mirror of
https://github.com/k4yt3x/video2x.git
synced 2026-03-12 11:37:29 +08:00
renamed waifu2x_settings to driver_settings
This commit is contained in:
32
src/waifu2x_caffe.py
Normal file → Executable file
32
src/waifu2x_caffe.py
Normal file → Executable file
@@ -4,7 +4,7 @@
|
||||
Name: Waifu2x Caffe Driver
|
||||
Author: K4YT3X
|
||||
Date Created: Feb 24, 2018
|
||||
Last Modified: August 3, 2019
|
||||
Last Modified: October 6, 2019
|
||||
|
||||
Description: This class is a high-level wrapper
|
||||
for waifu2x-caffe.
|
||||
@@ -27,11 +27,11 @@ class Waifu2xCaffe:
|
||||
the upscale function.
|
||||
"""
|
||||
|
||||
def __init__(self, waifu2x_settings, process, model_dir, bit_depth):
|
||||
self.waifu2x_settings = waifu2x_settings
|
||||
self.waifu2x_settings['process'] = process
|
||||
self.waifu2x_settings['model_dir'] = model_dir
|
||||
self.waifu2x_settings['output_depth'] = bit_depth
|
||||
def __init__(self, driver_settings, process, model_dir, bit_depth):
|
||||
self.driver_settings = driver_settings
|
||||
self.driver_settings['process'] = process
|
||||
self.driver_settings['model_dir'] = model_dir
|
||||
self.driver_settings['output_depth'] = bit_depth
|
||||
|
||||
# arguments passed through command line overwrites config file values
|
||||
self.process = process
|
||||
@@ -50,16 +50,16 @@ class Waifu2xCaffe:
|
||||
|
||||
try:
|
||||
# overwrite config file settings
|
||||
self.waifu2x_settings['input_path'] = input_directory
|
||||
self.waifu2x_settings['output_path'] = output_directory
|
||||
self.driver_settings['input_path'] = input_directory
|
||||
self.driver_settings['output_path'] = output_directory
|
||||
|
||||
if scale_ratio:
|
||||
self.waifu2x_settings['scale_ratio'] = scale_ratio
|
||||
self.driver_settings['scale_ratio'] = scale_ratio
|
||||
elif scale_width and scale_height:
|
||||
self.waifu2x_settings['scale_width'] = scale_width
|
||||
self.waifu2x_settings['scale_height'] = scale_height
|
||||
self.driver_settings['scale_width'] = scale_width
|
||||
self.driver_settings['scale_height'] = scale_height
|
||||
|
||||
self.waifu2x_settings['output_extention'] = image_format
|
||||
self.driver_settings['output_extention'] = image_format
|
||||
|
||||
# print thread start message
|
||||
self.print_lock.acquire()
|
||||
@@ -68,14 +68,14 @@ class Waifu2xCaffe:
|
||||
|
||||
# list to be executed
|
||||
# initialize the list with waifu2x binary path as the first element
|
||||
execute = [str(self.waifu2x_settings['waifu2x_caffe_path'])]
|
||||
execute = [str(self.driver_settings['path'])]
|
||||
|
||||
for key in self.waifu2x_settings.keys():
|
||||
for key in self.driver_settings.keys():
|
||||
|
||||
value = self.waifu2x_settings[key]
|
||||
value = self.driver_settings[key]
|
||||
|
||||
# is executable key or null or None means that leave this option out (keep default)
|
||||
if key == 'waifu2x_caffe_path' or value is None or value is False:
|
||||
if key == 'path' or value is None or value is False:
|
||||
continue
|
||||
else:
|
||||
if len(key) == 1:
|
||||
|
||||
Reference in New Issue
Block a user