mirror of
https://github.com/k4yt3x/video2x.git
synced 2026-02-15 17:54:49 +08:00
reverting code back to batch waifu2x upscaling according to @VanTanev 's issue
This commit is contained in:
11
video2x.py
11
video2x.py
@@ -152,15 +152,8 @@ def video2x():
|
|||||||
|
|
||||||
# Upscale images one by one using waifu2x
|
# Upscale images one by one using waifu2x
|
||||||
avalon.info('Starting to upscale extracted images')
|
avalon.info('Starting to upscale extracted images')
|
||||||
for (dirpath, dirnames, filenames) in os.walk(FRAMES):
|
w2.upscale(FRAMES, UPSCALED, args.width, args.height)
|
||||||
file_list = tqdm(filenames, ascii=True)
|
avalon.info('Conversion complete')
|
||||||
for file in file_list:
|
|
||||||
if file[-4:].lower() == '.png':
|
|
||||||
image_path = '{}\\{}'.format(dirpath, file)
|
|
||||||
file_list.set_description('Upscaling: {}'.format(file))
|
|
||||||
# avalon.dbgInfo('Upscaling: {}'.format(image_path))
|
|
||||||
w2.upscale(image_path, UPSCALED, args.width, args.height)
|
|
||||||
avalon.info('Extraction complete')
|
|
||||||
|
|
||||||
# Frames to Video
|
# Frames to Video
|
||||||
avalon.info('Converting extracted frames into video')
|
avalon.info('Converting extracted frames into video')
|
||||||
|
|||||||
27
waifu2x.py
27
waifu2x.py
@@ -28,20 +28,15 @@ class WAIFU2X:
|
|||||||
self.method = method
|
self.method = method
|
||||||
self.model_type = model_type
|
self.model_type = model_type
|
||||||
|
|
||||||
def upscale(self, file, upscaled, width, height):
|
def upscale(self, folderin, folderout, width, height):
|
||||||
"""This is the core function for WAIFU2X class
|
"""This is the core function for WAIFU2X class
|
||||||
|
|
||||||
[description]
|
Arguments:
|
||||||
|
folderin {string} -- source folder path
|
||||||
Arguments:
|
folderout {string} -- output folder path
|
||||||
file {string} -- input image
|
width {int} -- output video width
|
||||||
upscaled {string} -- output folder path
|
height {int} -- output video height
|
||||||
width {int} -- output video width
|
"""
|
||||||
height {int} -- output video height
|
execute = "{} -p {} -I png -i {} -e png -o {} -w {} -h {} -n 3 -m noise_scale -y {}".format(
|
||||||
model_type {string} -- model to use for upscaling
|
self.waifu2x_path, self.method, folderin, folderout, width, height, self.model_type)
|
||||||
"""
|
subprocess.call(execute)
|
||||||
file_id = file.split('extracted_')[-1].split('.png')[0]
|
|
||||||
output_file = '{}\\{}{}{}'.format(upscaled, 'extracted_', file_id, '.png')
|
|
||||||
execute = "{} -p {} -I png -i {} -e png -o {} -w {} -h {} -n 3 -m noise_scale -y {}".format(
|
|
||||||
self.waifu2x_path, self.method, file, output_file, width, height, self.model_type)
|
|
||||||
subprocess.call(execute, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user