16 Commits
4.3.0 ... 4.4.0

Author SHA1 Message Date
k4yt3x
d3db4e8cf1 updated build script requirements file name 2020-05-29 16:24:22 -04:00
k4yt3x
f887dfe3a7 fixed a dash with the wrong encoding 2020-05-29 16:20:11 -04:00
k4yt3x
a41df138bf updated setup script for RealSR NCNN Vulkan and changed requirement files 2020-05-29 16:02:06 -04:00
k4yt3x
41833f4068 fixed Anime4KCPP multi-processing mishandling issue 2020-05-29 15:30:16 -04:00
K4YT3X
c0955ae7e4 updated file modes for Linux 2020-05-28 10:52:38 -04:00
K4YT3X
682aeb82ff updated GitHub Actions config for requirements file changes 2020-05-28 10:24:24 -04:00
K4YT3X
21407c831c separated Linux requirements from Windows requirements 2020-05-28 10:23:54 -04:00
k4yt3x
7e34bf7516 updated Patreon badge 2020-05-27 19:17:05 -04:00
k4yt3x
4c5ca73e38 added RealSR NCNN Vulkan support 2020-05-26 06:35:53 -04:00
k4yt3x
387a233daf added Docker cloud build status badge 2020-05-25 05:29:28 -04:00
k4yt3x
781eb6686f added Docker usage section, added @lhanjian to special thanks for writing the Dockerfile 2020-05-24 23:36:10 -04:00
k4yt3x
c73edd9001 fixed docker submodule issues, formatted Dockerfile 2020-05-24 23:09:22 -04:00
k4yt3x
deb742ee8d added a short description for each of the drivers 2020-05-24 14:26:32 -04:00
k4yt3x
5ef6eb7e8e added Dockerfile written by @lhanjian 2020-05-24 13:24:28 -04:00
k4yt3x
6c5e079a1c added a list of supported drivers into README since it is useful info 2020-05-23 10:19:18 -04:00
k4yt3x
1e384596ee Updated special thanks section 2020-05-23 09:40:17 -04:00
21 changed files with 539 additions and 20 deletions

View File

@@ -1,7 +1,7 @@
# Name: Video2X Nightly Build
# Creator: K4YT3X
# Date Created: May 12, 2020
# Last Modified: May 13, 2020
# Last Modified: May 28, 2020
name: Video2X Nightly Build
@@ -27,7 +27,7 @@ jobs:
run: |
python -m pip install -U pip
pip install -U pyinstaller pywin32
pip install -U -r requirements.txt
pip install -U -r requirements-windows.txt
- name: Build Video2X CLI
run: |
pyinstaller --noconfirm --log-level=WARN `

186
Dockerfile Normal file
View File

@@ -0,0 +1,186 @@
FROM ubuntu:19.10
#FROM nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04
MAINTAINER Danielle Douglas <ddouglas87@gmail.com>
MAINTAINER Lhanjian <lhjay1@foxmail.com>
MAINTAINER K4YT3X <k4yt3x@k4yt3x.com>
# Don't ask questions during image setup.
ENV DEBIAN_FRONTEND noninteractive
ENV NASM_VERSION 2.14
ENV NVCODEC_VERSION 8.2.15.6
ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig
ENV FFMPEG_VERSION 4.1.2
# Install apt-fast, because we got gigs to download.
RUN apt-get update && apt-get install -y apt-utils &&\
apt-get install -y --no-install-recommends software-properties-common &&\
add-apt-repository ppa:apt-fast/stable &&\
add-apt-repository -y ppa:graphics-drivers/ppa &&\
apt-get install -y --no-install-recommends apt-fast && apt-fast update
## Install Video2X ##
# Dependencies
RUN apt-fast install -y --no-install-recommends git-core python3-pip python3-setuptools python3-wheel python3-psutil ffmpeg gcc g++ \
libc6-dev python3-dev libmagic-dev libmagic1 python3.8 nvidia-driver-440 nvidia-cuda-toolkit gnupg2 curl ca-certificates pkg-config \
autoconf libx264-dev libx265-dev libnuma-dev libvpx-dev libfdk-aac-dev libmp3lame-dev libopus-dev libass-dev libfreetype6-dev libgnutls28-dev \
libsdl2-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev texinfo wget yasm zlib1g-dev \
libass-dev libfreetype6-dev libsdl2-dev p11-kit libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev \
pkg-config texinfo wget zlib1g-dev libchromaprint-dev frei0r-plugins-dev gnutls-dev ladspa-sdk libcaca-dev libcdio-paranoia-dev libcodec2-dev \
libfontconfig1-dev libfreetype6-dev libfribidi-dev libgme-dev libgsm1-dev libjack-dev libmodplug-dev libmp3lame-dev libopencore-amrnb-dev \
libopencore-amrwb-dev libopenjp2-7-dev libopenmpt-dev libopus-dev libpulse-dev librsvg2-dev librubberband-dev librtmp-dev libshine-dev \
libsmbclient-dev libsnappy-dev libsoxr-dev libspeex-dev libssh-dev libtesseract-dev libtheora-dev libtwolame-dev libv4l-dev libvo-amrwbenc-dev \
libvorbis-dev libvpx-dev libwavpack-dev libwebp-dev libx264-dev libx265-dev libxvidcore-dev libxml2-dev libzmq3-dev libzvbi-dev liblilv-dev \
libopenal-dev opencl-dev libjack-dev libbluray-dev libfdk-aac-dev libmysofa-dev
RUN curl -vfsSLO https://www.nasm.us/pub/nasm/releasebuilds/$NASM_VERSION/nasm-$NASM_VERSION.tar.bz2 \
&& tar -xjf nasm-$NASM_VERSION.tar.bz2 \
&& cd nasm-$NASM_VERSION \
&& ./autogen.sh \
&& ./configure \
&& make -j$(nproc) \
&& make install
RUN git clone --recurse-submodules -b n$NVCODEC_VERSION --depth 1 https://git.videolan.org/git/ffmpeg/nv-codec-headers \
&& cd nv-codec-headers \
&& make install
RUN curl -vfsSLO https://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2 \
&& tar -xjf ffmpeg-$FFMPEG_VERSION.tar.bz2 \
&& cd ffmpeg-$FFMPEG_VERSION \
&& ./configure --enable-cuda-sdk --enable-cuvid --enable-nonfree --enable-libnpp --enable-nvenc \
--enable-gpl --enable-version3 \
--enable-small --enable-avisynth --enable-chromaprint \
--enable-frei0r --enable-gmp --enable-gnutls --enable-ladspa \
--enable-libass --enable-libcaca --enable-libcdio \
--enable-libcodec2 --enable-libfontconfig --enable-libfreetype \
--enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack \
--enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb \
--enable-libopencore-amrwb --enable-libopencore-amrwb \
--enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse \
--enable-librsvg --enable-librubberband --enable-librtmp --enable-libshine \
--enable-libsnappy --enable-libsoxr --enable-libspeex \
--enable-libssh --enable-libtesseract --enable-libtheora \
--enable-libtwolame --enable-libv4l2 --enable-libvo-amrwbenc \
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp \
--enable-libx264 --enable-libx265 --enable-libxvid --enable-libxml2 \
--enable-libzmq --enable-libzvbi --enable-lv2 \
--enable-libmysofa \
--enable-openal --enable-opencl --enable-opengl --enable-libdrm \
--enable-libfdk-aac --enable-libbluray \
&& make -j$(nproc) \
&& make install
# Install Nvidia Driver
RUN curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub | apt-key add -
RUN echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/nvidia-ml.list
# Install Video2X
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1 && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2
RUN cd / && python3.8 -m pip install --upgrade pip &&\
git clone --recurse-submodules --progress https://github.com/k4yt3x/video2x.git --depth=1 &&\
python3.8 -m pip install avalon_framework colorama python-magic patool psutil pyqt5 pyunpack pyyaml requests tqdm
# eg: docker build -t video2x . --build-arg driver=waifu2x_ncnn_vulkan
ARG driver=all
# Check if driver exists.
SHELL ["/bin/bash", "-c"]
RUN drivers=(all waifu2x_caffe waifu2x_converter waifu2x_ncnn_vulkan) &&\
case ${drivers[@]} in (*${driver,,}*) true ;; (*)\
echo "ERROR: Unrecognized driver." >&2 &&\
printf "%s " "Choices are: ${drivers[@]}" >&2 | printf "\n" >&2 &&\
exit 1 ;;\
esac
RUN if [ "$driver" = "all" ] || [ "$driver" = "waifu2x_caffe" ] ; then \
# nagadomi/caffe prerequisites
apt-fast update &&\
apt-fast install -y --no-install-recommends build-essential cmake libboost-system-dev libboost-thread-dev libboost-filesystem-dev libboost-chrono-dev libboost-date-time-dev libboost-atomic-dev libboost-python-dev libprotobuf-dev protobuf-compiler libhdf5-dev liblmdb-dev libleveldb-dev libsnappy-dev libopencv-dev libatlas-base-dev python-numpy libgflags-dev libgoogle-glog-dev &&\
# nagadomi/waifu2x-caffee-ubuntu prerequisites
apt-fast install -y --no-install-recommends libboost-iostreams-dev;\
fi
# build waifu2x-caffe && install caffe
RUN if [ "$driver" = "all" ] || [ "$driver" = "waifu2x_caffe" ] ; then \
git clone --recurse-submodules --depth=1 --progress --recurse-submodules https://github.com/nagadomi/waifu2x-caffe-ubuntu.git &&\
cd waifu2x-caffe-ubuntu &&\
git clone --recurse-submodules --progress --depth=1 https://github.com/nagadomi/caffe.git;\
fi
RUN if [ "$driver" = "all" ] || [ "$driver" = "waifu2x_caffe" ] ; then \
apt-fast install --no-install-recommends -y gcc-8 libcudnn7 libcudnn7-dev &&\
apt-get remove -y gcc g++ &&\
ln -s /usr/bin/gcc-8 /usr/bin/gcc && ln -s /usr/bin/g++-8 /usr/bin/g++ &&\
cd /waifu2x-caffe-ubuntu &&\
mkdir build &&\
cd build &&\
cmake .. -DCMAKE_INSTALL_PREFIX=/usr &&\
make -j$(nproc) install;\
fi
RUN if [ "$driver" = "all" ] || [ "$driver" = "waifu2x_caffe" ] ; then \
# install waifu2x-caffe
cd /waifu2x-caffe-ubuntu/build &&\
cp waifu2x-caffe ../bin/ &&\
mv ../bin tempname &&\
mv tempname /video2x/ &&\
mv /video2x/tempname /video2x/waifu2x-caffe &&\
rm -rf ../waifu2x-caffe-ubuntu ;\
fi
RUN if [ "$driver" = "all" ] || [ "$driver" = "waifu2x_ncnn_vulkan" ] ; then \
apt-fast install -y --no-install-recommends software-properties-common build-essential cmake libvulkan-dev glslang-tools libprotobuf-dev protobuf-compiler &&\
git clone --recurse-submodules --depth=1 --progress https://github.com/Tencent/ncnn.git &&\
cd ncnn &&\
mkdir -p build &&\
cd build &&\
cmake -DCMAKE_INSTALL_PREFIX=/usr -DNCNN_VULKAN=ON .. &&\
make -j$(nproc) install &&\
rm -rf ../../ncnn &&\
cd / &&\
# Compile waifu2x-ncnn-vulkan
git clone --recurse-submodules --depth=1 --progress https://github.com/nihui/waifu2x-ncnn-vulkan.git &&\
cd waifu2x-ncnn-vulkan &&\
mkdir -p build &&\
cd build &&\
cmake ../src &&\
make -j$(nproc) &&\
# Incall waifu2x-ncnn-vulkan
cd /waifu2x-ncnn-vulkan &&\
mkdir waifu2x-ncnn-vulkan &&\
mv models/models-cunet waifu2x-ncnn-vulkan/ &&\
mv build/waifu2x-ncnn-vulkan waifu2x-ncnn-vulkan/ &&\
mv waifu2x-ncnn-vulkan /video2x/ &&\
rm -rf ../waifu2x-ncnn-vulkan ;\
fi
RUN if [ "$driver" = "all" ] || [ "$driver" = "waifu2x_converter" ] ;\
then \
# Prerequisits for waifu2x-converter-cpp
apt-fast install -y --no-install-recommends build-essential cmake libopencv-dev ocl-icd-opencl-dev &&\
# Compile & Install
git clone --recurse-submodules --depth=1 --progress https://github.com/DeadSix27/waifu2x-converter-cpp &&\
cd waifu2x-converter-cpp &&\
mkdir build &&\
cd build &&\
cmake .. &&\
make -j$(nproc) &&\
#ldconfig &&\
cp -r ../models_rgb ./&&\
cd / ;\
fi
# Go!
#COPY entrypoint.sh /
#ENTRYPOINT ["/entrypoint.sh"]
WORKDIR /host
ENTRYPOINT ["/bin/bash"]
ENV NVIDIA_DRIVER_CAPABILITIES all
# Docker image can ask questions now, if needed.
ENV DEBIAN_FRONTEND teletype

View File

@@ -4,10 +4,11 @@
![GitHub release (latest by date)](https://img.shields.io/github/v/release/k4yt3x/video2x?style=flat-square)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/k4yt3x/video2x/Video2X%20Nightly%20Build?label=Nightly&style=flat-square)
![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/k4yt3x/video2x?style=flat-square)
![GitHub All Releases](https://img.shields.io/github/downloads/k4yt3x/video2x/total?style=flat-square)
![GitHub](https://img.shields.io/github/license/k4yt3x/video2x?style=flat-square)
![Platforms](https://img.shields.io/badge/Platforms-Windows%20%7C%20Linux%20%7C%20macOS-blue?style=flat-square)
<img alt="Become a Patron!" src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" href="https://www.patreon.com/bePatron?u=34970782" height=20>
![Become A Patron!](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.herokuapp.com%2Fk4yt3x&style=flat-square)
<!--# Video2X Lossless Video Enlarger-->
@@ -34,6 +35,14 @@ To download the latest nightly build, go to the [GitHub Actions](https://github.
Video2X is a video/GIF/image upscaling software based on Waifu2X, Anime4K and SRMD written in Python 3. It upscales videos, GIFs and images, restoring details from low-resolution inputs. Video2X also accepts GIF input to video output and video input to GIF output.
Currently, Video2X supports the following drivers (implementations of algorithms).
- **Waifu2X Caffe**: Caffe implementation of waifu2x
- **Waifu2X Converter CPP**: CPP implementation of waifu2x based on OpenCL and OpenCV
- **Waifu2X NCNN Vulkan**: NCNN implementation of waifu2x based on Vulkan API
- **SRMD NCNN Vulkan**: NCNN implementation of SRMD based on Vulkan API
- **Anime4KCPP**: CPP implementation of Anime4K
### Video Upscaling
![Spirited Away Demo](https://user-images.githubusercontent.com/21986859/49412428-65083280-f73a-11e8-8237-bb34158a545e.png)\
@@ -170,6 +179,14 @@ To see a help page for driver-specific settings, use `-d` to select the driver a
python video2x.py -d waifu2x_caffe -- --help
```
### Running Video2X (Docker)
Video2X can be deployed via Docker.
```shell
docker pull k4yt3x/video2x
```
---
## Documentations
@@ -267,10 +284,12 @@ This project relies on the following software and projects.
## Special Thanks
Appreciations given to the following code contributors:
Appreciations given to the following personnel who have contributed significantly to the project (specifically the technical perspective).
- @BrianPetkovsek
- @SAT3LL
- @ddouglas87
- @lhanjian
## Related Projects

View File

@@ -9,7 +9,7 @@ executable (PE) releases automatically using PyInstaller.
This script is currently only tuned for K4YT3X's environment.
To start a PowerShell session with execution policy bypass
powershell ExecutionPolicy Bypass
powershell -ExecutionPolicy Bypass
#>
if ($args.count -ne 1){
@@ -82,7 +82,7 @@ Copy-Item "dist\video2x.exe" -Destination "$($VIDEO2X_VERSION)\video2x-$($VIDEO2
Copy-Item "dist\video2x_gui.exe" -Destination "$($VIDEO2X_VERSION)\video2x-$($VIDEO2X_VERSION)-win32-light\"
Copy-Item "dist\video2x_setup.exe" -Destination "$($VIDEO2X_VERSION)\video2x-$($VIDEO2X_VERSION)-win32-light\"
Copy-Item "video2x.yaml" -Destination "$($VIDEO2X_VERSION)\video2x-$($VIDEO2X_VERSION)-win32-light\"
Copy-Item "requirements.txt" -Destination "$($VIDEO2X_VERSION)\video2x-$($VIDEO2X_VERSION)-win32-light\"
Copy-Item "requirements-windows.txt" -Destination "$($VIDEO2X_VERSION)\video2x-$($VIDEO2X_VERSION)-win32-light\"
# clean up temporary files
Write-Host -ForegroundColor White "`nDeleting temporary files"

0
src/progress_monitor.py Normal file → Executable file
View File

View File

@@ -0,0 +1,10 @@
avalon_framework
colorama
patool
psutil
pyqt5
python-magic
pyunpack
pyyaml
requests
tqdm

View File

@@ -4,7 +4,7 @@
Name: Video2X Upscaler
Author: K4YT3X
Date Created: December 10, 2018
Last Modified: May 22, 2020
Last Modified: May 29, 2020
Description: This file contains the Upscaler class. Each
instance of the Upscaler class is an upscaler on an image or
@@ -50,7 +50,7 @@ language.install()
_ = language.gettext
# version information
UPSCALER_VERSION = '4.1.1'
UPSCALER_VERSION = '4.2.0'
# these names are consistent for
# - driver selection in command line
@@ -60,6 +60,7 @@ AVAILABLE_DRIVERS = ['waifu2x_caffe',
'waifu2x_converter_cpp',
'waifu2x_ncnn_vulkan',
'srmd_ncnn_vulkan',
'realsr_ncnn_vulkan',
'anime4kcpp']
@@ -281,7 +282,7 @@ class Upscaler:
process_directory.mkdir(parents=True, exist_ok=True)
# waifu2x-converter-cpp will perform multi-threading within its own process
if self.driver in ['waifu2x_converter_cpp', 'waifu2x_ncnn_vulkan', 'srmd_ncnn_vulkan']:
if self.driver in ['waifu2x_converter_cpp', 'waifu2x_ncnn_vulkan', 'srmd_ncnn_vulkan', 'realsr_ncnn_vulkan', 'anime4kcpp']:
process_directories = [self.extracted_frames]
else:

View File

@@ -1,7 +1,7 @@
# Name: Video2X Configuration File
# Creator: K4YT3X
# Date Created: October 23, 2018
# Last Modified: May 23, 2020
# Last Modified: May 26, 2020
# Values here are the default values. Change the value here to
# save the default value permanently.
# Items commented out are parameters irrelevant to this context
@@ -76,6 +76,17 @@ srmd_ncnn_vulkan:
g: 0 # gpu device to use (default=0)
j: '1:2:2' # thread count for load/proc/save (default=1:2:2)
x: false # enable tta mode
realsr_ncnn_vulkan:
path: '%LOCALAPPDATA%\video2x\realsr-ncnn-vulkan\realsr-ncnn-vulkan'
v: null # verbose output
#i: null # input-path: input image path (jpg/png) or directory
#o: null # output-path: output image path (png) or directory
s: 4 # upscale ratio (4, default=4)
t: 0 # tile size (>=32/0=auto, default=0)
m: null # realsr model path (default=models-DF2K)
g: 0 # gpu device to use (default=0)
j: '1:2:2' # thread count for load/proc/save (default=1:2:2)
x: false # enable tta mode
anime4kcpp:
path: '%LOCALAPPDATA%\video2x\anime4kcpp\CLI\Anime4KCPP_CLI\Anime4KCPP_CLI'
#input: null # File for loading (string [=./pic/p1.png])

View File

@@ -4,7 +4,7 @@
Creator: Video2X GUI
Author: K4YT3X
Date Created: May 5, 2020
Last Modified: May 23, 2020
Last Modified: May 26, 2020
"""
# local imports
@@ -32,7 +32,7 @@ from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import magic
GUI_VERSION = '2.4.0'
GUI_VERSION = '2.5.0'
LEGAL_INFO = f'''Video2X GUI Version: {GUI_VERSION}\\
Upscaler Version: {UPSCALER_VERSION}\\
@@ -46,6 +46,7 @@ AVAILABLE_DRIVERS = {
'Waifu2X Converter CPP': 'waifu2x_converter_cpp',
'Waifu2X NCNN Vulkan': 'waifu2x_ncnn_vulkan',
'SRMD NCNN Vulkan': 'srmd_ncnn_vulkan',
'RealSR NCNN Vulkan': 'realsr_ncnn_vulkan',
'Anime4KCPP': 'anime4kcpp'
}
@@ -346,6 +347,17 @@ class Video2XMainWindow(QMainWindow):
self.srmd_ncnn_vulkan_jobs_line_edit = self.findChild(QLineEdit, 'srmdNcnnVulkanJobsLineEdit')
self.srmd_ncnn_vulkan_tta_check_box = self.findChild(QCheckBox, 'srmdNcnnVulkanTtaCheckBox')
# realsr-ncnn-vulkan
self.realsr_ncnn_vulkan_path_line_edit = self.findChild(QLineEdit, 'realsrNcnnVulkanPathLineEdit')
self.enable_line_edit_file_drop(self.realsr_ncnn_vulkan_path_line_edit)
self.realsr_ncnn_vulkan_path_select_button = self.findChild(QPushButton, 'realsrNcnnVulkanPathSelectButton')
self.realsr_ncnn_vulkan_path_select_button.clicked.connect(lambda: self.select_driver_binary_path(self.realsr_ncnn_vulkan_path_line_edit))
self.realsr_ncnn_vulkan_tile_size_spin_box = self.findChild(QSpinBox, 'realsrNcnnVulkanTileSizeSpinBox')
self.realsr_ncnn_vulkan_model_combo_box = self.findChild(QComboBox, 'realsrNcnnVulkanModelComboBox')
self.realsr_ncnn_vulkan_gpu_id_spin_box = self.findChild(QSpinBox, 'realsrNcnnVulkanGpuIdSpinBox')
self.realsr_ncnn_vulkan_jobs_line_edit = self.findChild(QLineEdit, 'realsrNcnnVulkanJobsLineEdit')
self.realsr_ncnn_vulkan_tta_check_box = self.findChild(QCheckBox, 'realsrNcnnVulkanTtaCheckBox')
# anime4k
self.anime4kcpp_path_line_edit = self.findChild(QLineEdit, 'anime4kCppPathLineEdit')
self.enable_line_edit_file_drop(self.anime4kcpp_path_line_edit)
@@ -497,6 +509,14 @@ class Video2XMainWindow(QMainWindow):
self.srmd_ncnn_vulkan_jobs_line_edit.setText(settings['j'])
self.srmd_ncnn_vulkan_tta_check_box.setChecked(settings['x'])
# realsr-ncnn-vulkan
settings = self.config['realsr_ncnn_vulkan']
self.realsr_ncnn_vulkan_path_line_edit.setText(str(pathlib.Path(os.path.expandvars(settings['path'])).absolute()))
self.realsr_ncnn_vulkan_tile_size_spin_box.setValue(settings['t'])
self.realsr_ncnn_vulkan_gpu_id_spin_box.setValue(settings['g'])
self.realsr_ncnn_vulkan_jobs_line_edit.setText(settings['j'])
self.realsr_ncnn_vulkan_tta_check_box.setChecked(settings['x'])
# anime4k
settings = self.config['anime4kcpp']
self.anime4kcpp_path_line_edit.setText(str(pathlib.Path(os.path.expandvars(settings['path'])).absolute()))
@@ -598,6 +618,14 @@ class Video2XMainWindow(QMainWindow):
self.config['srmd_ncnn_vulkan']['j'] = self.srmd_ncnn_vulkan_jobs_line_edit.text()
self.config['srmd_ncnn_vulkan']['x'] = self.srmd_ncnn_vulkan_tta_check_box.isChecked()
# realsr-ncnn-vulkan
self.config['realsr_ncnn_vulkan']['path'] = os.path.expandvars(self.realsr_ncnn_vulkan_path_line_edit.text())
self.config['realsr_ncnn_vulkan']['t'] = self.realsr_ncnn_vulkan_tile_size_spin_box.value()
self.config['realsr_ncnn_vulkan']['m'] = str((pathlib.Path(self.config['realsr_ncnn_vulkan']['path']).parent / self.realsr_ncnn_vulkan_model_combo_box.currentText()).absolute())
self.config['realsr_ncnn_vulkan']['g'] = self.realsr_ncnn_vulkan_gpu_id_spin_box.value()
self.config['realsr_ncnn_vulkan']['j'] = self.realsr_ncnn_vulkan_jobs_line_edit.text()
self.config['realsr_ncnn_vulkan']['x'] = self.realsr_ncnn_vulkan_tta_check_box.isChecked()
# anime4k
self.config['anime4kcpp']['path'] = os.path.expandvars(self.anime4kcpp_path_line_edit.text())
self.config['anime4kcpp']['passes'] = self.anime4kcpp_passes_spin_box.value()
@@ -788,6 +816,10 @@ class Video2XMainWindow(QMainWindow):
self.scale_ratio_double_spin_box.setMinimum(2.0)
self.scale_ratio_double_spin_box.setMaximum(4.0)
self.scale_ratio_double_spin_box.setValue(2.0)
elif current_driver == 'realsr_ncnn_vulkan':
self.scale_ratio_double_spin_box.setMinimum(4.0)
self.scale_ratio_double_spin_box.setMaximum(4.0)
self.scale_ratio_double_spin_box.setValue(4.0)
# update preferred processes/threads count
if current_driver == 'anime4kcpp':

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.12.0, 2020-05-23T08:51:47. -->
<!-- Written by QtCreator 4.12.0, 2020-05-26T06:35:20. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>673</width>
<height>802</height>
<height>844</height>
</rect>
</property>
<property name="acceptDrops">
@@ -342,6 +342,11 @@
<string>SRMD NCNN Vulkan</string>
</property>
</item>
<item>
<property name="text">
<string>RealSR NCNN Vulkan</string>
</property>
</item>
<item>
<property name="text">
<string>Anime4KCPP</string>
@@ -1384,6 +1389,131 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="realsrNcnnVulkanTab">
<attribute name="title">
<string>RealSR NCNN Vulkan</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_34">
<item>
<layout class="QHBoxLayout" name="realsrNcnnVulkanPathHorizontalLayout">
<item>
<widget class="QLineEdit" name="realsrNcnnVulkanPathLineEdit"/>
</item>
<item>
<widget class="QPushButton" name="realsrNcnnVulkanPathSelectButton">
<property name="text">
<string>Select Binary Path</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="realsrNcnnVulkanTileSizeHorizontalLayout">
<item>
<widget class="QLabel" name="realsrNcnnVulkanTileSizeLabel">
<property name="text">
<string>Tile Size</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="realsrNcnnVulkanTileSizeSpinBox">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>99999</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="realsrNcnnVulkanModelHorizontalLayout">
<item>
<widget class="QLabel" name="realsrNcnnVulkanModelLabel">
<property name="text">
<string>Model</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="realsrNcnnVulkanModelComboBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If the input file contains very little noise, DF2K will produce sharper outputs.&lt;/p&gt;&lt;p&gt;However, if the input is noisy, DF2K might produce artifacts. DF2K_JPEG will then be preferred.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>models-DF2K_JPEG</string>
</property>
</item>
<item>
<property name="text">
<string>models-DF2K</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="realsrNcnnVulkanGpuIdHorizontalLayout">
<item>
<widget class="QLabel" name="realsrNcnnVulkanGpuIdLabel">
<property name="text">
<string>GPU ID</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="realsrNcnnVulkanGpuIdSpinBox"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="realsrNcnnVulkanJobsHorizontalLayout">
<item>
<widget class="QLabel" name="realsrNcnnVulkanJobsLabel">
<property name="text">
<string>Jobs</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="realsrNcnnVulkanJobsLineEdit">
<property name="text">
<string>1:2:2</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="realsrNcnnVulkanTtaCheckBox">
<property name="text">
<string>TTA</string>
</property>
</widget>
</item>
<item>
<spacer name="realsrNcnnVulkanVerticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>331</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="anime4kCppTab">
<attribute name="title">
<string>Anime4K CPP</string>

View File

@@ -4,7 +4,7 @@
Name: Video2X Setup Script
Creator: K4YT3X
Date Created: November 28, 2018
Last Modified: May 16, 2020
Last Modified: May 29, 2020
Editor: BrianPetkovsek
Editor: SAT3LL
@@ -17,8 +17,9 @@ Installation Details:
- waifu2x-caffe: %LOCALAPPDATA%\\video2x\\waifu2x-caffe
- waifu2x-cpp-converter: %LOCALAPPDATA%\\video2x\\waifu2x-converter-cpp
- waifu2x_ncnn_vulkan: %LOCALAPPDATA%\\video2x\\waifu2x-ncnn-vulkan
- anime4kcpp: %LOCALAPPDATA%\\video2x\\anime4kcpp
- srmd_ncnn_vulkan: %LOCALAPPDATA%\\video2x\\srmd-ncnn-vulkan
- realsr_ncnn_vulkan: %LOCALAPPDATA%\\video2x\\realsr-ncnn-vulkan
- anime4kcpp: %LOCALAPPDATA%\\video2x\\anime4kcpp
"""
# built-in imports
@@ -43,7 +44,7 @@ import zipfile
# Therefore, they will be installed during the Python dependency
# installation step and imported later in the script.
SETUP_VERSION = '2.1.0'
SETUP_VERSION = '2.2.0'
# global static variables
LOCALAPPDATA = pathlib.Path(os.getenv('localappdata'))
@@ -54,8 +55,9 @@ DRIVER_OPTIONS = ['all',
'waifu2x_caffe',
'waifu2x_converter_cpp',
'waifu2x_ncnn_vulkan',
'anime4kcpp',
'srmd_ncnn_vulkan']
'srmd_ncnn_vulkan',
# 'realsr_ncnn_vulkan',
'anime4kcpp']
def parse_arguments():
@@ -103,7 +105,7 @@ class Video2xSetup:
def _install_python_requirements(self):
""" Read requirements.txt and return its content
"""
pip_install('requirements.txt')
pip_install('requirements-windows.txt')
def _cleanup(self):
""" Cleanup all the temp files downloaded
@@ -209,6 +211,32 @@ class Video2xSetup:
# rename the newly extracted directory
(LOCALAPPDATA / 'video2x' / zipf.namelist()[0]).rename(waifu2x_ncnn_vulkan_directory)
def _install_realsr_ncnn_vulkan(self):
""" Install realsr-ncnn-vulkan
"""
print('\nInstalling realsr-ncnn-vulkan')
import requests
# Get latest release of realsr-ncnn-vulkan via Github API
latest_release = requests.get('https://api.github.com/repos/nihui/realsr-ncnn-vulkan/releases/latest').json()
for a in latest_release['assets']:
if re.search(r'realsr-ncnn-vulkan-\d*\.zip', a['browser_download_url']):
realsr_ncnn_vulkan_zip = download(a['browser_download_url'], tempfile.gettempdir())
self.trash.append(realsr_ncnn_vulkan_zip)
# extract and rename
realsr_ncnn_vulkan_directory = LOCALAPPDATA / 'video2x' / 'realsr-ncnn-vulkan'
with zipfile.ZipFile(realsr_ncnn_vulkan_zip) as zipf:
zipf.extractall(LOCALAPPDATA / 'video2x')
# if directory already exists, remove it
if realsr_ncnn_vulkan_directory.exists():
shutil.rmtree(realsr_ncnn_vulkan_directory)
# rename the newly extracted directory
(LOCALAPPDATA / 'video2x' / zipf.namelist()[0]).rename(realsr_ncnn_vulkan_directory)
def _install_anime4kcpp(self):
""" Install Anime4KCPP
"""

0
src/wrappers/anime4kcpp.py Normal file → Executable file
View File

0
src/wrappers/ffmpeg.py Normal file → Executable file
View File

0
src/wrappers/gifski.py Normal file → Executable file
View File

View File

@@ -0,0 +1,102 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Name: RealSR NCNN Vulkan Driver
Creator: K4YT3X
Date Created: May 26, 2020
Last Modified: May 26, 2020
Description: This class is a high-level wrapper
for realsr_ncnn_vulkan.
"""
# built-in imports
import argparse
import os
import pathlib
import platform
import shlex
import subprocess
import threading
# third-party imports
from avalon_framework import Avalon
class WrapperMain:
"""This class communicates with RealSR NCNN Vulkan engine
An object will be created for this class, containing information
about the binary address and the processing method. When being called
by the main program, other detailed information will be passed to
the upscale function.
"""
def __init__(self, driver_settings):
self.driver_settings = driver_settings
self.print_lock = threading.Lock()
@staticmethod
def parse_arguments(arguments):
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, add_help=False)
parser.error = lambda message: (_ for _ in ()).throw(AttributeError(message))
parser.add_argument('--help', action='help', help='show this help message and exit')
parser.add_argument('-v', action='store_true', help='verbose output')
parser.add_argument('-i', type=str, help=argparse.SUPPRESS) # help='input image path (jpg/png) or directory')
parser.add_argument('-o', type=str, help=argparse.SUPPRESS) # help='output image path (png) or directory')
parser.add_argument('-s', type=int, choices=[4], help='upscale ratio')
parser.add_argument('-t', type=int, help='tile size (>=32/0=auto)')
parser.add_argument('-m', type=str, help='realsr model path')
parser.add_argument('-g', type=int, help='gpu device to use')
parser.add_argument('-j', type=str, help='thread count for load/proc/save')
parser.add_argument('-x', action='store_true', help='enable tta mode')
return parser.parse_args(arguments)
def load_configurations(self, upscaler):
self.driver_settings['s'] = int(upscaler.scale_ratio)
self.driver_settings['j'] = '{}:{}:{}'.format(upscaler.processes, upscaler.processes, upscaler.processes)
def upscale(self, input_directory, output_directory):
"""This is the core function for RealSR NCNN Vulkan class
Arguments:
input_directory {string} -- source directory path
output_directory {string} -- output directory path
ratio {int} -- output video ratio
"""
# overwrite config file settings
self.driver_settings['i'] = input_directory
self.driver_settings['o'] = output_directory
# by default, realsr-ncnn-vulkan will look for the models under the current working directory
# change the working directory to its containing folder if model directory not specified
if self.driver_settings['m'] is None and platform.system() == 'Windows':
os.chdir(pathlib.Path(self.driver_settings['path']).parent)
# list to be executed
# initialize the list with the binary path as the first element
execute = [self.driver_settings['path']]
for key in self.driver_settings.keys():
value = self.driver_settings[key]
# null or None means that leave this option out (keep default)
if key == 'path' or value is None or value is False:
continue
else:
if len(key) == 1:
execute.append(f'-{key}')
else:
execute.append(f'--{key}')
# true means key is an option
if value is not True:
execute.append(str(value))
# return the Popen object of the new process created
self.print_lock.acquire()
Avalon.debug_info(f'[upscaler] Subprocess {os.getpid()} executing: {shlex.join(execute)}')
self.print_lock.release()
return subprocess.Popen(execute)

0
src/wrappers/srmd_ncnn_vulkan.py Normal file → Executable file
View File

0
src/wrappers/waifu2x_caffe.py Normal file → Executable file
View File

0
src/wrappers/waifu2x_converter_cpp.py Normal file → Executable file
View File

0
src/wrappers/waifu2x_ncnn_vulkan.py Normal file → Executable file
View File