Created
June 18, 2020 07:11
-
-
Save bagusnl/18c4541fdcf21553dbbba1f56a9199db to your computer and use it in GitHub Desktop.
waifu2x ncnn batch script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
title waifu2x Vulkan CLI | |
echo waifu2x Vulkan CLI | |
set processor= | |
set thread_load= | |
set thread_proc= | |
set thread_save= | |
set thread= | |
set scaler= | |
set noisel= | |
set tilesize= | |
set inputfile= | |
set outputfile= | |
set modelpath= | |
set model= | |
:start | |
echo Select GPU ID for waifu2x | |
echo Default = 0 | |
set /p processor="Enter GPU ID: " | |
if '%processor%' == '' set processor=0 | |
echo. | |
cls | |
goto threadcount | |
:threadcount | |
echo Set thread count for processing "(>=1)" | |
echo Default : | |
echo Load = 1 | |
echo Processing = 2 | |
echo Saving = 2 | |
echo. | |
echo Using more threads means higher GPU Utility and Memory usage! | |
set /p thread_load="Load thread count: " | |
if '%thread_load%'=='' set thread_load=1 | |
set /p thread_proc="Processing thread count: " | |
if '%thread_proc%'=='' set thread_proc=2 | |
set /p thread_save="Saving thread count: " | |
if '%thread_save%'=='' set thread_save=2 | |
set thread=%thread_load%:%thread_proc%:%thread_save% | |
echo. | |
cls | |
goto snrset | |
:snrset | |
cls | |
echo Scale and Noise Reduction Mode | |
echo. | |
echo Set desired scale ratio (1~2) Default = 2 | |
echo Scale value above 2 is NOT recommended | |
set /p scaler="Scale ratio: " | |
if '%scaler%'=='' set scaler=2 | |
echo. | |
echo Set desired noise level (-1/0/1/2/3) | |
set /p noisel="Noise level: " | |
if '%noise1%'=='' set noise1=0 | |
set modeset=-s %scaler% -n %noise1% | |
echo. | |
echo What model did you want to use? | |
echo 1. models-cunet (Default) | |
echo 2. models-upconv_7_anime_style_art_rgb | |
echo 3. models-upconv_7_photo | |
set /p modelpath="Enter the number(1/2/3): " | |
if '%modelpath%'=='1' set model=models-cunet | |
if '%modelpath%'=='2' set model=models-upconv_7_anime_style_art_rgb | |
if '%modelpath%'=='3' set model=models-upconv_7_photo | |
if '%modelpath%'=='' set model=models-cunet | |
echo. | |
echo Set tilesize (using bigger tilesize means bigger memory usage but faster processing) | |
echo Default = 400 | |
set /p tilesize="Enter your desired tilesize: " | |
if '%tilesize%'=='' set tilesize=400 | |
cls | |
goto inputfile | |
:inputfile | |
cls | |
echo Please input your image filepath | |
echo Example: "C:\path\to\image\input\file.jpg" | |
echo You can drop the file here | |
set /p inputfile="Image input filepath: " | |
if '%inputfile%' == '' goto inputfile | |
echo. | |
goto outputfile | |
:outputfile | |
cls | |
echo Please input your output image filepath | |
echo Example: "C:\path\to\image\output\file.jpg" | |
echo The extension should match the inputfile | |
set /p outputfile="Image output filepath: " | |
if '%outputfile%' == '' set outputfile="%inputfile%_w2x-vulkan.png" | |
echo. | |
goto confirmation | |
:confirmation | |
cls | |
echo Please confirm your input! | |
echo. | |
echo GPU ID used : %processor% | |
echo You want to use %thread% thread(s) | |
echo. | |
echo You are using %scaler% scale | |
echo You are using level %noise1% noise reduction | |
echo Scaler model used : %model% | |
echo Tilesize : %tilesize% | |
echo. | |
echo Input File : %inputfile% | |
echo Output File : %outputfile% | |
pause | |
:process | |
cls | |
.\waifu2x-ncnn-vulkan.exe -i %inputfile% -o %outputfile% -v -g %processor% -j %thread% -m %model% -t %tilesize% -n %noise1% -s %scaler% | |
goto complete | |
:complete | |
echo. | |
echo Process complete! | |
echo. | |
echo Do you want to open the output file? | |
choice | |
if '%ERRORLEVEL%' == '1' %outputfile% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment