RealSR-NCNN-Android is a simple Android application that based on Realsr-NCNN & Real-ESRGAN.

Overview

RealSR-NCNN-Android

Real-ESRGAN is a Practical Algorithms for General Image Restoration.
RealSR-NCNN-Android is a simple Android application that based on Realsr-NCNN & Real-ESRGAN.
The application does not collect any private information from your device.

This repository contains 2 project:

  1. RealSR-NCNN-Android-CLI can build a program that can be used by the console (for example, Termux) for Android.
  2. RealSR-NCNN-Android-GUI can build a APK (has a GUI and easy to use). Actually it is a shell of the former.

About Real-ESRGAN

[Paper]   [Project Page]   [YouTube Video]   [B站讲解]   [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. Moreover, it may not perform well on human faces, text, etc, which will be optimized later.

how to build RealSR-NCNN-Android-CLI

step1

https://github.com/Tencent/ncnn/releases download ncnn-android-vulkan.zip or build ncnn for android yourself

step2

extract ncnn-android-vulkan.zip into app/src/main/jni or change the ncnn_DIR path to yours in app/src/main/jni/CMakeLists.txt

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

I have package and upload models, also you can download models from RealSR-NCNN and Real-ESRGAN.

https://github.com/tumuyan/RealSR-NCNN-Android/releases/download/1.0/models.zip

Example Command

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

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

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
  -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 Real-ESRGAN/RealSRGAN models and put them to this folder, then build it with Android Studio

RealSR-NCNN-Android-GUI\app\src\main\assets\realsr
│  libvulkan.so    
│  styletransferncnn
│  
├─models-DF2K_ESRGAN_anime
│      x4.bin
│      x4.param
│      
└─models-DF2K_ESRGAN
        x4.bin
        x4.param
		

how to build RealSR-NCNN-Android-GUI

You can open photo picker, 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.

Also the app could input shell command.

screenshot

input & output

Original Project

Other Open-Source Code Used

Comments
  • is it possible to make GFPGAN work on android?

    is it possible to make GFPGAN work on android?

    Similar to how you setup SR GAN , do you think it's possible to make GFPGAN work on images via android. would be great if you could try to make a similar project. ncnn gfpgan + android.

    opened by GeorvityLabs 4
  • hello can you help with models?

    hello can you help with models?

    Hello i have a free app with code for thermal camera and i want to try the models you have in this git but the problems is that my app use opencv which know only *.pb or *.onnx models and i'm stuck can you help me somehow? thank you

    opened by ilie321 1
  • Not working when target SDK is 33 issue: [2]: ./realsr-ncnn: can't execute: Permission denied"">

    Not working when target SDK is 33 issue: "sh: [2]: ./realsr-ncnn: can't execute: Permission denied"

    Not working when target SDK is 33 issue: "sh: [2]: ./realsr-ncnn: can't execute: Permission denied",

    when i make target SDK 33 , 32 it doesn't work but when i shift it back to 28 it works kindly fix it

    image

    opened by syedusama5556 3
  • Not able to run the default algorithms

    Not able to run the default algorithms "vkQueueSubmit failed -4"

    I can not run real-esrgan and real-cugan algorithms with adreno 618. When I try to run real-esrgan-x4 it prints the following lines:

    [0 Adreno (TM) 618] queueC=0[3] queueC=0[3] queueC=0[3] [0 Adreno (TM) 618] bugsbn1=1 bugbilz=0 bugcopc=0 bugihfa=0 [0 Adreno (TM) 618] fp16-p/s/a=1/0/1 int8-p/s/a=1/0/1 [0 Adreno (TM) 618] subgroup=64 basic=1 vote=1 ballot=1 shuffle=1 busy... stbi_load_from_memory get channel 3 input&output w/h/c 529/529/1 2116/2116/1 0.00% vkQueueSubmit failed -4

    I have tried to change the tile size and it does not work with real-esrgan-x4 but it work with realsr-ncnn

    opened by MVR3S 4
  • ✨incredible would be the possibility of an option that allows you to select multiple images✨

    ✨incredible would be the possibility of an option that allows you to select multiple images✨

    incredible would be the possibility of an option that allows you to select multiple images

    and also the possibility for the image to be output with the same name as the input image

    just serious AMAZING

    opened by DavidSilvadeSa 2
Releases(1.7.12)
Owner
null
GFPGAN-ncnn - a naive NCNN implementation of GFPGAN aims at developing Practical Algorithms for Real-world Face Restoration

GFPGAN-ncnn a naive ncnn implementation of GFPGAN aims at developing Practical Algorithms for Real-world Face Restoration model support: 1.GFPGANClean

FeiGeChuanShu 42 Dec 10, 2022
This is a sample ncnn android project, it depends on ncnn library and opencv

This is a sample ncnn android project, it depends on ncnn library and opencv

null 248 Jan 6, 2023
Video, Image and GIF upscale/enlarge(Super-Resolution) and Video frame interpolation. Achieved with Waifu2x, SRMD, RealSR, Anime4K, RIFE, CAIN, DAIN and ACNet.

Video, Image and GIF upscale/enlarge(Super-Resolution) and Video frame interpolation. Achieved with Waifu2x, SRMD, RealSR, Anime4K, RIFE, CAIN, DAIN and ACNet.

Aaron Feng 8.7k Dec 31, 2022
NCNN+Int8+YOLOv4 quantitative modeling and real-time inference

NCNN+Int8+YOLOv4 quantitative modeling and real-time inference

pengtougu 20 Dec 6, 2022
Android hand detect and pose estimation by ncnn

ncnn_nanodet_hand 1.hand detect:用nanode-m训练了个hand detect模型, 2.hand pose:用CMU的数据集训练了个ghostnet作为backbone模仿pfld的handpose模型 3.推理:handpose.cpp单独检测pose,nano

null 80 Jan 3, 2023
Android face detect and segmentation by ncnn

Android face detect and segmentation by ncnn

null 118 Dec 29, 2022
Android hair/human segmentation demo by ncnn

ncnn_Android_human Android hair/human segmentation demo by ncnn PS:performance maybe poor.it's just a demo:) Reference: 1.https://github.com/Tencent/n

null 23 May 23, 2022
Android yolox hand detect by ncnn

The yolox hand detection This is a sample ncnn android project, it depends on ncnn library and opencv https://github.com/Tencent/ncnn https://github.c

FeiGeChuanShu 14 Sep 7, 2022
Android MoveNet pose estimation by ncnn

ncnn_Android_MoveNet Android MoveNet single human pose estimation by ncnn this project is a ncnn Android demo for MoveNet, it depends on ncnn library

FeiGeChuanShu 93 Dec 31, 2022
PiDiNet running in Android by ncnn

PiDiNet-NCNN 使用NCNN在安卓上实现PiDiNet这个边缘检测网络。 什么是PiDiNet?指南针:https://github.com/zhuoinoulu/pidinet 文件构成 ncnn-android-nanodet是基于nihui的nanodet项目魔改的,被我改成了运行P

WuJinxuan 9 Dec 13, 2022
monodepth running in Android by ncnn

monodepth-NCNN 将wavelet-monodepth的模型搬运到NCNN上,工程里面给了安卓的工程以及以及生成好的app安装包 wavelet-monodepth wavelet-monodepth:RGB图像的深度估计,wavelet顾名思义,就使用了小波变换的,官方的工程在这:ht

WuJinxuan 14 Aug 13, 2022
YOLOP running in Android by ncnn

YOLOP-NCNN 将YOLOP的模型搬运到NCNN上,工程里面给了windows下的VS测试以及安卓实现 YOLOP YOLOP:车辆检测+路面分割+车道线分割 三合一的网络,基于YOLO系列设计的,官方的工程在这:https://github.com/hustvl/YOLOP 工程细节 VS2

WuJinxuan 34 Dec 28, 2022
Android demo of LightTrack infer by ncnn

ncnn_Android_LightTrack this project is a ncnn Android demo for LightTrack, it depends on ncnn library and opencv. https://github.com/Tencent/ncnn htt

FeiGeChuanShu 21 Dec 14, 2022
Android CrowdCounting demo infer by ncnn

ncnn_Android_CrowdCounting This is a sample CrowdCounting Android demo infer by ncnn, it depends on ncnn library and opencv https://github.com/Tencent

FeiGeChuanShu 10 Jul 2, 2022
ncnn Android demo of PP-TinyPose

ncnn_Android_PP-TinyPose ncnn Android demo of PP-TinyPose this project is a ncnn Android demo for PP-TinyPose, it depends on ncnn library and opencv.

FeiGeChuanShu 20 Nov 25, 2022
Android human segmentation by ncnn

ncnn_Android_human_segmentation this project is a ncnn Android demo for RobustVideoMatting, it depends on ncnn library and opencv. https://github.com/

FeiGeChuanShu 111 Nov 30, 2022
M-LSD Android demo infer by ncnn

ncnn_Android_mlsd The Android demo of M-LSD: Towards Light-weight and Real-time Line Segment Detection This is a sample ncnn android project, it depen

FeiGeChuanShu 17 Jun 22, 2022
Depoly yolov5.ncnn in android.

Deploy yolov5.ncnn(v6.0) in android 测试效果 如何构建? 1. 下载 Android studio Android studio 下载地址: https://developer.android.com/studio 2. git clone 项目构建 Androi

yangcheng 10 Dec 25, 2022
A lightweight 2D Pose model can be deployed on Linux/Window/Android, supports CPU/GPU inference acceleration, and can be detected in real time on ordinary mobile phones.

A lightweight 2D Pose model can be deployed on Linux/Window/Android, supports CPU/GPU inference acceleration, and can be detected in real time on ordinary mobile phones.

JinquanPan 58 Jan 3, 2023