Skip to content

Commit 39ed5b3

Browse files
committed
update cli readme
1 parent 4add781 commit 39ed5b3

File tree

3 files changed

+103
-77
lines changed

3 files changed

+103
-77
lines changed

.github/workflows/mnnsr-linux.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ jobs:
146146
ldd mnnsr/lib/libMNN.so | grep "=>" | awk '{print $3}' | xargs -I {} cp -Ln {} mnnsr/lib/
147147
ldd mnnsr/mnnsr-ncnn | grep "=>" | awk '{print $3}' | xargs -I {} cp -Ln {} mnnsr/lib/
148148
# patchelf --set-rpath '$ORIGIN/../lib' mnnsr/mnnsr-ncnn
149+
cp ../../../../*.md mnnsr/
149150
working-directory: RealSR-NCNN-Android-CLI/MNN-SR/src/main/jni
150151

151152
- name: test mnnsr

RealSR-NCNN-Android-CLI/README.md

Lines changed: 52 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,53 @@
11
[中文说明](./README_CHS.md)
2+
# MNN-SR
3+
4+
This module is a [mnn](https://github.com/alibaba/MNN) implementation for super resolution.
5+
1. MNN can be compatible with more model architectures than NCNN.
6+
7+
2. This module supports compilation with GCC, VS, and AS, meaning that not only Android but also Windows, Linux, and even other PC systems now have a more universal super-resolution tool that operates independently of Python!
8+
9+
3. MNN supports multiple backends. The current configuration for Android includes Vulkan, OpenCL, and CPU, with OpenCL recommended. For Windows, it supports Vulkan, OpenCL, CPU, and CUDA. However, CUDA produces incorrect output on my computer and requires further testing and feedback. OpenCL does not show GPU usage in the system task manager, but the GPU can be fully utilized as seen in the nvidia-smi tool. On Linux, it supports Vulkan, OpenCL, CPU, and CUDA. In my test environment, CUDA is the fastest, Vulkan fails to utilize the GPU, and OpenCL performs well. Overall, all platforms function properly with speeds no lower than NCNN.
10+
**🙏Waiting your help!**
11+
12+
### How to build in Android Studio
13+
14+
1. download opencv lib and others libs and extract them to RealSR-NCNN-Android/3rdparty just like the ncnn modules.
15+
16+
2. download mnn lib and extract them to RealSR-NCNN-Android/3rdparty
17+
18+
```
19+
├─libwebp
20+
├─mnn_android
21+
│ ├─arm64-v8a
22+
│ ├─armeabi-v7a
23+
│ └─include
24+
```
25+
26+
3. sync and build this module
27+
28+
4. copy models and *.so from mnn_android to assets dir and build the GUI App.
29+
30+
5. run mnnsr commands in App
31+
32+
33+
### How to build in VS for Windows
34+
1. download Windows libs just like Android. if you need cuda, you should build mnn by yourself.
35+
2. modify the path in cmake file according to actually libs path.
36+
3. open the jni path and build
37+
38+
39+
### How to build in Linux
40+
refer to ci script
41+
42+
43+
### Usages
44+
45+
The usage of others program is same as realsr-ncnn. Add these param:
46+
47+
-b backend forward backend type(CPU=0,AUTO=4,CUDA=2,OPENCL=3,OPENGL=6,VULKAN=7,NN=5,USER_0=8,USER_1=9, default=3)
48+
-c color-type model & output color space type (RGB=1, BGR=2, YCbCr=5, YUV=6, GRAY=10, GRAY model & YCbCr output=11, GRAY model & YUV output=12, default=1)
49+
-d decensor-mode remove censor mode (Not=-1, Mosaic=0, default=-1)
50+
251

352
# NCNN-Modules
453

@@ -42,6 +91,8 @@ RealSR-NCNN-Android
4291
Open this project with Android Studio, rebuild it and the build result in `RealSR-NCNN-Android-CLI\*\build\intermediates\cmake\release\obj\arm64-v8a` or `RealSR-NCNN-Android-CLI\*\build\intermediates\cmake\debug\obj\arm64-v8a` could copy to the GUI project automatilly.
4392
Click `3rdparty/copy_cli_build_result.bat` and it could copy the other files to GUI project.
4493

94+
95+
4596
## How to use RealSR-NCNN-Android-CLI
4697

4798
### Download models
@@ -82,37 +133,4 @@ Usage: realsr-ncnn -i infile -o outfile [options]...
82133
- `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.
83134
- `format` = the format of the image to be output, png is better supported, however webp generally yields smaller file sizes, both are losslessly encoded
84135

85-
If you encounter crash or error, try to upgrade your derive
86-
87-
# MNN-SR
88-
89-
This module is a [mnn](https://github.com/alibaba/MNN) implementation for super resolution. MNN could support more models than ncnn.
90-
I am trying to make this module a CLI program that can be compiled in both VS(for Windows) and AS(for Android), but it not fast than ncnn. **🙏Waiting your help!**
91-
92-
### How to build in Android Studio
93-
94-
1. download opencv lib and others libs and extract them to RealSR-NCNN-Android/3rdparty just like the ncnn modules.
95-
96-
2. download mnn lib and extract them to RealSR-NCNN-Android/3rdparty
97-
98-
```
99-
├─libwebp
100-
├─mnn_android
101-
│ ├─arm64-v8a
102-
│ ├─armeabi-v7a
103-
│ └─include
104-
```
105-
106-
3. sync and build this module
107-
108-
4. copy models and *.so from mnn_android to assets dir and build the GUI App.
109-
110-
5. run mnnsr commands in App
111-
112-
### Usages
113-
114-
The usage of others program is same as realsr-ncnn. Add these param:
115-
116-
-b backend forward backend type(CPU=0,AUTO=4,CUDA=2,OPENCL=3,OPENGL=6,VULKAN=7,NN=5,USER_0=8,USER_1=9, default=3)
117-
-c color-type model & output color space type (RGB=1, BGR=2, YCbCr=5, YUV=6, GRAY=10, GRAY model & YCbCr output=11, GRAY model & YUV output=12, default=1)
118-
-d decensor-mode remove censor mode (Not=-1, Mosaic=0, default=-1)
136+
If you encounter crash or error, try to upgrade your derive

RealSR-NCNN-Android-CLI/README_CHS.md

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,55 @@
11
[English](./README.md)
22

3+
# MNN-SR
4+
5+
这个模块是用 [mnn](https://github.com/alibaba/MNN) 实现的超分辨率命令行程序。有如下特色:
6+
1. mnn可以比ncnn兼容更多模型架构。
7+
2. 本模块支持gcc、VS和AS编译,因此不止是Android,连Windows和Linux甚至其他PC系统也有脱离Python的更为通用的超分辨率工具了!
8+
3. mnn支持多种后端, 当前配置Android端支持vulkan、opencl和cpu,推荐opencl。Windows端支持vulkan、opencl、CPU和cuda,其中cuda在我的电脑中输出结果错误,需要更多测试和反馈;opencl在系统任务管理器中看不到gpu占用,在nvidia-smi工具中可以看到gpu能够跑满。Linux支持vulkan、opencl、CPU和cuda,我的测试环境中cuda最快,vulkan无法调用到gpu,opencl表现良好。整体来看,各平台都能正常使用并且速度不低于ncnn。
9+
**如果可能的话,请你帮我进一步完善🙏!**
10+
11+
### 如何在AS中编译
12+
13+
1. 和前边的ncnn模块一样下载并解压依赖到 RealSR-NCNN-Android/3rdparty
14+
15+
2. 下载mnn库并解压到RealSR-NCNN-Android/3rdparty
16+
17+
```
18+
├─libwebp
19+
├─mnn_android
20+
│ ├─arm64-v8a
21+
│ ├─armeabi-v7a
22+
│ └─include
23+
```
24+
25+
3. sync 并 build
26+
27+
4. 从mnn库中复制 *.so 文件到GUI项目的assest中.
28+
29+
### 如何在VS中编译Windows x64
30+
31+
1. 和Android版本一样下载Windows的各项依赖,注意如果需要cuda加速,需要重新编译mnn
32+
33+
2. 根据实际路径调整CMake中的文件路径
34+
35+
3. 使用VS打开MNNSR的jni目录,刷新CMake文件
36+
37+
4. build
38+
39+
### 如何使用gcc编译Linux x64
40+
请参考ci脚本进行编译
41+
42+
### 用法
43+
44+
和realsr-ncnn基本相同,增加了如下参数:
45+
46+
```console
47+
-b backend 推理后端类型(需要注意的是,这只是设置的后端类型,实际调用时mnn框架可能会自动调整,请留意程序运行时打印的信息)(CPU=0,AUTO=4,CUDA=2,OPENCL=3,OPENGL=6,VULKAN=7,NN=5,USER_0=8,USER_1=9, default=3)
48+
-c color-type 模型和输出图片的色彩空间(RGB=1, BGR=2, YCbCr=5, YUV=6, GRAY=10, GRAY模型+YCbCr色彩转换=11, GRAY模型+YUV色彩转换=12, default=1)
49+
-d decensor-mode 去审核模式,使用此模式则输出的图片与输入图片的分辨率相同(关闭=-1, 去马赛克=0, default=-1)
50+
```
51+
52+
353
# NCNN 各模块
454

555
## 如何编译 RealSR-NCNN-Android-CLI
@@ -76,46 +126,3 @@ RealSR-NCNN-Android
76126
-x 开启tta模式
77127
-f format 输出格式(jpg/png/webp, 默认ext/png)
78128
```
79-
80-
# MNN-SR
81-
82-
这个模块是用 [mnn](https://github.com/alibaba/MNN) 实现的超分辨率命令行程序。经测试确认,mnn可以比ncnn兼容更多模型。
83-
另外这个模块能同时兼容VS和AS,这样不止是Android,连Windows甚至其他PC系统也有脱离Python的更为通用的超分辨率工具了!**如果可能的话,请你帮我进一步完善🙏!**
84-
85-
### 如何在AS中编译
86-
87-
1. 和前边的ncnn模块一样下载并解压依赖到 RealSR-NCNN-Android/3rdparty
88-
89-
2. 下载mnn库并解压到RealSR-NCNN-Android/3rdparty
90-
91-
```
92-
├─libwebp
93-
├─mnn_android
94-
│ ├─arm64-v8a
95-
│ ├─armeabi-v7a
96-
│ └─include
97-
```
98-
99-
3. sync 并 build
100-
101-
4. 从mnn库中复制 *.so 文件到GUI项目的assest中.
102-
103-
### 如何在VS中编译Windows x64
104-
105-
1. 和Android版本一样下载Windows的各项依赖
106-
107-
2. 根据实际路径调整CMake中的文件路径
108-
109-
3. 使用VS打开MNNSR的jni目录,刷新CMake文件
110-
111-
4. build
112-
113-
### 用法
114-
115-
和realsr-ncnn基本相同,增加了如下参数:
116-
117-
```console
118-
-b backend 推理后端类型(需要注意的是,这只是设置的后端类型,实际调用时mnn框架可能会自动调整,请留意程序运行时打印的信息)(CPU=0,AUTO=4,CUDA=2,OPENCL=3,OPENGL=6,VULKAN=7,NN=5,USER_0=8,USER_1=9, default=3)
119-
-c color-type 模型和输出图片的色彩空间(RGB=1, BGR=2, YCbCr=5, YUV=6, GRAY=10, GRAY模型+YCbCr色彩转换=11, GRAY模型+YUV色彩转换=12, default=1)
120-
-d decensor-mode 去审核模式,使用此模式则输出的图片与输入图片的分辨率相同(关闭=-1, 去马赛克=0, default=-1)
121-
```

0 commit comments

Comments
 (0)