• Stars
    star
    1,045
  • Rank 44,098 (Top 0.9 %)
  • Language
    C++
  • License
    Other
  • Created almost 3 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An Android application for super-resolution & interpolation. Contains RealSR-NCNN, SRMD-NCNN, RealCUGAN-NCNN, Real-ESRGAN-NCNN, Waifu2x-NCNN, Anime4kcpp, nearest, bilinear, bicubic, AVIR...

RealSR-NCNN-Android

中文说明

RealSR-NCNN-Android is a simple Android application that based on Waifu2x-NCNN, SRMD-NCNN, RealCUGAN-NCNN, RealSR-NCNN, & Real-ESRGAN.
The application does not collect any private information from your device.
Download: Github Release or CoolApk

This repository contains 7 project:

  1. RealSR-NCNN-Android-GUI can build a APK (has a GUI and easy to use). Actually it is a shell of the follow programs.
  2. RealSR-NCNN-Android-CLI can build a program that can be used by the console (for example, Termux) for Android. This program can use realsr models and real-esrgan models.
  3. RealCUGAN-NCNN-Android-CLI can build a program that can be used by the console (for example, Termux) for Android.
  4. SRMD-NCNN-Android-CLI can build a program that can be used by the console (for example, Termux) for Android.
  5. Waifu2x-NCNN-Android-CLI can build a program that can be used by the console (for example, Termux) for Android (models not packaged in APK).
  6. Resize-NCNN-Android-CLI can build a program that can be used by the console (for example, Termux) for Android. use ncnn only to reduce the elf file size. Contains classical interpolation mode nearest bilinear bicubic and avir lancir
  7. Resize-CLI just a demo like the Resize-NCNN-Android-CLI, but it not need ncnn and could build by VS

How to use RealSR-NCNN-Android-GUI

Two ways of selecting files:

  1. Share one or more images from other apps (e.g. Gallery) to this app
  2. In this app, click Select Image to select an image

Tow ways of running:

  1. chose a model, click the Run button and wait some time. The photo view will show the result when the progrem finish its work. If you like the result, you could click the Save button.
  2. input shell command and enter. (You can input help and get more info)

input & output

Add more models to RealSR-NCNN-Android-GUI

RealSR-NCNN-Android-GUI could load extra models from sdcard automatily in ver 1.7.6. You could download more models from https://huggingface.co/tumuyan/realsr .

  1. Make a directory in sdcard.
  2. Input the directory path to Path for custom models (RealSR/ESRGAN/Waifu2x) and save.
  3. Download and copy models to the directory you make.
  4. Return the main activity, then you could select the new models.

Convert pth models by yourself

Also you could convert ESRGAN pth moddls by yourself.

  1. Download ESRGAN pytorch models from https://upscale.wiki/wiki/Model_Database and unzip it to somewhere.
  2. Download cupscale and unzip it in your PC.
  3. Convert pytorch models to ncnn. Open CupscaleData\bin\pth2ncnn, use pth2ncnn.exe to convert pth files to ncnn file.
  4. Rename models, just like this:
models-Real-ESRGAN-AnimeSharp  // directory should have a suffix of models-Real- or models-ESRGAN-
├─x4.bin                       // models name as x[n], n is scale
├─x4.param

Web UI

https://huggingface.co/spaces/tumuyan/RealSR The hugging face repository contains the model and executable file for Windows/Linux platform, you can clone the repository and open a web UI in the python (instead of the original command line program) Also you could try online demo! Hugging Face

About Real-ESRGAN

Real-ESRGAN is a Practical Algorithms for General Image Restoration.

[Paper] [Project Page]   [YouTube Video] [Bilibili]   [Poster] [PPT slides]
Xintao Wang, Liangbin Xie, Chao Dong, Ying Shan
Tencent ARC Lab; Shenzhen Institutes of Advanced Technology, Chinese Academy of Sciences

img Note that RealESRGAN may still fail in some cases as the real-world degradations are really too complex.

About RealSR

[paper] [project] [NTIRE 2020 Challenge on Real-World Image Super-Resolution: Methods and Results]

About SRMD

[paper] [project] demo demo

About Real-CUGAN

[project]
Real-CUGAN is an AI super resolution model for anime images, trained in a million scale anime dataset, using the same architecture as Waifu2x-CUNet.

How to build RealSR-NCNN-Android-CLI

step1

https://github.com/Tencent/ncnn/releases
download ncnn-yyyymmdd-android-vulkan-shared.zip.
https://github.com/webmproject/libwebp download the source of libwebp.

step2

extract ncnn-yyyymmdd-android-vulkan-shared.zip into ../3rdparty/ncnn-android-vulkan-shared
extract the source of libwebp into app/src/main/jni/webp

step3

open this project with Android Studio, rebuild it and then you could find the program in RealSR-NCNN-Android-CLI\app\build\intermediates\cmake\debug\obj

How to use RealSR-NCNN-Android-CLI

Download models

You could run this command in shell (termux) to download and unzip program and models: curl https://huggingface.co/spaces/tumuyan/RealSR/raw/main/install_realsr_android.sh | bash

or download and unzip them by your self. https://huggingface.co/spaces/tumuyan/RealSR/resolve/main/assets.zip

Example Command

make sure the elf file has execute permission. Then input command

./realsr-ncnn -i input.jpg -o output.jpg

Full Usages

Usage: realsr-ncnn -i infile -o outfile [options]...

  -h                   show this help
  -v                   verbose output
  -i input-path        input image path (jpg/png/webp) or directory
  -o output-path       output image path (jpg/png/webp) or directory
  -s scale             upscale ratio (4, default=4)
  -t tile-size         tile size (>=32/0=auto, default=0) can be 0,0,0 for multi-gpu
  -m model-path        realsr model path (default=models-DF2K_JPEG)
  -g gpu-id            gpu device to use (default=0) can be 0,1,2 for multi-gpu, -1 use cpu
  -j load:proc:save    thread count for load/proc/save (default=1:2:2) can be 1:2,2,2:2 for multi-gpu
  -x                   enable tta mode
  -f format            output image format (jpg/png/webp, default=ext/png)
  • input-path and output-path accept either file path or directory path
  • scale = scale level, 4 = upscale 4x
  • tile-size = tile size, use smaller value to reduce GPU memory usage, default selects automatically
  • load:proc:save = thread count for the three stages (image decoding + realsr upscaling + image encoding), using larger values may increase GPU usage and consume more GPU memory. You can tune this configuration with "4:4:4" for many small-size images, and "2:2:2" for large-size images. The default setting usually works fine for most situations. If you find that your GPU is hungry, try increasing thread count to achieve faster processing.
  • format = the format of the image to be output, png is better supported, however webp generally yields smaller file sizes, both are losslessly encoded

If you encounter crash or error, try to upgrade your derive

How to build RealSR-NCNN-Android-GUI

download models & elf files, unzip and put them to this folder, then build it with Android Studio.

RealSR-NCNN-Android-GUI\app\src\main\assets\
└─realsr
    │  colors.xml
    │  delegates.xml
    │  libc++_shared.so
    │  libncnn.so
    │  libomp.so
    │  magick
    │  realcugan-ncnn
    │  realsr-ncnn
    │  resize-ncnn
    │  srmd-ncnn
    │  waifu2x-ncnn
    │  
    ├─models-nose
    │      up2x-no-denoise.bin
    │      up2x-no-denoise.param
    │      
    ├─models-pro
    │      up2x-conservative.bin
    │      up2x-conservative.param
    │      up2x-denoise3x.bin
    │      up2x-denoise3x.param
    │      up2x-no-denoise.bin
    │      up2x-no-denoise.param
    │      up3x-conservative.bin
    │      up3x-conservative.param
    │      up3x-denoise3x.bin
    │      up3x-denoise3x.param
    │      up3x-no-denoise.bin
    │      up3x-no-denoise.param
    │      
    ├─models-Real-ESRGAN
    │      x4.bin
    │      x4.param
    │      
    ├─models-Real-ESRGAN-anime
    │      x4.bin
    │      x4.param
    │      
    ├─models-Real-ESRGANv2-anime
    │      x2.bin
    │      x2.param
    │      x4.bin
    │      x4.param
    │      
    ├─models-Real-ESRGANv3-anime
    │      x2.bin
    │      x2.param
    │      x3.bin
    │      x3.param
    │      x4.bin
    │      x4.param
    │      
    ├─models-se
    │      up2x-conservative.bin
    │      up2x-conservative.param
    │      up2x-denoise1x.bin
    │      up2x-denoise1x.param
    │      up2x-denoise2x.bin
    │      up2x-denoise2x.param
    │      up2x-denoise3x.bin
    │      up2x-denoise3x.param
    │      up2x-no-denoise.bin
    │      up2x-no-denoise.param
    │      up3x-conservative.bin
    │      up3x-conservative.param
    │      up3x-denoise3x.bin
    │      up3x-denoise3x.param
    │      up3x-no-denoise.bin
    │      up3x-no-denoise.param
    │      up4x-conservative.bin
    │      up4x-conservative.param
    │      up4x-denoise3x.bin
    │      up4x-denoise3x.param
    │      up4x-no-denoise.bin
    │      up4x-no-denoise.param
    │      
    └─models-srmd
            srmdnf_x2.bin
            srmdnf_x2.param
            srmdnf_x3.bin
            srmdnf_x3.param
            srmdnf_x4.bin
            srmdnf_x4.param
            srmd_x2.bin
            srmd_x2.param
            srmd_x3.bin
            srmd_x3.param
            srmd_x4.bin
            srmd_x4.param

Others project in this Repository

Building and usage is same as RealSR-NCNN-Android-CLI

Acknowledgement

original super-resolution projects

ncnn projects and models

Most of the C code is copied from Nihui, cause of the directory structure had to be adjusted, the original git was broken

Other Open-Source Code Used

More Repositories

1

SourceBook-Dataset

image datasets & model for text/book super-resolution
309
star
2

Tree-Style-History

Not only show browser history in tree style. 不止用树状形式展示浏览器历史 (For Edge / Chromium / Chrome)
JavaScript
182
star
3

AnyLauncher

You can choose any Android application and set it as a Luncher.
Java
126
star
4

MusicBeePlug_AlbumCover

A Artwork Provider Plug-in for MusicBee.
C#
56
star
5

video-shuffler-for-aegisub

Script for Aegisub to cut video and voice files | 在Aegisub中用字幕切割视频和音频文件
Lua
19
star
6

rime-pinyin-jap

李さんの日本語入力方法。一個Rime日語方案,完全忽略音読訓読,使用漢語拼音录入日語漢字字形,使用羅馬音録入仮名。適用於基本不懂日語並且無意深入学習,但是又有一定日語書写的人。
Lua
17
star
7

video-shuffler

Cut video to clips and shuffle them by ass file | 洋片箱:用ASS字幕文件切割视频,并重组输出
Python
14
star
8

ESRGAN-Android-TFLite-Demo

TFLite Super Resolution for Android with ESRGAN model, modify from https://github.com/tensorflow/examples/tree/master/lite/examples/super_resolution/android
C
10
star
9

realsr-models

models for realsr
6
star
10

trime-peach

同文输入法辅助工具(安卓端rime输入法的方案、词库、滤镜、脚本的订阅、下载、导入、应用、同步工具)
4
star
11

Auto-Mute

一个能自动静音后台标签页的Chrome/Edge浏览器扩展
JavaScript
4
star
12

Rime-Pinyin-9Key

Rime九宫拼音,基于【袖珍简化字拼音】和【Rime 简体中文用户定制文件】
Lua
3
star
13

libMediainfo-Android

把Mediainfo Android版代码改为使用预编译so文件,从而降低了编译难度。如果有Android libmediainfo使用需求,能快速导入到自己的项目中。
Kotlin
2
star
14

Regulatable-Flashlight

A Android demo to control flash LED
Java
2
star
15

MPC-Shader

Shader for MPC-BE
HLSL
1
star
16

Dict-Trick

生成字典的若干小工具
Java
1
star
17

Bilibili-live-on-Alipay-IoT

基于支付宝Iot小程序官方示例搓的直播小程序
JavaScript
1
star
18

WikiFilter

统计词库的每个词条在文本文件的多少行中出现过
Python
1
star
19

ArduEx

利用Arduino的IO资源,使用(PC/手机)对产品进行快速调试。
C++
1
star