diff --git a/.gitignore b/.gitignore
index 092e7000..838358f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,4 +13,4 @@ third_party
build/
lite.ai.toolkit.cmake
TestExamples
-
+*.jpg
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a3bcf3fd..2c1b2532 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,16 +31,15 @@ add_definitions(-DSOURCE_PATH="${CMAKE_SOURCE_DIR}")
option(ENABLE_TEST "build test examples." OFF)
option(ENABLE_DEBUG_STRING "enable DEBUG string or not" ON)
-option(ENABLE_ONNXRUNTIME "enable ONNXRuntime engine" ON)
-option(ENABLE_TENSORRT "enable TensorRT engine" OFF)
-option(ENABLE_MNN "enable MNN engine" OFF)
-option(ENABLE_NCNN "enable NCNN engine" OFF)
-option(ENABLE_TNN "enable TNN engine" OFF)
+option(ENABLE_ONNXRUNTIME "enable ONNXRuntime engine (kept as numerical reference + test host)" ON)
+option(ENABLE_TENSORRT "enable TensorRT engine (the maintained high-performance backend)" OFF)
option(ENABLE_ONNXRUNTIME_CUDA "enable ONNXRuntime engine with CUDA provider" OFF) # for future use
option(ENABLE_OPENCV_VIDEOIO "enable opencv videoio modules for detect_video apis" ON) # now, ON only
-if ((NOT ENABLE_ONNXRUNTIME) AND (NOT ENABLE_MNN))
- message(FATAL_ERROR "One of ONNXRuntime/MNN Backend must be enable!")
+# As of >=0.3.2 the MNN/NCNN/TNN backends were dropped (frozen on tag `v0.2-all-backends`).
+# ONNXRuntime is kept as the numerical-reference oracle and the only backend that can build tests.
+if (NOT ENABLE_ONNXRUNTIME)
+ message(FATAL_ERROR "ONNXRuntime backend must be enabled (it hosts the test suite and numerical reference)!")
endif()
if ((NOT ENABLE_ONNXRUNTIME) AND ENABLE_TEST)
@@ -82,8 +81,5 @@ message(STATUS " Root Path: ${CMAKE_SOURCE_DIR}")
message(STATUS " OpenCV: ON Version: ${OpenCV_Version}")
message(STATUS " ONNXRUNTIME: ${ENABLE_ONNXRUNTIME} Version: ${OnnxRuntime_Version}")
message(STATUS " TENSORRT: ${ENABLE_TENSORRT} Version: ${TensorRT_Version}")
-message(STATUS " MNN: ${ENABLE_MNN} Version: ${MNN_Version}")
-message(STATUS " NCNN: ${ENABLE_NCNN} Version: ${NCNN_Version}")
-message(STATUS " TNN: ${ENABLE_TNN} Version: ${TNN_Version}")
message(STATUS " INSTALL: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "-------------------------- lite.ai.toolkit Configuration Summary --------------------------")
diff --git a/README.md b/README.md
index 5358611a..9ac3c89b 100644
--- a/README.md
+++ b/README.md
@@ -1,1124 +1,167 @@
-
-
-
-
+

+
-๐ **Lite.Ai.ToolKit**: A lite C++ toolkit of 100+ Awesome AI models, such as [Object Detection](#lite.ai.toolkit-object-detection), [Face Detection](#lite.ai.toolkit-face-detection), [Face Recognition](#lite.ai.toolkit-face-recognition), [Segmentation](#lite.ai.toolkit-segmentation), [Matting](#lite.ai.toolkit-matting), etc. See [Model Zoo](#lite.ai.toolkit-Model-Zoo) and [ONNX Hub](https://github.com/xlite-dev/lite.ai.toolkit/tree/main/docs/hub/lite.ai.toolkit.hub.onnx.md), [MNN Hub](https://github.com/xlite-dev/lite.ai.toolkit/tree/main/docs/hub/lite.ai.toolkit.hub.mnn.md), [TNN Hub](https://github.com/xlite-dev/lite.ai.toolkit/tree/main/docs/hub/lite.ai.toolkit.hub.tnn.md), [NCNN Hub](https://github.com/xlite-dev/lite.ai.toolkit/tree/main/docs/hub/lite.ai.toolkit.hub.ncnn.md). Welcome to ๐๐๐ปstar this repo to support me, many thanks ~ ๐๐
+๐ **Lite.Ai.ToolKit** is a C++ toolkit focused on one flagship target: an end-to-end
+**FaceFusion face-swap pipeline** (detect โ landmark โ recognize โ swap โ restore) running on
+**TensorRT**. The current line is about keeping the real pipeline GPU-resident, not collecting model
+wrappers: CUDA / NPP kernels handle the hot pre/post-processing, `DeviceFrame` carries full frames
+between stages, and the benchmark reports the real per-frame path.
-
+> **Heads up (>= 0.3):** the active line targets **TensorRT only**. ONNXRuntime is kept as the numerical
+> reference + the host for the test suite. The legacy multi-backend build (MNN / NCNN / TNN, 300+ thin
+> model wrappers) is frozen on tag **[`v0.2-all-backends`](https://github.com/xlite-dev/lite.ai.toolkit/tree/v0.2-all-backends)** โ check it out if you need those backends.
## ๐ News ๐ฅ๐ฅ
-- [2026/03] Cache-DiT **[๐v1.3.0](https://github.com/vipshop/cache-dit)** release is ready, the major updates including: [Ring](https://cache-dit.readthedocs.io/en/latest/user_guide/CONTEXT_PARALLEL) Attention w/ [batched P2P](https://cache-dit.readthedocs.io/en/latest/user_guide/CONTEXT_PARALLEL), [USP](https://cache-dit.readthedocs.io/en/latest/user_guide/CONTEXT_PARALLEL/) (Hybrid Ring and Ulysses), Hybrid 2D and 3D Parallelism (๐ฅ[USP + TP](https://cache-dit.readthedocs.io/en/latest/user_guide/HYBRID_PARALLEL/)), VAE-P Comm overhead reduce.
-
-
-
-- Most of my time now is focused on **LLM/VLM** Inference. Please check ๐[Awesome-LLM-Inference](https://github.com/xlite-dev/Awesome-LLM-Inference)  and ๐[LeetCUDA](https://github.com/xlite-dev/LeetCUDA)  for more details. Now, [lite.ai.toolkit](https://github.com/xlite-dev/lite.ai.toolkit)  is mainly maintained by ๐[@wangzijian1010](https://github.com/wangzijian1010).
-
-## Citations ๐๐
-```BibTeX
-@misc{lite.ai.toolkit@2021,
- title={lite.ai.toolkit: A lite C++ toolkit of 100+ Awesome AI models.},
- url={https://github.com/xlite-dev/lite.ai.toolkit},
- note={Open-source software available at https://github.com/xlite-dev/lite.ai.toolkit},
- author={xlite-dev, wangzijian1010 etc},
- year={2021}
-}
-```
-
-## Features ๐๐
-
-* **Simply and User friendly.** Simply and Consistent syntax like **lite::cv::Type::Class**, see [examples](#lite.ai.toolkit-Examples-for-Lite.AI.ToolKit).
-* **Minimum Dependencies.** Only **OpenCV** and **ONNXRuntime** are required by default, see [build](#lite.ai.toolkit-Build-Lite.AI.ToolKit).
-* **Many Models Supported.** **[300+](#lite.ai.toolkit-Supported-Models-Matrix)** C++ implementations and **[500+](https://github.com/xlite-dev/lite.ai.toolkit/tree/main/docs/hub/lite.ai.toolkit.hub.onnx.md)** weights ๐ **[Supported-Matrix](#lite.ai.toolkit-Supported-Models-Matrix)**.
-
-## Build ๐๐
-Download prebuilt lite.ai.toolkit library from [tag/v0.2.0](https://github.com/xlite-dev/lite.ai.toolkit/releases/tag/v0.2.0), or just build it from source:
-```shell
-git clone --depth=1 https://github.com/xlite-dev/lite.ai.toolkit.git # latest
-cd lite.ai.toolkit && sh ./build.sh # >= 0.2.0, support Linux only, tested on Ubuntu 20.04.6 LTS
-```
-
-## Quick Start ๐๐
-
-
-#### Example0: Object Detection using [YOLOv5](https://github.com/ultralytics/yolov5). Download model from Model-Zoo[2 ](#lite.ai.toolkit-2).
-```c++
-#include "lite/lite.h"
-
-int main(int argc, char *argv[]) {
- std::string onnx_path = "yolov5s.onnx";
- std::string test_img_path = "test_yolov5.jpg";
- std::string save_img_path = "test_results.jpg";
-
- auto *yolov5 = new lite::cv::detection::YoloV5(onnx_path);
- std::vector detected_boxes;
- cv::Mat img_bgr = cv::imread(test_img_path);
- yolov5->detect(img_bgr, detected_boxes);
-
- lite::utils::draw_boxes_inplace(img_bgr, detected_boxes);
- cv::imwrite(save_img_path, img_bgr);
- delete yolov5;
- return 0;
-}
-```
-You can download the prebuilt lite.ai.tooklit library and test resources from [tag/v0.2.0](https://github.com/xlite-dev/lite.ai.toolkit/releases/tag/v0.2.0).
-```bash
-export LITE_AI_TAG_URL=https://github.com/xlite-dev/lite.ai.toolkit/releases/download/v0.2.0
-wget ${LITE_AI_TAG_URL}/lite-ort1.17.1+ocv4.9.0+ffmpeg4.2.2-linux-x86_64.tgz
-wget ${LITE_AI_TAG_URL}/yolov5s.onnx && wget ${LITE_AI_TAG_URL}/test_yolov5.jpg
-```
-#### ๐๐[TensorRT](https://github.com/NVIDIA/TensorRT): Boost inference performance with NVIDIA GPU via TensorRT.
-Run `bash ./build.sh tensorrt` to build lite.ai.toolkit with TensorRT support, and then test yolov5 with the codes below. NOTE: lite.ai.toolkit need TensorRT 10.x (or later) and CUDA 12.x (or later). Please check [build.sh](./build.sh), [tensorrt-linux-x86_64-install.zh.md](./docs/tensorrt/tensorrt-linux-x86_64.zh.md), [test_lite_yolov5.cpp](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_yolov5.cpp) and [NVIDIA/TensorRT](https://github.com/NVIDIA/TensorRT) for more details.
-```c++
-// trtexec --onnx=yolov5s.onnx --saveEngine=yolov5s.engine
-auto *yolov5 = new lite::trt::cv::detection::YOLOV5(engine_path);
-```
-
-## Quick Setup ๐
-
-To quickly setup `lite.ai.toolkit`, you can follow the `CMakeLists.txt` listed as belows. ๐๐
-
-```cmake
-set(lite.ai.toolkit_DIR YOUR-PATH-TO-LITE-INSTALL)
-find_package(lite.ai.toolkit REQUIRED PATHS ${lite.ai.toolkit_DIR})
-add_executable(lite_yolov5 test_lite_yolov5.cpp)
-target_link_libraries(lite_yolov5 ${lite.ai.toolkit_LIBS})
-```
-
-## Mixed with MNN or ONNXRuntime ๐๐
-The goal of lite.ai.toolkit is not to abstract on top of MNN and ONNXRuntime. So, you can use lite.ai.toolkit mixed with MNN(`-DENABLE_MNN=ON, default OFF`) or ONNXRuntime(`-DENABLE_ONNXRUNTIME=ON, default ON`). The lite.ai.toolkit installation package contains complete MNN and ONNXRuntime. The workflow may looks like:
-```C++
-#include "lite/lite.h"
-// 0. use yolov5 from lite.ai.toolkit to detect objs.
-auto *yolov5 = new lite::cv::detection::YoloV5(onnx_path);
-// 1. use OnnxRuntime or MNN to implement your own classfier.
-interpreter = std::shared_ptr(MNN::Interpreter::createFromFile(mnn_path));
-// or: session = new Ort::Session(ort_env, onnx_path, session_options);
-classfier = interpreter->createSession(schedule_config);
-// 2. then, classify the detected objs use your own classfier ...
-```
-The included headers of MNN and ONNXRuntime can be found at [mnn_config.h](./lite/mnn/core/mnn_config.h) and [ort_config.h](./lite/ort/core/ort_config.h).
-
-
- ๐๏ธ Check the detailed Quick Start๏ผClick here!
+- **Current FaceFusion pipeline:** **23.6 ms / frame, 42.3 FPS** on an RTX 4090, FP16 deployment,
+ source prepared once and target processed per frame.
+- **Current full-frame copies:** one H2D upload of the target frame, one D2H download of the final
+ result. The swap โ restoration boundary stays GPU-resident.
+- Now, [lite.ai.toolkit](https://github.com/xlite-dev/lite.ai.toolkit) is mainly maintained by ๐[@wangzijian1010](https://github.com/wangzijian1010).
-### Download resources
+## โก Benchmark ๐ฅ
+
-You can download the prebuilt lite.ai.tooklit library and test resources from [tag/v0.2.0](https://github.com/xlite-dev/lite.ai.toolkit/releases/tag/v0.2.0).
-```bash
-export LITE_AI_TAG_URL=https://github.com/xlite-dev/lite.ai.toolkit/releases/download/v0.2.0
-wget ${LITE_AI_TAG_URL}/lite-ort1.17.1+ocv4.9.0+ffmpeg4.2.2-linux-x86_64.tgz
-wget ${LITE_AI_TAG_URL}/yolov5s.onnx && wget ${LITE_AI_TAG_URL}/test_yolov5.jpg
-tar -zxvf lite-ort1.17.1+ocv4.9.0+ffmpeg4.2.2-linux-x86_64.tgz
-```
-### Write test code
-
-write YOLOv5 example codes and name it `test_lite_yolov5.cpp`:
-```c++
-#include "lite/lite.h"
+Measured on **RTX 4090 ยท TensorRT 10.x ยท CUDA 12.x**, FP16 deployment, source prepared once and
+60 per-frame target iterations.
-int main(int argc, char *argv[]) {
- std::string onnx_path = "yolov5s.onnx";
- std::string test_img_path = "test_yolov5.jpg";
- std::string save_img_path = "test_results.jpg";
+| Stage | Time |
+|:--|--:|
+| face detect | 3.94 ms |
+| 68 landmarks | 3.46 ms |
+| face swap | 4.96 ms |
+| face restoration | 9.85 ms |
+| **TOTAL** | **23.6 ms / frame** |
+| **Throughput** | **42.3 FPS** |
+| GPU memory | 1550 MiB |
- auto *yolov5 = new lite::cv::detection::YoloV5(onnx_path);
- std::vector detected_boxes;
- cv::Mat img_bgr = cv::imread(test_img_path);
- yolov5->detect(img_bgr, detected_boxes);
-
- lite::utils::draw_boxes_inplace(img_bgr, detected_boxes);
- cv::imwrite(save_img_path, img_bgr);
- delete yolov5;
- return 0;
-}
-```
+## Data Flow
-### Setup CMakeLists.txt
-```cmake
-cmake_minimum_required(VERSION 3.10)
-project(lite_yolov5)
-set(CMAKE_CXX_STANDARD 17)
+Current full-frame data movement is down to the intended minimum:
-set(lite.ai.toolkit_DIR YOUR-PATH-TO-LITE-INSTALL)
-find_package(lite.ai.toolkit REQUIRED PATHS ${lite.ai.toolkit_DIR})
-if (lite.ai.toolkit_Found)
- message(STATUS "lite.ai.toolkit_INCLUDE_DIRS: ${lite.ai.toolkit_INCLUDE_DIRS}")
- message(STATUS " lite.ai.toolkit_LIBS: ${lite.ai.toolkit_LIBS}")
- message(STATUS " lite.ai.toolkit_LIBS_DIRS: ${lite.ai.toolkit_LIBS_DIRS}")
-endif()
-add_executable(lite_yolov5 test_lite_yolov5.cpp)
-target_link_libraries(lite_yolov5 ${lite.ai.toolkit_LIBS})
-```
-### Build example
+| Copy | Direction | Purpose |
+|:--|:--|:--|
+| 1 | Host โ Device | upload target frame once into `target_dev_` |
+| 2 | Device โ Host | download final restored result |
-```bash
-mkdir build && cd build && cmake .. && make -j1
-```
-Then, export the lib paths to `LD_LIBRARY_PATH` which listed by `lite.ai.toolkit_LIBS_DIRS`.
-```bash
-export LD_LIBRARY_PATH=YOUR-PATH-TO-LITE-INSTALL/lib:$LD_LIBRARY_PATH
-export LD_LIBRARY_PATH=YOUR-PATH-TO-LITE-INSTALL/third_party/opencv/lib:$LD_LIBRARY_PATH
-export LD_LIBRARY_PATH=YOUR-PATH-TO-LITE-INSTALL/third_party/onnxruntime/lib:$LD_LIBRARY_PATH
-export LD_LIBRARY_PATH=YOUR-PATH-TO-LITE-INSTALL/third_party/MNN/lib:$LD_LIBRARY_PATH # if -DENABLE_MNN=ON
-```
+The expensive swap โ restoration boundary no longer bounces through host memory:
-### Run binary:
-```bash
-cp ../yolov5s.onnx ../test_yolov.jpg .
-./lite_yolov5
+```text
+target host Mat
+ -> H2D once into target_dev_
+ -> swap NPP warp + preprocess + infer + paste_back
+ -> swapped_frame_ DeviceFrame
+ -> restoration NPP warp + preprocess + infer + postprocess + paste_back
+ -> D2H final result
```
-The output logs:
-```bash
-LITEORT_DEBUG LogId: ../examples/hub/onnx/cv/yolov5s.onnx
-=============== Input-Dims ==============
-Name: images
-Dims: 1
-Dims: 3
-Dims: 640
-Dims: 640
-=============== Output-Dims ==============
-Output: 0 Name: pred Dim: 0 :1
-Output: 0 Name: pred Dim: 1 :25200
-Output: 0 Name: pred Dim: 2 :85
-Output: 1 Name: output2 Dim: 0 :1
-......
-Output: 3 Name: output4 Dim: 1 :3
-Output: 3 Name: output4 Dim: 2 :20
-Output: 3 Name: output4 Dim: 3 :20
-Output: 3 Name: output4 Dim: 4 :85
-========================================
-detected num_anchors: 25200
-generate_bboxes num: 48
-```
-
-
-
-
-
-
-## Supported Models Matrix
-
-* / = not supported now.
-* โ
= known work and official supported now.
-* โ๏ธ = known work, but unofficial supported now.
-* โ = in my plan, but not coming soon, maybe a few months later.
-
-### NVIDIA GPU Inference: TensorRT
-
-|Class|Class|Class|Class|Class| System | Engine |
-|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
-|โ
[YOLOv5](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_yolov5.cpp)|โ
[YOLOv6](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_yolov6.cpp)|โ
[YOLOv8](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_yolov8.cpp)|โ
[YOLOv8Face](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_yolov8face.cpp)|โ
[YOLOv5Face](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_yolo5face.cpp)| Linux | TensorRT |
-|โ
[YOLOX](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_yolox.cpp)|โ
[YOLOv5BlazeFace](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_yolov5_blazeface.cpp) |โ
[StableDiffusion](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/sd/test_lite_sd_pipeline.cpp)| โ
[FaceFusion](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_facefusion_pipeline_gpu.cpp) | / | Linux | TensorRT |
-
-### CPU Inference: ONNXRuntime, MNN, NCNN and TNN
-| Class | Size | Type | Demo | ONNXRuntime | MNN | NCNN | TNN | Linux | MacOS | Windows | Android |
-|:-----------------------------------------------------------------------------------------------------------------:|:-----:|:----------------:|:----------------------------------------------------------------------------------------------------------------------:|:-----------:|:---:|:----:|:---:|:-----:|:-----:|:-------:|:-------:|
-| [YoloV5](https://github.com/ultralytics/yolov5) | 28M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_yolov5.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [YoloV3](https://github.com/onnx/models/blob/master/vision/object_detection_segmentation/yolov3) | 236M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_yolov3.cpp) | โ
| / | / | / | โ
| โ๏ธ | โ๏ธ | / |
-| [TinyYoloV3](https://github.com/onnx/models/blob/master/vision/object_detection_segmentation/tiny-yolov3) | 33M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_tiny_yolov3.cpp) | โ
| / | / | / | โ
| โ๏ธ | โ๏ธ | / |
-| [YoloV4](https://github.com/argusswift/YOLOv4-pytorch) | 176M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_yolov4.cpp) | โ
| / | / | / | โ
| โ๏ธ | โ๏ธ | / |
-| [SSD](https://github.com/onnx/models/blob/master/vision/object_detection_segmentation/ssd) | 76M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_ssd.cpp) | โ
| / | / | / | โ
| โ๏ธ | โ๏ธ | / |
-| [SSDMobileNetV1](https://github.com/onnx/models/blob/master/vision/object_detection_segmentation/ssd-mobilenetv1) | 27M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_ssd_mobilenetv1.cpp) | โ
| / | / | / | โ
| โ๏ธ | โ๏ธ | / |
-| [YoloX](https://github.com/Megvii-BaseDetection/YOLOX) | 3.5M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_yolox.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [TinyYoloV4VOC](https://github.com/bubbliiiing/yolov4-tiny-pytorch) | 22M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_tiny_yolov4_voc.cpp) | โ
| / | / | / | โ
| โ๏ธ | โ๏ธ | / |
-| [TinyYoloV4COCO](https://github.com/bubbliiiing/yolov4-tiny-pytorch) | 22M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_tiny_yolov4_coco.cpp) | โ
| / | / | / | โ
| โ๏ธ | โ๏ธ | / |
-| [YoloR](https://github.com/WongKinYiu/yolor) | 39M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_yolor.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [ScaledYoloV4](https://github.com/WongKinYiu/ScaledYOLOv4) | 270M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_scaled_yolov4.cpp) | โ
| / | / | / | โ
| โ๏ธ | โ๏ธ | / |
-| [EfficientDet](https://github.com/zylo117/Yet-Another-EfficientDet-Pytorch) | 15M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_efficientdet.cpp) | โ
| / | / | / | โ
| โ๏ธ | โ๏ธ | / |
-| [EfficientDetD7](https://github.com/zylo117/Yet-Another-EfficientDet-Pytorch) | 220M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_efficientdet_d7.cpp) | โ
| / | / | / | โ
| โ๏ธ | โ๏ธ | / |
-| [EfficientDetD8](https://github.com/zylo117/Yet-Another-EfficientDet-Pytorch) | 322M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_efficientdet_d8.cpp) | โ
| / | / | / | โ
| โ๏ธ | โ๏ธ | / |
-| [YOLOP](https://github.com/hustvl/YOLOP) | 30M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_yolop.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [NanoDet](https://github.com/RangiLyu/nanodet) | 1.1M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_nanodet.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [NanoDetPlus](https://github.com/RangiLyu/nanodet) | 4.5M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_nanodet_plus.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [NanoDetEffi...](https://github.com/RangiLyu/nanodet) | 12M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_nanodet_efficientnet_lite.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [YoloX_V_0_1_1](https://github.com/Megvii-BaseDetection/YOLOX) | 3.5M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_yolox_v0.1.1.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [YoloV5_V_6_0](https://github.com/ultralytics/yolov5) | 7.5M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_yolov5_v6.0.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [GlintArcFace](https://github.com/deepinsight/insightface/tree/master/recognition/arcface_torch) | 92M | *faceid* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_glint_arcface.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [GlintCosFace](https://github.com/deepinsight/insightface/tree/master/recognition/arcface_torch) | 92M | *faceid* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_glint_cosface.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [GlintPartialFC](https://github.com/deepinsight/insightface/tree/master/recognition/partial_fc) | 170M | *faceid* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_glint_partial_fc.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [FaceNet](https://github.com/timesler/facenet-pytorch) | 89M | *faceid* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_facenet.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [FocalArcFace](https://github.com/ZhaoJ9014/face.evoLVe.PyTorch) | 166M | *faceid* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_focal_arcface.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [FocalAsiaArcFace](https://github.com/ZhaoJ9014/face.evoLVe.PyTorch) | 166M | *faceid* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_focal_asia_arcface.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [TencentCurricularFace](https://github.com/Tencent/TFace/tree/master/tasks/distfc) | 249M | *faceid* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_tencent_curricular_face.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [TencentCifpFace](https://github.com/Tencent/TFace/tree/master/tasks/cifp) | 130M | *faceid* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_tencent_cifp_face.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [CenterLossFace](https://github.com/louis-she/center-loss.pytorch) | 280M | *faceid* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_center_loss_face.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [SphereFace](https://github.com/clcarwin/sphereface_pytorch) | 80M | *faceid* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_sphere_face.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [PoseRobustFace](https://github.com/penincillin/DREAM) | 92M | *faceid* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_pose_robust_face.cpp) | โ
| / | / | / | โ
| โ๏ธ | โ๏ธ | / |
-| [NaivePoseRobustFace](https://github.com/penincillin/DREAM) | 43M | *faceid* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_naive_pose_robust_face.cpp) | โ
| / | / | / | โ
| โ๏ธ | โ๏ธ | / |
-| [MobileFaceNet](https://github.com/Xiaoccer/MobileFaceNet_Pytorch) | 3.8M | *faceid* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_mobile_facenet.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [CavaGhostArcFace](https://github.com/cavalleria/cavaface.pytorch) | 15M | *faceid* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_cava_ghost_arcface.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [CavaCombinedFace](https://github.com/cavalleria/cavaface.pytorch) | 250M | *faceid* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_cava_combined_face.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [MobileSEFocalFace](https://github.com/grib0ed0v/face_recognition.pytorch) | 4.5M | *faceid* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_mobilese_focal_face.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 14M | *matting* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_rvm.cpp) | โ
| โ
| / | โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [MGMatting](https://github.com/yucornetto/MGMatting) | 113M | *matting* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_mg_matting.cpp) | โ
| โ
| / | โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [MODNet](https://github.com/ZHKKKe/MODNet) | 24M | *matting* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_modnet.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [MODNetDyn](https://github.com/ZHKKKe/MODNet) | 24M | *matting* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_modnet_dyn.cpp) | โ
| / | / | / | โ
| โ๏ธ | โ๏ธ | / |
-| [BackgroundMattingV2](https://github.com/PeterL1n/BackgroundMattingV2) | 20M | *matting* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_backgroundmattingv2.cpp) | โ
| โ
| / | โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [BackgroundMattingV2Dyn](https://github.com/PeterL1n/BackgroundMattingV2) | 20M | *matting* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_backgroundmattingv2_dyn.cpp) | โ
| / | / | / | โ
| โ๏ธ | โ๏ธ | / |
-| [UltraFace](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB) | 1.1M | *face::detect* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_ultraface.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [RetinaFace](https://github.com/biubug6/Pytorch_Retinaface) | 1.6M | *face::detect* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_retinaface.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [FaceBoxes](https://github.com/zisianw/FaceBoxes.PyTorch) | 3.8M | *face::detect* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_faceboxes.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [FaceBoxesV2](https://github.com/jhb86253817/FaceBoxesV2) | 3.8M | *face::detect* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_faceboxesv2.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd/) | 2.5M | *face::detect* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_scrfd.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 4.8M | *face::detect* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_yolo5face.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [PFLD](https://github.com/Hsintao/pfld_106_face_landmarks) | 1.0M | *face::align* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_pfld.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [PFLD98](https://github.com/polarisZhao/PFLD-pytorch) | 4.8M | *face::align* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_pfld98.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [MobileNetV268](https://github.com/cunjian/pytorch_face_landmark) | 9.4M | *face::align* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_mobilenetv2_68.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [MobileNetV2SE68](https://github.com/cunjian/pytorch_face_landmark) | 11M | *face::align* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_mobilenetv2_se_68.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [PFLD68](https://github.com/cunjian/pytorch_face_landmark) | 2.8M | *face::align* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_pfld68.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [FaceLandmark1000](https://github.com/Single430/FaceLandmark1000) | 2.0M | *face::align* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_face_landmarks_1000.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [PIPNet98](https://github.com/jhb86253817/PIPNet) | 44.0M | *face::align* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_pipnet98.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [PIPNet68](https://github.com/jhb86253817/PIPNet) | 44.0M | *face::align* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_pipnet68.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [PIPNet29](https://github.com/jhb86253817/PIPNet) | 44.0M | *face::align* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_pipnet29.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [PIPNet19](https://github.com/jhb86253817/PIPNet) | 44.0M | *face::align* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_pipnet19.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [FSANet](https://github.com/omasaht/headpose-fsanet-pytorch) | 1.2M | *face::pose* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_fsanet.cpp) | โ
| โ
| / | โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [AgeGoogleNet](https://github.com/onnx/models/tree/master/vision/body_analysis/age_gender) | 23M | *face::attr* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_age_googlenet.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [GenderGoogleNet](https://github.com/onnx/models/tree/master/vision/body_analysis/age_gender) | 23M | *face::attr* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_gender_googlenet.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [EmotionFerPlus](https://github.com/onnx/models/blob/master/vision/body_analysis/emotion_ferplus) | 33M | *face::attr* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_emotion_ferplus.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [VGG16Age](https://github.com/onnx/models/tree/master/vision/body_analysis/age_gender) | 514M | *face::attr* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_vgg16_age.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [VGG16Gender](https://github.com/onnx/models/tree/master/vision/body_analysis/age_gender) | 512M | *face::attr* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_vgg16_gender.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [SSRNet](https://github.com/oukohou/SSR_Net_Pytorch) | 190K | *face::attr* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_ssrnet.cpp) | โ
| โ
| / | โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [EfficientEmotion7](https://github.com/HSE-asavchenko/face-emotion-recognition) | 15M | *face::attr* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_efficient_emotion7.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [EfficientEmotion8](https://github.com/HSE-asavchenko/face-emotion-recognition) | 15M | *face::attr* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_efficient_emotion8.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [MobileEmotion7](https://github.com/HSE-asavchenko/face-emotion-recognition) | 13M | *face::attr* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_mobile_emotion7.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [ReXNetEmotion7](https://github.com/HSE-asavchenko/face-emotion-recognition) | 30M | *face::attr* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_rexnet_emotion7.cpp) | โ
| โ
| / | โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [EfficientNetLite4](https://github.com/onnx/models/blob/master/vision/classification/efficientnet-lite4) | 49M | *classification* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_efficientnet_lite4.cpp) | โ
| โ
| / | โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [ShuffleNetV2](https://github.com/onnx/models/blob/master/vision/classification/shufflenet) | 8.7M | *classification* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_shufflenetv2.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [DenseNet121](https://pytorch.org/hub/pytorch_vision_densenet/) | 30.7M | *classification* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_densenet.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [GhostNet](https://pytorch.org/hub/pytorch_vision_ghostnet/) | 20M | *classification* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_ghostnet.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [HdrDNet](https://pytorch.org/hub/pytorch_vision_hardnet//) | 13M | *classification* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_hardnet.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [IBNNet](https://pytorch.org/hub/pytorch_vision_ibnnet/) | 97M | *classification* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_ibnnet.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [MobileNetV2](https://pytorch.org/hub/pytorch_vision_mobilenet_v2/) | 13M | *classification* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_mobilenetv2.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [ResNet](https://pytorch.org/hub/pytorch_vision_resnet/) | 44M | *classification* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_resnet.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [ResNeXt](https://pytorch.org/hub/pytorch_vision_resnext/) | 95M | *classification* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_resnext.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [DeepLabV3ResNet101](https://pytorch.org/hub/pytorch_vision_deeplabv3_resnet101/) | 232M | *segmentation* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_deeplabv3_resnet101.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [FCNResNet101](https://pytorch.org/hub/pytorch_vision_fcn_resnet101/) | 207M | *segmentation* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_fcn_resnet101.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [FastStyleTransfer](https://github.com/onnx/models/blob/master/vision/style_transfer/fast_neural_style) | 6.4M | *style* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_fast_style_transfer.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [Colorizer](https://github.com/richzhang/colorization) | 123M | *colorization* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_colorizer.cpp) | โ
| โ
| / | โ
| โ
| โ๏ธ | โ๏ธ | / |
-| [SubPixelCNN](https://github.com/niazwazir/SUB_PIXEL_CNN) | 234K | *resolution* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_subpixel_cnn.cpp) | โ
| โ
| / | โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [SubPixelCNN](https://github.com/niazwazir/SUB_PIXEL_CNN) | 234K | *resolution* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_subpixel_cnn.cpp) | โ
| โ
| / | โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [InsectDet](https://github.com/quarrying/quarrying-insect-id) | 27M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_insectdet.cpp) | โ
| โ
| / | โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [InsectID](https://github.com/quarrying/quarrying-insect-id) | 22M | *classification* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_insectid.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ๏ธ | โ |
-| [PlantID](https://github.com/quarrying/quarrying-plant-id) | 30M | *classification* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_plantid.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ๏ธ | โ |
-| [YOLOv5BlazeFace](https://github.com/deepcam-cn/yolov5-face) | 3.4M | *face::detect* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_yolov5_blazeface.cpp) | โ
| โ
| / | / | โ
| โ๏ธ | โ๏ธ | โ |
-| [YoloV5_V_6_1](https://github.com/ultralytics/yolov5/releases/tag/v6.1) | 7.5M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_yolov5_v6.1.cpp) | โ
| โ
| / | / | โ
| โ๏ธ | โ๏ธ | โ |
-| [HeadSeg](https://github.com/minivision-ai/photo2cartoon) | 31M | *segmentation* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_head_seg.cpp) | โ
| โ
| / | โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [FemalePhoto2Cartoon](https://github.com/minivision-ai/photo2cartoon) | 15M | *style* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_female_photo2cartoon.cpp) | โ
| โ
| / | โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [FastPortraitSeg](https://github.com/YexingWan/Fast-Portrait-Segmentation) | 400k | *segmentation* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_fast_portrait_seg.cpp) | โ
| โ
| / | / | โ
| โ๏ธ | โ๏ธ | โ |
-| [PortraitSegSINet](https://github.com/clovaai/ext_portrait_segmentation) | 380k | *segmentation* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_portrait_seg_sinet.cpp) | โ
| โ
| / | / | โ
| โ๏ธ | โ๏ธ | โ |
-| [PortraitSegExtremeC3Net](https://github.com/clovaai/ext_portrait_segmentation) | 180k | *segmentation* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_portrait_seg_extremec3net.cpp) | โ
| โ
| / | / | โ
| โ๏ธ | โ๏ธ | โ |
-| [FaceHairSeg](https://github.com/kampta/face-seg) | 18M | *segmentation* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_face_hair_seg.cpp) | โ
| โ
| / | / | โ
| โ๏ธ | โ๏ธ | โ |
-| [HairSeg](https://github.com/akirasosa/mobile-semantic-segmentation) | 18M | *segmentation* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_hair_seg.cpp) | โ
| โ
| / | / | โ
| โ๏ธ | โ๏ธ | โ |
-| [MobileHumanMatting](https://github.com/lizhengwei1992/mobile_phone_human_matting) | 3M | *matting* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_mobile_human_matting.cpp) | โ
| โ
| / | / | โ
| โ๏ธ | โ๏ธ | โ |
-| [MobileHairSeg](https://github.com/wonbeomjang/mobile-hair-segmentation-pytorch) | 14M | *segmentation* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_mobile_hair_seg.cpp) | โ
| โ
| / | / | โ
| โ๏ธ | โ๏ธ | โ |
-| [YOLOv6](https://github.com/meituan/YOLOv6) | 17M | *detection* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_yolov6.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [FaceParsingBiSeNet](https://github.com/zllrunning/face-parsing.PyTorch) | 50M | *segmentation* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_face_parsing_bisenet.cpp) | โ
| โ
| โ
| โ
| โ
| โ๏ธ | โ๏ธ | โ |
-| [FaceParsingBiSeNetDyn](https://github.com/zllrunning/face-parsing.PyTorch) | 50M | *segmentation* | [demo](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_face_parsing_bisenet_dyn.cpp) | โ
| / | / | / | / | โ๏ธ | โ๏ธ | โ |
+Remaining copies are small: detect letterbox input/output metadata, landmark crop/output points, swap's
+128 crop transpose bounce, and restoration mask/affine uploads.
-
+## Headroom
-
+Latency is now close to model-bound. The largest remaining block is GFPGAN inference inside restoration
+(about 8 ms), so further single-frame latency gains are harder without quality-risky model changes such
+as INT8 or a lighter restorer. The more realistic path toward 60+ FPS is throughput work: multi-stream
+frame pipelining and CUDA Graphs, so different frames can overlap instead of running fully serial.
-
- ๐๏ธ Model Zoo๏ผClick here!
-
-## Model Zoo.
+## Features ๐๐
-
+- **GPU-first.** The whole FaceFusion pipeline runs on TensorRT; the pre/post-processing that usually
+ lingers on the CPU (warp / color-convert / normalize / layout / paste-back / NMS) is being moved into
+ **CUDA / NPP kernels** under [`lite/trt/kernel/`](https://github.com/xlite-dev/lite.ai.toolkit/tree/main/lite/trt/kernel), with `DeviceFrame`, reused buffers, and pinned + async copies.
+- **Measured, not claimed.** A header-only profiler ([`lite/bench/profiler.h`](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/lite/bench/profiler.h)) gives CPU-chrono + GPU-cudaEvent timings (p50 / p99 / FPS / CSV). Every optimization ships with a before/after `lite_*_bench` binary.
+- **Video-shaped API.** `prepare_source()` caches the fixed source face embedding once; `process()` is the per-frame target path. The old one-shot `detect()` API remains for images and demos.
+- **Multi-threaded TRT path.** `_mt` pipelines (e.g. `trt_face_restoration_mt`) run a thread pool with one
+ `IExecutionContext` + `cudaStream_t` + buffer set per thread and an async task queue.
-**Lite.Ai.ToolKit** contains almost **[100+](https://github.com/xlite-dev/lite.ai.toolkit/tree/main/docs/hub/lite.ai.toolkit.hub.onnx.md)** AI models with **[500+](https://github.com/xlite-dev/lite.ai.toolkit/tree/main/docs/hub/lite.ai.toolkit.hub.onnx.md)** frozen pretrained files now. Most of the files are converted by myself. You can use it through **lite::cv::Type::Class** syntax, such as **[lite::cv::detection::YoloV5](#lite.ai.toolkit-object-detection)**. More details can be found at [Examples for Lite.Ai.ToolKit](#lite.ai.toolkit-Examples-for-Lite.AI.ToolKit). Note, for Google Drive, I can not upload all the *.onnx files because of the storage limitation (15G).
+## Build ๐๐
-| File | Baidu Drive | Google Drive | Docker Hub | Hub (Docs) |
-|:----:|:-------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------:|
-| ONNX | [Baidu Drive](https://pan.baidu.com/s/1elUGcx7CZkkjEoYhTMwTRQ) code: 8gin | [Google Drive](https://drive.google.com/drive/folders/1p6uBcxGeyS1exc-T61vL8YRhwjYL4iD2?usp=sharing) | [ONNX Docker v0.1.22.01.08 (28G), v0.1.22.02.02 (400M)](https://hub.docker.com/r/qyjdefdocker/lite.ai.toolkit-onnx-hub/tags) | [ONNX Hub](https://github.com/xlite-dev/lite.ai.toolkit/tree/main/docs/hub/lite.ai.toolkit.hub.onnx.md) |
-| MNN | [Baidu Drive](https://pan.baidu.com/s/1KyO-bCYUv6qPq2M8BH_Okg) code: 9v63 | โ | [MNN Docker v0.1.22.01.08 (11G), v0.1.22.02.02 (213M)](https://hub.docker.com/r/qyjdefdocker/lite.ai.toolkit-mnn-hub/tags) | [MNN Hub](https://github.com/xlite-dev/lite.ai.toolkit/tree/main/docs/hub/lite.ai.toolkit.hub.mnn.md) |
-| NCNN | [Baidu Drive](https://pan.baidu.com/s/1hlnqyNsFbMseGFWscgVhgQ) code: sc7f | โ | [NCNN Docker v0.1.22.01.08 (9G), v0.1.22.02.02 (197M)](https://hub.docker.com/r/qyjdefdocker/lite.ai.toolkit-ncnn-hub/tags) | [NCNN Hub](https://github.com/xlite-dev/lite.ai.toolkit/tree/main/docs/hub/lite.ai.toolkit.hub.ncnn.md) |
-| TNN | [Baidu Drive](https://pan.baidu.com/s/1lvM2YKyUbEc5HKVtqITpcw) code: 6o6k | โ | [TNN Docker v0.1.22.01.08 (11G), v0.1.22.02.02 (217M)](https://hub.docker.com/r/qyjdefdocker/lite.ai.toolkit-tnn-hub/tags) | [TNN Hub](https://github.com/xlite-dev/lite.ai.toolkit/tree/main/docs/hub/lite.ai.toolkit.hub.tnn.md) |
+TensorRT is the maintained backend. It needs **TensorRT 10.x** and **CUDA 12.x** (Linux only). The first
+build downloads third-party libs into `third_party/` automatically.
```shell
- docker pull qyjdefdocker/lite.ai.toolkit-onnx-hub:v0.1.22.01.08 # (28G)
- docker pull qyjdefdocker/lite.ai.toolkit-mnn-hub:v0.1.22.01.08 # (11G)
- docker pull qyjdefdocker/lite.ai.toolkit-ncnn-hub:v0.1.22.01.08 # (9G)
- docker pull qyjdefdocker/lite.ai.toolkit-tnn-hub:v0.1.22.01.08 # (11G)
- docker pull qyjdefdocker/lite.ai.toolkit-onnx-hub:v0.1.22.02.02 # (400M) + YOLO5Face
- docker pull qyjdefdocker/lite.ai.toolkit-mnn-hub:v0.1.22.02.02 # (213M) + YOLO5Face
- docker pull qyjdefdocker/lite.ai.toolkit-ncnn-hub:v0.1.22.02.02 # (197M) + YOLO5Face
- docker pull qyjdefdocker/lite.ai.toolkit-tnn-hub:v0.1.22.02.02 # (217M) + YOLO5Face
-```
-
-### ๐๏ธ How to download Model Zoo from Docker Hub?
-
-* Firstly, pull the image from docker hub.
- ```shell
- docker pull qyjdefdocker/lite.ai.toolkit-mnn-hub:v0.1.22.01.08 # (11G)
- docker pull qyjdefdocker/lite.ai.toolkit-ncnn-hub:v0.1.22.01.08 # (9G)
- docker pull qyjdefdocker/lite.ai.toolkit-tnn-hub:v0.1.22.01.08 # (11G)
- docker pull qyjdefdocker/lite.ai.toolkit-onnx-hub:v0.1.22.01.08 # (28G)
- ```
-* Secondly, run the container with local `share` dir using `docker run -idt xxx`. A minimum example will show you as follows.
- * make a `share` dir in your local device.
- ```shell
- mkdir share # any name is ok.
- ```
- * write `run_mnn_docker_hub.sh` script like:
- ```shell
- #!/bin/bash
- PORT1=6072
- PORT2=6084
- SERVICE_DIR=/Users/xxx/Desktop/your-path-to/share
- CONRAINER_DIR=/home/hub/share
- CONRAINER_NAME=mnn_docker_hub_d
-
- docker run -idt -p ${PORT2}:${PORT1} -v ${SERVICE_DIR}:${CONRAINER_DIR} --shm-size=16gb --name ${CONRAINER_NAME} qyjdefdocker/lite.ai.toolkit-mnn-hub:v0.1.22.01.08
-
- ```
-* Finally, copy the model weights from `/home/hub/mnn/cv` to your local `share` dir.
- ```shell
- # activate mnn docker.
- sh ./run_mnn_docker_hub.sh
- docker exec -it mnn_docker_hub_d /bin/bash
- # copy the models to the share dir.
- cd /home/hub
- cp -rf mnn/cv share/
- ```
-
-
-### Model Hubs
-The pretrained and converted ONNX files provide by lite.ai.toolkit are listed as follows. Also, see [Model Zoo](#lite.ai.toolkit-Model-Zoo) and [ONNX Hub](https://github.com/xlite-dev/lite.ai.toolkit/tree/main/docs/hub/lite.ai.toolkit.hub.onnx.md), [MNN Hub](https://github.com/xlite-dev/lite.ai.toolkit/tree/main/docs/hub/lite.ai.toolkit.hub.mnn.md), [TNN Hub](https://github.com/xlite-dev/lite.ai.toolkit/tree/main/docs/hub/lite.ai.toolkit.hub.tnn.md), [NCNN Hub](https://github.com/xlite-dev/lite.ai.toolkit/tree/main/docs/hub/lite.ai.toolkit.hub.ncnn.md) for more details.
-
-
-
-
-
-
-
- ๐๏ธ More Examples๏ผClick here!
-
-## ๐๏ธ More Examples.
-
-More examples can be found at [examples](https://github.com/xlite-dev/lite.ai.toolkit/tree/main/examples/lite/cv).
-
-
-
-#### Example0: Object Detection using [YOLOv5](https://github.com/ultralytics/yolov5). Download model from Model-Zoo[2 ](#lite.ai.toolkit-2).
-```c++
-#include "lite/lite.h"
-
-static void test_default()
-{
- std::string onnx_path = "../../../examples/hub/onnx/cv/yolov5s.onnx";
- std::string test_img_path = "../../../examples/lite/resources/test_lite_yolov5_1.jpg";
- std::string save_img_path = "../../../examples/logs/test_lite_yolov5_1.jpg";
-
- auto *yolov5 = new lite::cv::detection::YoloV5(onnx_path);
- std::vector detected_boxes;
- cv::Mat img_bgr = cv::imread(test_img_path);
- yolov5->detect(img_bgr, detected_boxes);
-
- lite::utils::draw_boxes_inplace(img_bgr, detected_boxes);
- cv::imwrite(save_img_path, img_bgr);
-
- delete yolov5;
-}
-```
-
-The output is:
-
-
-
-
-
-Or you can use Newest ๐ฅ๐ฅ ! YOLO series's detector [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) or [YoloR](https://github.com/WongKinYiu/yolor). They got the similar results.
-
-More classes for general object detection (80 classes, COCO).
-```c++
-auto *detector = new lite::cv::detection::YoloX(onnx_path); // Newest YOLO detector !!! 2021-07
-auto *detector = new lite::cv::detection::YoloV4(onnx_path);
-auto *detector = new lite::cv::detection::YoloV3(onnx_path);
-auto *detector = new lite::cv::detection::TinyYoloV3(onnx_path);
-auto *detector = new lite::cv::detection::SSD(onnx_path);
-auto *detector = new lite::cv::detection::YoloV5(onnx_path);
-auto *detector = new lite::cv::detection::YoloR(onnx_path); // Newest YOLO detector !!! 2021-05
-auto *detector = new lite::cv::detection::TinyYoloV4VOC(onnx_path);
-auto *detector = new lite::cv::detection::TinyYoloV4COCO(onnx_path);
-auto *detector = new lite::cv::detection::ScaledYoloV4(onnx_path);
-auto *detector = new lite::cv::detection::EfficientDet(onnx_path);
-auto *detector = new lite::cv::detection::EfficientDetD7(onnx_path);
-auto *detector = new lite::cv::detection::EfficientDetD8(onnx_path);
-auto *detector = new lite::cv::detection::YOLOP(onnx_path);
-auto *detector = new lite::cv::detection::NanoDet(onnx_path); // Super fast and tiny!
-auto *detector = new lite::cv::detection::NanoDetPlus(onnx_path); // Super fast and tiny! 2021/12/25
-auto *detector = new lite::cv::detection::NanoDetEfficientNetLite(onnx_path); // Super fast and tiny!
-auto *detector = new lite::cv::detection::YoloV5_V_6_0(onnx_path);
-auto *detector = new lite::cv::detection::YoloV5_V_6_1(onnx_path);
-auto *detector = new lite::cv::detection::YoloX_V_0_1_1(onnx_path); // Newest YOLO detector !!! 2021-07
-auto *detector = new lite::cv::detection::YOLOv6(onnx_path); // Newest 2022 YOLO detector !!!
-```
-
-
-****
-
-
-
-#### Example1: Video Matting using [RobustVideoMatting2021๐ฅ๐ฅ๐ฅ](https://github.com/PeterL1n/RobustVideoMatting). Download model from Model-Zoo[2 ](#lite.ai.toolkit-2).
-
-```c++
-#include "lite/lite.h"
-
-static void test_default()
-{
- std::string onnx_path = "../../../examples/hub/onnx/cv/rvm_mobilenetv3_fp32.onnx";
- std::string video_path = "../../../examples/lite/resources/test_lite_rvm_0.mp4";
- std::string output_path = "../../../examples/logs/test_lite_rvm_0.mp4";
- std::string background_path = "../../../examples/lite/resources/test_lite_matting_bgr.jpg";
-
- auto *rvm = new lite::cv::matting::RobustVideoMatting(onnx_path, 16); // 16 threads
- std::vector contents;
-
- // 1. video matting.
- cv::Mat background = cv::imread(background_path);
- rvm->detect_video(video_path, output_path, contents, false, 0.4f,
- 20, true, true, background);
-
- delete rvm;
-}
-```
-The output is:
-
-
-
-More classes for matting (image matting, video matting, trimap/mask-free, trimap/mask-based)
-```c++
-auto *matting = new lite::cv::matting::RobustVideoMatting:(onnx_path); // WACV 2022.
-auto *matting = new lite::cv::matting::MGMatting(onnx_path); // CVPR 2021
-auto *matting = new lite::cv::matting::MODNet(onnx_path); // AAAI 2022
-auto *matting = new lite::cv::matting::MODNetDyn(onnx_path); // AAAI 2022 Dynamic Shape Inference.
-auto *matting = new lite::cv::matting::BackgroundMattingV2(onnx_path); // CVPR 2020
-auto *matting = new lite::cv::matting::BackgroundMattingV2Dyn(onnx_path); // CVPR 2020 Dynamic Shape Inference.
-auto *matting = new lite::cv::matting::MobileHumanMatting(onnx_path); // 3Mb only !!!
-```
-
-
-****
-
-
-
-#### Example2: 1000 Facial Landmarks Detection using [FaceLandmarks1000](https://github.com/Single430/FaceLandmark1000). Download model from Model-Zoo[2 ](#lite.ai.toolkit-2).
-```c++
-#include "lite/lite.h"
-
-static void test_default()
-{
- std::string onnx_path = "../../../examples/hub/onnx/cv/FaceLandmark1000.onnx";
- std::string test_img_path = "../../../examples/lite/resources/test_lite_face_landmarks_0.png";
- std::string save_img_path = "../../../examples/logs/test_lite_face_landmarks_1000.jpg";
-
- auto *face_landmarks_1000 = new lite::cv::face::align::FaceLandmark1000(onnx_path);
-
- lite::types::Landmarks landmarks;
- cv::Mat img_bgr = cv::imread(test_img_path);
- face_landmarks_1000->detect(img_bgr, landmarks);
- lite::utils::draw_landmarks_inplace(img_bgr, landmarks);
- cv::imwrite(save_img_path, img_bgr);
-
- delete face_landmarks_1000;
-}
-```
-The output is:
-
-
-More classes for face alignment (68 points, 98 points, 106 points, 1000 points)
-```c++
-auto *align = new lite::cv::face::align::PFLD(onnx_path); // 106 landmarks, 1.0Mb only!
-auto *align = new lite::cv::face::align::PFLD98(onnx_path); // 98 landmarks, 4.8Mb only!
-auto *align = new lite::cv::face::align::PFLD68(onnx_path); // 68 landmarks, 2.8Mb only!
-auto *align = new lite::cv::face::align::MobileNetV268(onnx_path); // 68 landmarks, 9.4Mb only!
-auto *align = new lite::cv::face::align::MobileNetV2SE68(onnx_path); // 68 landmarks, 11Mb only!
-auto *align = new lite::cv::face::align::FaceLandmark1000(onnx_path); // 1000 landmarks, 2.0Mb only!
-auto *align = new lite::cv::face::align::PIPNet98(onnx_path); // 98 landmarks, CVPR2021!
-auto *align = new lite::cv::face::align::PIPNet68(onnx_path); // 68 landmarks, CVPR2021!
-auto *align = new lite::cv::face::align::PIPNet29(onnx_path); // 29 landmarks, CVPR2021!
-auto *align = new lite::cv::face::align::PIPNet19(onnx_path); // 19 landmarks, CVPR2021!
-```
-
-
-****
-
-
-
-#### Example3: Colorization using [colorization](https://github.com/richzhang/colorization). Download model from Model-Zoo[2 ](#lite.ai.toolkit-2).
-```c++
-#include "lite/lite.h"
-
-static void test_default()
-{
- std::string onnx_path = "../../../examples/hub/onnx/cv/eccv16-colorizer.onnx";
- std::string test_img_path = "../../../examples/lite/resources/test_lite_colorizer_1.jpg";
- std::string save_img_path = "../../../examples/logs/test_lite_eccv16_colorizer_1.jpg";
-
- auto *colorizer = new lite::cv::colorization::Colorizer(onnx_path);
-
- cv::Mat img_bgr = cv::imread(test_img_path);
- lite::types::ColorizeContent colorize_content;
- colorizer->detect(img_bgr, colorize_content);
-
- if (colorize_content.flag) cv::imwrite(save_img_path, colorize_content.mat);
- delete colorizer;
-}
-```
-The output is:
-
-
-
-More classes for colorization (gray to rgb)
-```c++
-auto *colorizer = new lite::cv::colorization::Colorizer(onnx_path);
-```
-
-****
-
-
-
-#### Example4: Face Recognition using [ArcFace](https://github.com/deepinsight/insightface/tree/master/recognition/arcface_torch). Download model from Model-Zoo[2 ](#lite.ai.toolkit-2).
-
-```c++
-#include "lite/lite.h"
-
-static void test_default()
-{
- std::string onnx_path = "../../../examples/hub/onnx/cv/ms1mv3_arcface_r100.onnx";
- std::string test_img_path0 = "../../../examples/lite/resources/test_lite_faceid_0.png";
- std::string test_img_path1 = "../../../examples/lite/resources/test_lite_faceid_1.png";
- std::string test_img_path2 = "../../../examples/lite/resources/test_lite_faceid_2.png";
-
- auto *glint_arcface = new lite::cv::faceid::GlintArcFace(onnx_path);
-
- lite::types::FaceContent face_content0, face_content1, face_content2;
- cv::Mat img_bgr0 = cv::imread(test_img_path0);
- cv::Mat img_bgr1 = cv::imread(test_img_path1);
- cv::Mat img_bgr2 = cv::imread(test_img_path2);
- glint_arcface->detect(img_bgr0, face_content0);
- glint_arcface->detect(img_bgr1, face_content1);
- glint_arcface->detect(img_bgr2, face_content2);
-
- if (face_content0.flag && face_content1.flag && face_content2.flag)
- {
- float sim01 = lite::utils::math::cosine_similarity(
- face_content0.embedding, face_content1.embedding);
- float sim02 = lite::utils::math::cosine_similarity(
- face_content0.embedding, face_content2.embedding);
- std::cout << "Detected Sim01: " << sim << " Sim02: " << sim02 << std::endl;
- }
-
- delete glint_arcface;
-}
-```
-
-The output is:
-
-
-> Detected Sim01: 0.721159 Sim02: -0.0626267
-
-More classes for face recognition (face id vector extract)
-```c++
-auto *recognition = new lite::cv::faceid::GlintCosFace(onnx_path); // DeepGlint(insightface)
-auto *recognition = new lite::cv::faceid::GlintArcFace(onnx_path); // DeepGlint(insightface)
-auto *recognition = new lite::cv::faceid::GlintPartialFC(onnx_path); // DeepGlint(insightface)
-auto *recognition = new lite::cv::faceid::FaceNet(onnx_path);
-auto *recognition = new lite::cv::faceid::FocalArcFace(onnx_path);
-auto *recognition = new lite::cv::faceid::FocalAsiaArcFace(onnx_path);
-auto *recognition = new lite::cv::faceid::TencentCurricularFace(onnx_path); // Tencent(TFace)
-auto *recognition = new lite::cv::faceid::TencentCifpFace(onnx_path); // Tencent(TFace)
-auto *recognition = new lite::cv::faceid::CenterLossFace(onnx_path);
-auto *recognition = new lite::cv::faceid::SphereFace(onnx_path);
-auto *recognition = new lite::cv::faceid::PoseRobustFace(onnx_path);
-auto *recognition = new lite::cv::faceid::NaivePoseRobustFace(onnx_path);
-auto *recognition = new lite::cv::faceid::MobileFaceNet(onnx_path); // 3.8Mb only !
-auto *recognition = new lite::cv::faceid::CavaGhostArcFace(onnx_path);
-auto *recognition = new lite::cv::faceid::CavaCombinedFace(onnx_path);
-auto *recognition = new lite::cv::faceid::MobileSEFocalFace(onnx_path); // 4.5Mb only !
-```
-
-****
-
-
-
-#### Example5: Face Detection using [SCRFD 2021](https://github.com/deepinsight/insightface/blob/master/detection/scrfd/). Download model from Model-Zoo[2 ](#lite.ai.toolkit-2).
-```c++
-#include "lite/lite.h"
-
-static void test_default()
-{
- std::string onnx_path = "../../../examples/hub/onnx/cv/scrfd_2.5g_bnkps_shape640x640.onnx";
- std::string test_img_path = "../../../examples/lite/resources/test_lite_face_detector.jpg";
- std::string save_img_path = "../../../examples/logs/test_lite_scrfd.jpg";
-
- auto *scrfd = new lite::cv::face::detect::SCRFD(onnx_path);
-
- std::vector detected_boxes;
- cv::Mat img_bgr = cv::imread(test_img_path);
- scrfd->detect(img_bgr, detected_boxes);
-
- lite::utils::draw_boxes_with_landmarks_inplace(img_bgr, detected_boxes);
- cv::imwrite(save_img_path, img_bgr);
-
- delete scrfd;
-}
-```
-The output is:
-
-
-More classes for face detection (super fast face detection)
-```c++
-auto *detector = new lite::face::detect::UltraFace(onnx_path); // 1.1Mb only !
-auto *detector = new lite::face::detect::FaceBoxes(onnx_path); // 3.8Mb only !
-auto *detector = new lite::face::detect::FaceBoxesv2(onnx_path); // 4.0Mb only !
-auto *detector = new lite::face::detect::RetinaFace(onnx_path); // 1.6Mb only ! CVPR2020
-auto *detector = new lite::face::detect::SCRFD(onnx_path); // 2.5Mb only ! CVPR2021, Super fast and accurate!!
-auto *detector = new lite::face::detect::YOLO5Face(onnx_path); // 2021, Super fast and accurate!!
-auto *detector = new lite::face::detect::YOLOv5BlazeFace(onnx_path); // 2021, Super fast and accurate!!
-```
-
-****
-
-
-
-#### Example6: Object Segmentation using [DeepLabV3ResNet101](https://pytorch.org/hub/pytorch_vision_deeplabv3_resnet101/). Download model from Model-Zoo[2 ](#lite.ai.toolkit-2).
-```c++
-#include "lite/lite.h"
-
-static void test_default()
-{
- std::string onnx_path = "../../../examples/hub/onnx/cv/deeplabv3_resnet101_coco.onnx";
- std::string test_img_path = "../../../examples/lite/resources/test_lite_deeplabv3_resnet101.png";
- std::string save_img_path = "../../../examples/logs/test_lite_deeplabv3_resnet101.jpg";
-
- auto *deeplabv3_resnet101 = new lite::cv::segmentation::DeepLabV3ResNet101(onnx_path, 16); // 16 threads
-
- lite::types::SegmentContent content;
- cv::Mat img_bgr = cv::imread(test_img_path);
- deeplabv3_resnet101->detect(img_bgr, content);
-
- if (content.flag)
- {
- cv::Mat out_img;
- cv::addWeighted(img_bgr, 0.2, content.color_mat, 0.8, 0., out_img);
- cv::imwrite(save_img_path, out_img);
- if (!content.names_map.empty())
- {
- for (auto it = content.names_map.begin(); it != content.names_map.end(); ++it)
- {
- std::cout << it->first << " Name: " << it->second << std::endl;
- }
- }
- }
- delete deeplabv3_resnet101;
-}
-```
-
-The output is:
-
-
-
-
-
-More classes for object segmentation (general objects segmentation)
-```c++
-auto *segment = new lite::cv::segmentation::FCNResNet101(onnx_path);
-auto *segment = new lite::cv::segmentation::DeepLabV3ResNet101(onnx_path);
-```
-
-****
-
-
-
-#### Example7: Age Estimation using [SSRNet](https://github.com/oukohou/SSR_Net_Pytorch) . Download model from Model-Zoo[2 ](#lite.ai.toolkit-2).
-```c++
-#include "lite/lite.h"
-
-static void test_default()
-{
- std::string onnx_path = "../../../examples/hub/onnx/cv/ssrnet.onnx";
- std::string test_img_path = "../../../examples/lite/resources/test_lite_ssrnet.jpg";
- std::string save_img_path = "../../../examples/logs/test_lite_ssrnet.jpg";
-
- auto *ssrnet = new lite::cv::face::attr::SSRNet(onnx_path);
-
- lite::types::Age age;
- cv::Mat img_bgr = cv::imread(test_img_path);
- ssrnet->detect(img_bgr, age);
- lite::utils::draw_age_inplace(img_bgr, age);
- cv::imwrite(save_img_path, img_bgr);
-
- delete ssrnet;
-}
-```
-The output is:
-
-
-More classes for face attributes analysis (age, gender, emotion)
-```c++
-auto *attribute = new lite::cv::face::attr::AgeGoogleNet(onnx_path);
-auto *attribute = new lite::cv::face::attr::GenderGoogleNet(onnx_path);
-auto *attribute = new lite::cv::face::attr::EmotionFerPlus(onnx_path);
-auto *attribute = new lite::cv::face::attr::VGG16Age(onnx_path);
-auto *attribute = new lite::cv::face::attr::VGG16Gender(onnx_path);
-auto *attribute = new lite::cv::face::attr::EfficientEmotion7(onnx_path); // 7 emotions, 15Mb only!
-auto *attribute = new lite::cv::face::attr::EfficientEmotion8(onnx_path); // 8 emotions, 15Mb only!
-auto *attribute = new lite::cv::face::attr::MobileEmotion7(onnx_path); // 7 emotions, 13Mb only!
-auto *attribute = new lite::cv::face::attr::ReXNetEmotion7(onnx_path); // 7 emotions
-auto *attribute = new lite::cv::face::attr::SSRNet(onnx_path); // age estimation, 190kb only!!!
+git clone --depth=1 https://github.com/xlite-dev/lite.ai.toolkit.git
+cd lite.ai.toolkit
+bash ./build.sh tensorrt # GPU / TensorRT backend
```
-****
-
-
-
-#### Example8: 1000 Classes Classification using [DenseNet](https://pytorch.org/hub/pytorch_vision_densenet/). Download model from Model-Zoo[2 ](#lite.ai.toolkit-2).
-```c++
-#include "lite/lite.h"
-
-static void test_default()
-{
- std::string onnx_path = "../../../examples/hub/onnx/cv/densenet121.onnx";
- std::string test_img_path = "../../../examples/lite/resources/test_lite_densenet.jpg";
-
- auto *densenet = new lite::cv::classification::DenseNet(onnx_path);
-
- lite::types::ImageNetContent content;
- cv::Mat img_bgr = cv::imread(test_img_path);
- densenet->detect(img_bgr, content);
- if (content.flag)
- {
- const unsigned int top_k = content.scores.size();
- if (top_k > 0)
- {
- for (unsigned int i = 0; i < top_k; ++i)
- std::cout << i + 1
- << ": " << content.labels.at(i)
- << ": " << content.texts.at(i)
- << ": " << content.scores.at(i)
- << std::endl;
- }
- }
- delete densenet;
-}
-```
+See [tensorrt-linux-x86_64.zh.md](./docs/tensorrt/tensorrt-linux-x86_64.zh.md) for the TensorRT/CUDA setup.
-The output is:
-
-
-
-
-
-More classes for image classification (1000 classes)
-```c++
-auto *classifier = new lite::cv::classification::EfficientNetLite4(onnx_path);
-auto *classifier = new lite::cv::classification::ShuffleNetV2(onnx_path); // 8.7Mb only!
-auto *classifier = new lite::cv::classification::GhostNet(onnx_path);
-auto *classifier = new lite::cv::classification::HdrDNet(onnx_path);
-auto *classifier = new lite::cv::classification::IBNNet(onnx_path);
-auto *classifier = new lite::cv::classification::MobileNetV2(onnx_path); // 13Mb only!
-auto *classifier = new lite::cv::classification::ResNet(onnx_path);
-auto *classifier = new lite::cv::classification::ResNeXt(onnx_path);
-```
-
-****
-
-
-
-#### Example9: Head Pose Estimation using [FSANet](https://github.com/omasaht/headpose-fsanet-pytorch). Download model from Model-Zoo[2 ](#lite.ai.toolkit-2).
-
-```c++
-#include "lite/lite.h"
-
-static void test_default()
-{
- std::string onnx_path = "../../../examples/hub/onnx/cv/fsanet-var.onnx";
- std::string test_img_path = "../../../examples/lite/resources/test_lite_fsanet.jpg";
- std::string save_img_path = "../../../examples/logs/test_lite_fsanet.jpg";
-
- auto *fsanet = new lite::cv::face::pose::FSANet(onnx_path);
- cv::Mat img_bgr = cv::imread(test_img_path);
- lite::types::EulerAngles euler_angles;
- fsanet->detect(img_bgr, euler_angles);
-
- if (euler_angles.flag)
- {
- lite::utils::draw_axis_inplace(img_bgr, euler_angles);
- cv::imwrite(save_img_path, img_bgr);
- std::cout << "yaw:" << euler_angles.yaw << " pitch:" << euler_angles.pitch << " row:" << euler_angles.roll << std::endl;
- }
- delete fsanet;
-}
-```
+## Quick Start ๐๐
+
-The output is:
-
+#### Flagship: FaceFusion face-swap pipeline on the GPU
+End-to-end sourceโtarget face swap, fully on TensorRT. **Out of the box**, build with
+`bash ./build.sh tensorrt` and run the CLI on your own images โ no source editing:
-More classes for head pose estimation (euler angle, yaw, pitch, roll)
-```c++
-auto *pose = new lite::cv::face::pose::FSANet(onnx_path); // 1.2Mb only!
+```bash
+# build the 5 engines once, then run:
+bash ./build_facefusion_engines.sh
+./build/install/bin/lite_facefusion_cli source.jpg target.jpg output.jpg
```
-****
+Full walkthrough: **[docs/facefusion_quickstart.md](./docs/facefusion_quickstart.md)**. The C++ API
+(see [`test_lite_facefusion_pipeline.cpp`](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/examples/lite/cv/test_lite_facefusion_pipeline.cpp)):
-
-
-#### Example10: Style Transfer using [FastStyleTransfer](https://github.com/onnx/models/tree/master/vision/style_transfer/fast_neural_style). Download model from Model-Zoo[2 ](#lite.ai.toolkit-2).
```c++
#include "lite/lite.h"
+// build the 5 engines once, e.g. trtexec --onnx=gfpgan_1.4.onnx --saveEngine=gfpgan_1.4_fp32.engine
+auto pipeline = lite::trt::cv::face::swap::FaceFusionPipeLine(
+ face_detect_engine, // yoloface_8n
+ face_landmarks_68_engine, // 2dfan4
+ face_recognizer_engine, // arcface_w600k_r50
+ face_swap_engine, // inswapper_128
+ face_restoration_engine); // gfpgan_1.4
+// Video/server path: prepare the fixed source face once.
+cv::Mat source = cv::imread(source_image_path);
+pipeline.prepare_source(source, 0);
-static void test_default()
-{
- std::string onnx_path = "../../../examples/hub/onnx/cv/style-candy-8.onnx";
- std::string test_img_path = "../../../examples/lite/resources/test_lite_fast_style_transfer.jpg";
- std::string save_img_path = "../../../examples/logs/test_lite_fast_style_transfer_candy.jpg";
-
- auto *fast_style_transfer = new lite::cv::style::FastStyleTransfer(onnx_path);
-
- lite::types::StyleContent style_content;
- cv::Mat img_bgr = cv::imread(test_img_path);
- fast_style_transfer->detect(img_bgr, style_content);
+// Per target frame: process() reuses the cached source embedding.
+cv::Mat target = cv::imread(target_image_path);
+cv::Mat result = pipeline.process(target, 0);
+cv::imwrite(save_image_path, result);
- if (style_content.flag) cv::imwrite(save_img_path, style_content.mat);
- delete fast_style_transfer;
-}
+// One-shot image convenience is still available:
+// pipeline.detect(source_image_path, 0, target_image_path, 0, save_image_path);
```
-The output is:
-
+## Architecture ๐งฉ
-More classes for style transfer (neural style transfer, others)
-```c++
-auto *transfer = new lite::cv::style::FastStyleTransfer(onnx_path); // 6.4Mb only
```
-
-****
-
-#### Example11: Human Head Segmentation using [HeadSeg](https://github.com/minivision-ai/photo2cartoon). Download model from Model-Zoo[2 ](#lite.ai.toolkit-2).
-```c++
-#include "lite/lite.h"
-
-static void test_default()
-{
- std::string onnx_path = "../../../examples/hub/onnx/cv/minivision_head_seg.onnx";
- std::string test_img_path = "../../../examples/lite/resources/test_lite_head_seg.png";
- std::string save_img_path = "../../../examples/logs/test_lite_head_seg.jpg";
-
- auto *head_seg = new lite::cv::segmentation::HeadSeg(onnx_path, 4); // 4 threads
-
- lite::types::HeadSegContent content;
- cv::Mat img_bgr = cv::imread(test_img_path);
- head_seg->detect(img_bgr, content);
- if (content.flag) cv::imwrite(save_img_path, content.mask * 255.f);
-
- delete head_seg;
-}
-```
-The output is:
-
-
-
-More classes for human segmentation (head, portrait, hair, others)
-```c++
-auto *segment = new lite::cv::segmentation::HeadSeg(onnx_path); // 31Mb
-auto *segment = new lite::cv::segmentation::FastPortraitSeg(onnx_path); // <= 400Kb !!!
-auto *segment = new lite::cv::segmentation::PortraitSegSINet(onnx_path); // <= 380Kb !!!
-auto *segment = new lite::cv::segmentation::PortraitSegExtremeC3Net(onnx_path); // <= 180Kb !!! Extreme Tiny !!!
-auto *segment = new lite::cv::segmentation::FaceHairSeg(onnx_path); // 18M
-auto *segment = new lite::cv::segmentation::HairSeg(onnx_path); // 18M
-auto *segment = new lite::cv::segmentation::MobileHairSeg(onnx_path); // 14M
-```
-
-****
-
-#### Example12: Photo transfer to Cartoon [Photo2Cartoon](https://github.com/minivision-ai/photo2cartoon). Download model from Model-Zoo[2 ](#lite.ai.toolkit-2).
-```c++
-#include "lite/lite.h"
-
-static void test_default()
-{
- std::string head_seg_onnx_path = "../../../examples/hub/onnx/cv/minivision_head_seg.onnx";
- std::string cartoon_onnx_path = "../../../examples/hub/onnx/cv/minivision_female_photo2cartoon.onnx";
- std::string test_img_path = "../../../examples/lite/resources/test_lite_female_photo2cartoon.jpg";
- std::string save_mask_path = "../../../examples/logs/test_lite_female_photo2cartoon_seg.jpg";
- std::string save_cartoon_path = "../../../examples/logs/test_lite_female_photo2cartoon_cartoon.jpg";
-
- auto *head_seg = new lite::cv::segmentation::HeadSeg(head_seg_onnx_path, 4); // 4 threads
- auto *female_photo2cartoon = new lite::cv::style::FemalePhoto2Cartoon(cartoon_onnx_path, 4); // 4 threads
-
- lite::types::HeadSegContent head_seg_content;
- cv::Mat img_bgr = cv::imread(test_img_path);
- head_seg->detect(img_bgr, head_seg_content);
-
- if (head_seg_content.flag && !head_seg_content.mask.empty())
- {
- cv::imwrite(save_mask_path, head_seg_content.mask * 255.f);
- // Female Photo2Cartoon Style Transfer
- lite::types::FemalePhoto2CartoonContent female_cartoon_content;
- female_photo2cartoon->detect(img_bgr, head_seg_content.mask, female_cartoon_content);
-
- if (female_cartoon_content.flag && !female_cartoon_content.cartoon.empty())
- cv::imwrite(save_cartoon_path, female_cartoon_content.cartoon);
- }
-
- delete head_seg;
- delete female_photo2cartoon;
-}
-```
-The output is:
-
-
-
-More classes for photo style transfer.
-```c++
-auto *transfer = new lite::cv::style::FemalePhoto2Cartoon(onnx_path);
+lite/
+โโโ trt/ # TensorRT backend โ the maintained high-performance path
+โ โโโ core/ # trt_handler base (engine load, buffers, streams)
+โ โโโ cv/ # one .h/.cpp per model + the facefusion pipeline (+ _mt variants)
+โ โโโ kernel/ # hand-written fused CUDA kernels (.cu/.cuh) + host-side managers
+โ โโโ sd/ # Stable Diffusion components (clip / unet / vae / scheduler)
+โโโ ort/ # ONNXRuntime backend โ numerical reference + test host
+โโโ bench/ # header-only profiler (CPU chrono + GPU cudaEvent, p50/p99/FPS/CSV)
+โโโ lite.h # single public include
```
-****
-
-#### Example13: Face Parsing using [FaceParsing](https://github.com/zllrunning/face-parsing.PyTorch). Download model from Model-Zoo[2 ](#lite.ai.toolkit-2).
-```c++
-#include "lite/lite.h"
-
-static void test_default()
-{
- std::string onnx_path = "../../../examples/hub/onnx/cv/face_parsing_512x512.onnx";
- std::string test_img_path = "../../../examples/lite/resources/test_lite_face_parsing.png";
- std::string save_img_path = "../../../examples/logs/test_lite_face_parsing_bisenet.jpg";
-
- auto *face_parsing_bisenet = new lite::cv::segmentation::FaceParsingBiSeNet(onnx_path, 8); // 8 threads
-
- lite::types::FaceParsingContent content;
- cv::Mat img_bgr = cv::imread(test_img_path);
- face_parsing_bisenet->detect(img_bgr, content);
-
- if (content.flag && !content.merge.empty())
- cv::imwrite(save_img_path, content.merge);
-
- delete face_parsing_bisenet;
-}
-```
-The output is:
-
-
-
-More classes for face parsing (hair, eyes, nose, mouth, others)
-```c++
-auto *segment = new lite::cv::segmentation::FaceParsingBiSeNet(onnx_path); // 50Mb
-auto *segment = new lite::cv::segmentation::FaceParsingBiSeNetDyn(onnx_path); // Dynamic Shape Inference.
-```
-
+`lite::cv` is a compile-time namespace alias resolved in [`lite/models.h`](https://github.com/xlite-dev/lite.ai.toolkit/blob/main/lite/models.h). Pin a backend explicitly with `lite::trt::cv::...` (GPU) or `lite::onnxruntime::cv::...` (CPU reference).
## ยฉ๏ธLicense
GNU General Public License v3.0
-## ๐Contribute
-Please consider โญ this repo if you like it, as it is the simplest way to support me.
-
-
+## Star History
+
+
+
+
+
+
+
diff --git a/build_facefusion_engines.sh b/build_facefusion_engines.sh
new file mode 100755
index 00000000..ccedafbc
--- /dev/null
+++ b/build_facefusion_engines.sh
@@ -0,0 +1,53 @@
+#!/usr/bin/env bash
+# Build the 5 TensorRT engines the FaceFusion pipeline needs, from their ONNX files.
+#
+# Usage:
+# bash ./build_facefusion_engines.sh
+#
+# directory holding the 5 ONNX models (see docs/facefusion_quickstart.md)
+# where the .engine files are written (create if missing)
+#
+# Requires `trtexec` on PATH (ships with TensorRT 10.x). Override with TRTEXEC=...
+set -euo pipefail
+
+ONNX_DIR="${1:?usage: $0 }"
+ENGINE_DIR="${2:?usage: $0 }"
+TRTEXEC="${TRTEXEC:-trtexec}"
+PYTHON="${PYTHON:-python3}"
+HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+
+mkdir -p "$ENGINE_DIR"
+
+build() {
+ local onnx="$ONNX_DIR/$1" engine="$ENGINE_DIR/$2"; shift 2
+ if [[ ! -f "$onnx" ]]; then
+ echo "[build_facefusion_engines] MISSING onnx: $onnx" >&2; exit 1
+ fi
+ if [[ -f "$engine" ]]; then
+ echo "[build_facefusion_engines] skip (exists): $engine"; return
+ fi
+ echo "[build_facefusion_engines] $onnx -> $engine ($*)"
+ "$TRTEXEC" --onnx="$onnx" --saveEngine="$engine" "$@"
+}
+
+build yoloface_8n.onnx yoloface_8n_fp16.engine --fp16
+build 2dfan4.onnx 2dfan4_fp16.engine --fp16
+build arcface_w600k_r50.onnx arcface_w600k_r50_fp16.engine --fp16
+build inswapper_128.onnx inswapper_128_fp16.engine --fp16
+
+# GFPGAN: a naive --fp16 engine blows up its StyleGAN modulated convs (grey-block / a grey
+# halo around the pasted-back face). The fix is mixed precision โ FP16 everywhere except the
+# style_conv/to_rgb layers, which stay FP32 (build_gfpgan_fp16_engine.py). That is numerically
+# identical to the FP32 engine (PSNR ~58 dB) while cutting the restoration stage ~3 ms.
+# Needs the TensorRT 10.x python wheel on $PYTHON; set GFPGAN_FP32=1 to fall back to plain FP32.
+GFPGAN_ENGINE="$ENGINE_DIR/gfpgan_1.4_mixed.engine"
+if [[ "${GFPGAN_FP32:-0}" == "1" ]]; then
+ build gfpgan_1.4.onnx gfpgan_1.4_fp32.engine
+elif [[ -f "$GFPGAN_ENGINE" ]]; then
+ echo "[build_facefusion_engines] skip (exists): $GFPGAN_ENGINE"
+else
+ echo "[build_facefusion_engines] gfpgan_1.4.onnx -> $GFPGAN_ENGINE (mixed fp16, style layers fp32)"
+ "$PYTHON" "$HERE/build_gfpgan_fp16_engine.py" "$ONNX_DIR/gfpgan_1.4.onnx" "$GFPGAN_ENGINE"
+fi
+
+echo "[build_facefusion_engines] done -> $ENGINE_DIR"
diff --git a/build_gfpgan_fp16_engine.py b/build_gfpgan_fp16_engine.py
new file mode 100644
index 00000000..f8bc65ba
--- /dev/null
+++ b/build_gfpgan_fp16_engine.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+# Build a *mixed-precision* TensorRT engine for GFPGAN that the lite.ai.toolkit C++
+# (TensorRT 10.1) can load โ fast FP16 everywhere EXCEPT the StyleGAN modulated convs,
+# which are kept in FP32.
+#
+# Why this exists:
+# A naive `trtexec --fp16` GFPGAN engine produces grey-block artifacts: the StyleGAN
+# "modulated conv" demodulation (sum-of-squares -> rsqrt) overflows/underflows in FP16.
+# The clean fix is to keep just those layers (style_conv* / to_rgb*) in FP32 and run the
+# rest in FP16. On TensorRT 10.1 the "strong typing via Cast nodes in the ONNX" route
+# crashes (matchTypeSpec); the route that works is weak FP16 + OBEY_PRECISION_CONSTRAINTS
+# with per-layer FP32 precision set through the builder API (this script).
+#
+# Result on RTX 4090 / TRT 10.1: restoration infer 10.8 -> 8.0 ms, output numerically clean
+# (no grey blocks); facefusion pipeline 36.6 -> 33.1 ms (27 -> 30 FPS).
+#
+# Requirements: the TensorRT 10.1 *python* wheel (ships in the TRT tarball under python/),
+# e.g. python -m venv env && env/bin/pip install /usr/local/tensorrt/python/tensorrt-10.1.0-cp312-*.whl
+#
+# Usage:
+# LD_LIBRARY_PATH=/usr/local/tensorrt/lib:/usr/local/cuda/lib64 \
+# python build_gfpgan_fp16_engine.py
+#
+import sys
+import os
+import tensorrt as trt
+
+# Substring match on layer names; these are the StyleGAN modulated convs that must stay FP32.
+KEEP_FP32 = ("style_conv", "to_rgb")
+FLOAT_TYPES = (trt.float32, trt.float16)
+
+
+def main():
+ if len(sys.argv) < 3:
+ print(__doc__)
+ sys.exit(1)
+ onnx_path, engine_path = sys.argv[1], sys.argv[2]
+
+ log = trt.Logger(trt.Logger.WARNING)
+ builder = trt.Builder(log)
+ network = builder.create_network(0)
+ parser = trt.OnnxParser(network, log)
+ with open(onnx_path, "rb") as f:
+ if not parser.parse(f.read()):
+ for i in range(parser.num_errors):
+ print(parser.get_error(i))
+ sys.exit(1)
+
+ cfg = builder.create_builder_config()
+ cfg.set_memory_pool_limit(trt.MemoryPoolType.WORKSPACE, 4 << 30)
+ cfg.set_flag(trt.BuilderFlag.FP16)
+ cfg.set_flag(trt.BuilderFlag.OBEY_PRECISION_CONSTRAINTS)
+
+ def all_float(layer):
+ return layer.num_outputs > 0 and all(
+ layer.get_output(j).dtype in FLOAT_TYPES for j in range(layer.num_outputs)
+ )
+
+ pinned = 0
+ for i in range(network.num_layers):
+ layer = network.get_layer(i)
+ if not any(k in layer.name for k in KEEP_FP32):
+ continue
+ # Only float compute layers; skip Int64/shape Constants (can't be FP32-typed).
+ if layer.type == trt.LayerType.CONSTANT or not all_float(layer):
+ continue
+ layer.precision = trt.float32
+ for j in range(layer.num_outputs):
+ layer.set_output_type(j, trt.float32)
+ pinned += 1
+ print(f"network layers={network.num_layers} pinned to fp32={pinned}", flush=True)
+
+ print("building serialized engine (this is slow on the first build)...", flush=True)
+ serialized = builder.build_serialized_network(network, cfg)
+ if serialized is None:
+ print("BUILD FAILED")
+ sys.exit(1)
+ with open(engine_path, "wb") as f:
+ f.write(serialized)
+ print(f"OK wrote {engine_path} ({os.path.getsize(engine_path) / 1e6:.1f} MB)")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/cmake/MNN.cmake b/cmake/MNN.cmake
deleted file mode 100644
index 1565dcf0..00000000
--- a/cmake/MNN.cmake
+++ /dev/null
@@ -1,38 +0,0 @@
-set(MNN_Version "2.8.2" CACHE STRING "MNN version" FORCE)
-set(MNN_DIR ${THIRD_PARTY_PATH}/MNN)
-# download from github if MNN library is not exists
-if (NOT EXISTS ${MNN_DIR})
- set(MNN_Filename "MNN-${MNN_Version}-linux-cpu-x86_64.tgz")
- set(MNN_URL https://github.com/DefTruth/lite.ai.toolkit/releases/download/v0.2.0-rc0/${MNN_Filename})
- message("[Lite.AI.Toolkit][I] Downloading MNN library: ${MNN_URL}")
- download_and_decompress(${MNN_URL} ${MNN_Filename} ${MNN_DIR})
-else()
- message("[Lite.AI.Toolkit][I] Found local MNN library: ${MNN_DIR}")
-endif()
-if(NOT EXISTS ${MNN_DIR})
- message(FATAL_ERROR "[Lite.AI.Toolkit][E] ${MNN_DIR} is not exists!")
-endif()
-
-include_directories(${MNN_DIR}/include)
-link_directories(${MNN_DIR}/lib)
-
-# 1. glob sources files
-file(GLOB MNN_CORE_SRCS ${CMAKE_SOURCE_DIR}/lite/mnn/core/*.cpp)
-file(GLOB MNN_CV_SRCS ${CMAKE_SOURCE_DIR}/lite/mnn/cv/*.cpp)
-file(GLOB MNN_NLP_SRCS ${CMAKE_SOURCE_DIR}/lite/mnn/nlp/*.cpp)
-file(GLOB MNN_ASR_SRCS ${CMAKE_SOURCE_DIR}/lite/mnn/asr/*.cpp)
-# 2. glob headers files
-file(GLOB MNN_CORE_HEAD ${CMAKE_SOURCE_DIR}/lite/mnn/core/*.h)
-file(GLOB MNN_CV_HEAD ${CMAKE_SOURCE_DIR}/lite/mnn/cv/*.h)
-file(GLOB MNN_NLP_HEAD ${CMAKE_SOURCE_DIR}/lite/mnn/nlp/*.h)
-file(GLOB MNN_ASR_HEAD ${CMAKE_SOURCE_DIR}/lite/mnn/asr/*.h)
-
-set(MNN_SRCS ${MNN_CV_SRCS} ${MNN_NLP_SRCS} ${MNN_ASR_SRCS} ${MNN_CORE_SRCS})
-# 3. copy
-message("[Lite.AI.Toolkit][I] Installing Lite.AI.ToolKit Headers for MNN Backend ...")
-# "INSTALL" can copy all files from the list to the specified path.
-# "COPY" only copies one file to a specified path
-file(INSTALL ${MNN_CORE_HEAD} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/lite/mnn/core)
-file(INSTALL ${MNN_CV_HEAD} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/lite/mnn/cv)
-file(INSTALL ${MNN_ASR_HEAD} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/lite/mnn/asr)
-file(INSTALL ${MNN_NLP_HEAD} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/lite/mnn/nlp)
diff --git a/cmake/TNN.cmake b/cmake/TNN.cmake
deleted file mode 100644
index 08a246a6..00000000
--- a/cmake/TNN.cmake
+++ /dev/null
@@ -1,27 +0,0 @@
-set(TNN_DIR ${THIRD_PARTY_PATH}/TNN)
-if(NOT EXISTS ${TNN_DIR})
- message(FATAL_ERROR "[Lite.AI.Toolkit][E] ${TNN_DIR} is not exists!")
-endif()
-include_directories(${TNN_DIR}/include)
-link_directories(${TNN_DIR}/lib)
-
-# 1. glob sources files
-file(GLOB TNN_CORE_SRCS ${CMAKE_SOURCE_DIR}/lite/tnn/core/*.cpp)
-file(GLOB TNN_CV_SRCS ${CMAKE_SOURCE_DIR}/lite/tnn/cv/*.cpp)
-file(GLOB TNN_NLP_SRCS ${CMAKE_SOURCE_DIR}/lite/tnn/nlp/*.cpp)
-file(GLOB TNN_ASR_SRCS ${CMAKE_SOURCE_DIR}/lite/tnn/asr/*.cpp)
-# 2. glob headers files
-file(GLOB TNN_CORE_HEAD ${CMAKE_SOURCE_DIR}/lite/tnn/core/*.h)
-file(GLOB TNN_CV_HEAD ${CMAKE_SOURCE_DIR}/lite/tnn/cv/*.h)
-file(GLOB TNN_NLP_HEAD ${CMAKE_SOURCE_DIR}/lite/tnn/nlp/*.h)
-file(GLOB TNN_ASR_HEAD ${CMAKE_SOURCE_DIR}/lite/tnn/asr/*.h)
-
-set(TNN_SRCS ${TNN_CV_SRCS} ${TNN_NLP_SRCS} ${TNN_ASR_SRCS} ${TNN_CORE_SRCS})
-# 3. copy
-message("[Lite.AI.Toolkit][I] Installing Lite.AI.ToolKit Headers for TNN Backend ...")
-# "INSTALL" can copy all files from the list to the specified path.
-# "COPY" only copies one file to a specified path
-file(INSTALL ${TNN_CORE_HEAD} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/lite/tnn/core)
-file(INSTALL ${TNN_CV_HEAD} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/lite/tnn/cv)
-file(INSTALL ${TNN_ASR_HEAD} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/lite/tnn/asr)
-file(INSTALL ${TNN_NLP_HEAD} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/lite/tnn/nlp)
diff --git a/cmake/lite.ai.toolkit.cmake.in b/cmake/lite.ai.toolkit.cmake.in
index 38e11060..7bd937ea 100644
--- a/cmake/lite.ai.toolkit.cmake.in
+++ b/cmake/lite.ai.toolkit.cmake.in
@@ -1,9 +1,6 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.8)
set(ENABLE_ONNXRUNTIME @ENABLE_ONNXRUNTIME@)
-set(ENABLE_MNN @ENABLE_MNN@)
-set(ENABLE_NCNN @ENABLE_NCNN@)
-set(ENABLE_TNN @ENABLE_TNN@)
set(ENABLE_TENSORRT @ENABLE_TENSORRT@)
set(CUDA_DIR @CUDA_DIR@)
set(TensorRT_DIR @TensorRT_DIR@)
@@ -13,8 +10,8 @@ if (NOT (UNIX AND NOT APPLE))
message(FATAL_ERROR "lite.ai.toolkit>=0.2 not support for windows/mac now!")
endif()
-if ((NOT ENABLE_ONNXRUNTIME) AND (NOT ENABLE_MNN))
- message(FATAL_ERROR "One of ONNXRuntime/MNN Backend must be enable!")
+if (NOT ENABLE_ONNXRUNTIME)
+ message(FATAL_ERROR "ONNXRuntime backend must be enabled!")
endif()
# lite.ai.toolkit
@@ -46,33 +43,6 @@ if (ENABLE_ONNXRUNTIME)
list(APPEND Lite_AI_LIBS onnxruntime)
endif()
-# MNN
-if (ENABLE_MNN)
- include_directories(${THIRD_PARTY_PATH}/MNN/include)
- link_directories(${THIRD_PARTY_PATH}/MNN/lib)
- list(APPEND Lite_AI_INCLUDE_DIRS ${THIRD_PARTY_PATH}/MNN/include)
- list(APPEND Lite_AI_LIBS_DIRS ${THIRD_PARTY_PATH}/MNN/lib)
- list(APPEND Lite_AI_LIBS MNN)
-endif()
-
-# TNN
-if (ENABLE_TNN)
- include_directories(${THIRD_PARTY_PATH}/TNN/include)
- link_directories(${THIRD_PARTY_PATH}/TNN/lib)
- list(APPEND Lite_AI_INCLUDE_DIRS ${THIRD_PARTY_PATH}/TNN/include)
- list(APPEND Lite_AI_LIBS_DIRS ${THIRD_PARTY_PATH}/TNN/lib)
- list(APPEND Lite_AI_LIBS TNN)
-endif()
-
-# ncnn
-if (ENABLE_NCNN)
- include_directories(${THIRD_PARTY_PATH}/ncnn/include)
- link_directories(${THIRD_PARTY_PATH}/ncnn/lib)
- list(APPEND Lite_AI_INCLUDE_DIRS ${THIRD_PARTY_PATH}/ncnn/include)
- list(APPEND Lite_AI_LIBS_DIRS ${THIRD_PARTY_PATH}/ncnn/lib)
- list(APPEND Lite_AI_LIBS ncnn)
-endif()
-
# tensorrt
if (ENABLE_TENSORRT)
include_directories(${TensorRT_DIR}/include)
diff --git a/cmake/ncnn.cmake b/cmake/ncnn.cmake
deleted file mode 100644
index 61800e83..00000000
--- a/cmake/ncnn.cmake
+++ /dev/null
@@ -1,27 +0,0 @@
-set(NCNN_DIR ${THIRD_PARTY_PATH}/ncnn)
-if(NOT EXISTS ${NCNN_DIR})
- message(FATAL_ERROR "[Lite.AI.Toolkit][E] ${NCNN_DIR} is not exists!")
-endif()
-include_directories(${NCNN_DIR}/include)
-link_directories(${NCNN_DIR}/lib)
-
-# 1. glob sources files
-file(GLOB NCNN_CORE_SRCS ${CMAKE_SOURCE_DIR}/lite/ncnn/core/*.cpp)
-file(GLOB NCNN_CV_SRCS ${CMAKE_SOURCE_DIR}/lite/ncnn/cv/*.cpp)
-file(GLOB NCNN_NLP_SRCS ${CMAKE_SOURCE_DIR}/lite/ncnn/nlp/*.cpp)
-file(GLOB NCNN_ASR_SRCS ${CMAKE_SOURCE_DIR}/lite/ncnn/asr/*.cpp)
-# 2. glob headers files
-file(GLOB NCNN_CORE_HEAD ${CMAKE_SOURCE_DIR}/lite/ncnn/core/*.h)
-file(GLOB NCNN_CV_HEAD ${CMAKE_SOURCE_DIR}/lite/ncnn/cv/*.h)
-file(GLOB NCNN_NLP_HEAD ${CMAKE_SOURCE_DIR}/lite/ncnn/nlp/*.h)
-file(GLOB NCNN_ASR_HEAD ${CMAKE_SOURCE_DIR}/lite/ncnn/asr/*.h)
-
-set(NCNN_SRCS ${NCNN_CV_SRCS} ${NCNN_NLP_SRCS} ${NCNN_ASR_SRCS} ${NCNN_CORE_SRCS})
-# 3. copy
-message("[Lite.AI.Toolkit][I] Installing Lite.AI.ToolKit Headers for NCNN Backend ...")
-# "INSTALL" can copy all files from the list to the specified path.
-# "COPY" only copies one file to a specified path
-file(INSTALL ${NCNN_CORE_HEAD} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/lite/ncnn/core)
-file(INSTALL ${NCNN_CV_HEAD} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/lite/ncnn/cv)
-file(INSTALL ${NCNN_ASR_HEAD} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/lite/ncnn/asr)
-file(INSTALL ${NCNN_NLP_HEAD} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/lite/ncnn/nlp)
diff --git a/cmake/utils.cmake b/cmake/utils.cmake
index 9073a3c4..498b8c92 100644
--- a/cmake/utils.cmake
+++ b/cmake/utils.cmake
@@ -53,28 +53,11 @@ function(add_lite_ai_toolkit_shared_library version soversion)
include(cmake/tensorrt.cmake)
set(LITE_SRCS ${LITE_SRCS} ${TRT_SRCS})
set(LITE_DEPENDENCIES ${LITE_DEPENDENCIES} cuda cudart nvinfer nvonnxparser
- nvinfer_plugin ddim_scheduler_cpp)
+ nvinfer_plugin ddim_scheduler_cpp
+ nppc nppig nppidei) # NPP: GPU warp/resize
link_directories(${CMAKE_SOURCE_DIR}/lite/bin)
endif ()
- if (ENABLE_MNN)
- include(cmake/MNN.cmake)
- set(LITE_SRCS ${LITE_SRCS} ${MNN_SRCS})
- set(LITE_DEPENDENCIES ${LITE_DEPENDENCIES} MNN)
- endif ()
-
- if (ENABLE_NCNN)
- include(cmake/ncnn.cmake)
- set(LITE_SRCS ${LITE_SRCS} ${NCNN_SRCS})
- set(LITE_DEPENDENCIES ${LITE_DEPENDENCIES} ncnn)
- endif ()
-
- if (ENABLE_TNN)
- include(cmake/TNN.cmake)
- set(LITE_SRCS ${LITE_SRCS} ${TNN_SRCS})
- set(LITE_DEPENDENCIES ${LITE_DEPENDENCIES} TNN)
- endif ()
-
# 4. shared library
add_library(lite.ai.toolkit SHARED ${LITE_SRCS})
target_link_libraries(lite.ai.toolkit ${LITE_DEPENDENCIES})
diff --git a/docs/facefusion_quickstart.md b/docs/facefusion_quickstart.md
new file mode 100644
index 00000000..8c3c4aa2
--- /dev/null
+++ b/docs/facefusion_quickstart.md
@@ -0,0 +1,73 @@
+# FaceFusion Pipeline โ Quickstart (TensorRT)
+
+Run the flagship end-to-end face-swap pipeline (detect โ 68 landmarks โ recognize โ
+swap โ restore) on your own images, on an NVIDIA GPU. Linux only, **TensorRT 10.x +
+CUDA 12.x**.
+
+## 1. Build
+
+```bash
+git clone --depth=1 https://github.com/xlite-dev/lite.ai.toolkit.git
+cd lite.ai.toolkit
+bash ./build.sh tensorrt
+```
+
+Binaries land in `build/install/bin/` (the CLI runner is `lite_facefusion_cli`).
+
+## 2. Get the 5 ONNX models
+
+The pipeline uses these 5 models (the standard FaceFusion / InsightFace assets):
+
+| Stage | ONNX file |
+|--|--|
+| face detect | `yoloface_8n.onnx` |
+| 68 landmarks | `2dfan4.onnx` |
+| face recognize | `arcface_w600k_r50.onnx` |
+| face swap | `inswapper_128.onnx` |
+| face restore | `gfpgan_1.4.onnx` |
+
+Put all 5 in one directory, e.g. `~/ff_onnx/`.
+
+## 3. Build the TensorRT engines
+
+```bash
+bash ./build_facefusion_engines.sh ~/ff_onnx ~/ff_engines
+```
+
+This runs `trtexec` for four of the models (FP16) and writes the `.engine` files into
+`~/ff_engines/`. GFPGAN is built as a **mixed-precision** engine via
+`build_gfpgan_fp16_engine.py`: a naive `--fp16` GFPGAN blows up its StyleGAN modulated
+convs (a grey halo around the pasted-back face), so the style_conv/to_rgb layers are kept
+FP32 and the rest run FP16. That is numerically identical to the FP32 engine (PSNR ~58 dB)
+while cutting the restoration stage ~3 ms (โ28.6 โ 31 FPS on an RTX 4090).
+
+The mixed build needs the **TensorRT 10.x python wheel** on `python3` (ships in the TRT
+tarball under `python/`, e.g. `pip install /usr/local/tensorrt/python/tensorrt-10.*-cp3*-*.whl`).
+If you can't set that up, run `GFPGAN_FP32=1 bash ./build_facefusion_engines.sh ...` to fall
+back to a plain FP32 GFPGAN engine. Engines are GPU/TensorRT-version specific โ rebuild them
+if you change GPU or TensorRT version.
+
+## 4. Run
+
+```bash
+./build/install/bin/lite_facefusion_cli \
+ ~/ff_engines \
+ source.jpg \
+ target.jpg \
+ output.jpg
+
+# optionally pick which detected face to use on each side (default 0 0):
+# ... output.jpg
+```
+
+That's it โ `output.jpg` is the swapped + restored result. `source.jpg` is the face to take,
+and `target.jpg` is the image to paste it onto.
+
+## Performance
+
+The benchmark path is video-shaped: prepare the fixed source face once, then time
+per-frame `process(target)`. On an RTX 4090, FP16 deployment, the current pipeline
+runs at **23.6 ms / frame (42.3 FPS)**. The pipeline now does one full-frame H2D
+upload for the target and one full-frame D2H download for the final result; the
+swap โ restoration boundary stays GPU-resident. See the
+[Benchmark](../README.md#benchmark) section.
diff --git a/docs/hub/lite.ai.toolkit.hub.mnn.md b/docs/hub/lite.ai.toolkit.hub.mnn.md
deleted file mode 100644
index e68524bf..00000000
--- a/docs/hub/lite.ai.toolkit.hub.mnn.md
+++ /dev/null
@@ -1,333 +0,0 @@
-# Lite.AI.ToolKit.Hub.MNN
-
-You can download all the pretrained models files of MNN format from ([Baidu Drive](https://pan.baidu.com/s/1KyO-bCYUv6qPq2M8BH_Okg) code: 9v63)
-
-## Object Detection.
-
-
-
-| Class | Pretrained MNN Files | Rename or Converted From (Repo) | Size |
-|:---------------------------------------------------:|:----------------------------------:|:------------------------------------------------------------:|:-----:|
-| *lite::mnn::cv::detection::NanoDet* | nanodet_m_0.5x.mnn | [nanodet](https://github.com/RangiLyu/nanodet) | 1.1Mb |
-| *lite::mnn::cv::detection::NanoDet* | nanodet_m.mnn | [nanodet](https://github.com/RangiLyu/nanodet) | 3.6Mb |
-| *lite::mnn::cv::detection::NanoDet* | nanodet_m_1.5x.mnn | [nanodet](https://github.com/RangiLyu/nanodet) | 7.9Mb |
-| *lite::mnn::cv::detection::NanoDet* | nanodet_m_1.5x_416.mnn | [nanodet](https://github.com/RangiLyu/nanodet) | 7.9Mb |
-| *lite::mnn::cv::detection::NanoDet* | nanodet_m_416.mnn | [nanodet](https://github.com/RangiLyu/nanodet) | 3.6Mb |
-| *lite::mnn::cv::detection::NanoDet* | nanodet_g.mnn | [nanodet](https://github.com/RangiLyu/nanodet) | 14Mb |
-| *lite::mnn::cv::detection::NanoDet* | nanodet_t.mnn | [nanodet](https://github.com/RangiLyu/nanodet) | 5.1Mb |
-| *lite::mnn::cv::detection::NanoDet* | nanodet-RepVGG-A0_416.mnn | [nanodet](https://github.com/RangiLyu/nanodet) | 26Mb |
-| *lite::mnn::cv::detection::NanoDetEfficientNetLite* | nanodet-EfficientNet-Lite0_320.mnn | [nanodet](https://github.com/RangiLyu/nanodet) | 12Mb |
-| *lite::mnn::cv::detection::NanoDetEfficientNetLite* | nanodet-EfficientNet-Lite1_416.mnn | [nanodet](https://github.com/RangiLyu/nanodet) | 15Mb |
-| *lite::mnn::cv::detection::NanoDetEfficientNetLite* | nanodet-EfficientNet-Lite2_512.mnn | [nanodet](https://github.com/RangiLyu/nanodet) | 18Mb |
-| *lite::mnn::cv::detection::YoloX* | yolox_x.mnn | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 378Mb |
-| *lite::mnn::cv::detection::YoloX* | yolox_l.mnn | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 207Mb |
-| *lite::mnn::cv::detection::YoloX* | yolox_m.mnn | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 97Mb |
-| *lite::mnn::cv::detection::YoloX* | yolox_s.mnn | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 34Mb |
-| *lite::mnn::cv::detection::YoloX* | yolox_tiny.mnn | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 19Mb |
-| *lite::mnn::cv::detection::YoloX* | yolox_nano.mnn | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 3.5Mb |
-| *lite::mnn::cv::detection::YOLOP* | yolop-320-320.mnn | [YOLOP](https://github.com/hustvl/YOLOP) | 30Mb |
-| *lite::mnn::cv::detection::YOLOP* | yolop-640-640.mnn | [YOLOP](https://github.com/hustvl/YOLOP) | 30Mb |
-| *lite::mnn::cv::detection::YOLOP* | yolop-1280-1280.mnn | [YOLOP](https://github.com/hustvl/YOLOP) | 30Mb |
-| *lite::mnn::cv::detection::YoloV5* | yolov5l.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 188Mb |
-| *lite::mnn::cv::detection::YoloV5* | yolov5m.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 85Mb |
-| *lite::mnn::cv::detection::YoloV5* | yolov5s.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 29Mb |
-| *lite::mnn::cv::detection::YoloV5* | yolov5x.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 351Mb |
-| *lite::mnn::cv::detection::YoloX_V_0_1_1* | yolox_x_v0.1.1.mnn | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 378Mb |
-| *lite::mnn::cv::detection::YoloX_V_0_1_1* | yolox_l_v0.1.1.mnn | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 207Mb |
-| *lite::mnn::cv::detection::YoloX_V_0_1_1* | yolox_m_v0.1.1.mnn | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 97Mb |
-| *lite::mnn::cv::detection::YoloX_V_0_1_1* | yolox_s_v0.1.1.mnn | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 34Mb |
-| *lite::mnn::cv::detection::YoloX_V_0_1_1* | yolox_tiny_v0.1.1.mnn | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 19Mb |
-| *lite::mnn::cv::detection::YoloX_V_0_1_1* | yolox_nano_v0.1.1.mnn | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 3.5Mb |
-| *lite::mnn::cv::detection::YoloR* | yolor-p6-320-320.mnn | [yolor](https://github.com/WongKinYiu/yolor) | 157Mb |
-| *lite::mnn::cv::detection::YoloR* | yolor-p6-640-640.mnn | [yolor](https://github.com/WongKinYiu/yolor) | 157Mb |
-| *lite::mnn::cv::detection::YoloR* | yolor-ssss-s2d-640-640.mnn | [yolor](https://github.com/WongKinYiu/yolor) | 50Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_0* | yolov5l.640-640.v.6.0.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 178Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_0* | yolov5m.640-640.v.6.0.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 81Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_0* | yolov5s.640-640.v.6.0.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 28Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_0* | yolov5n.640-640.v.6.0.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 7.5Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_0* | yolov5l6.640-640.v.6.0.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 294Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_0* | yolov5m6.640-640.v.6.0.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 128Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_0* | yolov5s6.640-640.v.6.0.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 50Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_0* | yolov5n6.640-640.v.6.0.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 14Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_0* | yolov5l6.1280-1280.v.6.0.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 294Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_0* | yolov5m6.1280-1280.v.6.0.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 128Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_0* | yolov5s6.1280-1280.v.6.0.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 50Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_0* | yolov5n6.1280-1280.v.6.0.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 14Mb |
-| *lite::mnn::cv::detection::NanoDetPlus* | nanodet-plus-m_320.mnn | [nanodet](https://github.com/RangiLyu/nanodet) | 4.5Mb |
-| *lite::mnn::cv::detection::NanoDetPlus* | nanodet-plus-m_416.mnn | [nanodet](https://github.com/RangiLyu/nanodet) | 4.5Mb |
-| *lite::mnn::cv::detection::NanoDetPlus* | nanodet-plus-m-1.5x_320.mnn | [nanodet](https://github.com/RangiLyu/nanodet) | 9.4Mb |
-| *lite::mnn::cv::detection::NanoDetPlus* | nanodet-plus-m-1.5x_416.mnn | [nanodet](https://github.com/RangiLyu/nanodet) | 9.4Mb |
-| *lite::mnn::cv::detection::InsectDet* | quarrying_insect_detector.mnn | [InsectID](https://github.com/quarrying/quarrying-insect-id) | 22Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_1* | yolov5l.v6.1.640x640.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 178Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_1* | yolov5l.v6.1.1280x1280.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 178Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_1* | yolov5m.v6.1.640x640.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 81Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_1* | yolov5x.v6.1.640x640.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 332Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_1* | yolov5x.v6.1.1280x1280.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 332Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_1* | yolov5s.v6.1.640x640.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 28Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_1* | yolov5s.v6.1.320x320.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 28Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_1* | yolov5n.v6.1.640x640.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 7Mb |
-| *lite::mnn::cv::detection::YoloV5_V_6_1* | yolov5n.v6.1.320x320.mnn | [yolov5](https://github.com/ultralytics/yolov5) | 7Mb |
-| *lite::mnn::cv::detection::YOLOv6* | yolov6n-320x320.mnn | [YOLOv6](https://github.com/meituan/YOLOv6) | 17Mb |
-| *lite::mnn::cv::detection::YOLOv6* | yolov6n-640x640.mnn | [YOLOv6](https://github.com/meituan/YOLOv6) | 17Mb |
-| *lite::mnn::cv::detection::YOLOv6* | yolov6s-320x320.mnn | [YOLOv6](https://github.com/meituan/YOLOv6) | 66Mb |
-| *lite::mnn::cv::detection::YOLOv6* | yolov6n-640x640.mnn | [YOLOv6](https://github.com/meituan/YOLOv6) | 66Mb |
-| *lite::mnn::cv::detection::YOLOv6* | yolov6t-640x640.mnn | [YOLOv6](https://github.com/meituan/YOLOv6) | 57Mb |
-
-
-## Matting.
-
-
-
-| Class | Pretrained MNN Files | Rename or Converted From (Repo) | Size |
-|:---------------------------------------------:|:--------------------------------------------------:|:-------------------------------------------------------------------------------------------:|:-----:|
-| *lite::mnn::cv::matting::RobustVideoMatting* | rvm_mobilenetv3_fp32.mnn | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 14Mb |
-| *lite::mnn::cv::matting::RobustVideoMatting* | rvm_mobilenetv3_fp32-480-480.mnn | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 14Mb |
-| *lite::mnn::cv::matting::RobustVideoMatting* | rvm_mobilenetv3_fp32-480-640.mnn | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 14Mb |
-| *lite::mnn::cv::matting::RobustVideoMatting* | rvm_mobilenetv3_fp32-640-480.mnn | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 14Mb |
-| *lite::mnn::cv::matting::RobustVideoMatting* | rvm_mobilenetv3_fp32-1080-1920.mnn | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 14Mb |
-| *lite::mnn::cv::matting::RobustVideoMatting* | rvm_resnet50_fp32.mnn | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 50Mb |
-| *lite::mnn::cv::matting::RobustVideoMatting* | rvm_resnet50_fp32-480-480.mnn | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 50Mb |
-| *lite::mnn::cv::matting::RobustVideoMatting* | rvm_resnet50_fp32-480-640.mnn | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 50Mb |
-| *lite::mnn::cv::matting::RobustVideoMatting* | rvm_resnet50_fp32-640-480.mnn | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 50Mb |
-| *lite::mnn::cv::matting::RobustVideoMatting* | rvm_resnet50_fp32-1080-1920.mnn | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 50Mb |
-| *lite::mnn::cv::matting::MGMatting* | MGMatting-DIM-100k.mnn | [MGMatting](https://github.com/yucornetto/MGMatting) | 113Mb |
-| *lite::mnn::cv::matting::MGMatting* | MGMatting-RWP-100k.mnn | [MGMatting](https://github.com/yucornetto/MGMatting) | 113Mb |
-| *lite::mnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-1024x1024.mnn | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::mnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-1024x512.mnn | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::mnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-256x256.mnn | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::mnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-256x512.mnn | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::mnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-512x1024.mnn | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::mnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-512x256.mnn | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::mnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-512x512.mnn | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::mnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-1024x1024.mnn | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::mnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-1024x512.mnn | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::mnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-256x256.mnn | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::mnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-256x512.mnn | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::mnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-512x1024.mnn | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::mnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-512x256.mnn | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::mnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-512x512.mnn | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::mnn::cv::matting::BackgroundMattingV2* | BGMv2_mobilenetv2-256x256-full.mnn | [BackgroundMattingV2](https://github.com/PeterL1n/BackgroundMattingV2) | 20Mb |
-| *lite::mnn::cv::matting::BackgroundMattingV2* | BGMv2_mobilenetv2-512x512-full.mnn | [BackgroundMattingV2](https://github.com/PeterL1n/BackgroundMattingV2) | 20Mb |
-| *lite::mnn::cv::matting::BackgroundMattingV2* | BGMv2_mobilenetv2-1080x1920-full.mnn | [BackgroundMattingV2](https://github.com/PeterL1n/BackgroundMattingV2) | 20Mb |
-| *lite::mnn::cv::matting::BackgroundMattingV2* | BGMv2_mobilenetv2-2160x3840-full.mnn | [BackgroundMattingV2](https://github.com/PeterL1n/BackgroundMattingV2) | 20Mb |
-| *lite::mnn::cv::matting::BackgroundMattingV2* | BGMv2_resnet50-1080x1920-full.mnn | [BackgroundMattingV2](https://github.com/PeterL1n/BackgroundMattingV2) | 20Mb |
-| *lite::mnn::cv::matting::BackgroundMattingV2* | BGMv2_resnet50-2160x3840-full.mnn | [BackgroundMattingV2](https://github.com/PeterL1n/BackgroundMattingV2) | 20Mb |
-| *lite::mnn::cv::matting::BackgroundMattingV2* | BGMv2_resnet101-2160x3840-full.mnn | [BackgroundMattingV2](https://github.com/PeterL1n/BackgroundMattingV2) | 154Mb |
-| *lite::mnn::cv::matting::MobileHumanMatting* | mobile_human_matting_256x256.mnn | [mobile_phone_human_matting_](https://github.com/lizhengwei1992/mobile_phone_human_matting) | 3Mb |
-| *lite::mnn::cv::matting::MobileHumanMatting* | mobile_human_matting_128x128.mnn | [mobile_phone_human_matting_](https://github.com/lizhengwei1992/mobile_phone_human_matting) | 3Mb |
-| *lite::mnn::cv::matting::MobileHumanMatting* | mobile_human_matting_320x320.mnn | [mobile_phone_human_matting_](https://github.com/lizhengwei1992/mobile_phone_human_matting) | 3Mb |
-| *lite::mnn::cv::matting::MobileHumanMatting* | mobile_human_matting_512x512.mnn | [mobile_phone_human_matting_](https://github.com/lizhengwei1992/mobile_phone_human_matting) | 3Mb |
-
-## Face Recognition.
-
-
-
-
-| Class | Pretrained MNN Files | Rename or Converted From (Repo) | Size |
-|:----------------------------------------------:|:------------------------------------------------------:|:----------------------------------------------------------------------:|:-----:|
-| *lite::mnn::cv::faceid::GlintArcFace* | ms1mv3_arcface_r100.mnn | [insightface](https://github.com/deepinsight/insightface) | 248Mb |
-| *lite::mnn::cv::faceid::GlintArcFace* | ms1mv3_arcface_r50.mnn | [insightface](https://github.com/deepinsight/insightface) | 166Mb |
-| *lite::mnn::cv::faceid::GlintArcFace* | ms1mv3_arcface_r34.mnn | [insightface](https://github.com/deepinsight/insightface) | 130Mb |
-| *lite::mnn::cv::faceid::GlintArcFace* | ms1mv3_arcface_r18.mnn | [insightface](https://github.com/deepinsight/insightface) | 91Mb |
-| *lite::mnn::cv::faceid::GlintCosFace* | glint360k_cosface_r100.mnn | [insightface](https://github.com/deepinsight/insightface) | 248Mb |
-| *lite::mnn::cv::faceid::GlintCosFace* | glint360k_cosface_r50.mnn | [insightface](https://github.com/deepinsight/insightface) | 166Mb |
-| *lite::mnn::cv::faceid::GlintCosFace* | glint360k_cosface_r34.mnn | [insightface](https://github.com/deepinsight/insightface) | 130Mb |
-| *lite::mnn::cv::faceid::GlintCosFace* | glint360k_cosface_r18.mnn | [insightface](https://github.com/deepinsight/insightface) | 91Mb |
-| *lite::mnn::cv::faceid::GlintPartialFC* | partial_fc_glint360k_r100.mnn | [insightface](https://github.com/deepinsight/insightface) | 248Mb |
-| *lite::mnn::cv::faceid::GlintPartialFC* | partial_fc_glint360k_r50.mnn | [insightface](https://github.com/deepinsight/insightface) | 91Mb |
-| *lite::mnn::cv::faceid::FaceNet* | facenet_vggface2_resnet.mnn | [facenet...](https://github.com/timesler/facenet-pytorch) | 89Mb |
-| *lite::mnn::cv::faceid::FaceNet* | facenet_casia-webface_resnet.mnn | [facenet...](https://github.com/timesler/facenet-pytorch) | 89Mb |
-| *lite::mnn::cv::faceid::FocalArcFace* | focal-arcface-ms1m-ir152.mnn | [face.evoLVe...](https://github.com/ZhaoJ9014/face.evoLVe.PyTorch) | 269Mb |
-| *lite::mnn::cv::faceid::FocalArcFace* | focal-arcface-ms1m-ir50-epoch120.mnn | [face.evoLVe...](https://github.com/ZhaoJ9014/face.evoLVe.PyTorch) | 166Mb |
-| *lite::mnn::cv::faceid::FocalArcFace* | focal-arcface-ms1m-ir50-epoch63.mnn | [face.evoLVe...](https://github.com/ZhaoJ9014/face.evoLVe.PyTorch) | 166Mb |
-| *lite::mnn::cv::faceid::FocalAsiaArcFace* | focal-arcface-bh-ir50-asia.mnn | [face.evoLVe...](https://github.com/ZhaoJ9014/face.evoLVe.PyTorch) | 166Mb |
-| *lite::mnn::cv::faceid::TencentCurricularFace* | Tencent_CurricularFace_Backbone.mnn | [TFace](https://github.com/Tencent/TFace) | 249Mb |
-| *lite::mnn::cv::faceid::TencentCifpFace* | Tencent_Cifp_BUPT_Balancedface_IR_34.mnn | [TFace](https://github.com/Tencent/TFace) | 130Mb |
-| *lite::mnn::cv::faceid::CenterLossFace* | CenterLossFace_epoch_100.mnn | [center-loss...](https://github.com/louis-she/center-loss.pytorch) | 280Mb |
-| *lite::mnn::cv::faceid::SphereFace* | sphere20a_20171020.mnn | [sphere...](https://github.com/clcarwin/sphereface_pytorch) | 86Mb |
-| *lite::mnn::cv::faceid:MobileFaceNet* | MobileFaceNet_Pytorch_068.mnn | [MobileFace...](https://github.com/Xiaoccer/MobileFaceNet_Pytorch) | 3.8Mb |
-| *lite::mnn::cv::faceid:CavaGhostArcFace* | cavaface_GhostNet_x1.3_Arcface_Epoch_24.mnn | [cavaface...](https://github.com/cavalleria/cavaface.pytorch) | 15Mb |
-| *lite::mnn::cv::faceid:CavaCombinedFace* | cavaface_IR_SE_100_Combined_Epoch_24.mnn | [cavaface...](https://github.com/cavalleria/cavaface.pytorch) | 250Mb |
-| *lite::mnn::cv::faceid:MobileSEFocalFace* | face_recognition.pytorch_Mobilenet_se_focal_121000.mnn | [face_recog...](https://github.com/grib0ed0v/face_recognition.pytorch) | 4.5Mb |
-
-## Face Detection.
-
-
-
-| Class | Pretrained MNN Files | Rename or Converted From (Repo) | Size |
-|:----------------------------------------------:|:------------------------------------------:|:---------------------------------------------------------------------------------------:|:------:|
-| *lite::mnn::cv::face::detect::UltraFace* | ultraface-rfb-320.mnn | [Ultra-Light...](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB) | 1.5Mb |
-| *lite::mnn::cv::face::detect::UltraFace* | ultraface-rfb-640.mnn | [Ultra-Light...](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB) | 1.5Mb |
-| *lite::mnn::cv::face::detect::UltraFace* | ultraface-slim-320.mnn | [Ultra-Light...](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB) | 1.2Mb |
-| *lite::mnn::cv::face::detect::UltraFace* | ultraface-slim-640.mnn | [Ultra-Light...](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB) | 1.2Mb |
-| *lite::mnn::cv::face::detect::RetinaFace* | Pytorch_RetinaFace_mobile0.25.mnn | [...Retinaface](https://github.com/biubug6/Pytorch_Retinaface) | 1.6Mb |
-| *lite::mnn::cv::face::detect::RetinaFace* | Pytorch_RetinaFace_mobile0.25-640-640.mnn | [...Retinaface](https://github.com/biubug6/Pytorch_Retinaface) | 1.6Mb |
-| *lite::mnn::cv::face::detect::RetinaFace* | Pytorch_RetinaFace_mobile0.25-320-320.mnn | [...Retinaface](https://github.com/biubug6/Pytorch_Retinaface) | 1.6Mb |
-| *lite::mnn::cv::face::detect::RetinaFace* | Pytorch_RetinaFace_mobile0.25-720-1080.mnn | [...Retinaface](https://github.com/biubug6/Pytorch_Retinaface) | 1.6Mb |
-| *lite::mnn::cv::face::detect::FaceBoxes* | FaceBoxes.mnn | [FaceBoxes](https://github.com/zisianw/FaceBoxes.PyTorch) | 3.8Mb |
-| *lite::mnn::cv::face::detect::FaceBoxes* | FaceBoxes-640-640.mnn | [FaceBoxes](https://github.com/zisianw/FaceBoxes.PyTorch) | 3.8Mb |
-| *lite::mnn::cv::face::detect::FaceBoxes* | FaceBoxes-320-320.mnn | [FaceBoxes](https://github.com/zisianw/FaceBoxes.PyTorch) | 3.8Mb |
-| *lite::mnn::cv::face::detect::FaceBoxes* | FaceBoxes-720-1080.mnn | [FaceBoxes](https://github.com/zisianw/FaceBoxes.PyTorch) | 3.8Mb |
-| *lite::mnn::cv::face::detect::SCRFD* | scrfd_500m_shape160x160.mnn | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.5Mb |
-| *lite::mnn::cv::face::detect::SCRFD* | scrfd_500m_shape320x320.mnn | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.5Mb |
-| *lite::mnn::cv::face::detect::SCRFD* | scrfd_500m_shape640x640.mnn | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.5Mb |
-| *lite::mnn::cv::face::detect::SCRFD* | scrfd_500m_bnkps_shape160x160.mnn | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.5Mb |
-| *lite::mnn::cv::face::detect::SCRFD* | scrfd_500m_bnkps_shape320x320.mnn | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.5Mb |
-| *lite::mnn::cv::face::detect::SCRFD* | scrfd_500m_bnkps_shape640x640.mnn | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.5Mb |
-| *lite::mnn::cv::face::detect::SCRFD* | scrfd_1g_shape160x160.mnn | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.7Mb |
-| *lite::mnn::cv::face::detect::SCRFD* | scrfd_1g_shape320x320.mnn | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.7Mb |
-| *lite::mnn::cv::face::detect::SCRFD* | scrfd_1g_shape640x640.mnn | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.7Mb |
-| *lite::mnn::cv::face::detect::SCRFD* | scrfd_2.5g_shape160x160.mnn | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 3.3Mb |
-| *lite::mnn::cv::face::detect::SCRFD* | scrfd_2.5g_shape320x320.mnn | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 3.3Mb |
-| *lite::mnn::cv::face::detect::SCRFD* | scrfd_2.5g_shape640x640.mnn | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 3.3Mb |
-| *lite::mnn::cv::face::detect::SCRFD* | scrfd_2.5g_bnkps_shape160x160.mnn | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 3.3Mb |
-| *lite::mnn::cv::face::detect::SCRFD* | scrfd_2.5g_bnkps_shape320x320.mnn | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 3.3Mb |
-| *lite::mnn::cv::face::detect::SCRFD* | scrfd_2.5g_bnkps_shape640x640.mnn | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 3.3Mb |
-| *lite::mnn::cv::face::detect::SCRFD* | scrfd_10g_shape640x640.mnn | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 16.9Mb |
-| *lite::mnn::cv::face::detect::SCRFD* | scrfd_10g_shape1280x1280.mnn | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 16.9Mb |
-| *lite::mnn::cv::face::detect::SCRFD* | scrfd_10g_bnkps_shape640x640.mnn | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 16.9Mb |
-| *lite::mnn::cv::face::detect::SCRFD* | scrfd_10g_bnkps_shape1280x1280.mnn | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 16.9Mb |
-| *lite::mnn::cv::face::detect::YOLO5Face* | yolov5face-blazeface-640x640.mnn | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 3.4Mb |
-| *lite::mnn::cv::face::detect::YOLO5Face* | yolov5face-l-640x640.mnn | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 181Mb |
-| *lite::mnn::cv::face::detect::YOLO5Face* | yolov5face-m-640x640.mnn | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 83Mb |
-| *lite::mnn::cv::face::detect::YOLO5Face* | yolov5face-n-0.5-320x320.mnn | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 2.5Mb |
-| *lite::mnn::cv::face::detect::YOLO5Face* | yolov5face-n-0.5-640x640.mnn | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 4.6Mb |
-| *lite::mnn::cv::face::detect::YOLO5Face* | yolov5face-n-640x640.mnn | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 9.5Mb |
-| *lite::mnn::cv::face::detect::YOLO5Face* | yolov5face-s-640x640.mnn | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 30Mb |
-| *lite::mnn::cv::face::detect::FaceBoxesV2* | faceboxesv2-640x640.mnn | [FaceBoxesV2](https://github.com/jhb86253817/FaceBoxesV2) | 4.0Mb |
-| *lite::mnn::cv::face::detect::YOLOv5BlazeFace* | yolov5face-blazeface-640x640.mnn | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 3.4Mb |
-
-
-## Face Alignment.
-
-
-
-
-| Class | Pretrained MNN Files | Rename or Converted From (Repo) | Size |
-|:-----------------------------------------------:|:------------------------------------------------------------:|:------------------------------------------------------------------:|:-------:|
-| *lite::mnn::cv::face::align::PFLD* | pfld-106-lite.mnn | [pfld_106_...](https://github.com/Hsintao/pfld_106_face_landmarks) | 1.0Mb |
-| *lite::mnn::cv::face::align::PFLD* | pfld-106-v3.mnn | [pfld_106_...](https://github.com/Hsintao/pfld_106_face_landmarks) | 5.5Mb |
-| *lite::mnn::cv::face::align::PFLD* | pfld-106-v2.mnn | [pfld_106_...](https://github.com/Hsintao/pfld_106_face_landmarks) | 5.0Mb |
-| *lite::mnn::cv::face::align::PFLD98* | PFLD-pytorch-pfld.mnn | [PFLD...](https://github.com/polarisZhao/PFLD-pytorch) | 4.8Mb |
-| *lite::mnn::cv::face::align::MobileNetV268* | pytorch_face_landmarks_landmark_detection_56.mnn | [...landmark](https://github.com/cunjian/pytorch_face_landmark) | 9.4Mb |
-| *lite::mnn::cv::face::align::MobileNetV2SE68* | pytorch_face_landmarks_landmark_detection_56_se_external.mnn | [...landmark](https://github.com/cunjian/pytorch_face_landmark) | 11Mb |
-| *lite::mnn::cv::face::align::PFLD68* | pytorch_face_landmarks_pfld.mnn | [...landmark](https://github.com/cunjian/pytorch_face_landmark) | 2.8Mb |
-| *lite::mnn::cv::face::align::FaceLandmarks1000* | FaceLandmark1000.mnn | [FaceLandm...](https://github.com/Single430/FaceLandmark1000) | 2.0Mb |
-| *lite::mnn::cv::face::align::PIPNet98* | pipnet_resnet18_10x98x32x256_wflw.mnn | [PIPNet](https://github.com/jhb86253817/PIPNet) | 44.0Mb |
-| *lite::mnn::cv::face::align::PIPNet68* | pipnet_resnet18_10x68x32x256_300w.mnn | [PIPNet](https://github.com/jhb86253817/PIPNet) | 44.0Mb |
-| *lite::mnn::cv::face::align::PIPNet29* | pipnet_resnet18_10x29x32x256_cofw.mnn | [PIPNet](https://github.com/jhb86253817/PIPNet) | 44.0Mb |
-| *lite::mnn::cv::face::align::PIPNet19* | pipnet_resnet18_10x19x32x256_aflw.mnn | [PIPNet](https://github.com/jhb86253817/PIPNet) | 44.0Mb |
-| *lite::mnn::cv::face::align::PIPNet98* | pipnet_resnet101_10x98x32x256_wflw.mnn | [PIPNet](https://github.com/jhb86253817/PIPNet) | 150.0Mb |
-| *lite::mnn::cv::face::align::PIPNet68* | pipnet_resnet101_10x68x32x256_300w.mnn | [PIPNet](https://github.com/jhb86253817/PIPNet) | 150.0Mb |
-| *lite::mnn::cv::face::align::PIPNet29* | pipnet_resnet101_10x29x32x256_cofw.mnn | [PIPNet](https://github.com/jhb86253817/PIPNet) | 150.0Mb |
-| *lite::mnn::cv::face::align::PIPNet19* | pipnet_resnet101_10x19x32x256_aflw.mnn | [PIPNet](https://github.com/jhb86253817/PIPNet) | 150.0Mb |
-
-
-## Head Pose Estimation.
-
-
-
-
-| Class | Pretrained MNN Files | Rename or Converted From (Repo) | Size |
-|:-----------------------------------:|:--------------------:|:------------------------------------------------------------------:|:-----:|
-| *lite::mnn::cv::face::pose::FSANet* | fsanet-var.mnn | [...fsanet...](https://github.com/omasaht/headpose-fsanet-pytorch) | 1.2Mb |
-| *lite::mnn::cv::face::pose::FSANet* | fsanet-1x1.mnn | [...fsanet...](https://github.com/omasaht/headpose-fsanet-pytorch) | 1.2Mb |
-
-## Face Attributes.
-
-
-
-
-| Class | Pretrained MNN Files | Rename or Converted From (Repo) | Size |
-|:----------------------------------------------:|:-----------------------------------------------------------:|:-------------------------------------------------------------------------:|:-----:|
-| *lite::mnn::cv::face::attr::AgeGoogleNet* | age_googlenet.mnn | [onnx-models](https://github.com/onnx/models) | 23Mb |
-| *lite::mnn::cv::face::attr::GenderGoogleNet* | gender_googlenet.mnn | [onnx-models](https://github.com/onnx/models) | 23Mb |
-| *lite::mnn::cv::face::attr::EmotionFerPlus* | emotion-ferplus-7.mnn | [onnx-models](https://github.com/onnx/models) | 33Mb |
-| *lite::mnn::cv::face::attr::EmotionFerPlus* | emotion-ferplus-8.mnn | [onnx-models](https://github.com/onnx/models) | 33Mb |
-| *lite::mnn::cv::face::attr::SSRNet* | ssrnet.mnn | [SSR_Net...](https://github.com/oukohou/SSR_Net_Pytorch) | 190Kb |
-| *lite::mnn::cv::face::attr::EfficientEmotion7* | face-emotion-recognition-enet_b0_7.mnn | [face-emo...](https://github.com/HSE-asavchenko/face-emotion-recognition) | 15Mb |
-| *lite::mnn::cv::face::attr::EfficientEmotion8* | face-emotion-recognition-enet_b0_8_best_afew.mnn | [face-emo...](https://github.com/HSE-asavchenko/face-emotion-recognition) | 15Mb |
-| *lite::mnn::cv::face::attr::EfficientEmotion8* | face-emotion-recognition-enet_b0_8_best_vgaf.mnn | [face-emo...](https://github.com/HSE-asavchenko/face-emotion-recognition) | 15Mb |
-| *lite::mnn::cv::face::attr::MobileEmotion7* | face-emotion-recognition-mobilenet_7.mnn | [face-emo...](https://github.com/HSE-asavchenko/face-emotion-recognition) | 13Mb |
-| *lite::mnn::cv::face::attr::ReXNetEmotion7* | face-emotion-recognition-affectnet_7_vggface2_rexnet150.mnn | [face-emo...](https://github.com/HSE-asavchenko/face-emotion-recognition) | 30Mb |
-
-## Classification.
-
-
-
-
-| Class | Pretrained MNN Files | Rename or Converted From (Repo) | Size |
-|:-------------------------------------------------:|:-------------------------------:|:------------------------------------------------------------:|:-----:|
-| *lite::mnn::cv::classification:EfficientNetLite4* | efficientnet-lite4-11.mnn | [onnx-models](https://github.com/onnx/models) | 49Mb |
-| *lite::mnn::cv::classification::ShuffleNetV2* | shufflenet-v2-10.mnn | [onnx-models](https://github.com/onnx/models) | 8.7Mb |
-| *lite::mnn::cv::classification::DenseNet121* | densenet121.mnn | [torchvision](https://github.com/pytorch/vision) | 30Mb |
-| *lite::mnn::cv::classification::GhostNet* | ghostnet.mnn | [torchvision](https://github.com/pytorch/vision) | 20Mb |
-| *lite::mnn::cv::classification::HdrDNet* | hardnet.mnn | [torchvision](https://github.com/pytorch/vision) | 13Mb |
-| *lite::mnn::cv::classification::IBNNet* | ibnnet18.mnn | [torchvision](https://github.com/pytorch/vision) | 97Mb |
-| *lite::mnn::cv::classification::MobileNetV2* | mobilenetv2.mnn | [torchvision](https://github.com/pytorch/vision) | 13Mb |
-| *lite::mnn::cv::classification::ResNet* | resnet18.mnn | [torchvision](https://github.com/pytorch/vision) | 44Mb |
-| *lite::mnn::cv::classification::ResNeXt* | resnext.mnn | [torchvision](https://github.com/pytorch/vision) | 95Mb |
-| *lite::mnn::cv::classification::InsectID* | quarrying_insect_identifier.mnn | [InsectID](https://github.com/quarrying/quarrying-insect-id) | 27Mb |
-| *lite::mnn::cv::classification:PlantID* | quarrying_planted_model.mnn | [PlantID](https://github.com/quarrying/quarrying-plant-id) | 30Mb |
-
-
-## Segmentation.
-
-
-
-
-| Class | Pretrained MNN Files | Rename or Converted From (Repo) | Size |
-|:------------------------------------------------------:|:------------------------------------------:|:---------------------------------------------------------------------------------:|:-----:|
-| *lite::mnn::cv::segmentation::DeepLabV3ResNet101* | deeplabv3_resnet101_coco.mnn | [torchvision](https://github.com/pytorch/vision) | 232Mb |
-| *lite::mnn::cv::segmentation::FCNResNet101* | fcn_resnet101.mnn | [torchvision](https://github.com/pytorch/vision) | 207Mb |
-| *lite::mnn::cv::segmentation::HeadSeg* | minivision_head_seg.mnn | [photo2cartoon](https://github.com/minivision-ai/photo2cartoon) | 31Mb |
-| *lite::mnn::cv::segmentation::FastPortraitSeg* | fast_portrait_seg_SINet_bi_192_128.mnn | [Fast-Portrait...](https://github.com/YexingWan/Fast-Portrait-Segmentation) | 400k |
-| *lite::mnn::cv::segmentation::FastPortraitSeg* | fast_portrait_seg_SINet_bi_256_160.mnn | [Fast-Portrait...](https://github.com/YexingWan/Fast-Portrait-Segmentation) | 400k |
-| *lite::mnn::cv::segmentation::FastPortraitSeg* | fast_portrait_seg_SINet_bi_320_256.mnn | [Fast-Portrait...](https://github.com/YexingWan/Fast-Portrait-Segmentation) | 400k |
-| *lite::mnn::cv::segmentation::PortraitSegSINet* | ext_portrait_seg_SINet_224x224.mnn | [ext_portrait...](https://github.com/clovaai/ext_portrait_segmentation) | 380k |
-| *lite::mnn::cv::segmentation::PortraitSegExtremeC3Net* | ext_portrait_seg_ExtremeC3_224x224.mnn | [ext_portrait...](https://github.com/clovaai/ext_portrait_segmentation) | 180k |
-| *lite::mnn::cv::segmentation::FaceHairSeg* | face_hair_seg_224x224.mnn | [face-seg](https://github.com/kampta/face-seg) | 18M |
-| *lite::mnn::cv::segmentation::HairSeg* | hairseg_224x224.mnn | [mobile-semantic-seg](https://github.com/akirasosa/mobile-semantic-segmentation) | 18M |
-| *lite::mnn::cv::segmentation::MobileHairSeg* | mobile_hair_seg_hairmattenetv1_224x224.mnn | [mobile-hair...](https://github.com/wonbeomjang/mobile-hair-segmentation-pytorch) | 14M |
-| *lite::mnn::cv::segmentation::MobileHairSeg* | mobile_hair_seg_hairmattenetv2_224x224.mnn | [mobile-hair...](https://github.com/wonbeomjang/mobile-hair-segmentation-pytorch) | 14M |
-| *lite::mnn::cv::segmentation::FaceParsingBiSeNet* | face_parsing_512x512.mnn | [face-parsing.PyTorch](https://github.com/zllrunning/face-parsing.PyTorch) | 50M |
-| *lite::mnn::cv::segmentation::FaceParsingBiSeNet* | face_parsing_1024x1024.mnn | [face-parsing.PyTorch](https://github.com/zllrunning/face-parsing.PyTorch) | 50M |
-
-
-## Style Transfer.
-
-
-
-| Class | Pretrained MNN Files | Rename or Converted From (Repo) | Size |
-|:-------------------------------------------:|:-----------------------------------:|:---------------------------------------------------------------:|:-----:|
-| *lite::mnn::cv::style::FastStyleTransfer* | style-mosaic-8.mnn | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::mnn::cv::style::FastStyleTransfer* | style-candy-9.mnn | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::mnn::cv::style::FastStyleTransfer* | style-udnie-8.mnn | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::mnn::cv::style::FastStyleTransfer* | style-udnie-9.mnn | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::mnn::cv::style::FastStyleTransfer* | style-pointilism-8.mnn | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::mnn::cv::style::FastStyleTransfer* | style-pointilism-9.mnn | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::mnn::cv::style::FastStyleTransfer* | style-rain-princess-9.mnn | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::mnn::cv::style::FastStyleTransfer* | style-rain-princess-8.mnn | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::mnn::cv::style::FastStyleTransfer* | style-candy-8.mnn | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::mnn::cv::style::FastStyleTransfer* | style-mosaic-9.mnn | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::mnn::cv::style::FemalePhoto2Cartoon* | minivision_female_photo2cartoon.mnn | [photo2cartoon](https://github.com/minivision-ai/photo2cartoon) | 15Mb |
-
-
-## Colorization.
-
-
-
-| Class | Pretrained MNN Files | Rename or Converted From (Repo) | Size |
-|:----------------------------------------:|:------------------------:|:---------------------------------------------------------:|:-----:|
-| *lite::mnn::cv::colorization::Colorizer* | eccv16-colorizer.mnn | [colorization](https://github.com/richzhang/colorization) | 123Mb |
-| *lite::mnn::cv::colorization::Colorizer* | siggraph17-colorizer.mnn | [colorization](https://github.com/richzhang/colorization) | 129Mb |
-
-
-## Super Resolution.
-
-
-
-| Class | Pretrained MNN Files | Rename or Converted From (Repo) | Size |
-|:----------------------------------------:|:--------------------:|:---------------------------------------------------------:|:-----:|
-| *lite::mnn::cv::resolution::SubPixelCNN* | subpixel-cnn.mnn | [...PIXEL...](https://github.com/niazwazir/SUB_PIXEL_CNN) | 234Kb |
-
diff --git a/docs/hub/lite.ai.toolkit.hub.ncnn.md b/docs/hub/lite.ai.toolkit.hub.ncnn.md
deleted file mode 100644
index 9f553daa..00000000
--- a/docs/hub/lite.ai.toolkit.hub.ncnn.md
+++ /dev/null
@@ -1,271 +0,0 @@
-# Lite.AI.ToolKit.Hub.NCNN
-
-You can download all the pretrained models files of NCNN format from ([Baidu Drive](https://pan.baidu.com/s/1hlnqyNsFbMseGFWscgVhgQ) code: sc7f)
-
-## Object Detection.
-
-
-
-| Class | Pretrained NCNN Files | Rename or Converted From (Repo) | Size |
-|:---------------------------------------------------------------:|:--------------------------------------------------------:|:------------------------------------------------------:|:-----:|
-| *lite::ncnn::cv::detection::YoloV5* | yolov5l.opt.param&bin | [yolov5](https://github.com/ultralytics/yolov5) | 188Mb |
-| *lite::ncnn::cv::detection::YoloV5* | yolov5m.opt.param&bin | [yolov5](https://github.com/ultralytics/yolov5) | 85Mb |
-| *lite::ncnn::cv::detection::YoloV5* | yolov5s.opt.param&bin | [yolov5](https://github.com/ultralytics/yolov5) | 29Mb |
-| *lite::ncnn::cv::detection::YoloV5* | yolov5x.opt.param&bin | [yolov5](https://github.com/ultralytics/yolov5) | 351Mb |
-| *lite::ncnn::cv::detection::YoloX* | yolox_x.opt.param&bin | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 378Mb |
-| *lite::ncnn::cv::detection::YoloX* | yolox_l.opt.param&bin | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 207Mb |
-| *lite::ncnn::cv::detection::YoloX* | yolox_m.opt.param&bin | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 97Mb |
-| *lite::ncnn::cv::detection::YoloX* | yolox_s.opt.param&bin | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 34Mb |
-| *lite::ncnn::cv::detection::YoloX* | yolox_tiny.opt.param&bin | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 19Mb |
-| *lite::ncnn::cv::detection::YoloX* | yolox_nano.opt.param&bin | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 3.5Mb |
-| *lite::ncnn::cv::detection::YOLOP* | yolop-640-640.opt.param&bin | [YOLOP](https://github.com/hustvl/YOLOP) | 30Mb |
-| *lite::ncnn::cv::detection::NanoDet* | nanodet_m_0.5x-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 1.1Mb |
-| *lite::ncnn::cv::detection::NanoDet* | nanodet_m-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 3.6Mb |
-| *lite::ncnn::cv::detection::NanoDet* | nanodet_m_1.5x-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 7.9Mb |
-| *lite::ncnn::cv::detection::NanoDet* | nanodet_m_1.5x_416-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 7.9Mb |
-| *lite::ncnn::cv::detection::NanoDet* | nanodet_m_416-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 3.6Mb |
-| *lite::ncnn::cv::detection::NanoDet* | nanodet_g-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 14Mb |
-| *lite::ncnn::cv::detection::NanoDet* | nanodet_t-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 5.1Mb |
-| *lite::ncnn::cv::detection::NanoDet* | nanodet-RepVGG-A0_416-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 26Mb |
-| *lite::ncnn::cv::detection::NanoDetEfficientNetLite* | nanodet-EfficientNet-Lite0_320-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 12Mb |
-| *lite::ncnn::cv::detection::NanoDetEfficientNetLite* | nanodet-EfficientNet-Lite1_416-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 15Mb |
-| *lite::ncnn::cv::detection::NanoDetEfficientNetLite* | nanodet-EfficientNet-Lite2_512-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 18Mb |
-| *lite::ncnn::cv::detection::NanoDetDepreciated* | nanodet_m_0.5x-depreciated-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 1.1Mb |
-| *lite::ncnn::cv::detection::NanoDetDepreciated* | nanodet_m-depreciated-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 3.6Mb |
-| *lite::ncnn::cv::detection::NanoDetDepreciated* | nanodet_m_1.5x-depreciated-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 7.9Mb |
-| *lite::ncnn::cv::detection::NanoDetDepreciated* | nanodet_m_1.5x_416-depreciated-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 7.9Mb |
-| *lite::ncnn::cv::detection::NanoDetDepreciated* | nanodet_m_416-depreciated-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 3.6Mb |
-| *lite::ncnn::cv::detection::NanoDetDepreciated* | nanodet_g-depreciated-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 14Mb |
-| *lite::ncnn::cv::detection::NanoDetDepreciated* | nanodet_t-depreciated-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 5.1Mb |
-| *lite::ncnn::cv::detection::NanoDetDepreciated* | nanodet-RepVGG-A0_416-depreciated-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 26Mb |
-| *lite::ncnn::cv::detection::NanoDetEfficientNetLiteDepreciated* | nanodet-EfficientNet-Lite0_320-depreciated-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 12Mb |
-| *lite::ncnn::cv::detection::NanoDetEfficientNetLiteDepreciated* | nanodet-EfficientNet-Lite1_416-depreciated-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 15Mb |
-| *lite::ncnn::cv::detection::NanoDetEfficientNetLiteDepreciated* | nanodet-EfficientNet-Lite2_512-depreciated-opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 18Mb |
-| *lite::ncnn::cv::detection::YoloX_V_0_1_1* | yolox_x_v0.1.1.opt.param&bin | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 378Mb |
-| *lite::ncnn::cv::detection::YoloX_V_0_1_1* | yolox_l_v0.1.1.opt.param&bin | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 207Mb |
-| *lite::ncnn::cv::detection::YoloX_V_0_1_1* | yolox_m_v0.1.1.opt.param&bin | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 97Mb |
-| *lite::ncnn::cv::detection::YoloX_V_0_1_1* | yolox_s_v0.1.1.opt.param&bin | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 34Mb |
-| *lite::ncnn::cv::detection::YoloX_V_0_1_1* | yolox_tiny_v0.1.1.opt.param&bin | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 19Mb |
-| *lite::ncnn::cv::detection::YoloX_V_0_1_1* | yolox_nano_v0.1.1.opt.param&bin | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 3.5Mb |
-| *lite::ncnn::cv::detection::YoloR* | yolor-p6-320-320.opt.param&bin | [yolor](https://github.com/WongKinYiu/yolor) | 157Mb |
-| *lite::ncnn::cv::detection::YoloR* | yolor-p6-640-640.opt.param&bin | [yolor](https://github.com/WongKinYiu/yolor) | 157Mb |
-| *lite::ncnn::cv::detection::YoloR* | yolor-ssss-s2d-640-640.opt.param&bin | [yolor](https://github.com/WongKinYiu/yolor) | 50Mb |
-| *lite::ncnn::cv::detection::YoloV5_V_6_0* | yolov5m.640-640.v.6.0.opt.param&bin | [yolov5](https://github.com/ultralytics/yolov5) | 81Mb |
-| *lite::ncnn::cv::detection::YoloV5_V_6_0* | yolov5s.640-640.v.6.0.opt.param&bin | [yolov5](https://github.com/ultralytics/yolov5) | 28Mb |
-| *lite::ncnn::cv::detection::YoloV5_V_6_0* | yolov5n.640-640.v.6.0.opt.param&bin | [yolov5](https://github.com/ultralytics/yolov5) | 7.5Mb |
-| *lite::ncnn::cv::detection::YoloV5_V_6_0_P6* | yolov5m6.640-640.v.6.0.opt.param&bin | [yolov5](https://github.com/ultralytics/yolov5) | 128Mb |
-| *lite::ncnn::cv::detection::YoloV5_V_6_0_P6* | yolov5s6.640-640.v.6.0.opt.param&bin | [yolov5](https://github.com/ultralytics/yolov5) | 50Mb |
-| *lite::ncnn::cv::detection::YoloV5_V_6_0_P6* | yolov5n6.640-640.v.6.0.opt.param&bin | [yolov5](https://github.com/ultralytics/yolov5) | 14Mb |
-| *lite::ncnn::cv::detection::YoloV5_V_6_0_P6* | yolov5m6.1280-1280.v.6.0.opt.param&bin | [yolov5](https://github.com/ultralytics/yolov5) | 128Mb |
-| *lite::ncnn::cv::detection::YoloV5_V_6_0_P6* | yolov5s6.1280-1280.v.6.0.opt.param&bin | [yolov5](https://github.com/ultralytics/yolov5) | 50Mb |
-| *lite::ncnn::cv::detection::YoloV5_V_6_0_P6* | yolov5n6.1280-1280.v.6.0.opt.param&bin | [yolov5](https://github.com/ultralytics/yolov5) | 14Mb |
-| *lite::ncnn::cv::detection::NanoDetPlus* | nanodet-plus-m_320.opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 4.5Mb |
-| *lite::ncnn::cv::detection::NanoDetPlus* | nanodet-plus-m_416.opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 4.5Mb |
-| *lite::ncnn::cv::detection::NanoDetPlus* | nanodet-plus-m-1.5x_320.opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 9.4Mb |
-| *lite::ncnn::cv::detection::NanoDetPlus* | nanodet-plus-m-1.5x_416.opt.param&bin | [nanodet](https://github.com/RangiLyu/nanodet) | 9.4Mb |
-| *lite::ncnn::cv::detection::YOLOv6* | yolov6n-320x320-for-ncnn.opt.param&bin | [YOLOv6](https://github.com/meituan/YOLOv6) | 17Mb |
-| *lite::ncnn::cv::detection::YOLOv6* | yolov6n-640x640-for-ncnn.opt.param&bin | [YOLOv6](https://github.com/meituan/YOLOv6) | 17Mb |
-| *lite::ncnn::cv::detection::YOLOv6* | yolov6s-320x320-for-ncnn.opt.param&bin | [YOLOv6](https://github.com/meituan/YOLOv6) | 66Mb |
-| *lite::ncnn::cv::detection::YOLOv6* | yolov6n-640x640-for-ncnn.opt.param&bin | [YOLOv6](https://github.com/meituan/YOLOv6) | 66Mb |
-| *lite::ncnn::cv::detection::YOLOv6* | yolov6t-640x640-for-ncnn.opt.param&bin | [YOLOv6](https://github.com/meituan/YOLOv6) | 57Mb |
-
-
-
-## Matting.
-
-
-
-| Class | Pretrained NCNN Files | Rename or Converted From (Repo) | Size |
-|:---------------------------------------------:|:--------------------------------------------:|:--------------------------------------------------------------------:|:----:|
-| *lite::ncnn::cv::matting::RobustVideoMatting* | rvm_mobilenetv3_fp32-opt.param&bin | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 14Mb |
-| *lite::ncnn::cv::matting::RobustVideoMatting* | rvm_mobilenetv3_fp32-480-480-opt.param&bin | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 14Mb |
-| *lite::ncnn::cv::matting::RobustVideoMatting* | rvm_mobilenetv3_fp32-480-640-opt.param&bin | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 14Mb |
-| *lite::ncnn::cv::matting::RobustVideoMatting* | rvm_mobilenetv3_fp32-640-480-opt.param&bin | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 14Mb |
-| *lite::ncnn::cv::matting::RobustVideoMatting* | rvm_mobilenetv3_fp32-1080-1920-opt.param&bin | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 14Mb |
-| *lite::ncnn::cv::matting::RobustVideoMatting* | rvm_resnet50_fp32-opt.param&bin | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 50Mb |
-| *lite::ncnn::cv::matting::RobustVideoMatting* | rvm_resnet50_fp32-480-480-opt.param&bin | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 50Mb |
-| *lite::ncnn::cv::matting::RobustVideoMatting* | rvm_resnet50_fp32-480-640-opt.param&bin | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 50Mb |
-| *lite::ncnn::cv::matting::RobustVideoMatting* | rvm_resnet50_fp32-640-480-opt.param&bin | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 50Mb |
-| *lite::ncnn::cv::matting::RobustVideoMatting* | rvm_resnet50_fp32-1080-1920-opt.param&bin | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 50Mb |
-
-## Face Recognition.
-
-
-
-
-| Class | Pretrained NCNN Files | Rename or Converted From (Repo) | Size |
-|:-----------------------------------------------:|:----------------------------------------------------------------:|:----------------------------------------------------------------------:|:-----:|
-| *lite::ncnn::cv::faceid::GlintArcFace* | ms1mv3_arcface_r100.opt.param&bin | [insightface](https://github.com/deepinsight/insightface) | 248Mb |
-| *lite::ncnn::cv::faceid::GlintArcFace* | ms1mv3_arcface_r50.opt.param&bin | [insightface](https://github.com/deepinsight/insightface) | 166Mb |
-| *lite::ncnn::cv::faceid::GlintArcFace* | ms1mv3_arcface_r34.opt.param&bin | [insightface](https://github.com/deepinsight/insightface) | 130Mb |
-| *lite::ncnn::cv::faceid::GlintArcFace* | ms1mv3_arcface_r18.opt.param&bin | [insightface](https://github.com/deepinsight/insightface) | 91Mb |
-| *lite::ncnn::cv::faceid::GlintCosFace* | glint360k_cosface_r100.opt.param&bin | [insightface](https://github.com/deepinsight/insightface) | 248Mb |
-| *lite::ncnn::cv::faceid::GlintCosFace* | glint360k_cosface_r50.opt.param&bin | [insightface](https://github.com/deepinsight/insightface) | 166Mb |
-| *lite::ncnn::cv::faceid::GlintCosFace* | glint360k_cosface_r34.opt.param&bin | [insightface](https://github.com/deepinsight/insightface) | 130Mb |
-| *lite::ncnn::cv::faceid::GlintCosFace* | glint360k_cosface_r18.opt.param&bin | [insightface](https://github.com/deepinsight/insightface) | 91Mb |
-| *lite::ncnn::cv::faceid::GlintPartialFC* | partial_fc_glint360k_r100.opt.param&bin | [insightface](https://github.com/deepinsight/insightface) | 248Mb |
-| *lite::ncnn::cv::faceid::GlintPartialFC* | partial_fc_glint360k_r50.opt.param&bin | [insightface](https://github.com/deepinsight/insightface) | 91Mb |
-| *lite::ncnn::cv::faceid::FaceNet* | facenet_vggface2_resnet.opt.param&bin | [facenet...](https://github.com/timesler/facenet-pytorch) | 89Mb |
-| *lite::ncnn::cv::faceid::FaceNet* | facenet_casia-webface_resnet.opt.param&bin | [facenet...](https://github.com/timesler/facenet-pytorch) | 89Mb |
-| *lite::ncnn::cv::faceid::FocalArcFace* | focal-arcface-ms1m-ir152.opt.param&bin | [face.evoLVe...](https://github.com/ZhaoJ9014/face.evoLVe.PyTorch) | 269Mb |
-| *lite::ncnn::cv::faceid::FocalArcFace* | focal-arcface-ms1m-ir50-epoch120.opt.param&bin | [face.evoLVe...](https://github.com/ZhaoJ9014/face.evoLVe.PyTorch) | 166Mb |
-| *lite::ncnn::cv::faceid::FocalArcFace* | focal-arcface-ms1m-ir50-epoch63.opt.param&bin | [face.evoLVe...](https://github.com/ZhaoJ9014/face.evoLVe.PyTorch) | 166Mb |
-| *lite::ncnn::cv::faceid::FocalAsiaArcFace* | focal-arcface-bh-ir50-asia.opt.param&bin | [face.evoLVe...](https://github.com/ZhaoJ9014/face.evoLVe.PyTorch) | 166Mb |
-| *lite::ncnn::cv::faceid::TencentCurricularFace* | Tencent_CurricularFace_Backbone.opt.param&bin | [TFace](https://github.com/Tencent/TFace) | 249Mb |
-| *lite::ncnn::cv::faceid::TencentCifpFace* | Tencent_Cifp_BUPT_Balancedface_IR_34.opt.param&bin | [TFace](https://github.com/Tencent/TFace) | 130Mb |
-| *lite::ncnn::cv::faceid::CenterLossFace* | CenterLossFace_epoch_100.opt.param&bin | [center-loss...](https://github.com/louis-she/center-loss.pytorch) | 280Mb |
-| *lite::ncnn::cv::faceid::SphereFace* | sphere20a_20171020.opt.param&bin | [sphere...](https://github.com/clcarwin/sphereface_pytorch) | 86Mb |
-| *lite::ncnn::cv::faceid:MobileFaceNet* | MobileFaceNet_Pytorch_068.opt.param&bin | [MobileFace...](https://github.com/Xiaoccer/MobileFaceNet_Pytorch) | 3.8Mb |
-| *lite::ncnn::cv::faceid:CavaGhostArcFace* | cavaface_GhostNet_x1.3_Arcface_Epoch_24.opt.param&bin | [cavaface...](https://github.com/cavalleria/cavaface.pytorch) | 15Mb |
-| *lite::ncnn::cv::faceid:CavaCombinedFace* | cavaface_IR_SE_100_Combined_Epoch_24.opt.param&bin | [cavaface...](https://github.com/cavalleria/cavaface.pytorch) | 250Mb |
-| *lite::ncnn::cv::faceid:MobileSEFocalFace* | face_recognition.pytorch_Mobilenet_se_focal_121000.opt.param&bin | [face_recog...](https://github.com/grib0ed0v/face_recognition.pytorch) | 4.5Mb |
-
-
-## Face Detection.
-
-
-
-| Class | Pretrained NCNN Files | Rename or Converted From (Repo) | Size |
-|:-------------------------------------------:|:----------------------------------------------------:|:---------------------------------------------------------------------------------------:|:------:|
-| *lite::ncnn::cv::face::detect::UltraFace* | ultraface-rfb-320.param&bin | [Ultra-Light...](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB) | 1.5Mb |
-| *lite::ncnn::cv::face::detect::UltraFace* | ultraface-slim-320.param&bin | [Ultra-Light...](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB) | 1.2Mb |
-| *lite::ncnn::cv::face::detect::RetinaFace* | Pytorch_RetinaFace_mobile0.25.opt.param&bin | [...Retinaface](https://github.com/biubug6/Pytorch_Retinaface) | 1.6Mb |
-| *lite::ncnn::cv::face::detect::RetinaFace* | Pytorch_RetinaFace_mobile0.25-640-640.opt.param&bin | [...Retinaface](https://github.com/biubug6/Pytorch_Retinaface) | 1.6Mb |
-| *lite::ncnn::cv::face::detect::RetinaFace* | Pytorch_RetinaFace_mobile0.25-320-320.opt.param&bin | [...Retinaface](https://github.com/biubug6/Pytorch_Retinaface) | 1.6Mb |
-| *lite::ncnn::cv::face::detect::RetinaFace* | Pytorch_RetinaFace_mobile0.25-720-1080.opt.param&bin | [...Retinaface](https://github.com/biubug6/Pytorch_Retinaface) | 1.6Mb |
-| *lite::ncnn::cv::face::detect::FaceBoxes* | FaceBoxes.opt.param&bin | [FaceBoxes](https://github.com/zisianw/FaceBoxes.PyTorch) | 3.8Mb |
-| *lite::ncnn::cv::face::detect::FaceBoxes* | FaceBoxes-640-640.opt.param&bin | [FaceBoxes](https://github.com/zisianw/FaceBoxes.PyTorch) | 3.8Mb |
-| *lite::ncnn::cv::face::detect::FaceBoxes* | FaceBoxes-320-320.opt.param&bin | [FaceBoxes](https://github.com/zisianw/FaceBoxes.PyTorch) | 3.8Mb |
-| *lite::ncnn::cv::face::detect::FaceBoxes* | FaceBoxes-720-1080.opt.param&bin | [FaceBoxes](https://github.com/zisianw/FaceBoxes.PyTorch) | 3.8Mb |
-| *lite::ncnn::cv::face::detect::SCRFD* | scrfd_500m_shape160x160.opt.param&bin | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.5Mb |
-| *lite::ncnn::cv::face::detect::SCRFD* | scrfd_500m_shape320x320.opt.param&bin | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.5Mb |
-| *lite::ncnn::cv::face::detect::SCRFD* | scrfd_500m_shape640x640.opt.param&bin | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.5Mb |
-| *lite::ncnn::cv::face::detect::SCRFD* | scrfd_500m_bnkps_shape160x160.opt.param&bin | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.5Mb |
-| *lite::ncnn::cv::face::detect::SCRFD* | scrfd_500m_bnkps_shape320x320.opt.param&bin | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.5Mb |
-| *lite::ncnn::cv::face::detect::SCRFD* | scrfd_500m_bnkps_shape640x640.opt.param&bin | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.5Mb |
-| *lite::ncnn::cv::face::detect::SCRFD* | scrfd_1g_shape160x160.opt.param&bin | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.7Mb |
-| *lite::ncnn::cv::face::detect::SCRFD* | scrfd_1g_shape320x320.opt.param&bin | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.7Mb |
-| *lite::ncnn::cv::face::detect::SCRFD* | scrfd_1g_shape640x640.opt.param&bin | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.7Mb |
-| *lite::ncnn::cv::face::detect::SCRFD* | scrfd_2.5g_shape160x160.opt.param&bin | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 3.3Mb |
-| *lite::ncnn::cv::face::detect::SCRFD* | scrfd_2.5g_shape320x320.opt.param&bin | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 3.3Mb |
-| *lite::ncnn::cv::face::detect::SCRFD* | scrfd_2.5g_shape640x640.opt.param&bin | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 3.3Mb |
-| *lite::ncnn::cv::face::detect::SCRFD* | scrfd_2.5g_bnkps_shape160x160.opt.param&bin | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 3.3Mb |
-| *lite::ncnn::cv::face::detect::SCRFD* | scrfd_2.5g_bnkps_shape320x320.opt.param&bin | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 3.3Mb |
-| *lite::ncnn::cv::face::detect::SCRFD* | scrfd_2.5g_bnkps_shape640x640.opt.param&bin | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 3.3Mb |
-| *lite::ncnn::cv::face::detect::SCRFD* | scrfd_10g_shape640x640.opt.param&bin | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 16.9Mb |
-| *lite::ncnn::cv::face::detect::SCRFD* | scrfd_10g_shape1280x1280.opt.param&bin | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 16.9Mb |
-| *lite::ncnn::cv::face::detect::SCRFD* | scrfd_10g_bnkps_shape640x640.opt.param&bin | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 16.9Mb |
-| *lite::ncnn::cv::face::detect::SCRFD* | scrfd_10g_bnkps_shape1280x1280.opt.param&bin | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 16.9Mb |
-| *lite::ncnn::cv::face::detect::YOLO5Face* | yolov5face-l-640x640.opt.param&bin | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 181Mb |
-| *lite::ncnn::cv::face::detect::YOLO5Face* | yolov5face-m-640x640.opt.param&bin | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 83Mb |
-| *lite::ncnn::cv::face::detect::YOLO5Face* | yolov5face-n-0.5-320x320.opt.param&bin | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 2.5Mb |
-| *lite::ncnn::cv::face::detect::YOLO5Face* | yolov5face-n-0.5-640x640.opt.param&bin | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 4.6Mb |
-| *lite::ncnn::cv::face::detect::YOLO5Face* | yolov5face-n-640x640.opt.param&bin | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 9.5Mb |
-| *lite::ncnn::cv::face::detect::YOLO5Face* | yolov5face-s-640x640.opt.param&bin | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 30Mb |
-| *lite::ncnn::cv::face::detect::FaceBoxesV2* | faceboxesv2-640x640.opt.param&bin | [FaceBoxesV2](https://github.com/jhb86253817/FaceBoxesV2) | 4.0Mb |
-
-
-## Face Alignment.
-
-
-
-
-| Class | Pretrained NCNN Files | Rename or Converted From (Repo) | Size |
-|:------------------------------------------------:|:----------------------------------------------------------------------:|:------------------------------------------------------------------:|:-------:|
-| *lite::ncnn::cv::face::align::PFLD* | pfld-106-lite.opt.param&bin | [pfld_106_...](https://github.com/Hsintao/pfld_106_face_landmarks) | 1.0Mb |
-| *lite::ncnn::cv::face::align::PFLD* | pfld-106-v3.opt.param&bin | [pfld_106_...](https://github.com/Hsintao/pfld_106_face_landmarks) | 5.5Mb |
-| *lite::ncnn::cv::face::align::PFLD* | pfld-106-v2.opt.param&bin | [pfld_106_...](https://github.com/Hsintao/pfld_106_face_landmarks) | 5.0Mb |
-| *lite::ncnn::cv::face::align::PFLD98* | PFLD-pytorch-pfld.opt.param&bin | [PFLD...](https://github.com/polarisZhao/PFLD-pytorch) | 4.8Mb |
-| *lite::ncnn::cv::face::align::MobileNetV268* | pytorch_face_landmarks_landmark_detection_56.opt.param&bin | [...landmark](https://github.com/cunjian/pytorch_face_landmark) | 9.4Mb |
-| *lite::ncnn::cv::face::align::MobileNetV2SE68* | pytorch_face_landmarks_landmark_detection_56_se_external.opt.param&bin | [...landmark](https://github.com/cunjian/pytorch_face_landmark) | 11Mb |
-| *lite::ncnn::cv::face::align::PFLD68* | pytorch_face_landmarks_pfld.opt.param&bin | [...landmark](https://github.com/cunjian/pytorch_face_landmark) | 2.8Mb |
-| *lite::ncnn::cv::face::align::FaceLandmarks1000* | FaceLandmark1000.opt.param&bin | [FaceLandm...](https://github.com/Single430/FaceLandmark1000) | 2.0Mb |
-| *lite::ncnn::cv::face::align::PIPNet98* | pipnet_resnet18_10x98x32x256_wflw.opt.param&bin | [PIPNet](https://github.com/jhb86253817/PIPNet) | 44.0Mb |
-| *lite::ncnn::cv::face::align::PIPNet68* | pipnet_resnet18_10x68x32x256_300w.opt.param&bin | [PIPNet](https://github.com/jhb86253817/PIPNet) | 44.0Mb |
-| *lite::ncnn::cv::face::align::PIPNet29* | pipnet_resnet18_10x29x32x256_cofw.opt.param&bin | [PIPNet](https://github.com/jhb86253817/PIPNet) | 44.0Mb |
-| *lite::ncnn::cv::face::align::PIPNet19* | pipnet_resnet18_10x19x32x256_aflw.opt.param&bin | [PIPNet](https://github.com/jhb86253817/PIPNet) | 44.0Mb |
-| *lite::ncnn::cv::face::align::PIPNet98* | pipnet_resnet101_10x98x32x256_wflw.opt.param&bin | [PIPNet](https://github.com/jhb86253817/PIPNet) | 150.0Mb |
-| *lite::ncnn::cv::face::align::PIPNet68* | pipnet_resnet101_10x68x32x256_300w.opt.param&bin | [PIPNet](https://github.com/jhb86253817/PIPNet) | 150.0Mb |
-| *lite::ncnn::cv::face::align::PIPNet29* | pipnet_resnet101_10x29x32x256_cofw.opt.param&bin | [PIPNet](https://github.com/jhb86253817/PIPNet) | 150.0Mb |
-| *lite::ncnn::cv::face::align::PIPNet19* | pipnet_resnet101_10x19x32x256_aflw.opt.param&bin | [PIPNet](https://github.com/jhb86253817/PIPNet) | 150.0Mb |
-
-
-## Face Attributes.
-
-
-
-
-| Class | Pretrained NCNN Files | Rename or Converted From (Repo) | Size |
-|:-----------------------------------------------:|:----------------------------------------------------------:|:-------------------------------------------------------------------------:|:----:|
-| *lite::ncnn::cv::face::attr::AgeGoogleNet* | age_googlenet.opt.param&bin | [onnx-models](https://github.com/onnx/models) | 23Mb |
-| *lite::ncnn::cv::face::attr::GenderGoogleNet* | gender_googlenet.opt.param&bin | [onnx-models](https://github.com/onnx/models) | 23Mb |
-| *lite::ncnn::cv::face::attr::EmotionFerPlus* | emotion-ferplus-7.opt.param&bin | [onnx-models](https://github.com/onnx/models) | 33Mb |
-| *lite::ncnn::cv::face::attr::EmotionFerPlus* | emotion-ferplus-8.opt.param&bin | [onnx-models](https://github.com/onnx/models) | 33Mb |
-| *lite::ncnn::cv::face::attr::EfficientEmotion7* | face-emotion-recognition-enet_b0_7.opt.param&bin | [face-emo...](https://github.com/HSE-asavchenko/face-emotion-recognition) | 15Mb |
-| *lite::ncnn::cv::face::attr::EfficientEmotion8* | face-emotion-recognition-enet_b0_8_best_afew.opt.param&bin | [face-emo...](https://github.com/HSE-asavchenko/face-emotion-recognition) | 15Mb |
-| *lite::ncnn::cv::face::attr::EfficientEmotion8* | face-emotion-recognition-enet_b0_8_best_vgaf.opt.param&bin | [face-emo...](https://github.com/HSE-asavchenko/face-emotion-recognition) | 15Mb |
-| *lite::ncnn::cv::face::attr::MobileEmotion7* | face-emotion-recognition-mobilenet_7.opt.param&bin | [face-emo...](https://github.com/HSE-asavchenko/face-emotion-recognition) | 13Mb |
-
-
-## Classification.
-
-
-
-
-| Class | Pretrained NCNN Files | Rename or Converted From (Repo) | Size |
-|:----------------------------------------------:|:-----------------------------------------:|:------------------------------------------------------------:|:-----:|
-| *lite::ncnn::cv::classification::ShuffleNetV2* | shufflenet-v2-10.opt.param&bin | [onnx-models](https://github.com/onnx/models) | 8.7Mb |
-| *lite::ncnn::cv::classification::DenseNet121* | densenet121.opt.param&bin | [torchvision](https://github.com/pytorch/vision) | 30Mb |
-| *lite::ncnn::cv::classification::GhostNet* | ghostnet.opt.param&bin | [torchvision](https://github.com/pytorch/vision) | 20Mb |
-| *lite::ncnn::cv::classification::HdrDNet* | hardnet.opt.param&bin | [torchvision](https://github.com/pytorch/vision) | 13Mb |
-| *lite::ncnn::cv::classification::IBNNet* | ibnnet18.opt.param&bin | [torchvision](https://github.com/pytorch/vision) | 97Mb |
-| *lite::ncnn::cv::classification::MobileNetV2* | mobilenetv2.opt.param&bin | [torchvision](https://github.com/pytorch/vision) | 13Mb |
-| *lite::ncnn::cv::classification::ResNet* | resnet18.opt.param&bin | [torchvision](https://github.com/pytorch/vision) | 44Mb |
-| *lite::ncnn::cv::classification::ResNeXt* | resnext.opt.param&bin | [torchvision](https://github.com/pytorch/vision) | 95Mb |
-| *lite::ncnn::cv::classification::InsectID* | quarrying_insect_identifier.opt.param&bin | [InsectID](https://github.com/quarrying/quarrying-insect-id) | 27Mb |
-| *lite::ncnn::cv::classification:PlantID* | quarrying_plantid_model.opt.param&bin | [PlantID](https://github.com/quarrying/quarrying-plant-id) | 30Mb |
-
-## Segmentation.
-
-
-
-
-| Class | Pretrained NCNN Files | Rename or Converted From (Repo) | Size |
-|:--------------------------------------------------:|:--------------------------------------:|:--------------------------------------------------------------------------:|:-----:|
-| *lite::ncnn::cv::segmentation::DeepLabV3ResNet101* | deeplabv3_resnet101_coco.opt.param&bin | [torchvision](https://github.com/pytorch/vision) | 232Mb |
-| *lite::ncnn::cv::segmentation::FCNResNet101* | fcn_resnet101.opt.param&bin | [torchvision](https://github.com/pytorch/vision) | 207Mb |
-| *lite::ncnn::cv::segmentation::FaceParsingBiSeNet* | face_parsing_512x512.opt.param&bin | [face-parsing.PyTorch](https://github.com/zllrunning/face-parsing.PyTorch) | 50M |
-| *lite::ncnn::cv::segmentation::FaceParsingBiSeNet* | face_parsing_1024x1024.opt.param&bin | [face-parsing.PyTorch](https://github.com/zllrunning/face-parsing.PyTorch) | 50M |
-
-
-## Style Transfer.
-
-
-
-| Class | Pretrained NCNN Files | Rename or Converted From (Repo) | Size |
-|:------------------------------------------:|:------------------------------------------------------------:|:---------------------------------------------:|:-----:|
-| *lite::ncnn::cv::style::FastStyleTransfer* | style-mosaic-8.opt.param&bin | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::ncnn::cv::style::FastStyleTransfer* | style-candy-9.opt.param&bin | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::ncnn::cv::style::FastStyleTransfer* | style-udnie-8.opt.param&bin | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::ncnn::cv::style::FastStyleTransfer* | style-udnie-9.opt.param&bin | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::ncnn::cv::style::FastStyleTransfer* | style-pointilism-8.opt.param&bin | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::ncnn::cv::style::FastStyleTransfer* | style-pointilism-9.opt.param&bin | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::ncnn::cv::style::FastStyleTransfer* | style-rain-princess-9.opt.param&bin | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::ncnn::cv::style::FastStyleTransfer* | style-rain-princess-8.opt.param&bin | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::ncnn::cv::style::FastStyleTransfer* | style-candy-8.opt.param&bin | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::ncnn::cv::style::FastStyleTransfer* | style-mosaic-9.opt.param&bin | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::ncnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-1024x1024.opt.param&bin | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::ncnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-1024x512.opt.param&bin | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::ncnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-256x256.opt.param&bin | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::ncnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-256x512.opt.param&bin | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::ncnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-512x1024.opt.param&bin | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::ncnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-512x256.opt.param&bin | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::ncnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-512x512.opt.param&bin | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::ncnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-1024x1024.opt.param&bin | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::ncnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-1024x512.opt.param&bin | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::ncnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-256x256.opt.param&bin | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::ncnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-256x512.opt.param&bin | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::ncnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-512x1024.opt.param&bin | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::ncnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-512x256.opt.param&bin | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::ncnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-512x512.opt.param&bin | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-
diff --git a/docs/hub/lite.ai.toolkit.hub.tnn.md b/docs/hub/lite.ai.toolkit.hub.tnn.md
deleted file mode 100644
index 85b78b2b..00000000
--- a/docs/hub/lite.ai.toolkit.hub.tnn.md
+++ /dev/null
@@ -1,311 +0,0 @@
-# Lite.AI.ToolKit.Hub.TNN
-
-You can download all the pretrained models files of TNN format from ([Baidu Drive](https://pan.baidu.com/s/1lvM2YKyUbEc5HKVtqITpcw) code: 6o6k)
-
-## Object Detection.
-
-
-
-| Class | Pretrained TNN Files | Rename or Converted From (Repo) | Size |
-|:---------------------------------------------------:|:----------------------------------------------------:|:------------------------------------------------------------:|:-----:|
-| *lite::tnn::cv::detection::YoloV5* | yolov5l.opt.tnnproto&tnnmodel | [yolov5](https://github.com/ultralytics/yolov5) | 188Mb |
-| *lite::tnn::cv::detection::YoloV5* | yolov5m.opt.tnnproto&tnnmodel | [yolov5](https://github.com/ultralytics/yolov5) | 85Mb |
-| *lite::tnn::cv::detection::YoloV5* | yolov5s.opt.tnnproto&tnnmodel | [yolov5](https://github.com/ultralytics/yolov5) | 29Mb |
-| *lite::tnn::cv::detection::YoloV5* | yolov5x.opt.tnnproto&tnnmodel | [yolov5](https://github.com/ultralytics/yolov5) | 351Mb |
-| *lite::tnn::cv::detection::YoloX* | yolox_x.opt.tnnproto&tnnmodel | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 378Mb |
-| *lite::tnn::cv::detection::YoloX* | yolox_l.opt.tnnproto&tnnmodel | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 207Mb |
-| *lite::tnn::cv::detection::YoloX* | yolox_m.opt.tnnproto&tnnmodel | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 97Mb |
-| *lite::tnn::cv::detection::YoloX* | yolox_s.opt.tnnproto&tnnmodel | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 34Mb |
-| *lite::tnn::cv::detection::YoloX* | yolox_tiny.opt.tnnproto&tnnmodel | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 19Mb |
-| *lite::tnn::cv::detection::YoloX* | yolox_nano.opt.tnnproto&tnnmodel | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 3.5Mb |
-| *lite::tnn::cv::detection::YOLOP* | yolop-320-320.opt.tnnproto&tnnmodel | [YOLOP](https://github.com/hustvl/YOLOP) | 30Mb |
-| *lite::tnn::cv::detection::YOLOP* | yolop-640-640.opt.tnnproto&tnnmodel | [YOLOP](https://github.com/hustvl/YOLOP) | 30Mb |
-| *lite::tnn::cv::detection::YOLOP* | yolop-1280-1280.opt.tnnproto&tnnmodel | [YOLOP](https://github.com/hustvl/YOLOP) | 30Mb |
-| *lite::tnn::cv::detection::NanoDet* | nanodet_m_0.5x.opt.tnnproto&tnnmodel | [nanodet](https://github.com/RangiLyu/nanodet) | 1.1Mb |
-| *lite::tnn::cv::detection::NanoDet* | nanodet_m.opt.tnnproto&tnnmodel | [nanodet](https://github.com/RangiLyu/nanodet) | 3.6Mb |
-| *lite::tnn::cv::detection::NanoDet* | nanodet_m_1.5x.opt.tnnproto&tnnmodel | [nanodet](https://github.com/RangiLyu/nanodet) | 7.9Mb |
-| *lite::tnn::cv::detection::NanoDet* | nanodet_m_1.5x_416.opt.tnnproto&tnnmodel | [nanodet](https://github.com/RangiLyu/nanodet) | 7.9Mb |
-| *lite::tnn::cv::detection::NanoDet* | nanodet_m_416.opt.tnnproto&tnnmodel | [nanodet](https://github.com/RangiLyu/nanodet) | 3.6Mb |
-| *lite::tnn::cv::detection::NanoDet* | nanodet_g.opt.tnnproto&tnnmodel | [nanodet](https://github.com/RangiLyu/nanodet) | 14Mb |
-| *lite::tnn::cv::detection::NanoDet* | nanodet_t.opt.tnnproto&tnnmodel | [nanodet](https://github.com/RangiLyu/nanodet) | 5.1Mb |
-| *lite::tnn::cv::detection::NanoDet* | nanodet-RepVGG-A0_416.opt.tnnproto&tnnmodel | [nanodet](https://github.com/RangiLyu/nanodet) | 26Mb |
-| *lite::tnn::cv::detection::NanoDetEfficientNetLite* | nanodet-EfficientNet-Lite0_320.opt.tnnproto&tnnmodel | [nanodet](https://github.com/RangiLyu/nanodet) | 12Mb |
-| *lite::tnn::cv::detection::NanoDetEfficientNetLite* | nanodet-EfficientNet-Lite1_416.opt.tnnproto&tnnmodel | [nanodet](https://github.com/RangiLyu/nanodet) | 15Mb |
-| *lite::tnn::cv::detection::NanoDetEfficientNetLite* | nanodet-EfficientNet-Lite2_512.opt.tnnproto&tnnmodel | [nanodet](https://github.com/RangiLyu/nanodet) | 18Mb |
-| *lite::tnn::cv::detection::YoloX_V_0_1_1* | yolox_x_v0.1.1.opt.tnnproto&tnnmodel | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 378Mb |
-| *lite::tnn::cv::detection::YoloX_V_0_1_1* | yolox_l_v0.1.1.opt.tnnproto&tnnmodel | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 207Mb |
-| *lite::tnn::cv::detection::YoloX_V_0_1_1* | yolox_m_v0.1.1.opt.tnnproto&tnnmodel | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 97Mb |
-| *lite::tnn::cv::detection::YoloX_V_0_1_1* | yolox_s_v0.1.1.opt.tnnproto&tnnmodel | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 34Mb |
-| *lite::tnn::cv::detection::YoloX_V_0_1_1* | yolox_tiny_v0.1.1.opt.tnnproto&tnnmodel | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 19Mb |
-| *lite::tnn::cv::detection::YoloX_V_0_1_1* | yolox_nano_v0.1.1.opt.tnnproto&tnnmodel | [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | 3.5Mb |
-| *lite::tnn::cv::detection::YoloR* | yolor-p6-320-320.opt.tnnproto&tnnmodel | [yolor](https://github.com/WongKinYiu/yolor) | 157Mb |
-| *lite::tnn::cv::detection::YoloR* | yolor-p6-640-640.opt.tnnproto&tnnmodel | [yolor](https://github.com/WongKinYiu/yolor) | 157Mb |
-| *lite::tnn::cv::detection::YoloR* | yolor-ssss-s2d-640-640.opt.tnnproto&tnnmodel | [yolor](https://github.com/WongKinYiu/yolor) | 50Mb |
-| *lite::tnn::cv::detection::YoloV5_V_6_0* | yolov5m.640-640.v.6.0.opt.tnnproto&tnnmodel | [yolov5](https://github.com/ultralytics/yolov5) | 81Mb |
-| *lite::tnn::cv::detection::YoloV5_V_6_0* | yolov5s.640-640.v.6.0.opt.tnnproto&tnnmodel | [yolov5](https://github.com/ultralytics/yolov5) | 28Mb |
-| *lite::tnn::cv::detection::YoloV5_V_6_0* | yolov5n.640-640.v.6.0.opt.tnnproto&tnnmodel | [yolov5](https://github.com/ultralytics/yolov5) | 7.5Mb |
-| *lite::tnn::cv::detection::YoloV5_V_6_0* | yolov5m6.640-640.v.6.0.opt.tnnproto&tnnmodel | [yolov5](https://github.com/ultralytics/yolov5) | 128Mb |
-| *lite::tnn::cv::detection::YoloV5_V_6_0* | yolov5s6.640-640.v.6.0.opt.tnnproto&tnnmodel | [yolov5](https://github.com/ultralytics/yolov5) | 50Mb |
-| *lite::tnn::cv::detection::YoloV5_V_6_0* | yolov5n6.640-640.v.6.0.opt.tnnproto&tnnmodel | [yolov5](https://github.com/ultralytics/yolov5) | 14Mb |
-| *lite::tnn::cv::detection::YoloV5_V_6_0* | yolov5m6.1280-1280.v.6.0.opt.tnnproto&tnnmodel | [yolov5](https://github.com/ultralytics/yolov5) | 128Mb |
-| *lite::tnn::cv::detection::YoloV5_V_6_0* | yolov5s6.1280-1280.v.6.0.opt.tnnproto&tnnmodel | [yolov5](https://github.com/ultralytics/yolov5) | 50Mb |
-| *lite::tnn::cv::detection::YoloV5_V_6_0* | yolov5n6.1280-1280.v.6.0.opt.tnnproto&tnnmodel | [yolov5](https://github.com/ultralytics/yolov5) | 14Mb |
-| *lite::tnn::cv::detection::NanoDetPlus* | nanodet-plus-m_320.opt.tnnproto&tnnmodel | [nanodet](https://github.com/RangiLyu/nanodet) | 4.5Mb |
-| *lite::tnn::cv::detection::NanoDetPlus* | nanodet-plus-m_416.opt.tnnproto&tnnmodel | [nanodet](https://github.com/RangiLyu/nanodet) | 4.5Mb |
-| *lite::tnn::cv::detection::NanoDetPlus* | nanodet-plus-m-1.5x_320.opt.tnnproto&tnnmodel | [nanodet](https://github.com/RangiLyu/nanodet) | 9.4Mb |
-| *lite::tnn::cv::detection::NanoDetPlus* | nanodet-plus-m-1.5x_416.opt.tnnproto&tnnmodel | [nanodet](https://github.com/RangiLyu/nanodet) | 9.4Mb |
-| *lite::tnn::cv::detection::InsectDet* | quarrying_insect_detector.opt.tnnproto&tnnmodel | [InsectID](https://github.com/quarrying/quarrying-insect-id) | 22Mb |
-| *lite::tnn::cv::detection::YOLOv6* | yolov6n-320x320.opt.tnnproto&tnnmodel | [YOLOv6](https://github.com/meituan/YOLOv6) | 17Mb |
-| *lite::tnn::cv::detection::YOLOv6* | yolov6n-640x640.opt.tnnproto&tnnmodel | [YOLOv6](https://github.com/meituan/YOLOv6) | 17Mb |
-| *lite::tnn::cv::detection::YOLOv6* | yolov6s-320x320.opt.tnnproto&tnnmodel | [YOLOv6](https://github.com/meituan/YOLOv6) | 66Mb |
-| *lite::tnn::cv::detection::YOLOv6* | yolov6n-640x640.opt.tnnproto&tnnmodel | [YOLOv6](https://github.com/meituan/YOLOv6) | 66Mb |
-| *lite::tnn::cv::detection::YOLOv6* | yolov6t-640x640.opt.tnnproto&tnnmodel | [YOLOv6](https://github.com/meituan/YOLOv6) | 57Mb |
-
-
-## Matting.
-
-
-
-| Class | Pretrained TNN Files | Rename or Converted From (Repo) | Size |
-|:---------------------------------------------:|:----------------------------------------------------------------:|:----------------------------------------------------------------------:|:-----:|
-| *lite::tnn::cv::matting::RobustVideoMatting* | rvm_mobilenetv3_fp32-480-480-sim.tnnproto&tnnmodel | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 14Mb |
-| *lite::tnn::cv::matting::RobustVideoMatting* | rvm_mobilenetv3_fp32-480-480-sim.opt.tnnproto&tnnmodel | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 14Mb |
-| *lite::tnn::cv::matting::RobustVideoMatting* | rvm_mobilenetv3_fp32-480-640-sim.opt.tnnproto&tnnmodel | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 14Mb |
-| *lite::tnn::cv::matting::RobustVideoMatting* | rvm_mobilenetv3_fp32-640-480-sim.opt.tnnproto&tnnmodel | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 14Mb |
-| *lite::tnn::cv::matting::RobustVideoMatting* | rvm_mobilenetv3_fp32-1080-1920-sim.opt.tnnproto&tnnmodel | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 14Mb |
-| *lite::tnn::cv::matting::RobustVideoMatting* | rvm_resnet50_fp32-480-480-sim.opt.tnnproto&tnnmodel | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 50Mb |
-| *lite::tnn::cv::matting::RobustVideoMatting* | rvm_resnet50_fp32-480-640-sim.opt.tnnproto&tnnmodel | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 50Mb |
-| *lite::tnn::cv::matting::RobustVideoMatting* | rvm_resnet50_fp32-640-480-sim.opt.tnnproto&tnnmodel | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 50Mb |
-| *lite::tnn::cv::matting::RobustVideoMatting* | rvm_resnet50_fp32-1080-1920-sim.opt.tnnproto&tnnmodel | [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting) | 50Mb |
-| *lite::tnn::cv::matting::MGMatting* | MGMatting-DIM-100k.opt.tnnproto&tnnmodel | [MGMatting](https://github.com/yucornetto/MGMatting) | 113Mb |
-| *lite::tnn::cv::matting::MGMatting* | MGMatting-RWP-100k.opt.tnnproto&tnnmodel | [MGMatting](https://github.com/yucornetto/MGMatting) | 113Mb |
-| *lite::tnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-1024x1024.tnnproto&tnnmodel | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::tnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-1024x512.tnnproto&tnnmodel | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::tnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-256x256.tnnproto&tnnmodel | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::tnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-256x512.tnnproto&tnnmodel | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::tnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-512x1024.tnnproto&tnnmodel | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::tnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-512x256.tnnproto&tnnmodel | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::tnn::cv::matting::MODNet* | modnet_photographic_portrait_matting-512x512.tnnproto&tnnmodel | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::tnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-1024x1024.tnnproto&tnnmodel | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::tnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-1024x512.tnnproto&tnnmodel | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::tnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-256x256.tnnproto&tnnmodel | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::tnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-256x512.tnnproto&tnnmodel | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::tnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-512x1024.tnnproto&tnnmodel | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::tnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-512x256.tnnproto&tnnmodel | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::tnn::cv::matting::MODNet* | modnet_webcam_portrait_matting-512x512.tnnproto&tnnmodel | [MODNet](https://github.com/ZHKKKe/MODNet) | 24Mb |
-| *lite::tnn::cv::matting::BackgroundMattingV2* | BGMv2_mobilenetv2-256x256-full.opt.tnnproto&tnnmodel | [BackgroundMattingV2](https://github.com/PeterL1n/BackgroundMattingV2) | 20Mb |
-| *lite::tnn::cv::matting::BackgroundMattingV2* | BGMv2_mobilenetv2-512x512-full.opt.tnnproto&tnnmodel | [BackgroundMattingV2](https://github.com/PeterL1n/BackgroundMattingV2) | 20Mb |
-| *lite::tnn::cv::matting::BackgroundMattingV2* | BGMv2_mobilenetv2-1080x1920-full.opt.tnnproto&tnnmodel | [BackgroundMattingV2](https://github.com/PeterL1n/BackgroundMattingV2) | 20Mb |
-| *lite::tnn::cv::matting::BackgroundMattingV2* | BGMv2_mobilenetv2-2160x3840-full.opt.tnnproto&tnnmodel | [BackgroundMattingV2](https://github.com/PeterL1n/BackgroundMattingV2) | 20Mb |
-| *lite::tnn::cv::matting::BackgroundMattingV2* | BGMv2_resnet50-1080x1920-full.opt.tnnproto&tnnmodel | [BackgroundMattingV2](https://github.com/PeterL1n/BackgroundMattingV2) | 20Mb |
-| *lite::tnn::cv::matting::BackgroundMattingV2* | BGMv2_resnet50-2160x3840-full.opt.tnnproto&tnnmodel | [BackgroundMattingV2](https://github.com/PeterL1n/BackgroundMattingV2) | 20Mb |
-| *lite::tnn::cv::matting::BackgroundMattingV2* | BGMv2_resnet101-2160x3840-full.opt.tnnproto&tnnmodel | [BackgroundMattingV2](https://github.com/PeterL1n/BackgroundMattingV2) | 154Mb |
-
-
-## Face Recognition.
-
-
-
-
-| Class | Pretrained TNN Files | Rename or Converted From (Repo) | Size |
-|:----------------------------------------------:|:------------------------------------------------------------------------:|:----------------------------------------------------------------------:|:-----:|
-| *lite::tnn::cv::faceid::GlintArcFace* | ms1mv3_arcface_r100.opt.tnnproto&tnnmodel | [insightface](https://github.com/deepinsight/insightface) | 248Mb |
-| *lite::tnn::cv::faceid::GlintArcFace* | ms1mv3_arcface_r50.opt.tnnproto&tnnmodel | [insightface](https://github.com/deepinsight/insightface) | 166Mb |
-| *lite::tnn::cv::faceid::GlintArcFace* | ms1mv3_arcface_r34.opt.tnnproto&tnnmodel | [insightface](https://github.com/deepinsight/insightface) | 130Mb |
-| *lite::tnn::cv::faceid::GlintArcFace* | ms1mv3_arcface_r18.opt.tnnproto&tnnmodel | [insightface](https://github.com/deepinsight/insightface) | 91Mb |
-| *lite::tnn::cv::faceid::GlintCosFace* | glint360k_cosface_r100.opt.tnnproto&tnnmodel | [insightface](https://github.com/deepinsight/insightface) | 248Mb |
-| *lite::tnn::cv::faceid::GlintCosFace* | glint360k_cosface_r50.opt.tnnproto&tnnmodel | [insightface](https://github.com/deepinsight/insightface) | 166Mb |
-| *lite::tnn::cv::faceid::GlintCosFace* | glint360k_cosface_r34.opt.tnnproto&tnnmodel | [insightface](https://github.com/deepinsight/insightface) | 130Mb |
-| *lite::tnn::cv::faceid::GlintCosFace* | glint360k_cosface_r18.opt.tnnproto&tnnmodel | [insightface](https://github.com/deepinsight/insightface) | 91Mb |
-| *lite::tnn::cv::faceid::GlintPartialFC* | partial_fc_glint360k_r100.opt.tnnproto&tnnmodel | [insightface](https://github.com/deepinsight/insightface) | 248Mb |
-| *lite::tnn::cv::faceid::GlintPartialFC* | partial_fc_glint360k_r50.opt.tnnproto&tnnmodel | [insightface](https://github.com/deepinsight/insightface) | 91Mb |
-| *lite::tnn::cv::faceid::FaceNet* | facenet_vggface2_resnet.opt.tnnproto&tnnmodel | [facenet...](https://github.com/timesler/facenet-pytorch) | 89Mb |
-| *lite::tnn::cv::faceid::FaceNet* | facenet_casia-webface_resnet.opt.tnnproto&tnnmodel | [facenet...](https://github.com/timesler/facenet-pytorch) | 89Mb |
-| *lite::tnn::cv::faceid::FocalArcFace* | focal-arcface-ms1m-ir152.opt.tnnproto&tnnmodel | [face.evoLVe...](https://github.com/ZhaoJ9014/face.evoLVe.PyTorch) | 269Mb |
-| *lite::tnn::cv::faceid::FocalArcFace* | focal-arcface-ms1m-ir50-epoch120.opt.tnnproto&tnnmodel | [face.evoLVe...](https://github.com/ZhaoJ9014/face.evoLVe.PyTorch) | 166Mb |
-| *lite::tnn::cv::faceid::FocalArcFace* | focal-arcface-ms1m-ir50-epoch63.opt.tnnproto&tnnmodel | [face.evoLVe...](https://github.com/ZhaoJ9014/face.evoLVe.PyTorch) | 166Mb |
-| *lite::tnn::cv::faceid::FocalAsiaArcFace* | focal-arcface-bh-ir50-asia.opt.tnnproto&tnnmodel | [face.evoLVe...](https://github.com/ZhaoJ9014/face.evoLVe.PyTorch) | 166Mb |
-| *lite::tnn::cv::faceid::TencentCurricularFace* | Tencent_CurricularFace_Backbone.opt.tnnproto&tnnmodel | [TFace](https://github.com/Tencent/TFace) | 249Mb |
-| *lite::tnn::cv::faceid::TencentCifpFace* | Tencent_Cifp_BUPT_Balancedface_IR_34.opt.tnnproto&tnnmodel | [TFace](https://github.com/Tencent/TFace) | 130Mb |
-| *lite::tnn::cv::faceid::CenterLossFace* | CenterLossFace_epoch_100.opt.tnnproto&tnnmodel | [center-loss...](https://github.com/louis-she/center-loss.pytorch) | 280Mb |
-| *lite::tnn::cv::faceid::SphereFace* | sphere20a_20171020.opt.tnnproto&tnnmodel | [sphere...](https://github.com/clcarwin/sphereface_pytorch) | 86Mb |
-| *lite::tnn::cv::faceid:MobileFaceNet* | MobileFaceNet_Pytorch_068.opt.tnnproto&tnnmodel | [MobileFace...](https://github.com/Xiaoccer/MobileFaceNet_Pytorch) | 3.8Mb |
-| *lite::tnn::cv::faceid:CavaGhostArcFace* | cavaface_GhostNet_x1.3_Arcface_Epoch_24.opt.tnnproto&tnnmodel | [cavaface...](https://github.com/cavalleria/cavaface.pytorch) | 15Mb |
-| *lite::tnn::cv::faceid:CavaCombinedFace* | cavaface_IR_SE_100_Combined_Epoch_24.opt.tnnproto&tnnmodel | [cavaface...](https://github.com/cavalleria/cavaface.pytorch) | 250Mb |
-| *lite::tnn::cv::faceid:MobileSEFocalFace* | face_recognition.pytorch_Mobilenet_se_focal_121000.opt.tnnproto&tnnmodel | [face_recog...](https://github.com/grib0ed0v/face_recognition.pytorch) | 4.5Mb |
-
-
-## Face Detection.
-
-
-
-| Class | Pretrained TNN Files | Rename or Converted From (Repo) | Size |
-|:------------------------------------------:|:------------------------------------------------------------:|:---------------------------------------------------------------------------------------:|:------:|
-| *lite::tnn::cv::face::detect::UltraFace* | ultraface-rfb-320.opt.tnnproto&tnnmodel | [Ultra-Light...](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB) | 1.5Mb |
-| *lite::tnn::cv::face::detect::UltraFace* | ultraface-rfb-640.opt.tnnproto&tnnmodel | [Ultra-Light...](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB) | 1.5Mb |
-| *lite::tnn::cv::face::detect::UltraFace* | ultraface-slim-320.opt.tnnproto&tnnmodel | [Ultra-Light...](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB) | 1.2Mb |
-| *lite::tnn::cv::face::detect::UltraFace* | ultraface-slim-640.opt.tnnproto&tnnmodel | [Ultra-Light...](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB) | 1.2Mb |
-| *lite::tnn::cv::face::detect::RetinaFace* | Pytorch_RetinaFace_mobile0.25.opt.tnnproto&tnnmodel | [...Retinaface](https://github.com/biubug6/Pytorch_Retinaface) | 1.6Mb |
-| *lite::tnn::cv::face::detect::RetinaFace* | Pytorch_RetinaFace_mobile0.25-640-640.opt.tnnproto&tnnmodel | [...Retinaface](https://github.com/biubug6/Pytorch_Retinaface) | 1.6Mb |
-| *lite::tnn::cv::face::detect::RetinaFace* | Pytorch_RetinaFace_mobile0.25-320-320.opt.tnnproto&tnnmodel | [...Retinaface](https://github.com/biubug6/Pytorch_Retinaface) | 1.6Mb |
-| *lite::tnn::cv::face::detect::RetinaFace* | Pytorch_RetinaFace_mobile0.25-720-1080.opt.tnnproto&tnnmodel | [...Retinaface](https://github.com/biubug6/Pytorch_Retinaface) | 1.6Mb |
-| *lite::tnn::cv::face::detect::FaceBoxes* | FaceBoxes.opt.tnnproto&tnnmodel | [FaceBoxes](https://github.com/zisianw/FaceBoxes.PyTorch) | 3.8Mb |
-| *lite::tnn::cv::face::detect::FaceBoxes* | FaceBoxes-640-640.opt.tnnproto&tnnmodel | [FaceBoxes](https://github.com/zisianw/FaceBoxes.PyTorch) | 3.8Mb |
-| *lite::tnn::cv::face::detect::FaceBoxes* | FaceBoxes-320-320.opt.tnnproto&tnnmodel | [FaceBoxes](https://github.com/zisianw/FaceBoxes.PyTorch) | 3.8Mb |
-| *lite::tnn::cv::face::detect::FaceBoxes* | FaceBoxes-720-1080.opt.tnnproto&tnnmodel | [FaceBoxes](https://github.com/zisianw/FaceBoxes.PyTorch) | 3.8Mb |
-| *lite::tnn::cv::face::detect::SCRFD* | scrfd_500m_shape160x160.opt.tnnproto&tnnmodel | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.5Mb |
-| *lite::tnn::cv::face::detect::SCRFD* | scrfd_500m_shape320x320.opt.tnnproto&tnnmodel | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.5Mb |
-| *lite::tnn::cv::face::detect::SCRFD* | scrfd_500m_shape640x640.opt.tnnproto&tnnmodel | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.5Mb |
-| *lite::tnn::cv::face::detect::SCRFD* | scrfd_500m_bnkps_shape160x160.opt.tnnproto&tnnmodel | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.5Mb |
-| *lite::tnn::cv::face::detect::SCRFD* | scrfd_500m_bnkps_shape320x320.opt.tnnproto&tnnmodel | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.5Mb |
-| *lite::tnn::cv::face::detect::SCRFD* | scrfd_500m_bnkps_shape640x640.opt.tnnproto&tnnmodel | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.5Mb |
-| *lite::tnn::cv::face::detect::SCRFD* | scrfd_1g_shape160x160.opt.tnnproto&tnnmodel | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.7Mb |
-| *lite::tnn::cv::face::detect::SCRFD* | scrfd_1g_shape320x320.opt.tnnproto&tnnmodel | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.7Mb |
-| *lite::tnn::cv::face::detect::SCRFD* | scrfd_1g_shape640x640.opt.tnnproto&tnnmodel | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 2.7Mb |
-| *lite::tnn::cv::face::detect::SCRFD* | scrfd_2.5g_shape160x160.opt.tnnproto&tnnmodel | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 3.3Mb |
-| *lite::tnn::cv::face::detect::SCRFD* | scrfd_2.5g_shape320x320.opt.tnnproto&tnnmodel | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 3.3Mb |
-| *lite::tnn::cv::face::detect::SCRFD* | scrfd_2.5g_shape640x640.opt.tnnproto&tnnmodel | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 3.3Mb |
-| *lite::tnn::cv::face::detect::SCRFD* | scrfd_2.5g_bnkps_shape160x160.opt.tnnproto&tnnmodel | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 3.3Mb |
-| *lite::tnn::cv::face::detect::SCRFD* | scrfd_2.5g_bnkps_shape320x320.opt.tnnproto&tnnmodel | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 3.3Mb |
-| *lite::tnn::cv::face::detect::SCRFD* | scrfd_2.5g_bnkps_shape640x640.opt.tnnproto&tnnmodel | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 3.3Mb |
-| *lite::tnn::cv::face::detect::SCRFD* | scrfd_10g_shape640x640.opt.tnnproto&tnnmodel | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 16.9Mb |
-| *lite::tnn::cv::face::detect::SCRFD* | scrfd_10g_shape1280x1280.opt.tnnproto&tnnmodel | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 16.9Mb |
-| *lite::tnn::cv::face::detect::SCRFD* | scrfd_10g_bnkps_shape640x640.opt.tnnproto&tnnmodel | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 16.9Mb |
-| *lite::tnn::cv::face::detect::SCRFD* | scrfd_10g_bnkps_shape1280x1280.opt.tnnproto&tnnmodel | [SCRFD](https://github.com/deepinsight/insightface/blob/master/detection/scrfd) | 16.9Mb |
-| *lite::tnn::cv::face::detect::YOLO5Face* | yolov5face-blazeface-640x640.opt.tnnproto&tnnmodel | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 3.4Mb |
-| *lite::tnn::cv::face::detect::YOLO5Face* | yolov5face-l-640x640.opt.tnnproto&tnnmodel | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 181Mb |
-| *lite::tnn::cv::face::detect::YOLO5Face* | yolov5face-m-640x640.opt.tnnproto&tnnmodel | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 83Mb |
-| *lite::tnn::cv::face::detect::YOLO5Face* | yolov5face-n-0.5-320x320.opt.tnnproto&tnnmodel | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 2.5Mb |
-| *lite::tnn::cv::face::detect::YOLO5Face* | yolov5face-n-0.5-640x640.opt.tnnproto&tnnmodel | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 4.6Mb |
-| *lite::tnn::cv::face::detect::YOLO5Face* | yolov5face-n-640x640.opt.tnnproto&tnnmodel | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 9.5Mb |
-| *lite::tnn::cv::face::detect::YOLO5Face* | yolov5face-s-640x640.opt.tnnproto&tnnmodel | [YOLO5Face](https://github.com/deepcam-cn/yolov5-face) | 30Mb |
-| *lite::tnn::cv::face::detect::FaceBoxesV2* | faceboxesv2-640x640.opt.tnnproto&tnnmodel | [FaceBoxesV2](https://github.com/jhb86253817/FaceBoxesV2) | 4.0Mb |
-
-
-## Face Alignment.
-
-
-
-
-| Class | Pretrained TNN Files | Rename or Converted From (Repo) | Size |
-|:-----------------------------------------------:|:------------------------------------------------------------------------------:|:------------------------------------------------------------------:|:-------:|
-| *lite::tnn::cv::face::align::PFLD* | pfld-106-lite.opt.tnnproto&tnnmodel | [pfld_106_...](https://github.com/Hsintao/pfld_106_face_landmarks) | 1.0Mb |
-| *lite::tnn::cv::face::align::PFLD* | pfld-106-v3.opt.tnnproto&tnnmodel | [pfld_106_...](https://github.com/Hsintao/pfld_106_face_landmarks) | 5.5Mb |
-| *lite::tnn::cv::face::align::PFLD* | pfld-106-v2.opt.tnnproto&tnnmodel | [pfld_106_...](https://github.com/Hsintao/pfld_106_face_landmarks) | 5.0Mb |
-| *lite::tnn::cv::face::align::PFLD98* | PFLD-pytorch-pfld.opt.tnnproto&tnnmodel | [PFLD...](https://github.com/polarisZhao/PFLD-pytorch) | 4.8Mb |
-| *lite::tnn::cv::face::align::MobileNetV268* | pytorch_face_landmarks_landmark_detection_56.opt.tnnproto&tnnmodel | [...landmark](https://github.com/cunjian/pytorch_face_landmark) | 9.4Mb |
-| *lite::tnn::cv::face::align::MobileNetV2SE68* | pytorch_face_landmarks_landmark_detection_56_se_external.opt.tnnproto&tnnmodel | [...landmark](https://github.com/cunjian/pytorch_face_landmark) | 11Mb |
-| *lite::tnn::cv::face::align::PFLD68* | pytorch_face_landmarks_pfld.opt.tnnproto&tnnmodel | [...landmark](https://github.com/cunjian/pytorch_face_landmark) | 2.8Mb |
-| *lite::tnn::cv::face::align::FaceLandmarks1000* | FaceLandmark1000.opt.tnnproto&tnnmodel | [FaceLandm...](https://github.com/Single430/FaceLandmark1000) | 2.0Mb |
-| *lite::tnn::cv::face::align::PIPNet98* | pipnet_resnet18_10x98x32x256_wflw.opt.tnnproto&tnnmodel | [PIPNet](https://github.com/jhb86253817/PIPNet) | 44.0Mb |
-| *lite::tnn::cv::face::align::PIPNet68* | pipnet_resnet18_10x68x32x256_300w.opt.tnnproto&tnnmodel | [PIPNet](https://github.com/jhb86253817/PIPNet) | 44.0Mb |
-| *lite::tnn::cv::face::align::PIPNet29* | pipnet_resnet18_10x29x32x256_cofw.opt.tnnproto&tnnmodel | [PIPNet](https://github.com/jhb86253817/PIPNet) | 44.0Mb |
-| *lite::tnn::cv::face::align::PIPNet19* | pipnet_resnet18_10x19x32x256_aflw.opt.tnnproto&tnnmodel | [PIPNet](https://github.com/jhb86253817/PIPNet) | 44.0Mb |
-| *lite::tnn::cv::face::align::PIPNet98* | pipnet_resnet101_10x98x32x256_wflw.opt.tnnproto&tnnmodel | [PIPNet](https://github.com/jhb86253817/PIPNet) | 150.0Mb |
-| *lite::tnn::cv::face::align::PIPNet68* | pipnet_resnet101_10x68x32x256_300w.opt.tnnproto&tnnmodel | [PIPNet](https://github.com/jhb86253817/PIPNet) | 150.0Mb |
-| *lite::tnn::cv::face::align::PIPNet29* | pipnet_resnet101_10x29x32x256_cofw.opt.tnnproto&tnnmodel | [PIPNet](https://github.com/jhb86253817/PIPNet) | 150.0Mb |
-| *lite::tnn::cv::face::align::PIPNet19* | pipnet_resnet101_10x19x32x256_aflw.opt.tnnproto&tnnmodel | [PIPNet](https://github.com/jhb86253817/PIPNet) | 150.0Mb |
-
-
-## Head Pose Estimation.
-
-
-
-
-| Class | Pretrained TNN Files | Rename or Converted From (Repo) | Size |
-|:-----------------------------------:|:--------------------------------:|:------------------------------------------------------------------:|:-----:|
-| *lite::tnn::cv::face::pose::FSANet* | fsanet-var.opt.tnnproto&tnnmodel | [...fsanet...](https://github.com/omasaht/headpose-fsanet-pytorch) | 1.2Mb |
-| *lite::tnn::cv::face::pose::FSANet* | fsanet-1x1.opt.tnnproto&tnnmodel | [...fsanet...](https://github.com/omasaht/headpose-fsanet-pytorch) | 1.2Mb |
-
-## Face Attributes.
-
-
-
-
-| Class | Pretrained TNN Files | Rename or Converted From (Repo) | Size |
-|:----------------------------------------------:|:-----------------------------------------------------------------------------:|:-------------------------------------------------------------------------:|:-----:|
-| *lite::tnn::cv::face::attr::AgeGoogleNet* | age_googlenet.opt.tnnproto&tnnmodel | [onnx-models](https://github.com/onnx/models) | 23Mb |
-| *lite::tnn::cv::face::attr::GenderGoogleNet* | gender_googlenet.opt.tnnproto&tnnmodel | [onnx-models](https://github.com/onnx/models) | 23Mb |
-| *lite::tnn::cv::face::attr::EmotionFerPlus* | emotion-ferplus-7.opt.tnnproto&tnnmodel | [onnx-models](https://github.com/onnx/models) | 33Mb |
-| *lite::tnn::cv::face::attr::EmotionFerPlus* | emotion-ferplus-8.opt.tnnproto&tnnmodel | [onnx-models](https://github.com/onnx/models) | 33Mb |
-| *lite::tnn::cv::face::attr::SSRNet* | ssrnet.opt.tnnproto&tnnmodel | [SSR_Net...](https://github.com/oukohou/SSR_Net_Pytorch) | 190Kb |
-| *lite::tnn::cv::face::attr::EfficientEmotion7* | face-emotion-recognition-enet_b0_7.opt.tnnproto&tnnmodel | [face-emo...](https://github.com/HSE-asavchenko/face-emotion-recognition) | 15Mb |
-| *lite::tnn::cv::face::attr::EfficientEmotion8* | face-emotion-recognition-enet_b0_8_best_afew.opt.tnnproto&tnnmodel | [face-emo...](https://github.com/HSE-asavchenko/face-emotion-recognition) | 15Mb |
-| *lite::tnn::cv::face::attr::EfficientEmotion8* | face-emotion-recognition-enet_b0_8_best_vgaf.opt.tnnproto&tnnmodel | [face-emo...](https://github.com/HSE-asavchenko/face-emotion-recognition) | 15Mb |
-| *lite::tnn::cv::face::attr::MobileEmotion7* | face-emotion-recognition-mobilenet_7.opt.tnnproto&tnnmodel | [face-emo...](https://github.com/HSE-asavchenko/face-emotion-recognition) | 13Mb |
-| *lite::tnn::cv::face::attr::ReXNetEmotion7* | face-emotion-recognition-affectnet_7_vggface2_rexnet150.opt.tnnproto&tnnmodel | [face-emo...](https://github.com/HSE-asavchenko/face-emotion-recognition) | 30Mb |
-
-## Classification.
-
-
-
-
-| Class | Pretrained TNN Files | Rename or Converted From (Repo) | Size |
-|:-------------------------------------------------:|:-------------------------------------------------:|:------------------------------------------------------------:|:-----:|
-| *lite::tnn::cv::classification:EfficientNetLite4* | efficientnet-lite4-11.opt.tnnproto&tnnmodel | [onnx-models](https://github.com/onnx/models) | 49Mb |
-| *lite::tnn::cv::classification::ShuffleNetV2* | shufflenet-v2-10.opt.tnnproto&tnnmodel | [onnx-models](https://github.com/onnx/models) | 8.7Mb |
-| *lite::tnn::cv::classification::DenseNet121* | densenet121.opt.tnnproto&tnnmodel | [torchvision](https://github.com/pytorch/vision) | 30Mb |
-| *lite::tnn::cv::classification::GhostNet* | ghostnet.opt.tnnproto&tnnmodel | [torchvision](https://github.com/pytorch/vision) | 20Mb |
-| *lite::tnn::cv::classification::HdrDNet* | hardnet.opt.tnnproto&tnnmodel | [torchvision](https://github.com/pytorch/vision) | 13Mb |
-| *lite::tnn::cv::classification::IBNNet* | ibnnet18.opt.tnnproto&tnnmodel | [torchvision](https://github.com/pytorch/vision) | 97Mb |
-| *lite::tnn::cv::classification::MobileNetV2* | mobilenetv2.opt.tnnproto&tnnmodel | [torchvision](https://github.com/pytorch/vision) | 13Mb |
-| *lite::tnn::cv::classification::ResNet* | resnet18.opt.tnnproto&tnnmodel | [torchvision](https://github.com/pytorch/vision) | 44Mb |
-| *lite::tnn::cv::classification::ResNeXt* | resnext.opt.tnnproto&tnnmodel | [torchvision](https://github.com/pytorch/vision) | 95Mb |
-| *lite::tnn::cv::classification::InsectID* | quarrying_insect_identifier.opt.tnnproto&tnnmodel | [InsectID](https://github.com/quarrying/quarrying-insect-id) | 27Mb |
-| *lite::tnn::cv::classification:PlantID* | quarrying_planted_model.opt.tnnproto&tnnmodel | [PlantID](https://github.com/quarrying/quarrying-plant-id) | 30Mb |
-
-
-## Segmentation.
-
-
-
-
-| Class | Pretrained TNN Files | Rename or Converted From (Repo) | Size |
-|:-------------------------------------------------:|:----------------------------------------------:|:--------------------------------------------------------------------------:|:-----:|
-| *lite::tnn::cv::segmentation::DeepLabV3ResNet101* | deeplabv3_resnet101_coco.opt.tnnproto&tnnmodel | [torchvision](https://github.com/pytorch/vision) | 232Mb |
-| *lite::tnn::cv::segmentation::FCNResNet101* | fcn_resnet101.opt.tnnproto&tnnmodel | [torchvision](https://github.com/pytorch/vision) | 207Mb |
-| *lite::tnn::cv::segmentation::HeadSeg* | minivision_head_seg.opt.tnnproto&cmodel | [photo2cartoon](https://github.com/minivision-ai/photo2cartoon) | 31Mb |
-| *lite::tnn::cv::segmentation::FaceParsingBiSeNet* | face_parsing_512x512.opt.tnnproto&cmodel | [face-parsing.PyTorch](https://github.com/zllrunning/face-parsing.PyTorch) | 50M |
-| *lite::tnn::cv::segmentation::FaceParsingBiSeNet* | face_parsing_1024x1024.opt.tnnproto&cmodel | [face-parsing.PyTorch](https://github.com/zllrunning/face-parsing.PyTorch) | 50M |
-
-
-
-## Style Transfer.
-
-
-
-| Class | Pretrained TNN Files | Rename or Converted From (Repo) | Size |
-|:-------------------------------------------:|:-----------------------------------------------------:|:---------------------------------------------------------------:|:-----:|
-| *lite::tnn::cv::style::FastStyleTransfer* | style-mosaic-8.opt.tnnproto&tnnmodel | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::tnn::cv::style::FastStyleTransfer* | style-candy-9.opt.tnnproto&tnnmodel | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::tnn::cv::style::FastStyleTransfer* | style-udnie-8.opt.tnnproto&tnnmodel | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::tnn::cv::style::FastStyleTransfer* | style-udnie-9.opt.tnnproto&tnnmodel | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::tnn::cv::style::FastStyleTransfer* | style-pointilism-8.opt.tnnproto&tnnmodel | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::tnn::cv::style::FastStyleTransfer* | style-pointilism-9.opt.tnnproto&tnnmodel | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::tnn::cv::style::FastStyleTransfer* | style-rain-princess-9.opt.tnnproto&tnnmodel | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::tnn::cv::style::FastStyleTransfer* | style-rain-princess-8.opt.tnnproto&tnnmodel | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::tnn::cv::style::FastStyleTransfer* | style-candy-8.opt.tnnproto&tnnmodel | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::tnn::cv::style::FastStyleTransfer* | style-mosaic-9.opt.tnnproto&tnnmodel | [onnx-models](https://github.com/onnx/models) | 6.4Mb |
-| *lite::tnn::cv::style::FemalePhoto2Cartoon* | minivision_female_photo2cartoon.opt.tnnproto&tnnmodel | [photo2cartoon](https://github.com/minivision-ai/photo2cartoon) | 15Mb |
-
-
-## Colorization.
-
-
-
-| Class | Pretrained TNN Files | Rename or Converted From (Repo) | Size |
-|:----------------------------------------:|:------------------------------------------:|:---------------------------------------------------------:|:-----:|
-| *lite::tnn::cv::colorization::Colorizer* | eccv16-colorizer.opt.tnnproto&tnnmodel | [colorization](https://github.com/richzhang/colorization) | 123Mb |
-| *lite::tnn::cv::colorization::Colorizer* | siggraph17-colorizer.opt.tnnproto&tnnmodel | [colorization](https://github.com/richzhang/colorization) | 129Mb |
-
-
-## Super Resolution.
-
-
-
-| Class | Pretrained TNN Files | Rename or Converted From (Repo) | Size |
-|:----------------------------------------:|:----------------------------------:|:---------------------------------------------------------:|:-----:|
-| *lite::tnn::cv::resolution::SubPixelCNN* | subpixel-cnn.opt.tnnproto&tnnmodel | [...PIXEL...](https://github.com/niazwazir/SUB_PIXEL_CNN) | 234Kb |
-
-
-#
\ No newline at end of file
diff --git a/examples/lite/CMakeLists.txt b/examples/lite/CMakeLists.txt
index b8b90c53..d32c09ef 100644
--- a/examples/lite/CMakeLists.txt
+++ b/examples/lite/CMakeLists.txt
@@ -108,7 +108,10 @@ add_lite_executable(lite_face_68landmarks cv)
add_lite_executable(lite_face_recognizer cv)
add_lite_executable(lite_face_swap cv)
add_lite_executable(lite_face_restoration cv)
+add_lite_executable(lite_face_restoration_bench cv)
add_lite_executable(lite_facefusion_pipeline cv)
+add_lite_executable(lite_facefusion_cli cv)
+add_lite_executable(lite_facefusion_pipeline_bench cv)
add_lite_executable(lite_yolov8 cv)
add_lite_executable(lite_yolov11 cv)
add_lite_executable(lite_sd_pipeline sd)
diff --git a/examples/lite/cv/test_lite_face_restoration_bench.cpp b/examples/lite/cv/test_lite_face_restoration_bench.cpp
new file mode 100644
index 00000000..644e4521
--- /dev/null
+++ b/examples/lite/cv/test_lite_face_restoration_bench.cpp
@@ -0,0 +1,110 @@
+//
+// End-to-end benchmark for the GFPGAN face-restoration stage (Phase 0).
+// Usage:
+// lite_face_restoration_bench [engine_path] [test_img] [iters] [warmup] [csv]
+// Defaults point at a gfpgan engine + a test image on the remote 4090; override via argv.
+//
+// It first runs a CPU-vs-GPU paste_back equivalence check, then a compute-only
+// latency/throughput benchmark of restore() with per-stage aggregation
+// (preprocess / infer / postprocess / paste_back). Disk I/O (imwrite) is kept
+// out of the timed loop; one result image is saved afterwards for visual checking.
+//
+#include "lite/lite.h"
+#include "lite/bench/profiler.h"
+
+#ifdef ENABLE_TENSORRT
+#include "lite/trt/cv/trt_face_restoration.h"
+#include "lite/ort/cv/face_utils.h"
+#include "lite/trt/kernel/paste_back_manager.h"
+
+// A/B numerical check: per-pixel difference between the GPU fused paste_back and the
+// CPU reference, on the same real inputs (real affine + real crop).
+static void check_paste_back_equivalence(const cv::Mat &frame,
+ std::vector &lmk5) {
+ // Run the real warp to obtain the real affine + real 512 crop (uint8), then to float (as in the pipeline)
+ cv::Mat crop_u8, affine;
+ std::tie(crop_u8, affine) =
+ face_utils::warp_face_by_face_landmark_5(frame, lmk5, face_utils::FFHQ_512);
+ cv::Mat crop_f;
+ crop_u8.convertTo(crop_f, CV_32FC3);
+ cv::Mat mask = face_utils::create_static_box_mask({512, 512});
+
+ cv::Mat out_cpu = launch_paste_back(frame, crop_f, mask, affine);
+ PasteBackGPU gpu;
+ cv::Mat out_gpu = gpu.paste_back(frame, crop_f, mask, affine, nullptr);
+
+ cv::Mat diff;
+ cv::absdiff(out_cpu, out_gpu, diff);
+ cv::Scalar mean_diff = cv::mean(diff);
+ double max_diff = 0.0;
+ cv::minMaxLoc(diff.reshape(1), nullptr, &max_diff);
+ std::cout << "[check] paste_back CPU vs GPU max|diff|=" << max_diff
+ << " mean|diff|(B,G,R)=" << mean_diff[0] << "," << mean_diff[1]
+ << "," << mean_diff[2] << " (uint8 pixel values, smaller = closer)" << std::endl;
+}
+#endif
+
+int main(__unused int argc, __unused char *argv[]) {
+#ifdef ENABLE_TENSORRT
+ std::string engine_path =
+ argc > 1 ? argv[1] : "/root/autodl-tmp/gfpgan_proj/gfpgan_fp32.engine";
+ std::string test_img_path =
+ argc > 2 ? argv[2] : "../../../examples/lite/resources/test_lite_face_restoration.jpg";
+ int iters = argc > 3 ? std::atoi(argv[3]) : 50;
+ int warmup = argc > 4 ? std::atoi(argv[4]) : 10;
+ std::string csv_path = argc > 5 ? argv[5] : "bench_face_restoration.csv";
+
+ // Fixed 5-point landmarks (same as test_lite_face_restoration.cpp); the benchmark only
+ // cares about timing, so whether they exactly match the image does not affect the numbers.
+ std::vector face_landmark_5 = {
+ cv::Point2f(569.092041f, 398.845886f),
+ cv::Point2f(701.891724f, 399.156677f),
+ cv::Point2f(634.767212f, 482.927216f),
+ cv::Point2f(584.270996f, 543.294617f),
+ cv::Point2f(684.877991f, 543.067078f)};
+
+ cv::Mat img_bgr = cv::imread(test_img_path);
+ if (img_bgr.empty()) {
+ std::cerr << "[bench] cannot read test image: " << test_img_path << std::endl;
+ return 1;
+ }
+
+ std::cout << "[bench] engine=" << engine_path << "\n[bench] img="
+ << test_img_path << " (" << img_bgr.cols << "x" << img_bgr.rows
+ << ")\n[bench] warmup=" << warmup << " iters=" << iters << std::endl;
+
+ // Numerical correctness check (CPU vs GPU paste_back) before benchmarking
+ check_paste_back_equivalence(img_bgr, face_landmark_5);
+
+ trtcv::TRTFaceFusionFaceRestoration restorer(engine_path);
+ const std::string tmp_out = "/tmp/bench_restoration_out.jpg";
+
+ // Warmup (first runs include lazy engine/context init and cudnn autotune; excluded from stats)
+ for (int i = 0; i < warmup; ++i) {
+ restorer.restore(img_bgr, face_landmark_5, nullptr);
+ }
+
+ // Timed: restore() does not write to disk; the profiler collects per-stage timings
+ // (preprocess/infer/postprocess/paste_back) and the end-to-end TOTAL. imwrite is moved
+ // out of the loop; one image is saved at the end for visual verification.
+ lite::bench::Profiler prof;
+ cv::Mat dst;
+ for (int i = 0; i < iters; ++i) {
+ lite::bench::CpuTimer t;
+ t.start();
+ dst = restorer.restore(img_bgr, face_landmark_5, &prof);
+ prof.tick(t.stop_ms());
+ }
+
+ prof.report("GFPGAN face restoration (compute-only, no disk I/O)");
+ prof.to_csv(csv_path);
+
+ if (!dst.empty()) {
+ cv::imwrite(tmp_out, dst);
+ std::cout << "[bench] sample result (saved once, outside the loop): " << tmp_out << std::endl;
+ }
+#else
+ std::cerr << "This benchmark requires ENABLE_TENSORRT=ON." << std::endl;
+#endif
+ return 0;
+}
diff --git a/examples/lite/cv/test_lite_facefusion_cli.cpp b/examples/lite/cv/test_lite_facefusion_cli.cpp
new file mode 100644
index 00000000..5984604a
--- /dev/null
+++ b/examples/lite/cv/test_lite_facefusion_cli.cpp
@@ -0,0 +1,83 @@
+//
+// FaceFusion face-swap pipeline โ out-of-box CLI runner (TensorRT).
+//
+// Unlike the other examples, this one takes every path from argv so you can run
+// the flagship pipeline on your own images without editing/recompiling source.
+//
+// lite_facefusion_cli [src_face_idx] [tgt_face_idx]
+//
+// `engine_dir` must contain the 5 TensorRT engines (build them once from ONNX with
+// ./build_facefusion_engines.sh). See docs/facefusion_quickstart.md.
+//
+#include "lite/lite.h"
+#include
+#include
+#include
+
+// Default engine filenames expected inside .
+static const char *kFaceDetectEngine = "yoloface_8n_fp16.engine";
+static const char *kFaceLandmarksEngine = "2dfan4_fp16.engine";
+static const char *kFaceRecognizerEngine = "arcface_w600k_r50_fp16.engine";
+static const char *kFaceSwapEngine = "inswapper_128_fp16.engine";
+// Mixed-precision GFPGAN (style layers FP32, rest FP16) โ clean + ~3 ms faster than plain FP32.
+// Falls back to the plain FP32 engine name if the mixed one isn't present.
+static const char *kFaceRestoreEngine = "gfpgan_1.4_mixed.engine";
+static const char *kFaceRestoreEngineFp32 = "gfpgan_1.4_fp32.engine";
+
+static void usage(const char *prog)
+{
+ std::cout
+ << "Usage: " << prog
+ << " [src_face_idx=0] [tgt_face_idx=0]\n\n"
+ << " engine_dir directory holding the 5 TensorRT engines:\n"
+ << " " << kFaceDetectEngine << ", " << kFaceLandmarksEngine << ",\n"
+ << " " << kFaceRecognizerEngine << ", " << kFaceSwapEngine << ", "
+ << kFaceRestoreEngine << "\n"
+ << " source_img image whose face is taken\n"
+ << " target_img image whose face is replaced\n"
+ << " output_img where to write the swapped result\n";
+}
+
+int main(int argc, char *argv[])
+{
+#ifdef ENABLE_TENSORRT
+ if (argc < 5)
+ {
+ usage(argv[0]);
+ return 1;
+ }
+ const std::string engine_dir = argv[1];
+ const std::string source_img = argv[2];
+ const std::string target_img = argv[3];
+ const std::string output_img = argv[4];
+ const int src_idx = (argc > 5) ? std::stoi(argv[5]) : 0;
+ const int tgt_idx = (argc > 6) ? std::stoi(argv[6]) : 0;
+
+ const std::string sep =
+ (engine_dir.empty() || engine_dir.back() == '/') ? "" : "/";
+ auto engine = [&](const char *name) { return engine_dir + sep + name; };
+
+ // Prefer the mixed-precision restoration engine; fall back to plain FP32 if only that exists.
+ std::string restore_engine = engine(kFaceRestoreEngine);
+ {
+ std::ifstream f(restore_engine);
+ if (!f.good()) restore_engine = engine(kFaceRestoreEngineFp32);
+ }
+
+ auto pipeline = lite::trt::cv::face::swap::FaceFusionPipeLine(
+ engine(kFaceDetectEngine),
+ engine(kFaceLandmarksEngine),
+ engine(kFaceRecognizerEngine),
+ engine(kFaceSwapEngine),
+ restore_engine);
+
+ pipeline.detect(source_img, src_idx, target_img, tgt_idx, output_img);
+ std::cout << "[FaceFusion] wrote: " << output_img << std::endl;
+ return 0;
+#else
+ (void) argc;
+ (void) argv;
+ std::cerr << "This binary needs the TensorRT backend. Rebuild with: bash ./build.sh tensorrt\n";
+ return 1;
+#endif
+}
diff --git a/examples/lite/cv/test_lite_facefusion_pipeline_bench.cpp b/examples/lite/cv/test_lite_facefusion_pipeline_bench.cpp
new file mode 100644
index 00000000..98b07bcd
--- /dev/null
+++ b/examples/lite/cv/test_lite_facefusion_pipeline_bench.cpp
@@ -0,0 +1,98 @@
+//
+// Whole-pipeline benchmark for the FaceFusion face-swap pipeline.
+// lite_facefusion_pipeline_bench \
+// \
+// [iters=30] [warmup=5] [csv]
+//
+// Profiles the pipeline into per-stage times (imread / detect / landmark โ each x2 for
+// source+target โ / recognizer / swap / restoration) so we can see where the end-to-end
+// time actually goes BEFORE optimizing anything. Each stage returns a host-visible result,
+// so CPU-side timing is accurate.
+//
+// NOTE: the "restoration" stage here includes the final imwrite (the pipeline writes the
+// result to disk), so it reads a bit higher than the compute-only restoration bench.
+//
+#include "lite/lite.h"
+#include "lite/bench/profiler.h"
+#include
+#include
+#include
+
+#ifdef ENABLE_TENSORRT
+int main(int argc, char *argv[]) {
+ if (argc < 8) {
+ std::cout << "Usage: " << argv[0]
+ << " "
+ " [iters=30] [warmup=5] [csv]\n";
+ return 1;
+ }
+ const std::string detect_engine = argv[1];
+ const std::string landmark_engine = argv[2];
+ const std::string recognizer_engine = argv[3];
+ const std::string swap_engine = argv[4];
+ const std::string restoration_engine = argv[5];
+ const std::string source_img = argv[6];
+ const std::string target_img = argv[7];
+ const int iters = argc > 8 ? std::atoi(argv[8]) : 30;
+ const int warmup = argc > 9 ? std::atoi(argv[9]) : 5;
+ const std::string csv_path = argc > 10 ? argv[10] : "bench_facefusion_pipeline.csv";
+
+ const std::string out_path = "/tmp/bench_facefusion_out.jpg";
+
+ lite::trt::cv::face::swap::FaceFusionPipeLine pipeline(
+ detect_engine, landmark_engine, recognizer_engine, swap_engine, restoration_engine);
+
+ // Decode the two images ONCE, outside the timed loop. Real pipelines (video /
+ // server) decode at the edge, not per frame; keeping imread/imwrite out of the
+ // loop is what makes this a *compute-only* benchmark (the file-path detect()
+ // overload would re-read both images and write the result every iteration).
+ cv::Mat src = cv::imread(source_img);
+ cv::Mat tgt = cv::imread(target_img);
+ if (src.empty() || tgt.empty()) {
+ std::cerr << "[bench] cannot read source/target image" << std::endl;
+ return 1;
+ }
+ std::cout << "[bench] source=" << source_img << " target=" << target_img
+ << "\n[bench] warmup=" << warmup << " iters=" << iters
+ << " (compute-only, video-style: prepare_source once + per-frame process)" << std::endl;
+
+ // Video / server use case: the SOURCE face is fixed, so prepare it ONCE and then time only
+ // the per-frame process(target). This is what the source-embedding cache buys โ the loop no
+ // longer re-runs detect_src / landmark_src / recognizer every frame.
+ pipeline.prepare_source(src, 0);
+
+ // Warmup (lazy engine/context init, cudnn autotune) โ excluded from stats.
+ for (int i = 0; i < warmup; ++i)
+ pipeline.process(tgt, 0);
+
+ lite::bench::Profiler prof;
+ cv::Mat out;
+ for (int i = 0; i < iters; ++i) {
+ // Sanity: GPU memory should stay flat across iterations (no leak / no
+ // per-call buffer growth). Printed sparsely to avoid flooding the output.
+ if (i == 0 || i == iters - 1 || i % 10 == 0) {
+ size_t freeB = 0, totalB = 0;
+ cudaMemGetInfo(&freeB, &totalB);
+ std::cout << "[mem] iter " << i << " used=" << (totalB - freeB) / (1024 * 1024)
+ << " MiB" << std::endl;
+ }
+ lite::bench::CpuTimer t;
+ t.start();
+ out = pipeline.process(tgt, 0, &prof);
+ prof.tick(t.stop_ms());
+ }
+
+ prof.report("FaceFusion pipeline (per-frame, source cached)");
+ prof.to_csv(csv_path);
+ if (!out.empty()) {
+ cv::imwrite(out_path, out); // save one result (outside the timed loop) for visual check
+ std::cout << "[bench] sample result: " << out_path << std::endl;
+ }
+ return 0;
+}
+#else
+int main() {
+ std::cerr << "This benchmark requires ENABLE_TENSORRT=ON.\n";
+ return 0;
+}
+#endif
diff --git a/examples/lite/cv/test_lite_facefusion_pipeline_gpu.cpp b/examples/lite/cv/test_lite_facefusion_pipeline_gpu.cpp
deleted file mode 100644
index 8a11aca5..00000000
--- a/examples/lite/cv/test_lite_facefusion_pipeline_gpu.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-//
-// Created by wangzijian on 3/5/25.
-//
-#include "lite/trt/cv/trt_facefusion_pipeline_gpu.h"
-
-void test_default(){
- std::string face_swap_onnx_path = "/home/lite.ai.toolkit/examples/hub/trt/inswapper_128_fp16.engine";
- std::string face_detect_onnx_path = "/home/lite.ai.toolkit/examples/hub/trt/yoloface_8n_fp16.engine";
- std::string face_landmarks_68 = "/home/lite.ai.toolkit/examples/hub/trt/2dfan4_fp16.engine";
- std::string face_recognizer_onnx_path = "/home/lite.ai.toolkit/examples/hub/trt/arcface_w600k_r50_fp16.engine";
- std::string face_restoration_onnx_path = "/home/lite.ai.toolkit/examples/hub/trt/gfpgan_1.4_fp32.engine";
- std::vector model_list{face_swap_onnx_path,face_detect_onnx_path,face_landmarks_68,
- face_recognizer_onnx_path,face_restoration_onnx_path};
-
- trt_facefusion_pipeline_gpu test(model_list);
- cv::Mat test1 = cv::imread("/home/lite.ai.toolkit/1.jpg");
- cv::Mat test2;
-
- test.detect(test1,test2,1,2);
-}
-
-
-int main(){
- test_default();
-}
\ No newline at end of file
diff --git a/lite/bench/profiler.h b/lite/bench/profiler.h
new file mode 100644
index 00000000..78ad6a89
--- /dev/null
+++ b/lite/bench/profiler.h
@@ -0,0 +1,273 @@
+//
+// lite.ai.toolkit unified benchmark / timing utility (header-only, backend-agnostic)
+//
+// Goals:
+// * cross-platform, header-only, no dependency on any specific inference backend;
+// * CPU stages timed with std::chrono; GPU stages timed with cudaEvent
+// (so asynchronous calls are measured correctly, not via wall-clock);
+// * aggregate many samples into mean/p50/p90/p99/min/max and end-to-end FPS,
+// with optional CSV export.
+//
+// Typical usage:
+// lite::bench::Profiler prof;
+// for (int i = 0; i < N; ++i) {
+// lite::bench::CpuTimer total; total.start();
+// { LITE_CPU_SCOPE(prof, "preprocess"); /* ... */ }
+// { LITE_GPU_SCOPE(prof, "inference", stream); /* enqueueV3 ... */ }
+// { LITE_CPU_SCOPE(prof, "postprocess"); /* ... */ }
+// prof.tick(total.stop_ms()); // record one full iteration for FPS
+// }
+// prof.report("FaceFusion pipeline");
+// prof.to_csv("bench_facefusion.csv");
+//
+#ifndef LITE_AI_TOOLKIT_BENCH_PROFILER_H
+#define LITE_AI_TOOLKIT_BENCH_PROFILER_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#if defined(ENABLE_TENSORRT) || defined(__CUDACC__)
+#include
+#define LITE_BENCH_WITH_CUDA 1
+#endif
+
+namespace lite {
+namespace bench {
+
+// Aggregated stats for a single stage (unit: ms)
+struct Stat {
+ std::size_t calls = 0;
+ double mean = 0, p50 = 0, p90 = 0, p99 = 0, min = 0, max = 0;
+
+ static Stat from(std::vector v) {
+ Stat s;
+ if (v.empty()) return s;
+ std::sort(v.begin(), v.end());
+ s.calls = v.size();
+ s.min = v.front();
+ s.max = v.back();
+ s.mean = std::accumulate(v.begin(), v.end(), 0.0) / static_cast(v.size());
+ s.p50 = percentile(v, 50);
+ s.p90 = percentile(v, 90);
+ s.p99 = percentile(v, 99);
+ return s;
+ }
+
+ private:
+ // v must be sorted ascending; nearest-rank percentile
+ static double percentile(const std::vector &v, double p) {
+ if (v.empty()) return 0.0;
+ double rank = (p / 100.0) * static_cast(v.size() - 1);
+ auto idx = static_cast(std::llround(rank));
+ if (idx >= v.size()) idx = v.size() - 1;
+ return v[idx];
+ }
+};
+
+class Profiler {
+ public:
+ // Record one sample (ms) for a stage
+ void add(const std::string &stage, double ms) {
+ auto it = samples_.find(stage);
+ if (it == samples_.end()) {
+ order_.push_back(stage);
+ samples_[stage].push_back(ms);
+ } else {
+ it->second.push_back(ms);
+ }
+ }
+
+ // Record one full-iteration end-to-end latency (used to compute FPS)
+ void tick(double ms) { add(kTotal, ms); }
+
+ void clear() {
+ order_.clear();
+ samples_.clear();
+ }
+
+ // Print an aligned table; the caller is responsible for excluding warmup samples
+ void report(const std::string &title, std::ostream &os = std::cout) const {
+ os << "\n==================== Benchmark: " << title
+ << " ====================\n";
+ os << std::left << std::setw(18) << "stage" << std::right << std::setw(8)
+ << "calls" << std::setw(11) << "mean(ms)" << std::setw(11) << "p50"
+ << std::setw(11) << "p90" << std::setw(11) << "p99" << std::setw(11)
+ << "min" << std::setw(11) << "max" << "\n";
+ os << std::string(92, '-') << "\n";
+ for (const auto &stage : order_) {
+ if (stage == kTotal) continue;
+ print_row(os, stage, Stat::from(samples_.at(stage)));
+ }
+ auto it = samples_.find(kTotal);
+ if (it != samples_.end()) {
+ os << std::string(92, '-') << "\n";
+ Stat t = Stat::from(it->second);
+ print_row(os, "TOTAL", t);
+ if (t.mean > 0.0)
+ os << " -> throughput: " << std::fixed << std::setprecision(2)
+ << (1000.0 / t.mean) << " FPS (by mean), " << (1000.0 / t.p50)
+ << " FPS (by p50)\n";
+ }
+ os << std::string(92, '=') << "\n";
+ }
+
+ // Export CSV (stage,calls,mean,p50,p90,p99,min,max)
+ void to_csv(const std::string &path) const {
+ std::ofstream f(path);
+ if (!f) {
+ std::cerr << "[profiler] cannot write CSV: " << path << std::endl;
+ return;
+ }
+ f << "stage,calls,mean_ms,p50_ms,p90_ms,p99_ms,min_ms,max_ms\n";
+ for (const auto &stage : order_) {
+ Stat s = Stat::from(samples_.at(stage));
+ const char *name = (stage == kTotal) ? "TOTAL" : stage.c_str();
+ f << name << "," << s.calls << "," << s.mean << "," << s.p50 << ","
+ << s.p90 << "," << s.p99 << "," << s.min << "," << s.max << "\n";
+ }
+ std::cout << "[profiler] CSV written: " << path << std::endl;
+ }
+
+ Stat stat(const std::string &stage) const {
+ auto it = samples_.find(stage);
+ return it == samples_.end() ? Stat{} : Stat::from(it->second);
+ }
+
+ private:
+ static constexpr const char *kTotal = "__total__";
+
+ static void print_row(std::ostream &os, const std::string &name,
+ const Stat &s) {
+ os << std::left << std::setw(18) << name << std::right << std::setw(8)
+ << s.calls << std::fixed << std::setprecision(3) << std::setw(11)
+ << s.mean << std::setw(11) << s.p50 << std::setw(11) << s.p90
+ << std::setw(11) << s.p99 << std::setw(11) << s.min << std::setw(11)
+ << s.max << "\n";
+ }
+
+ std::vector order_;
+ std::unordered_map> samples_;
+};
+
+// ---------------- CPU timing (chrono) ----------------
+class CpuTimer {
+ public:
+ void start() { t0_ = clock::now(); }
+ double stop_ms() const {
+ return std::chrono::duration(clock::now() - t0_).count();
+ }
+
+ private:
+ using clock = std::chrono::high_resolution_clock;
+ clock::time_point t0_ = clock::now();
+};
+
+// RAII: record CPU elapsed time into the profiler on scope exit
+class ScopedCpuTimer {
+ public:
+ ScopedCpuTimer(Profiler &p, std::string stage)
+ : prof_(p), stage_(std::move(stage)) {
+ timer_.start();
+ }
+ ~ScopedCpuTimer() { prof_.add(stage_, timer_.stop_ms()); }
+
+ private:
+ Profiler &prof_;
+ std::string stage_;
+ CpuTimer timer_;
+};
+
+// Optional variant: when prof is nullptr it does nothing (zero overhead).
+// Used to instrument library code that is off by default and only on when benchmarking.
+class ScopedCpuTimerOpt {
+ public:
+ ScopedCpuTimerOpt(Profiler *p, std::string stage)
+ : prof_(p), stage_(std::move(stage)) {
+ if (prof_) timer_.start();
+ }
+ ~ScopedCpuTimerOpt() {
+ if (prof_) prof_->add(stage_, timer_.stop_ms());
+ }
+
+ private:
+ Profiler *prof_;
+ std::string stage_;
+ CpuTimer timer_;
+};
+
+#ifdef LITE_BENCH_WITH_CUDA
+// ---------------- GPU timing (cudaEvent) ----------------
+// Note: stop_ms() calls cudaEventSynchronize, so it serializes the stage; acceptable for benchmarking.
+class CudaTimer {
+ public:
+ CudaTimer() {
+ cudaEventCreate(&start_);
+ cudaEventCreate(&stop_);
+ }
+ ~CudaTimer() {
+ cudaEventDestroy(start_);
+ cudaEventDestroy(stop_);
+ }
+ void start(cudaStream_t stream = nullptr) {
+ stream_ = stream;
+ cudaEventRecord(start_, stream_);
+ }
+ float stop_ms() {
+ cudaEventRecord(stop_, stream_);
+ cudaEventSynchronize(stop_);
+ float ms = 0.f;
+ cudaEventElapsedTime(&ms, start_, stop_);
+ return ms;
+ }
+
+ private:
+ cudaEvent_t start_{}, stop_{};
+ cudaStream_t stream_ = nullptr;
+};
+
+// RAII: record GPU elapsed time (on the given stream) into the profiler on scope exit
+class ScopedCudaTimer {
+ public:
+ ScopedCudaTimer(Profiler &p, std::string stage, cudaStream_t stream = nullptr)
+ : prof_(p), stage_(std::move(stage)) {
+ timer_.start(stream);
+ }
+ ~ScopedCudaTimer() { prof_.add(stage_, timer_.stop_ms()); }
+
+ private:
+ Profiler &prof_;
+ std::string stage_;
+ CudaTimer timer_;
+};
+#endif // LITE_BENCH_WITH_CUDA
+
+} // namespace bench
+} // namespace lite
+
+// ---------------- convenience macros ----------------
+#define LITE_BENCH_CONCAT_(a, b) a##b
+#define LITE_BENCH_CONCAT(a, b) LITE_BENCH_CONCAT_(a, b)
+
+// Time the current scope on the CPU and record it into the profiler
+#define LITE_CPU_SCOPE(prof, name) \
+ lite::bench::ScopedCpuTimer LITE_BENCH_CONCAT(_lite_cpu_scope_, __LINE__)((prof), (name))
+
+// Optional variant taking a Profiler*; zero overhead when nullptr (for library instrumentation, off by default)
+#define LITE_CPU_SCOPE_OPT(profptr, name) \
+ lite::bench::ScopedCpuTimerOpt LITE_BENCH_CONCAT(_lite_cpu_scope_opt_, __LINE__)((profptr), (name))
+
+#ifdef LITE_BENCH_WITH_CUDA
+// Time the current scope on the GPU (given stream) and record it into the profiler
+#define LITE_GPU_SCOPE(prof, name, stream) \
+ lite::bench::ScopedCudaTimer LITE_BENCH_CONCAT(_lite_gpu_scope_, __LINE__)((prof), (name), (stream))
+#endif
+
+#endif // LITE_AI_TOOLKIT_BENCH_PROFILER_H
diff --git a/lite/config.h.in b/lite/config.h.in
index 6bed6b4a..51083521 100644
--- a/lite/config.h.in
+++ b/lite/config.h.in
@@ -3,9 +3,6 @@
#cmakedefine ENABLE_ONNXRUNTIME
#cmakedefine ENABLE_TENSORRT
-#cmakedefine ENABLE_MNN
-#cmakedefine ENABLE_NCNN
-#cmakedefine ENABLE_TNN
#cmakedefine ENABLE_ONNXRUNTIME_CUDA
#cmakedefine ENABLE_OPENCV_VIDEOIO
#cmakedefine ENABLE_DEBUG_STRING
diff --git a/lite/mnn/.gitignore b/lite/mnn/.gitignore
deleted file mode 100644
index e69de29b..00000000
diff --git a/lite/mnn/core/mnn_config.h b/lite/mnn/core/mnn_config.h
deleted file mode 100644
index 52c9c9b0..00000000
--- a/lite/mnn/core/mnn_config.h
+++ /dev/null
@@ -1,20 +0,0 @@
-//
-// Created by DefTruth on 2021/10/6.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CORE_MNN_CONFIG_H
-#define LITE_AI_TOOLKIT_MNN_CORE_MNN_CONFIG_H
-
-#include "mnn_defs.h"
-#include "lite/lite.ai.headers.h"
-
-#ifdef ENABLE_MNN
-#include "MNN/Interpreter.hpp"
-#include "MNN/MNNDefine.h"
-#include "MNN/Tensor.hpp"
-#include "MNN/ImageProcess.hpp"
-#endif
-
-namespace mnncore {}
-
-#endif //LITE_AI_TOOLKIT_MNN_CORE_MNN_CONFIG_H
diff --git a/lite/mnn/core/mnn_core.h b/lite/mnn/core/mnn_core.h
deleted file mode 100644
index 1d028023..00000000
--- a/lite/mnn/core/mnn_core.h
+++ /dev/null
@@ -1,114 +0,0 @@
-//
-// Created by DefTruth on 2021/10/6.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CORE_MNN_CORE_H
-#define LITE_AI_TOOLKIT_MNN_CORE_MNN_CORE_H
-
-#include "mnn_config.h"
-#include "mnn_handler.h"
-#include "mnn_types.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNNanoDet; // [0] * reference: https://github.com/RangiLyu/nanodet
- class LITE_EXPORTS MNNNanoDetEfficientNetLite; // [1] * reference: https://github.com/RangiLyu/nanodet
- class LITE_EXPORTS MNNRobustVideoMatting; // [2] * reference: https://github.com/PeterL1n/RobustVideoMatting
- class LITE_EXPORTS MNNYoloX; // [3] * reference: https://github.com/Megvii-BaseDetection/YOLOX
- class LITE_EXPORTS MNNYOLOP; // [4] * reference: https://github.com/hustvl/YOLOP
- class LITE_EXPORTS MNNYoloV5; // [5] * reference: https://github.com/ultralytics/yolov5
- class LITE_EXPORTS MNNYoloX_V_0_1_1; // [6] * reference: https://github.com/Megvii-BaseDetection/YOLOX
- class LITE_EXPORTS MNNYoloR; // [7] * reference: https://github.com/WongKinYiu/yolor
- class LITE_EXPORTS MNNYoloV5_V_6_0; // [8] * reference: https://github.com/ultralytics/yolov5
- class LITE_EXPORTS MNNGlintArcFace; // [9] * reference: https://github.com/deepinsight/insightface/tree/master/recognition/arcface_torch
- class LITE_EXPORTS MNNGlintCosFace; // [10] * reference: https://github.com/deepinsight/insightface/tree/master/recognition/arcface_torch
- class LITE_EXPORTS MNNGlintPartialFC; // [11] * reference: https://github.com/deepinsight/insightface/tree/master/recognition/partial_fc
- class LITE_EXPORTS MNNFaceNet; // [12] * reference: https://github.com/timesler/facenet-pytorch
- class LITE_EXPORTS MNNFocalArcFace; // [13] * reference: https://github.com/ZhaoJ9014/face.evoLVe.PyTorch
- class LITE_EXPORTS MNNFocalAsiaArcFace; // [14] * reference: https://github.com/ZhaoJ9014/face.evoLVe.PyTorch
- class LITE_EXPORTS MNNTencentCurricularFace; // [15] * reference: https://github.com/Tencent/TFace/tree/master/tasks/distfc
- class LITE_EXPORTS MNNTencentCifpFace; // [16] * reference: https://github.com/Tencent/TFace/tree/master/tasks/cifp
- class LITE_EXPORTS MNNCenterLossFace; // [17] * reference: https://github.com/louis-she/center-loss.pytorch
- class LITE_EXPORTS MNNSphereFace; // [18] * reference: https://github.com/clcarwin/sphereface_pytorch
- class LITE_EXPORTS MNNMobileFaceNet; // [19] * reference: https://github.com/Xiaoccer/MobileFaceNet_Pytorch
- class LITE_EXPORTS MNNCavaGhostArcFace; // [20] * reference: https://github.com/cavalleria/cavaface.pytorch
- class LITE_EXPORTS MNNCavaCombinedFace; // [21] * reference: https://github.com/cavalleria/cavaface.pytorch
- class LITE_EXPORTS MNNMobileSEFocalFace; // [22] * reference: https://github.com/grib0ed0v/face_recognition.pytorch
- class LITE_EXPORTS MNNUltraFace; // [23] * reference: https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB
- class LITE_EXPORTS MNNRetinaFace; // [24] * reference: https://github.com/biubug6/Pytorch_Retinaface
- class LITE_EXPORTS MNNFaceBoxes; // [25] * reference: https://github.com/zisianw/FaceBoxes.PyTorch
- class LITE_EXPORTS MNNPFLD; // [26] * reference: https://github.com/Hsintao/pfld_106_face_landmarks
- class LITE_EXPORTS MNNPFLD98; // [27] * reference: https://github.com/polarisZhao/PFLD-pytorch
- class LITE_EXPORTS MNNMobileNetV268; // [28] * reference: https://github.com/cunjian/pytorch_face_landmark
- class LITE_EXPORTS MNNMobileNetV2SE68; // [29] * reference: https://github.com/cunjian/pytorch_face_landmark
- class LITE_EXPORTS MNNPFLD68; // [30] * reference: https://github.com/cunjian/pytorch_face_landmark
- class LITE_EXPORTS MNNFaceLandmark1000; // [31] * reference: https://github.com/Single430/FaceLandmark1000
- class LITE_EXPORTS MNNFSANet; // [32] * reference: https://github.com/omasaht/headpose-fsanet-pytorch
- class LITE_EXPORTS MNNAgeGoogleNet; // [33] * reference: https://github.com/onnx/models/tree/master/vision/body_analysis/age_gender
- class LITE_EXPORTS MNNGenderGoogleNet; // [34] * reference: https://github.com/onnx/models/tree/master/vision/body_analysis/age_gender
- class LITE_EXPORTS MNNEmotionFerPlus; // [35] * reference: https://github.com/onnx/models/blob/master/vision/body_analysis/emotion_ferplus
- class LITE_EXPORTS MNNSSRNet; // [36] * reference: https://github.com/oukohou/SSR_Net_Pytorch
- class LITE_EXPORTS MNNEfficientEmotion7; // [37] * reference: https://github.com/HSE-asavchenko/face-emotion-recognition
- class LITE_EXPORTS MNNEfficientEmotion8; // [38] * reference: https://github.com/HSE-asavchenko/face-emotion-recognition
- class LITE_EXPORTS MNNMobileEmotion7; // [39] * reference: https://github.com/HSE-asavchenko/face-emotion-recognition
- class LITE_EXPORTS MNNReXNetEmotion7; // [40] * reference: https://github.com/HSE-asavchenko/face-emotion-recognition
- class LITE_EXPORTS MNNEfficientNetLite4; // [41] * reference: https://github.com/onnx/models/blob/master/vision/classification/efficientnet-lite4
- class LITE_EXPORTS MNNShuffleNetV2; // [42] * reference: https://github.com/onnx/models/blob/master/vision/classification/shufflenet
- class LITE_EXPORTS MNNDenseNet; // [43] * reference: https://pytorch.org/hub/pytorch_vision_densenet/
- class LITE_EXPORTS MNNGhostNet; // [44] * reference๏ผhttps://pytorch.org/hub/pytorch_vision_ghostnet/
- class LITE_EXPORTS MNNHdrDNet; // [45] * reference: https://pytorch.org/hub/pytorch_vision_hardnet/
- class LITE_EXPORTS MNNIBNNet; // [46] * reference: https://pytorch.org/hub/pytorch_vision_ibnnet/
- class LITE_EXPORTS MNNMobileNetV2; // [47] * reference: https://pytorch.org/hub/pytorch_vision_mobilenet_v2/
- class LITE_EXPORTS MNNResNet; // [48] * reference: https://pytorch.org/hub/pytorch_vision_resnet/
- class LITE_EXPORTS MNNResNeXt; // [49] * reference: https://pytorch.org/hub/pytorch_vision_resnext/
- class LITE_EXPORTS MNNFastStyleTransfer; // [50] * reference: https://github.com/onnx/models/blob/master/vision/style_transfer/fast_neural_style
- class LITE_EXPORTS MNNColorizer; // [51] * reference: https://github.com/richzhang/colorization
- class LITE_EXPORTS MNNSubPixelCNN; // [52] * reference: https://github.com/niazwazir/SUB_PIXEL_CNN
- class LITE_EXPORTS MNNDeepLabV3ResNet101; // [53] * reference: https://pytorch.org/hub/pytorch_vision_deeplabv3_resnet101/
- class LITE_EXPORTS MNNFCNResNet101; // [54] * reference: https://pytorch.org/hub/pytorch_vision_fcn_resnet101/
- class LITE_EXPORTS MNNMGMatting; // [55] * reference: https://github.com/yucornetto/MGMatting
- class LITE_EXPORTS MNNNanoDetPlus; // [56] * reference: https://github.com/RangiLyu/nanodet
- class LITE_EXPORTS MNNSCRFD; // [57] * reference: https://github.com/deepinsight/insightface/tree/master/detection/scrfd
- class LITE_EXPORTS MNNYOLO5Face; // [58] * reference: https://github.com/deepcam-cn/yolov5-face
- class LITE_EXPORTS MNNFaceBoxesV2; // [59] * reference: https://github.com/jhb86253817/FaceBoxesV2
- class LITE_EXPORTS MNNPIPNet19; // [60] * reference: https://github.com/jhb86253817/PIPNet
- class LITE_EXPORTS MNNPIPNet29; // [61] * reference: https://github.com/jhb86253817/PIPNet
- class LITE_EXPORTS MNNPIPNet68; // [62] * reference: https://github.com/jhb86253817/PIPNet
- class LITE_EXPORTS MNNPIPNet98; // [63] * reference: https://github.com/jhb86253817/PIPNet
- class LITE_EXPORTS MNNInsectDet; // [64] * reference: https://github.com/quarrying/quarrying-insect-id
- class LITE_EXPORTS MNNInsectID; // [65] * reference: https://github.com/quarrying/quarrying-insect-id
- class LITE_EXPORTS MNNPlantID; // [66] * reference: https://github.com/quarrying/quarrying-plant-id
- class LITE_EXPORTS MNNMODNet; // [67] * reference: https://github.com/ZHKKKe/MODNet
- class LITE_EXPORTS MNNBackgroundMattingV2; // [68] * reference: https://github.com/PeterL1n/BackgroundMattingV2
- class LITE_EXPORTS MNNYOLOv5BlazeFace; // [69] * reference: https://github.com/deepcam-cn/yolov5-face
- class LITE_EXPORTS MNNYoloV5_V_6_1; // [70] * reference: https://github.com/ultralytics/yolov5/releases/tag/v6.1
- class LITE_EXPORTS MNNHeadSeg; // [71] * reference: https://github.com/minivision-ai/photo2cartoon
- class LITE_EXPORTS MNNFemalePhoto2Cartoon; // [72] * reference: https://github.com/minivision-ai/photo2cartoon
- class LITE_EXPORTS MNNFastPortraitSeg; // [73] * reference: https://github.com/YexingWan/Fast-Portrait-Segmentation
- class LITE_EXPORTS MNNPortraitSegExtremeC3Net; // [74] * reference: https://github.com/clovaai/ext_portrait_segmentation
- class LITE_EXPORTS MNNPortraitSegSINet; // [75] * reference: https://github.com/clovaai/ext_portrait_segmentation
- class LITE_EXPORTS MNNFaceHairSeg; // [76] * reference: https://github.com/kampta/face-seg
- class LITE_EXPORTS MNNHairSeg; // [77] * reference: https://github.com/akirasosa/mobile-semantic-segmentation
- class LITE_EXPORTS MNNMobileHumanMatting; // [78] * reference: https://github.com/lizhengwei1992/mobile_phone_human_matting
- class LITE_EXPORTS MNNYOLOv6; // [78] * reference: https://github.com/meituan/YOLOv6
- class LITE_EXPORTS MNNFaceParsingBiSeNet; // [79] * reference: https://github.com/zllrunning/face-parsing.PyTorch
- class LITE_EXPORTS MNNFaceMesh; // [80] * reference: https://github.com/google/mediapipe/tree/master/mediapipe/graphs/face_mesh
- class LITE_EXPORTS MNNIrisLandmarks; // [81] * reference: https://github.com/google/mediapipe/tree/master/mediapipe/graphs/iris_tracking
-}
-
-namespace mnncv
-{
- using mnncore::BasicMNNHandler;
-}
-
-namespace mnnnlp
-{
- using mnncore::BasicMNNHandler;
-}
-
-namespace mnnasr
-{
- using mnncore::BasicMNNHandler;
-}
-
-#endif //LITE_AI_TOOLKIT_MNN_CORE_MNN_CORE_H
diff --git a/lite/mnn/core/mnn_defs.h b/lite/mnn/core/mnn_defs.h
deleted file mode 100644
index be2f5abb..00000000
--- a/lite/mnn/core/mnn_defs.h
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// Created by DefTruth on 2021/10/6.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CORE_MNN_DEFS_H
-#define LITE_AI_TOOLKIT_MNN_CORE_MNN_DEFS_H
-
-#include "lite/config.h"
-#include "lite/lite.ai.defs.h"
-
-#ifdef ENABLE_DEBUG_STRING
-# define LITEMNN_DEBUG 1
-#else
-# define LITEMNN_DEBUG 0
-#endif
-
-
-#ifdef LITE_WIN32
-# ifndef NOMINMAX
-# define NOMINMAX
-# endif
-#endif
-
-#endif //LITE_AI_TOOLKIT_MNN_CORE_MNN_DEFS_H
diff --git a/lite/mnn/core/mnn_handler.cpp b/lite/mnn/core/mnn_handler.cpp
deleted file mode 100644
index d1d75f2c..00000000
--- a/lite/mnn/core/mnn_handler.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-//
-// Created by DefTruth on 2021/10/6.
-//
-
-#include "mnn_handler.h"
-
-using mnncore::BasicMNNHandler;
-
-BasicMNNHandler::BasicMNNHandler(
- const std::string &_mnn_path, unsigned int _num_threads) :
- log_id(_mnn_path.data()), mnn_path(_mnn_path.data()),
- num_threads(_num_threads)
-{
- initialize_handler();
-}
-
-void BasicMNNHandler::initialize_handler()
-{
- // 1. init interpreter
- mnn_interpreter = std::shared_ptr(MNN::Interpreter::createFromFile(mnn_path));
- // 2. init schedule_config
- schedule_config.numThread = (int) num_threads;
- MNN::BackendConfig backend_config;
- backend_config.precision = MNN::BackendConfig::Precision_High; // default Precision_High
- schedule_config.backendConfig = &backend_config;
- // 3. create session
- mnn_session = mnn_interpreter->createSession(schedule_config);
- // 4. init input tensor
- input_tensor = mnn_interpreter->getSessionInput(mnn_session, nullptr);
- // 5. init input dims
- input_batch = input_tensor->batch();
- input_channel = input_tensor->channel();
- input_height = input_tensor->height();
- input_width = input_tensor->width();
- dimension_type = input_tensor->getDimensionType();
- // 6. resize tensor & session needed ???
- if (dimension_type == MNN::Tensor::CAFFE)
- {
- // NCHW
- mnn_interpreter->resizeTensor(
- input_tensor, {input_batch, input_channel, input_height, input_width});
- mnn_interpreter->resizeSession(mnn_session);
- } // NHWC
- else if (dimension_type == MNN::Tensor::TENSORFLOW)
- {
- mnn_interpreter->resizeTensor(
- input_tensor, {input_batch, input_height, input_width, input_channel});
- mnn_interpreter->resizeSession(mnn_session);
- } // NC4HW4
- else if (dimension_type == MNN::Tensor::CAFFE_C4)
- {
-#ifdef LITEMNN_DEBUG
- std::cout << "Dimension Type is CAFFE_C4, skip resizeTensor & resizeSession!\n";
-#endif
- }
- // output count
- num_outputs = mnn_interpreter->getSessionOutputAll(mnn_session).size();
-#ifdef LITEMNN_DEBUG
- this->print_debug_string();
-#endif
-}
-
-BasicMNNHandler::~BasicMNNHandler()
-{
- mnn_interpreter->releaseModel();
- if (mnn_session)
- mnn_interpreter->releaseSession(mnn_session);
-}
-
-void BasicMNNHandler::print_debug_string()
-{
- std::cout << "LITEMNN_DEBUG LogId: " << log_id << "\n";
- std::cout << "=============== Input-Dims ==============\n";
- if (input_tensor) input_tensor->printShape();
- if (dimension_type == MNN::Tensor::CAFFE)
- std::cout << "Dimension Type: (CAFFE/PyTorch/ONNX)NCHW" << "\n";
- else if (dimension_type == MNN::Tensor::TENSORFLOW)
- std::cout << "Dimension Type: (TENSORFLOW)NHWC" << "\n";
- else if (dimension_type == MNN::Tensor::CAFFE_C4)
- std::cout << "Dimension Type: (CAFFE_C4)NC4HW4" << "\n";
- std::cout << "=============== Output-Dims ==============\n";
- auto tmp_output_map = mnn_interpreter->getSessionOutputAll(mnn_session);
- std::cout << "getSessionOutputAll done!\n";
- for (auto it = tmp_output_map.cbegin(); it != tmp_output_map.cend(); ++it)
- {
- std::cout << "Output: " << it->first << ": ";
- it->second->printShape();
- }
- std::cout << "========================================\n";
-}
\ No newline at end of file
diff --git a/lite/mnn/core/mnn_handler.h b/lite/mnn/core/mnn_handler.h
deleted file mode 100644
index ced21152..00000000
--- a/lite/mnn/core/mnn_handler.h
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// Created by DefTruth on 2021/10/6.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CORE_MNN_HANDLER_H
-#define LITE_AI_TOOLKIT_MNN_CORE_MNN_HANDLER_H
-
-#include "mnn_config.h"
-
-namespace mnncore
-{
- class LITE_EXPORTS BasicMNNHandler
- {
- protected:
- std::shared_ptr mnn_interpreter;
- MNN::Session *mnn_session = nullptr;
- MNN::Tensor *input_tensor = nullptr; // assume single input.
- MNN::ScheduleConfig schedule_config;
- std::shared_ptr pretreat; // init at subclass
- const char *log_id = nullptr;
- const char *mnn_path = nullptr;
-
- protected:
- const unsigned int num_threads; // initialize at runtime.
- int input_batch;
- int input_channel;
- int input_height;
- int input_width;
- int dimension_type;
- int num_outputs = 1;
-
- protected:
- explicit BasicMNNHandler(const std::string &_mnn_path, unsigned int _num_threads = 1);
-
- virtual ~BasicMNNHandler();
-
- // un-copyable
- protected:
- BasicMNNHandler(const BasicMNNHandler &) = delete; //
- BasicMNNHandler(BasicMNNHandler &&) = delete; //
- BasicMNNHandler &operator=(const BasicMNNHandler &) = delete; //
- BasicMNNHandler &operator=(BasicMNNHandler &&) = delete; //
-
- protected:
- virtual void transform(const cv::Mat &mat) = 0; // ? needed ?
-
- private:
- void initialize_handler();
-
- void print_debug_string();
-
- };
-}
-
-#endif //LITE_AI_TOOLKIT_MNN_CORE_MNN_HANDLER_H
diff --git a/lite/mnn/core/mnn_types.h b/lite/mnn/core/mnn_types.h
deleted file mode 100644
index 2b88a3b8..00000000
--- a/lite/mnn/core/mnn_types.h
+++ /dev/null
@@ -1,15 +0,0 @@
-//
-// Created by DefTruth on 2021/10/6.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CORE_MNN_TYPES_H
-#define LITE_AI_TOOLKIT_MNN_CORE_MNN_TYPES_H
-
-#include "lite/types.h"
-
-namespace mnncv
-{
- namespace types = lite::types;
-}
-
-#endif //LITE_AI_TOOLKIT_MNN_CORE_MNN_TYPES_H
diff --git a/lite/mnn/core/mnn_utils.cpp b/lite/mnn/core/mnn_utils.cpp
deleted file mode 100644
index baf9570c..00000000
--- a/lite/mnn/core/mnn_utils.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-//
-// Created by DefTruth on 2021/10/6.
-//
-
-#include "mnn_utils.h"
diff --git a/lite/mnn/core/mnn_utils.h b/lite/mnn/core/mnn_utils.h
deleted file mode 100644
index 1be56fc3..00000000
--- a/lite/mnn/core/mnn_utils.h
+++ /dev/null
@@ -1,13 +0,0 @@
-//
-// Created by DefTruth on 2021/10/6.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CORE_MNN_UTILS_H
-#define LITE_AI_TOOLKIT_MNN_CORE_MNN_UTILS_H
-
-namespace mnncv
-{
- // no specific utils for MNN now.
-}
-
-#endif //LITE_AI_TOOLKIT_MNN_CORE_MNN_UTILS_H
diff --git a/lite/mnn/cv/mnn_age_googlenet.cpp b/lite/mnn/cv/mnn_age_googlenet.cpp
deleted file mode 100644
index 716ceb33..00000000
--- a/lite/mnn/cv/mnn_age_googlenet.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// Created by DefTruth on 2021/11/27.
-//
-
-#include "mnn_age_googlenet.h"
-#include "lite/utils.h"
-
-using mnncv::MNNAgeGoogleNet;
-
-MNNAgeGoogleNet::MNNAgeGoogleNet(const std::string &_mnn_path, unsigned int _num_threads)
- : BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-inline void MNNAgeGoogleNet::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNAgeGoogleNet::transform(const cv::Mat &mat)
-{
- cv::Mat canvas;
- // (1,3,224,224)
- cv::resize(mat, canvas, cv::Size(input_width, input_height));
- pretreat->convert(canvas.data, input_width, input_height, canvas.step[0], input_tensor);
-}
-
-void MNNAgeGoogleNet::detect(const cv::Mat &mat, types::Age &age)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. fetch age.
- auto device_age_logits_ptr = output_tensors.at("loss3/loss3_Y"); // (1,8)
- MNN::Tensor host_age_logits_tensor(device_age_logits_ptr, device_age_logits_ptr->getDimensionType());
- device_age_logits_ptr->copyToHostTensor(&host_age_logits_tensor);
-
- auto age_dims = host_age_logits_tensor.shape();
- unsigned int interval = 0;
- const unsigned int num_intervals = age_dims.at(1); // 8
- const float *pred_logits_ptr = host_age_logits_tensor.host();
-
- auto softmax_probs = lite::utils::math::softmax(pred_logits_ptr, num_intervals, interval);
- const float pred_age = static_cast(age_intervals[interval][0] + age_intervals[interval][1]) / 2.0f;
-
- age.age = pred_age;
- age.age_interval[0] = age_intervals[interval][0];
- age.age_interval[1] = age_intervals[interval][1];
- age.interval_prob = softmax_probs[interval];
- age.flag = true;
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_age_googlenet.h b/lite/mnn/cv/mnn_age_googlenet.h
deleted file mode 100644
index f1b4221d..00000000
--- a/lite/mnn/cv/mnn_age_googlenet.h
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// Created by DefTruth on 2021/11/27.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_AGE_GOOGLENET_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_AGE_GOOGLENET_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNAgeGoogleNet : public BasicMNNHandler
- {
- public:
- explicit MNNAgeGoogleNet(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNAgeGoogleNet() override = default;
-
- private:
- const float mean_vals[3] = {104.0f, 117.0f, 123.0f};
- const float norm_vals[3] = {1.0f, 1.0f, 1.0f};
- const unsigned int age_intervals[8][2] = {
- {0, 2},
- {4, 6},
- {8, 12},
- {15, 20},
- {25, 32},
- {38, 43},
- {48, 53},
- {60, 100}
- };
-
- private:
- void initialize_pretreat(); //
-
- void transform(const cv::Mat &mat) override; // padding & resize & normalize.
-
- public:
- void detect(const cv::Mat &mat, types::Age &age);
- };
-}
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_AGE_GOOGLENET_H
diff --git a/lite/mnn/cv/mnn_backgroundmattingv2.cpp b/lite/mnn/cv/mnn_backgroundmattingv2.cpp
deleted file mode 100644
index 08a110d1..00000000
--- a/lite/mnn/cv/mnn_backgroundmattingv2.cpp
+++ /dev/null
@@ -1,217 +0,0 @@
-//
-// Created by DefTruth on 2022/4/9.
-//
-
-#include "mnn_backgroundmattingv2.h"
-#include "lite/utils.h"
-
-using mnncv::MNNBackgroundMattingV2;
-
-MNNBackgroundMattingV2::MNNBackgroundMattingV2(
- const std::string &_mnn_path,
- unsigned int _num_threads
-) : log_id(_mnn_path.data()),
- mnn_path(_mnn_path.data()),
- num_threads(_num_threads)
-{
- initialize_interpreter();
- initialize_pretreat();
-}
-
-MNNBackgroundMattingV2::~MNNBackgroundMattingV2()
-{
- mnn_interpreter->releaseModel();
- if (mnn_session)
- mnn_interpreter->releaseSession(mnn_session);
-}
-
-void MNNBackgroundMattingV2::initialize_interpreter()
-{
- // 1. init interpreter
- mnn_interpreter = std::shared_ptr(MNN::Interpreter::createFromFile(mnn_path));
- // 2. init schedule_config
- schedule_config.numThread = (int) num_threads;
- MNN::BackendConfig backend_config;
- backend_config.precision = MNN::BackendConfig::Precision_High; // default Precision_High
- schedule_config.backendConfig = &backend_config;
- // 3. create session
- mnn_session = mnn_interpreter->createSession(schedule_config);
- // 4. init input tensor
- src_tensor = mnn_interpreter->getSessionInput(mnn_session, "src");
- bgr_tensor = mnn_interpreter->getSessionInput(mnn_session, "bgr");
- // 5. init input dims
- input_height = src_tensor->height();
- input_width = src_tensor->width();
- dimension_type = src_tensor->getDimensionType(); // CAFFE
- mnn_interpreter->resizeTensor(src_tensor, src_tensor->shape());
- mnn_interpreter->resizeTensor(bgr_tensor, bgr_tensor->shape());
- mnn_interpreter->resizeSession(mnn_session);
-#ifdef LITEMNN_DEBUG
- this->print_debug_string();
-#endif
-}
-
-void MNNBackgroundMattingV2::print_debug_string()
-{
- std::cout << "LITEMNN_DEBUG LogId: " << log_id << "\n";
- std::cout << "=============== Input-Dims ==============\n";
- if (src_tensor) src_tensor->printShape();
- if (bgr_tensor) bgr_tensor->printShape();
- if (dimension_type == MNN::Tensor::CAFFE)
- std::cout << "Dimension Type: (CAFFE/PyTorch/ONNX)NCHW" << "\n";
- else if (dimension_type == MNN::Tensor::TENSORFLOW)
- std::cout << "Dimension Type: (TENSORFLOW)NHWC" << "\n";
- else if (dimension_type == MNN::Tensor::CAFFE_C4)
- std::cout << "Dimension Type: (CAFFE_C4)NC4HW4" << "\n";
- std::cout << "=============== Output-Dims ==============\n";
- auto tmp_output_map = mnn_interpreter->getSessionOutputAll(mnn_session);
- std::cout << "getSessionOutputAll done!\n";
- for (auto it = tmp_output_map.cbegin(); it != tmp_output_map.cend(); ++it)
- {
- std::cout << "Output: " << it->first << ": ";
- it->second->printShape();
- }
- std::cout << "========================================\n";
-}
-
-void MNNBackgroundMattingV2::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-inline void MNNBackgroundMattingV2::transform(const cv::Mat &mat, const cv::Mat &bgr)
-{
- cv::Mat mat_rs, bgr_rs;
- cv::resize(mat, mat_rs, cv::Size(input_width, input_height));
- cv::resize(bgr, bgr_rs, cv::Size(input_width, input_height));
- pretreat->convert(mat_rs.data, input_width, input_height, mat_rs.step[0], src_tensor);
- pretreat->convert(bgr_rs.data, input_width, input_height, bgr_rs.step[0], bgr_tensor);
-}
-
-void MNNBackgroundMattingV2::detect(const cv::Mat &mat, const cv::Mat &bgr,
- types::MattingContent &content, bool remove_noise,
- bool minimum_post_process)
-{
- if (mat.empty() || bgr.empty()) return;
- // 1. make input tensor
- this->transform(mat, bgr);
- // 2. inference & run session
- mnn_interpreter->runSession(mnn_session);
-
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. generate matting
- this->generate_matting(output_tensors, mat, content, remove_noise, minimum_post_process);
-}
-
-void MNNBackgroundMattingV2::generate_matting(
- const std::map &output_tensors, const cv::Mat &mat,
- types::MattingContent &content, bool remove_noise,
- bool minimum_post_process)
-{
- auto device_fgr_ptr = output_tensors.at("fgr");
- auto device_pha_ptr = output_tensors.at("pha");
- MNN::Tensor host_fgr_tensor(device_fgr_ptr, device_fgr_ptr->getDimensionType()); // NCHW
- MNN::Tensor host_pha_tensor(device_pha_ptr, device_pha_ptr->getDimensionType()); // NCHW
- device_fgr_ptr->copyToHostTensor(&host_fgr_tensor);
- device_pha_ptr->copyToHostTensor(&host_pha_tensor);
- const unsigned int h = mat.rows;
- const unsigned int w = mat.cols;
- const unsigned int out_h = input_height;
- const unsigned int out_w = input_width;
-
- float *fgr_ptr = host_fgr_tensor.host();
- float *pha_ptr = host_pha_tensor.host();
- const unsigned int channel_step = out_h * out_w;
-
- // fast assign & channel transpose(CHW->HWC).
- cv::Mat pmat(out_h, out_w, CV_32FC1, pha_ptr);
- if (remove_noise) lite::utils::remove_small_connected_area(pmat, 0.05f);
-
- std::vector fgr_channel_mats;
- cv::Mat rmat(out_h, out_w, CV_32FC1, fgr_ptr);
- cv::Mat gmat(out_h, out_w, CV_32FC1, fgr_ptr + channel_step);
- cv::Mat bmat(out_h, out_w, CV_32FC1, fgr_ptr + 2 * channel_step);
- rmat *= 255.;
- bmat *= 255.;
- gmat *= 255.;
- fgr_channel_mats.push_back(bmat);
- fgr_channel_mats.push_back(gmat);
- fgr_channel_mats.push_back(rmat);
-
- content.pha_mat = pmat;
- cv::merge(fgr_channel_mats, content.fgr_mat);
- content.fgr_mat.convertTo(content.fgr_mat, CV_8UC3);
-
- if (!minimum_post_process)
- {
- std::vector merge_channel_mats;
- cv::Mat rest = 1. - pmat;
- cv::Mat mbmat = bmat.mul(pmat) + rest * 153.;
- cv::Mat mgmat = gmat.mul(pmat) + rest * 255.;
- cv::Mat mrmat = rmat.mul(pmat) + rest * 120.;
- merge_channel_mats.push_back(mbmat);
- merge_channel_mats.push_back(mgmat);
- merge_channel_mats.push_back(mrmat);
- cv::merge(merge_channel_mats, content.merge_mat);
- content.merge_mat.convertTo(content.merge_mat, CV_8UC3);
- }
-
- // resize alpha
- if (out_h != h || out_w != w)
- {
- // already allocated a new continuous memory after resize (pha_mat)
- cv::resize(content.pha_mat, content.pha_mat, cv::Size(w, h));
- cv::resize(content.fgr_mat, content.fgr_mat, cv::Size(w, h));
- if (!minimum_post_process)
- cv::resize(content.merge_mat, content.merge_mat, cv::Size(w, h));
- } //
- else
- {
- // need clone to allocate a new continuous memory if not performed resize.
- // The memory elements point to will release after return.
- content.pha_mat = content.pha_mat.clone();
- }
-
- content.flag = true;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lite/mnn/cv/mnn_backgroundmattingv2.h b/lite/mnn/cv/mnn_backgroundmattingv2.h
deleted file mode 100644
index f25ce219..00000000
--- a/lite/mnn/cv/mnn_backgroundmattingv2.h
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-// Created by DefTruth on 2022/4/9.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_BACKGROUNDMATTINGV2_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_BACKGROUNDMATTINGV2_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNBackgroundMattingV2
- {
- public:
- explicit MNNBackgroundMattingV2(const std::string &_mnn_path,
- unsigned int _num_threads = 1); //
- ~MNNBackgroundMattingV2();
-
- private:
- std::shared_ptr mnn_interpreter;
- MNN::Session *mnn_session = nullptr;
- MNN::ScheduleConfig schedule_config;
- std::shared_ptr pretreat; // init at runtime
- const char *log_id = nullptr;
- const char *mnn_path = nullptr;
-
- private:
- const float mean_vals[3] = {0.f, 0.f, 0.f}; // RGB
- const float norm_vals[3] = {1.f / 255.f, 1.f / 255.f, 1.f / 255.f};
- // hardcode input node names, hint only.
- // downsample_ratio has been freeze while onnx exported
- // and, the input size of each input has been freeze, also.
- std::vector input_node_names = {
- "src",
- "bgr"
- };
- // hardcode output node names, hint only.
- std::vector output_node_names = {
- "pha",
- "fgr",
- "pha_sm",
- "fgr_sm",
- "err_sm",
- "ref_sm"
- };
-
- private:
- const unsigned int num_threads; // initialize at runtime.
- // multi inputs.
- MNN::Tensor *src_tensor = nullptr;
- MNN::Tensor *bgr_tensor = nullptr;
- // input size, initialize at runtime.
- int input_height;
- int input_width;
- int dimension_type; // hint only
-
- // un-copyable
- protected:
- MNNBackgroundMattingV2(const MNNBackgroundMattingV2 &) = delete; //
- MNNBackgroundMattingV2(MNNBackgroundMattingV2 &&) = delete; //
- MNNBackgroundMattingV2 &operator=(const MNNBackgroundMattingV2 &) = delete; //
- MNNBackgroundMattingV2 &operator=(MNNBackgroundMattingV2 &&) = delete; //
-
- private:
- void print_debug_string();
-
- private:
- void transform(const cv::Mat &mat, const cv::Mat &bgr);
-
- void initialize_pretreat(); //
-
- void initialize_interpreter();
-
- void generate_matting(const std::map &output_tensors,
- const cv::Mat &mat, types::MattingContent &content,
- bool remove_noise = false, bool minimum_post_process = false);
-
- public:
- /**
- * @param mat cv::Mat input image with BGR format.
- * @param bgr cv::Mat input background image with BGR format.
- * @param content MattingContent output fgr, pha and merge_mat (if minimum_post_process is false)
- * @param remove_noise bool, whether to remove small connected areas.
- * @param minimum_post_process bool, will not return demo merge mat if True.
- */
- void detect(const cv::Mat &mat, const cv::Mat &bgr, types::MattingContent &content,
- bool remove_noise = false, bool minimum_post_process = false);
-
- };
-}
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_BACKGROUNDMATTINGV2_H
diff --git a/lite/mnn/cv/mnn_cava_combined_face.cpp b/lite/mnn/cv/mnn_cava_combined_face.cpp
deleted file mode 100644
index c10674c3..00000000
--- a/lite/mnn/cv/mnn_cava_combined_face.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// Created by DefTruth on 2021/11/14.
-//
-
-#include "mnn_cava_combined_face.h"
-
-using mnncv::MNNCavaCombinedFace;
-
-MNNCavaCombinedFace::MNNCavaCombinedFace(const std::string &_mnn_path, unsigned int _num_threads) :
- BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-inline void MNNCavaCombinedFace::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNCavaCombinedFace::transform(const cv::Mat &mat)
-{
- // normalize & HWC -> CHW & BGR -> RGB
- cv::Mat mat_rs;
- cv::resize(mat, mat_rs, cv::Size(input_width, input_height));
- pretreat->convert(mat_rs.data, input_width, input_height, mat_rs.step[0], input_tensor);
-}
-
-void MNNCavaCombinedFace::detect(const cv::Mat &mat, types::FaceContent &face_content)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference.
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
-
- auto device_embedding_ptr = output_tensors.at("embedding");
- MNN::Tensor host_embedding_tensor(device_embedding_ptr, device_embedding_ptr->getDimensionType()); // NCHW
- device_embedding_ptr->copyToHostTensor(&host_embedding_tensor);
-
- auto embedding_dims = host_embedding_tensor.shape(); // (1,512)
- const unsigned int hidden_dim = embedding_dims.at(1);
- const float *embedding_values = host_embedding_tensor.host();
-
- std::vector embedding_norm(embedding_values, embedding_values + hidden_dim);
- cv::normalize(embedding_norm, embedding_norm); // l2 normalize
- face_content.embedding.assign(embedding_norm.begin(), embedding_norm.end());
- face_content.dim = hidden_dim;
- face_content.flag = true;
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_cava_combined_face.h b/lite/mnn/cv/mnn_cava_combined_face.h
deleted file mode 100644
index 9dffb8bc..00000000
--- a/lite/mnn/cv/mnn_cava_combined_face.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// Created by DefTruth on 2021/11/14.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_CAVA_COMBINED_FACE_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_CAVA_COMBINED_FACE_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNCavaCombinedFace : public BasicMNNHandler
- {
- public:
- explicit MNNCavaCombinedFace(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNCavaCombinedFace() override = default;
-
- private:
- const float mean_vals[3] = {127.5f, 127.5f, 127.5f}; // RGB
- const float norm_vals[3] = {1.f / 128.0f, 1.f / 128.0f, 1.f / 128.0f};
-
- private:
- void initialize_pretreat(); //
-
- void transform(const cv::Mat &mat) override; //
-
- public:
- void detect(const cv::Mat &mat, types::FaceContent &face_content);
- };
-}
-
-
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_CAVA_COMBINED_FACE_H
diff --git a/lite/mnn/cv/mnn_cava_ghost_arcface.cpp b/lite/mnn/cv/mnn_cava_ghost_arcface.cpp
deleted file mode 100644
index 86d45ee2..00000000
--- a/lite/mnn/cv/mnn_cava_ghost_arcface.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// Created by DefTruth on 2021/11/14.
-//
-
-#include "mnn_cava_ghost_arcface.h"
-
-using mnncv::MNNCavaGhostArcFace;
-
-MNNCavaGhostArcFace::MNNCavaGhostArcFace(const std::string &_mnn_path, unsigned int _num_threads) :
- BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-
-inline void MNNCavaGhostArcFace::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNCavaGhostArcFace::transform(const cv::Mat &mat)
-{
- // normalize & HWC -> CHW & BGR -> RGB
- cv::Mat mat_rs;
- cv::resize(mat, mat_rs, cv::Size(input_width, input_height));
- pretreat->convert(mat_rs.data, input_width, input_height, mat_rs.step[0], input_tensor);
-}
-
-void MNNCavaGhostArcFace::detect(const cv::Mat &mat, types::FaceContent &face_content)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference.
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
-
- auto device_embedding_ptr = output_tensors.at("embedding");
- MNN::Tensor host_embedding_tensor(device_embedding_ptr, device_embedding_ptr->getDimensionType()); // NCHW
- device_embedding_ptr->copyToHostTensor(&host_embedding_tensor);
-
- auto embedding_dims = host_embedding_tensor.shape(); // (1,512)
- const unsigned int hidden_dim = embedding_dims.at(1);
- const float *embedding_values = host_embedding_tensor.host();
-
- std::vector embedding_norm(embedding_values, embedding_values + hidden_dim);
- cv::normalize(embedding_norm, embedding_norm); // l2 normalize
- face_content.embedding.assign(embedding_norm.begin(), embedding_norm.end());
- face_content.dim = hidden_dim;
- face_content.flag = true;
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_cava_ghost_arcface.h b/lite/mnn/cv/mnn_cava_ghost_arcface.h
deleted file mode 100644
index a61850fb..00000000
--- a/lite/mnn/cv/mnn_cava_ghost_arcface.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// Created by DefTruth on 2021/11/14.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_CAVA_GHOST_ARCFACE_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_CAVA_GHOST_ARCFACE_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNCavaGhostArcFace : public BasicMNNHandler
- {
- public:
- explicit MNNCavaGhostArcFace(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNCavaGhostArcFace() override = default;
-
- private:
- const float mean_vals[3] = {127.5f, 127.5f, 127.5f}; // RGB
- const float norm_vals[3] = {1.f / 128.0f, 1.f / 128.0f, 1.f / 128.0f};
-
- private:
- void initialize_pretreat(); //
-
- void transform(const cv::Mat &mat) override; //
-
- public:
- void detect(const cv::Mat &mat, types::FaceContent &face_content);
- };
-}
-
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_CAVA_GHOST_ARCFACE_H
diff --git a/lite/mnn/cv/mnn_center_loss_face.cpp b/lite/mnn/cv/mnn_center_loss_face.cpp
deleted file mode 100644
index 268b973c..00000000
--- a/lite/mnn/cv/mnn_center_loss_face.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// Created by DefTruth on 2021/11/14.
-//
-
-#include "mnn_center_loss_face.h"
-
-using mnncv::MNNCenterLossFace;
-
-MNNCenterLossFace::MNNCenterLossFace(const std::string &_mnn_path, unsigned int _num_threads) :
- BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-
-inline void MNNCenterLossFace::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNCenterLossFace::transform(const cv::Mat &mat)
-{
- // normalize & HWC -> CHW & BGR -> RGB
- cv::Mat mat_rs;
- cv::resize(mat, mat_rs, cv::Size(input_width, input_height));
- pretreat->convert(mat_rs.data, input_width, input_height, mat_rs.step[0], input_tensor);
-}
-
-void MNNCenterLossFace::detect(const cv::Mat &mat, types::FaceContent &face_content)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference.
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
-
- auto device_embedding_ptr = output_tensors.at("embedding");
- MNN::Tensor host_embedding_tensor(device_embedding_ptr, device_embedding_ptr->getDimensionType()); // NCHW
- device_embedding_ptr->copyToHostTensor(&host_embedding_tensor);
-
- auto embedding_dims = host_embedding_tensor.shape(); // (1,512)
- const unsigned int hidden_dim = embedding_dims.at(1);
- const float *embedding_values = host_embedding_tensor.host();
-
- std::vector embedding_norm(embedding_values, embedding_values + hidden_dim);
- cv::normalize(embedding_norm, embedding_norm); // l2 normalize
- face_content.embedding.assign(embedding_norm.begin(), embedding_norm.end());
- face_content.dim = hidden_dim;
- face_content.flag = true;
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_center_loss_face.h b/lite/mnn/cv/mnn_center_loss_face.h
deleted file mode 100644
index 1d8dd4ad..00000000
--- a/lite/mnn/cv/mnn_center_loss_face.h
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// Created by DefTruth on 2021/11/14.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_CENTER_LOSS_FACE_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_CENTER_LOSS_FACE_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNCenterLossFace : public BasicMNNHandler
- {
- public:
- explicit MNNCenterLossFace(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNCenterLossFace() override = default;
-
- private:
- const float mean_vals[3] = {127.5f, 127.5f, 127.5f}; // RGB
- const float norm_vals[3] = {1.f / 127.5f, 1.f / 127.5f, 1.f / 127.5f};
-
- private:
- void initialize_pretreat(); //
-
- void transform(const cv::Mat &mat) override; //
-
- public:
- void detect(const cv::Mat &mat, types::FaceContent &face_content);
- };
-}
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_CENTER_LOSS_FACE_H
diff --git a/lite/mnn/cv/mnn_colorizer.cpp b/lite/mnn/cv/mnn_colorizer.cpp
deleted file mode 100644
index a7405ae7..00000000
--- a/lite/mnn/cv/mnn_colorizer.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-//
-// Created by DefTruth on 2021/11/29.
-//
-
-#include "mnn_colorizer.h"
-
-using mnncv::MNNColorizer;
-
-MNNColorizer::MNNColorizer(const std::string &_mnn_path, unsigned int _num_threads)
- : BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-inline void MNNColorizer::initialize_pretreat()
-{
- pretreat = nullptr; // no use
-}
-
-void MNNColorizer::transform(const cv::Mat &mat)
-{
- cv::Mat mat_l; // assume that input mat is L of Lab
- mat.convertTo(mat_l, CV_32FC1, 1.0f, 0.f); // (256,256,1) range (0.,100.)
-
- auto tmp_host_nchw_tensor = new MNN::Tensor(input_tensor, MNN::Tensor::CAFFE); // tmp
- std::memcpy(tmp_host_nchw_tensor->host(), mat_l.data,
- input_height * input_width * sizeof(float));
- input_tensor->copyFromHostTensor(tmp_host_nchw_tensor);
-
- delete tmp_host_nchw_tensor;
-}
-
-void MNNColorizer::detect(const cv::Mat &mat, types::ColorizeContent &colorize_content)
-{
- if (mat.empty()) return;
- const unsigned int height = mat.rows;
- const unsigned int width = mat.cols;
-
- cv::Mat mat_rs = mat.clone();
- cv::resize(mat_rs, mat_rs, cv::Size(input_width, input_height)); // (256,256,3)
- cv::Mat mat_rs_norm, mat_orig_norm;
- mat_rs.convertTo(mat_rs_norm, CV_32FC3, 1.0f / 255.0f, 0.f); // (0.,1.) BGR
- mat.convertTo(mat_orig_norm, CV_32FC3, 1.0f / 255.0f, 0.f); // (0.,1.) BGR
- if (mat_rs_norm.empty() || mat_orig_norm.empty()) return;
-
- cv::Mat mat_lab_orig, mat_lab_rs;
- cv::cvtColor(mat_rs_norm, mat_lab_rs, cv::COLOR_BGR2Lab);
- cv::cvtColor(mat_orig_norm, mat_lab_orig, cv::COLOR_BGR2Lab);
-
- cv::Mat mat_rs_l, mat_orig_l;
- std::vector mats_rs_lab, mats_orig_lab;
- cv::split(mat_lab_rs, mats_rs_lab);
- cv::split(mat_lab_orig, mats_orig_lab);
-
- mat_rs_l = mats_rs_lab.at(0);
- mat_orig_l = mats_orig_lab.at(0);
-
- // 1. make input tensor
- this->transform(mat_rs_l); // (1,1,256,256)
- // 2. inference
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. fetch.
- auto device_pred_ab_ptr = output_tensors.at("out_ab");
- MNN::Tensor host_pred_ab_tensor(device_pred_ab_ptr, device_pred_ab_ptr->getDimensionType());
- device_pred_ab_ptr->copyToHostTensor(&host_pred_ab_tensor);
-
- auto pred_dims = host_pred_ab_tensor.shape(); // (1,2,256,256)
- const unsigned int rows = pred_dims.at(2); // H 256
- const unsigned int cols = pred_dims.at(3); // W 256
- const unsigned int pred_step = rows * cols;
-
- float *pred_ab_ptr = host_pred_ab_tensor.host();
-
- cv::Mat out_a_orig(rows, cols, CV_32FC1);
- cv::Mat out_b_orig(rows, cols, CV_32FC1);
-
- for (unsigned int i = 0; i < rows; ++i)
- {
- float *pa = out_a_orig.ptr(i);
- float *pb = out_b_orig.ptr(i);
- for (unsigned int j = 0; j < cols; ++j)
- {
- pa[j] = pred_ab_ptr[0 * pred_step + i * cols + j];
- pb[j] = pred_ab_ptr[1 * pred_step + i * cols + j];
- } // CHW->HWC
- }
-
- if (rows != height || cols != width)
- {
- cv::resize(out_a_orig, out_a_orig, cv::Size(width, height));
- cv::resize(out_b_orig, out_b_orig, cv::Size(width, height));
- }
-
- std::vector out_mats_lab;
- out_mats_lab.push_back(mat_orig_l);
- out_mats_lab.push_back(out_a_orig);
- out_mats_lab.push_back(out_b_orig);
-
- cv::Mat merge_mat_lab, mat_bgr_norm;
- cv::merge(out_mats_lab, merge_mat_lab);
- if (merge_mat_lab.empty()) return;
- cv::cvtColor(merge_mat_lab, mat_bgr_norm, cv::COLOR_Lab2BGR); // CV_32FC3
- mat_bgr_norm *= 255.0f;
-
- mat_bgr_norm.convertTo(colorize_content.mat, CV_8UC3); // uint8
-
- colorize_content.flag = true;
-
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_colorizer.h b/lite/mnn/cv/mnn_colorizer.h
deleted file mode 100644
index 0eb6e606..00000000
--- a/lite/mnn/cv/mnn_colorizer.h
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// Created by DefTruth on 2021/11/29.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_COLORIZER_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_COLORIZER_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNColorizer : public BasicMNNHandler
- {
- public:
- explicit MNNColorizer(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNColorizer() override = default;
-
- private:
- void initialize_pretreat(); // no use
-
- void transform(const cv::Mat &mat) override; // resize & normalize.
-
- public:
- void detect(const cv::Mat &mat, types::ColorizeContent &colorize_content);
- };
-}
-
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_COLORIZER_H
diff --git a/lite/mnn/cv/mnn_deeplabv3_resnet101.cpp b/lite/mnn/cv/mnn_deeplabv3_resnet101.cpp
deleted file mode 100644
index eeb0e74d..00000000
--- a/lite/mnn/cv/mnn_deeplabv3_resnet101.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-//
-// Created by DefTruth on 2021/11/29.
-//
-
-#include "mnn_deeplabv3_resnet101.h"
-
-using mnncv::MNNDeepLabV3ResNet101;
-
-MNNDeepLabV3ResNet101::MNNDeepLabV3ResNet101(
- const std::string &_mnn_path, unsigned int _num_threads
-) : log_id(_mnn_path.data()),
- mnn_path(_mnn_path.data()),
- num_threads(_num_threads)
-{
- initialize_interpreter();
- initialize_pretreat();
-}
-
-MNNDeepLabV3ResNet101::~MNNDeepLabV3ResNet101()
-{
- mnn_interpreter->releaseModel();
- if (mnn_session)
- mnn_interpreter->releaseSession(mnn_session);
-}
-
-void MNNDeepLabV3ResNet101::initialize_interpreter()
-{
- mnn_interpreter = std::shared_ptr(MNN::Interpreter::createFromFile(mnn_path));
- // 2. init schedule_config
- schedule_config.numThread = (int) num_threads;
- MNN::BackendConfig backend_config;
- backend_config.precision = MNN::BackendConfig::Precision_High; // default Precision_High
- schedule_config.backendConfig = &backend_config;
- // 3. create session
- mnn_session = mnn_interpreter->createSession(schedule_config);
- // 4. init input tensor
- input_tensor = mnn_interpreter->getSessionInput(mnn_session, nullptr);
- // 5. init input dims
- dynamic_input_height = input_tensor->height();
- dynamic_input_width = input_tensor->width();
- dimension_type = input_tensor->getDimensionType(); // CAFFE(NCHW)
- mnn_interpreter->resizeTensor(input_tensor, {1, 3, dynamic_input_height, dynamic_input_width});
- mnn_interpreter->resizeSession(mnn_session);
-#ifdef LITEMNN_DEBUG
- this->print_debug_string();
-#endif
-}
-
-void MNNDeepLabV3ResNet101::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNDeepLabV3ResNet101::transform(const cv::Mat &mat)
-{
- const int img_width = mat.cols;
- const int img_height = mat.rows;
- // update dynamic input dims
- dynamic_input_height = img_height;
- dynamic_input_width = img_width;
-
- // update input tensor and resize Session
- mnn_interpreter->resizeTensor(input_tensor, {1, 3, dynamic_input_height, dynamic_input_width});
- mnn_interpreter->resizeSession(mnn_session);
-
- // push data into input tensor
- pretreat->convert(mat.data, dynamic_input_width, dynamic_input_height, mat.step[0], input_tensor);
-}
-
-void MNNDeepLabV3ResNet101::detect(const cv::Mat &mat, types::SegmentContent &content)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference & run session
- mnn_interpreter->runSession(mnn_session);
-
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. fetch
- auto device_scores_ptr = output_tensors.at("out"); // (1,21,h,w)
- MNN::Tensor host_scores_tensor(device_scores_ptr, device_scores_ptr->getDimensionType());
- device_scores_ptr->copyToHostTensor(&host_scores_tensor);
-#ifdef LITEMNN_DEBUG
- host_scores_tensor.printShape();
-#endif
-
- auto scores_dims = host_scores_tensor.shape();
- const unsigned int output_classes = scores_dims.at(1);
- const unsigned int output_height = scores_dims.at(2);
- const unsigned int output_width = scores_dims.at(3);
-
- const float *scores_ptr = host_scores_tensor.host();
- // time cost!
- content.names_map.clear();
- content.class_mat = cv::Mat(output_height, output_width, CV_8UC1, cv::Scalar(0));
- content.color_mat = mat.clone();
-
- const unsigned int scores_step = output_height * output_width; // h x w
-
- for (unsigned int i = 0; i < output_height; ++i)
- {
-
- uchar *p_class = content.class_mat.ptr(i);
- cv::Vec3b *p_color = content.color_mat.ptr(i);
-
- for (unsigned int j = 0; j < output_width; ++j)
- {
- // argmax
- unsigned int max_label = 0;
- float max_conf = scores_ptr[0 * scores_step + i * output_width + j];
-
- for (unsigned int l = 0; l < output_classes; ++l)
- {
- float conf = scores_ptr[l * scores_step + i * output_width + j];
- if (conf > max_conf)
- {
- max_conf = conf;
- max_label = l;
- }
- }
-
- if (max_label == 0) continue;
-
- // assign label for pixel(i,j)
- p_class[j] = cv::saturate_cast(max_label);
- // assign color for detected class at pixel(i,j).
- p_color[j][0] = cv::saturate_cast((max_label % 10) * 20);
- p_color[j][1] = cv::saturate_cast((max_label % 5) * 40);
- p_color[j][2] = cv::saturate_cast((max_label % 10) * 20);
- // assign names map
- content.names_map[max_label] = class_names[max_label - 1]; // max_label >= 1
- }
-
- }
-
- content.flag = true;
-}
-
-void MNNDeepLabV3ResNet101::print_debug_string()
-{
- std::cout << "LITEMNN_DEBUG LogId: " << log_id << "\n";
- std::cout << "=============== Input-Dims ==============\n";
- if (input_tensor) input_tensor->printShape();
- if (dimension_type == MNN::Tensor::CAFFE)
- std::cout << "Dimension Type: (CAFFE/PyTorch/ONNX)NCHW" << "\n";
- else if (dimension_type == MNN::Tensor::TENSORFLOW)
- std::cout << "Dimension Type: (TENSORFLOW)NHWC" << "\n";
- else if (dimension_type == MNN::Tensor::CAFFE_C4)
- std::cout << "Dimension Type: (CAFFE_C4)NC4HW4" << "\n";
- std::cout << "=============== Output-Dims ==============\n";
- auto tmp_output_map = mnn_interpreter->getSessionOutputAll(mnn_session);
- std::cout << "getSessionOutputAll done!\n";
- for (auto it = tmp_output_map.cbegin(); it != tmp_output_map.cend(); ++it)
- {
- std::cout << "Output: " << it->first << ": ";
- it->second->printShape();
- }
- std::cout << "========================================\n";
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_deeplabv3_resnet101.h b/lite/mnn/cv/mnn_deeplabv3_resnet101.h
deleted file mode 100644
index da6924b3..00000000
--- a/lite/mnn/cv/mnn_deeplabv3_resnet101.h
+++ /dev/null
@@ -1,69 +0,0 @@
-//
-// Created by DefTruth on 2021/11/29.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_DEEPLABV3_RESNET101_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_DEEPLABV3_RESNET101_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNDeepLabV3ResNet101
- {
- public:
- explicit MNNDeepLabV3ResNet101(const std::string &_mnn_path,
- unsigned int _num_threads = 8); //
- ~MNNDeepLabV3ResNet101();
-
- private:
- std::shared_ptr mnn_interpreter;
- MNN::Session *mnn_session = nullptr;
- MNN::ScheduleConfig schedule_config;
- std::shared_ptr pretreat; // init at runtime
- const char *log_id = nullptr;
- const char *mnn_path = nullptr;
- MNN::Tensor *input_tensor = nullptr;
-
- private:
- const float norm_vals[3] = {(1.f / 0.229f) * (1.f / 255.f),
- (1.f / 0.224f) * (1.f / 255.f),
- (1.f / 0.225f) * (1.f / 255.f)};
- const float mean_vals[3] = {0.485f * 255.f, 0.456f * 255.f, 0.406f * 255.f}; // RGB
-
- private:
- const unsigned int num_threads; // initialize at runtime.
- int dynamic_input_height = 512; // init only, will change according to input mat.
- int dynamic_input_width = 512; // init only, will change according to input mat.
- int dimension_type; // hint only
-
- const char *class_names[20] = {
- "aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat", "chair", "cow",
- "diningtable", "dog", "horse", "motorbike", "person", "pottedplant", "sheep", "sofa",
- "train", "tvmonitor"
- }; // 20 classes
-
- // un-copyable
- protected:
- MNNDeepLabV3ResNet101(const MNNDeepLabV3ResNet101 &) = delete; //
- MNNDeepLabV3ResNet101(MNNDeepLabV3ResNet101 &&) = delete; //
- MNNDeepLabV3ResNet101 &operator=(const MNNDeepLabV3ResNet101 &) = delete; //
- MNNDeepLabV3ResNet101 &operator=(MNNDeepLabV3ResNet101 &&) = delete; //
-
- private:
- void print_debug_string();
-
- private:
- void transform(const cv::Mat &mat);
-
- void initialize_pretreat(); //
-
- void initialize_interpreter();
-
- public:
- void detect(const cv::Mat &mat, types::SegmentContent &content);
-
- };
-}
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_DEEPLABV3_RESNET101_H
diff --git a/lite/mnn/cv/mnn_densenet.cpp b/lite/mnn/cv/mnn_densenet.cpp
deleted file mode 100644
index 292f3e06..00000000
--- a/lite/mnn/cv/mnn_densenet.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-// Created by DefTruth on 2021/11/29.
-//
-
-#include "mnn_densenet.h"
-#include "lite/utils.h"
-
-using mnncv::MNNDenseNet;
-
-MNNDenseNet::MNNDenseNet(const std::string &_mnn_path, unsigned int _num_threads)
- : BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-inline void MNNDenseNet::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNDenseNet::transform(const cv::Mat &mat)
-{
- cv::Mat canvas;
- cv::resize(mat, canvas, cv::Size(input_width, input_height));
- // (1,3,224,224)
- pretreat->convert(canvas.data, input_width, input_height, canvas.step[0], input_tensor);
-}
-
-void MNNDenseNet::detect(const cv::Mat &mat, types::ImageNetContent &content, unsigned int top_k)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. fetch.
- auto device_logits_ptr = output_tensors.at("logits");
- MNN::Tensor host_logits_tensor(device_logits_ptr, device_logits_ptr->getDimensionType());
- device_logits_ptr->copyToHostTensor(&host_logits_tensor);
-
- auto logits_dims = host_logits_tensor.shape();
- const unsigned int num_classes = logits_dims.at(1); // 1000
- const float *logits = host_logits_tensor.host();
-
- unsigned int max_id;
- std::vector scores = lite::utils::math::softmax(logits, num_classes, max_id);
- std::vector sorted_indices = lite::utils::math::argsort(scores);
- if (top_k > num_classes) top_k = num_classes;
-
- content.scores.clear();
- content.labels.clear();
- content.texts.clear();
- for (unsigned int i = 0; i < top_k; ++i)
- {
- content.labels.push_back(sorted_indices[i]);
- content.scores.push_back(scores[sorted_indices[i]]);
- content.texts.push_back(class_names[sorted_indices[i]]);
- }
- content.flag = true;
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_densenet.h b/lite/mnn/cv/mnn_densenet.h
deleted file mode 100644
index a21c5255..00000000
--- a/lite/mnn/cv/mnn_densenet.h
+++ /dev/null
@@ -1,409 +0,0 @@
-//
-// Created by DefTruth on 2021/11/29.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_DENSENET_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_DENSENET_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNDenseNet : public BasicMNNHandler
- {
- public:
- explicit MNNDenseNet(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNDenseNet() override = default;
-
- private:
- const float mean_vals[3] = {0.485f * 255.f, 0.456f * 255.f, 0.406f * 255.f};
- const float norm_vals[3] = {(1.0f / 0.229f) * (1.0 / 255.f),
- (1.0f / 0.224f) * (1.0 / 255.f),
- (1.0f / 0.225f) * (1.0 / 255.f)};
-
- private:
- void initialize_pretreat(); //
-
- void transform(const cv::Mat &mat) override; // resize & normalize.
-
- public:
- void detect(const cv::Mat &mat, types::ImageNetContent &content, unsigned int top_k = 5);
-
- private:
- const char *class_names[1000] = {
- "tench, Tinca tinca", "goldfish, Carassius auratus",
- "great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias",
- "tiger shark, Galeocerdo cuvieri", "hammerhead, hammerhead shark",
- "electric ray, crampfish, numbfish, torpedo", "stingray", "cock",
- "hen", "ostrich, Struthio camelus", "brambling, Fringilla montifringilla",
- "goldfinch, Carduelis carduelis", "house finch, linnet, Carpodacus mexicanus",
- "junco, snowbird", "indigo bunting, indigo finch, indigo bird, Passerina cyanea",
- "robin, American robin, Turdus migratorius", "bulbul", "jay",
- "magpie", "chickadee", "water ouzel, dipper",
- "kite", "bald eagle, American eagle, Haliaeetus leucocephalus",
- "vulture", "great grey owl, great gray owl, Strix nebulosa", "European fire salamander, Salamandra salamandra",
- "common newt, Triturus vulgaris", "eft", "spotted salamander, Ambystoma maculatum",
- "axolotl, mud puppy, Ambystoma mexicanum", "bullfrog, Rana catesbeiana",
- "tree frog, tree-frog", "tailed frog, bell toad, ribbed toad, tailed toad, Ascaphus trui",
- "loggerhead, loggerhead turtle, Caretta caretta", "leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea",
- "mud turtle", "terrapin", "box turtle, box tortoise",
- "banded gecko", "common iguana, iguana, Iguana iguana", "American chameleon, anole, Anolis carolinensis",
- "whiptail, whiptail lizard", "agama", "frilled lizard, Chlamydosaurus kingi",
- "alligator lizard", "Gila monster, Heloderma suspectum", "green lizard, Lacerta viridis",
- "African chameleon, Chamaeleo chamaeleon", "Komodo dragon, Komodo lizard, dragon lizard, giant lizard, Varanus komodoensis",
- "African crocodile, Nile crocodile, Crocodylus niloticus", "American alligator, Alligator mississipiensis",
- "triceratops", "thunder snake, worm snake, Carphophis amoenus",
- "ringneck snake, ring-necked snake, ring snake", "hognose snake, puff adder, sand viper",
- "green snake, grass snake", "king snake, kingsnake", "garter snake, grass snake",
- "water snake", "vine snake", "night snake, Hypsiglena torquata",
- "boa constrictor, Constrictor constrictor", "rock python, rock snake, Python sebae",
- "Indian cobra, Naja naja", "green mamba", "sea snake",
- "horned viper, cerastes, sand viper, horned asp, Cerastes cornutus",
- "diamondback, diamondback rattlesnake, Crotalus adamanteus", "sidewinder, horned rattlesnake, Crotalus cerastes",
- "trilobite", "harvestman, daddy longlegs, Phalangium opilio", "scorpion",
- "black and gold garden spider, Argiope aurantia", "barn spider, Araneus cavaticus",
- "garden spider, Aranea diademata", "black widow, Latrodectus mactans",
- "tarantula", "wolf spider, hunting spider", "tick",
- "centipede", "black grouse", "ptarmigan",
- "ruffed grouse, partridge, Bonasa umbellus", "prairie chicken, prairie grouse, prairie fowl",
- "peacock", "quail", "partridge",
- "African grey, African gray, Psittacus erithacus", "macaw", "sulphur-crested cockatoo, Kakatoe galerita, Cacatua galerita",
- "lorikeet", "coucal", "bee eater",
- "hornbill", "hummingbird", "jacamar",
- "toucan", "drake", "red-breasted merganser, Mergus serrator",
- "goose", "black swan, Cygnus atratus", "tusker",
- "echidna, spiny anteater, anteater", "platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus",
- "wallaby, brush kangaroo", "koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus",
- "wombat", "jellyfish", "sea anemone, anemone",
- "brain coral", "flatworm, platyhelminth", "nematode, nematode worm, roundworm",
- "conch", "snail", "slug",
- "sea slug, nudibranch", "chiton, coat-of-mail shell, sea cradle, polyplacophore",
- "chambered nautilus, pearly nautilus, nautilus", "Dungeness crab, Cancer magister",
- "rock crab, Cancer irroratus", "fiddler crab",
- "king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica",
- "American lobster, Northern lobster, Maine lobster, Homarus americanus",
- "spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish",
- "crayfish, crawfish, crawdad, crawdaddy", "hermit crab", "isopod",
- "white stork, Ciconia ciconia", "black stork, Ciconia nigra", "spoonbill",
- "flamingo", "little blue heron, Egretta caerulea", "American egret, great white heron, Egretta albus",
- "bittern", "crane", "limpkin, Aramus pictus",
- "European gallinule, Porphyrio porphyrio", "American coot, marsh hen, mud hen, water hen, Fulica americana",
- "bustard", "ruddy turnstone, Arenaria interpres", "red-backed sandpiper, dunlin, Erolia alpina",
- "redshank, Tringa totanus", "dowitcher", "oystercatcher, oyster catcher",
- "pelican", "king penguin, Aptenodytes patagonica", "albatross, mollymawk",
- "grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus",
- "killer whale, killer, orca, grampus, sea wolf, Orcinus orca",
- "dugong, Dugong dugon", "sea lion", "Chihuahua",
- "Japanese spaniel", "Maltese dog, Maltese terrier, Maltese", "Pekinese, Pekingese, Peke",
- "Shih-Tzu", "Blenheim spaniel", "papillon",
- "toy terrier", "Rhodesian ridgeback", "Afghan hound, Afghan",
- "basset, basset hound", "beagle", "bloodhound, sleuthhound",
- "bluetick", "black-and-tan coonhound", "Walker hound, Walker foxhound",
- "English foxhound", "redbone", "borzoi, Russian wolfhound",
- "Irish wolfhound", "Italian greyhound", "whippet",
- "Ibizan hound, Ibizan Podenco", "Norwegian elkhound, elkhound",
- "otterhound, otter hound", "Saluki, gazelle hound", "Scottish deerhound, deerhound",
- "Weimaraner", "Staffordshire bullterrier, Staffordshire bull terrier",
- "American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier",
- "Bedlington terrier", "Border terrier", "Kerry blue terrier",
- "Irish terrier", "Norfolk terrier", "Norwich terrier",
- "Yorkshire terrier", "wire-haired fox terrier", "Lakeland terrier",
- "Sealyham terrier, Sealyham", "Airedale, Airedale terrier", "cairn, cairn terrier",
- "Australian terrier", "Dandie Dinmont, Dandie Dinmont terrier",
- "Boston bull, Boston terrier", "miniature schnauzer", "giant schnauzer",
- "standard schnauzer", "Scotch terrier, Scottish terrier, Scottie",
- "Tibetan terrier, chrysanthemum dog", "silky terrier, Sydney silky",
- "soft-coated wheaten terrier", "West Highland white terrier", "Lhasa, Lhasa apso",
- "flat-coated retriever", "curly-coated retriever", "golden retriever",
- "Labrador retriever", "Chesapeake Bay retriever", "German short-haired pointer",
- "vizsla, Hungarian pointer", "English setter", "Irish setter, red setter",
- "Gordon setter", "Brittany spaniel", "clumber, clumber spaniel",
- "English springer, English springer spaniel", "Welsh springer spaniel",
- "cocker spaniel, English cocker spaniel, cocker", "Sussex spaniel",
- "Irish water spaniel", "kuvasz", "schipperke",
- "groenendael", "malinois", "briard",
- "kelpie", "komondor", "Old English sheepdog, bobtail",
- "Shetland sheepdog, Shetland sheep dog, Shetland", "collie", "Border collie",
- "Bouvier des Flandres, Bouviers des Flandres", "Rottweiler", "German shepherd, German shepherd dog, German police dog, alsatian",
- "Doberman, Doberman pinscher", "miniature pinscher", "Greater Swiss Mountain dog",
- "Bernese mountain dog", "Appenzeller", "EntleBucher",
- "boxer", "bull mastiff", "Tibetan mastiff",
- "French bulldog", "Great Dane", "Saint Bernard, St Bernard",
- "Eskimo dog, husky", "malamute, malemute, Alaskan malamute", "Siberian husky",
- "dalmatian, coach dog, carriage dog", "affenpinscher, monkey pinscher, monkey dog",
- "basenji", "pug, pug-dog", "Leonberg",
- "Newfoundland, Newfoundland dog", "Great Pyrenees", "Samoyed, Samoyede",
- "Pomeranian", "chow, chow chow", "keeshond",
- "Brabancon griffon", "Pembroke, Pembroke Welsh corgi", "Cardigan, Cardigan Welsh corgi",
- "toy poodle", "miniature poodle", "standard poodle",
- "Mexican hairless", "timber wolf, grey wolf, gray wolf, Canis lupus",
- "white wolf, Arctic wolf, Canis lupus tundrarum", "red wolf, maned wolf, Canis rufus, Canis niger",
- "coyote, prairie wolf, brush wolf, Canis latrans", "dingo, warrigal, warragal, Canis dingo",
- "dhole, Cuon alpinus", "African hunting dog, hyena dog, Cape hunting dog, Lycaon pictus",
- "hyena, hyaena", "red fox, Vulpes vulpes", "kit fox, Vulpes macrotis",
- "Arctic fox, white fox, Alopex lagopus", "grey fox, gray fox, Urocyon cinereoargenteus",
- "tabby, tabby cat", "tiger cat", "Persian cat",
- "Siamese cat, Siamese", "Egyptian cat", "cougar, puma, catamount, mountain lion, painter, panther, Felis concolor",
- "lynx, catamount", "leopard, Panthera pardus", "snow leopard, ounce, Panthera uncia",
- "jaguar, panther, Panthera onca, Felis onca", "lion, king of beasts, Panthera leo",
- "tiger, Panthera tigris", "cheetah, chetah, Acinonyx jubatus", "brown bear, bruin, Ursus arctos",
- "American black bear, black bear, Ursus americanus, Euarctos americanus",
- "ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus",
- "sloth bear, Melursus ursinus, Ursus ursinus", "mongoose", "meerkat, mierkat",
- "tiger beetle", "ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle",
- "ground beetle, carabid beetle", "long-horned beetle, longicorn, longicorn beetle",
- "leaf beetle, chrysomelid", "dung beetle", "rhinoceros beetle",
- "weevil", "fly", "bee",
- "ant, emmet, pismire", "grasshopper, hopper", "cricket",
- "walking stick, walkingstick, stick insect", "cockroach, roach",
- "mantis, mantid", "cicada, cicala", "leafhopper",
- "lacewing, lacewing fly",
- "dragonfly, darning needle, devil's darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk",
- "damselfly", "admiral", "ringlet, ringlet butterfly",
- "monarch, monarch butterfly, milkweed butterfly, Danaus plexippus",
- "cabbage butterfly", "sulphur butterfly, sulfur butterfly", "lycaenid, lycaenid butterfly",
- "starfish, sea star", "sea urchin", "sea cucumber, holothurian",
- "wood rabbit, cottontail, cottontail rabbit", "hare", "Angora, Angora rabbit",
- "hamster", "porcupine, hedgehog", "fox squirrel, eastern fox squirrel, Sciurus niger",
- "marmot", "beaver", "guinea pig, Cavia cobaya",
- "sorrel", "zebra", "hog, pig, grunter, squealer, Sus scrofa",
- "wild boar, boar, Sus scrofa", "warthog", "hippopotamus, hippo, river horse, Hippopotamus amphibius",
- "ox", "water buffalo, water ox, Asiatic buffalo, Bubalus bubalis",
- "bison", "ram, tup", "bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis",
- "ibex, Capra ibex", "hartebeest", "impala, Aepyceros melampus",
- "gazelle", "Arabian camel, dromedary, Camelus dromedarius", "llama",
- "weasel", "mink", "polecat, fitch, foulmart, foumart, Mustela putorius",
- "black-footed ferret, ferret, Mustela nigripes", "otter", "skunk, polecat, wood pussy",
- "badger", "armadillo", "three-toed sloth, ai, Bradypus tridactylus",
- "orangutan, orang, orangutang, Pongo pygmaeus", "gorilla, Gorilla gorilla",
- "chimpanzee, chimp, Pan troglodytes", "gibbon, Hylobates lar", "siamang, Hylobates syndactylus, Symphalangus syndactylus",
- "guenon, guenon monkey", "patas, hussar monkey, Erythrocebus patas",
- "baboon", "macaque", "langur",
- "colobus, colobus monkey", "proboscis monkey, Nasalis larvatus",
- "marmoset", "capuchin, ringtail, Cebus capucinus", "howler monkey, howler",
- "titi, titi monkey", "spider monkey, Ateles geoffroyi", "squirrel monkey, Saimiri sciureus",
- "Madagascar cat, ring-tailed lemur, Lemur catta", "indri, indris, Indri indri, Indri brevicaudatus",
- "Indian elephant, Elephas maximus", "African elephant, Loxodonta africana",
- "lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens",
- "giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca",
- "barracouta, snoek", "eel", "coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus kisutch",
- "rock beauty, Holocanthus tricolor", "anemone fish", "sturgeon",
- "gar, garfish, garpike, billfish, Lepisosteus osseus", "lionfish",
- "puffer, pufferfish, blowfish, globefish", "abacus", "abaya",
- "academic gown, academic robe, judge's robe", "accordion, piano accordion, squeeze box",
- "acoustic guitar", "aircraft carrier, carrier, flattop, attack aircraft carrier",
- "airliner", "airship, dirigible", "altar",
- "ambulance", "amphibian, amphibious vehicle", "analog clock",
- "apiary, bee house", "apron",
- "ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin",
- "assault rifle, assault gun", "backpack, back pack, knapsack, packsack, rucksack, haversack",
- "bakery, bakeshop, bakehouse", "balance beam, beam", "balloon",
- "ballpoint, ballpoint pen, ballpen, Biro", "Band Aid", "banjo",
- "bannister, banister, balustrade, balusters, handrail", "barbell",
- "barber chair", "barbershop", "barn",
- "barometer", "barrel, cask", "barrow, garden cart, lawn cart, wheelbarrow",
- "baseball", "basketball", "bassinet",
- "bassoon", "bathing cap, swimming cap", "bath towel",
- "bathtub, bathing tub, bath, tub", "beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon",
- "beacon, lighthouse, beacon light, pharos", "beaker", "bearskin, busby, shako",
- "beer bottle", "beer glass", "bell cote, bell cot",
- "bib", "bicycle-built-for-two, tandem bicycle, tandem", "bikini, two-piece",
- "binder, ring-binder", "binoculars, field glasses, opera glasses",
- "birdhouse", "boathouse", "bobsled, bobsleigh, bob",
- "bolo tie, bolo, bola tie, bola", "bonnet, poke bonnet", "bookcase",
- "bookshop, bookstore, bookstall", "bottlecap", "bow",
- "bow tie, bow-tie, bowtie", "brass, memorial tablet, plaque", "brassiere, bra, bandeau",
- "breakwater, groin, groyne, mole, bulwark, seawall, jetty", "breastplate, aegis, egis",
- "broom", "bucket, pail", "buckle",
- "bulletproof vest", "bullet train, bullet", "butcher shop, meat market",
- "cab, hack, taxi, taxicab", "caldron, cauldron", "candle, taper, wax light",
- "cannon", "canoe", "can opener, tin opener",
- "cardigan", "car mirror", "carousel, carrousel, merry-go-round, roundabout, whirligig",
- "carpenter's kit, tool kit", "carton", "car wheel",
- "cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM",
- "cassette", "cassette player", "castle",
- "catamaran", "CD player", "cello, violoncello",
- "cellular telephone, cellular phone, cellphone, cell, mobile phone",
- "chain", "chainlink fence", "chain mail, ring mail, mail, chain armor, chain armour, ring armor, ring armour",
- "chain saw, chainsaw", "chest", "chiffonier, commode",
- "chime, bell, gong", "china cabinet, china closet", "Christmas stocking",
- "church, church building", "cinema, movie theater, movie theatre, movie house, picture palace",
- "cleaver, meat cleaver, chopper", "cliff dwelling", "cloak",
- "clog, geta, patten, sabot", "cocktail shaker", "coffee mug",
- "coffeepot", "coil, spiral, volute, whorl, helix", "combination lock",
- "computer keyboard, keypad", "confectionery, confectionary, candy store",
- "container ship, containership, container vessel", "convertible",
- "corkscrew, bottle screw", "cornet, horn, trumpet, trump", "cowboy boot",
- "cowboy hat, ten-gallon hat", "cradle", "crane",
- "crash helmet", "crate", "crib, cot",
- "Crock Pot", "croquet ball", "crutch",
- "cuirass", "dam, dike, dyke", "desk",
- "desktop computer", "dial telephone, dial phone", "diaper, nappy, napkin",
- "digital clock", "digital watch", "dining table, board",
- "dishrag, dishcloth", "dishwasher, dish washer, dishwashing machine",
- "disk brake, disc brake", "dock, dockage, docking facility", "dogsled, dog sled, dog sleigh",
- "dome", "doormat, welcome mat", "drilling platform, offshore rig",
- "drum, membranophone, tympan", "drumstick", "dumbbell",
- "Dutch oven", "electric fan, blower", "electric guitar",
- "electric locomotive", "entertainment center", "envelope",
- "espresso maker", "face powder", "feather boa, boa",
- "file, file cabinet, filing cabinet", "fireboat", "fire engine, fire truck",
- "fire screen, fireguard", "flagpole, flagstaff", "flute, transverse flute",
- "folding chair", "football helmet", "forklift",
- "fountain", "fountain pen", "four-poster",
- "freight car", "French horn, horn", "frying pan, frypan, skillet",
- "fur coat", "garbage truck, dustcart", "gasmask, respirator, gas helmet",
- "gas pump, gasoline pump, petrol pump, island dispenser", "goblet",
- "go-kart", "golf ball", "golfcart, golf cart",
- "gondola", "gong, tam-tam", "gown",
- "grand piano, grand", "greenhouse, nursery, glasshouse", "grille, radiator grille",
- "grocery store, grocery, food market, market", "guillotine", "hair slide",
- "hair spray", "half track", "hammer",
- "hamper", "hand blower, blow dryer, blow drier, hair dryer, hair drier",
- "hand-held computer, hand-held microcomputer", "handkerchief, hankie, hanky, hankey",
- "hard disc, hard disk, fixed disk", "harmonica, mouth organ, harp, mouth harp",
- "harp", "harvester, reaper", "hatchet",
- "holster", "home theater, home theatre", "honeycomb",
- "hook, claw", "hoopskirt, crinoline", "horizontal bar, high bar",
- "horse cart, horse-cart", "hourglass", "iPod",
- "iron, smoothing iron", "jack-o'-lantern", "jean, blue jean, denim",
- "jeep, landrover", "jersey, T-shirt, tee shirt", "jigsaw puzzle",
- "jinrikisha, ricksha, rickshaw", "joystick", "kimono",
- "knee pad", "knot", "lab coat, laboratory coat",
- "ladle", "lampshade, lamp shade", "laptop, laptop computer",
- "lawn mower, mower", "lens cap, lens cover", "letter opener, paper knife, paperknife",
- "library", "lifeboat", "lighter, light, igniter, ignitor",
- "limousine, limo", "liner, ocean liner", "lipstick, lip rouge",
- "Loafer", "lotion", "loudspeaker, speaker, speaker unit, loudspeaker system, speaker system",
- "loupe, jeweler's loupe", "lumbermill, sawmill", "magnetic compass",
- "mailbag, postbag", "mailbox, letter box", "maillot",
- "maillot, tank suit", "manhole cover", "maraca",
- "marimba, xylophone", "mask", "matchstick",
- "maypole", "maze, labyrinth", "measuring cup",
- "medicine chest, medicine cabinet", "megalith, megalithic structure",
- "microphone, mike", "microwave, microwave oven", "military uniform",
- "milk can", "minibus", "miniskirt, mini",
- "minivan", "missile", "mitten",
- "mixing bowl", "mobile home, manufactured home", "Model T",
- "modem", "monastery", "monitor",
- "moped", "mortar", "mortarboard",
- "mosque", "mosquito net", "motor scooter, scooter",
- "mountain bike, all-terrain bike, off-roader", "mountain tent",
- "mouse, computer mouse", "mousetrap", "moving van",
- "muzzle", "nail", "neck brace",
- "necklace", "nipple", "notebook, notebook computer",
- "obelisk", "oboe, hautboy, hautbois", "ocarina, sweet potato",
- "odometer, hodometer, mileometer, milometer", "oil filter", "organ, pipe organ",
- "oscilloscope, scope, cathode-ray oscilloscope, CRO", "overskirt",
- "oxcart", "oxygen mask", "packet",
- "paddle, boat paddle", "paddlewheel, paddle wheel", "padlock",
- "paintbrush", "pajama, pyjama, pj's, jammies", "palace",
- "panpipe, pandean pipe, syrinx", "paper towel", "parachute, chute",
- "parallel bars, bars", "park bench", "parking meter",
- "passenger car, coach, carriage", "patio, terrace", "pay-phone, pay-station",
- "pedestal, plinth, footstall", "pencil box, pencil case", "pencil sharpener",
- "perfume, essence", "Petri dish", "photocopier",
- "pick, plectrum, plectron", "pickelhaube", "picket fence, paling",
- "pickup, pickup truck", "pier", "piggy bank, penny bank",
- "pill bottle", "pillow", "ping-pong ball",
- "pinwheel", "pirate, pirate ship", "pitcher, ewer",
- "plane, carpenter's plane, woodworking plane", "planetarium", "plastic bag",
- "plate rack", "plow, plough", "plunger, plumber's helper",
- "Polaroid camera, Polaroid Land camera", "pole", "police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria",
- "poncho", "pool table, billiard table, snooker table", "pop bottle, soda bottle",
- "pot, flowerpot", "potter's wheel", "power drill",
- "prayer rug, prayer mat", "printer", "prison, prison house",
- "projectile, missile", "projector", "puck, hockey puck",
- "punching bag, punch bag, punching ball, punchball", "purse", "quill, quill pen",
- "quilt, comforter, comfort, puff", "racer, race car, racing car",
- "racket, racquet", "radiator", "radio, wireless",
- "radio telescope, radio reflector", "rain barrel", "recreational vehicle, RV, R.V.",
- "reel", "reflex camera", "refrigerator, icebox",
- "remote control, remote", "restaurant, eating house, eating place, eatery",
- "revolver, six-gun, six-shooter", "rifle", "rocking chair, rocker",
- "rotisserie", "rubber eraser, rubber, pencil eraser", "rugby ball",
- "rule, ruler", "running shoe", "safe",
- "safety pin", "saltshaker, salt shaker", "sandal",
- "sarong", "sax, saxophone", "scabbard",
- "scale, weighing machine", "school bus", "schooner",
- "scoreboard", "screen, CRT screen", "screw",
- "screwdriver", "seat belt, seatbelt", "sewing machine",
- "shield, buckler", "shoe shop, shoe-shop, shoe store", "shoji",
- "shopping basket", "shopping cart", "shovel",
- "shower cap", "shower curtain", "ski",
- "ski mask", "sleeping bag", "slide rule, slipstick",
- "sliding door", "slot, one-armed bandit", "snorkel",
- "snowmobile", "snowplow, snowplough", "soap dispenser",
- "soccer ball", "sock", "solar dish, solar collector, solar furnace",
- "sombrero", "soup bowl", "space bar",
- "space heater", "space shuttle", "spatula",
- "speedboat", "spider web, spider's web", "spindle",
- "sports car, sport car", "spotlight, spot", "stage",
- "steam locomotive", "steel arch bridge", "steel drum",
- "stethoscope", "stole", "stone wall",
- "stopwatch, stop watch", "stove", "strainer",
- "streetcar, tram, tramcar, trolley, trolley car", "stretcher", "studio couch, day bed",
- "stupa, tope", "submarine, pigboat, sub, U-boat", "suit, suit of clothes",
- "sundial", "sunglass", "sunglasses, dark glasses, shades",
- "sunscreen, sunblock, sun blocker", "suspension bridge", "swab, swob, mop",
- "sweatshirt", "swimming trunks, bathing trunks", "swing",
- "switch, electric switch, electrical switch", "syringe", "table lamp",
- "tank, army tank, armored combat vehicle, armoured combat vehicle",
- "tape player", "teapot", "teddy, teddy bear",
- "television, television system", "tennis ball", "thatch, thatched roof",
- "theater curtain, theatre curtain", "thimble", "thresher, thrasher, threshing machine",
- "throne", "tile roof", "toaster",
- "tobacco shop, tobacconist shop, tobacconist", "toilet seat", "torch",
- "totem pole", "tow truck, tow car, wrecker", "toyshop",
- "tractor", "trailer truck, tractor trailer, trucking rig, rig, articulated lorry, semi",
- "tray", "trench coat", "tricycle, trike, velocipede",
- "trimaran", "tripod", "triumphal arch",
- "trolleybus, trolley coach, trackless trolley", "trombone", "tub, vat",
- "turnstile", "typewriter keyboard", "umbrella",
- "unicycle, monocycle", "upright, upright piano", "vacuum, vacuum cleaner",
- "vase", "vault", "velvet",
- "vending machine", "vestment", "viaduct",
- "violin, fiddle", "volleyball", "waffle iron",
- "wall clock", "wallet, billfold, notecase, pocketbook", "wardrobe, closet, press",
- "warplane, military plane", "washbasin, handbasin, washbowl, lavabo, wash-hand basin",
- "washer, automatic washer, washing machine", "water bottle", "water jug",
- "water tower", "whiskey jug", "whistle",
- "wig", "window screen", "window shade",
- "Windsor tie", "wine bottle", "wing",
- "wok", "wooden spoon", "wool, woolen, woollen",
- "worm fence, snake fence, snake-rail fence, Virginia fence", "wreck",
- "yawl", "yurt", "web site, website, internet site, site",
- "comic book", "crossword puzzle, crossword", "street sign",
- "traffic light, traffic signal, stoplight", "book jacket, dust cover, dust jacket, dust wrapper",
- "menu", "plate", "guacamole",
- "consomme", "hot pot, hotpot", "trifle",
- "ice cream, icecream", "ice lolly, lolly, lollipop, popsicle", "French loaf",
- "bagel, beigel", "pretzel", "cheeseburger",
- "hotdog, hot dog, red hot", "mashed potato", "head cabbage",
- "broccoli", "cauliflower", "zucchini, courgette",
- "spaghetti squash", "acorn squash", "butternut squash",
- "cucumber, cuke", "artichoke, globe artichoke", "bell pepper",
- "cardoon", "mushroom", "Granny Smith",
- "strawberry", "orange", "lemon",
- "fig", "pineapple, ananas", "banana",
- "jackfruit, jak, jack", "custard apple", "pomegranate",
- "hay", "carbonara", "chocolate sauce, chocolate syrup",
- "dough", "meat loaf, meatloaf", "pizza, pizza pie",
- "potpie", "burrito", "red wine",
- "espresso", "cup", "eggnog",
- "alp", "bubble", "cliff, drop, drop-off",
- "coral reef", "geyser", "lakeside, lakeshore",
- "promontory, headland, head, foreland", "sandbar, sand bar", "seashore, coast, seacoast, sea-coast",
- "valley, vale", "volcano", "ballplayer, baseball player",
- "groom, bridegroom", "scuba diver", "rapeseed",
- "daisy", "yellow lady's slipper, yellow lady-slipper, Cypripedium calceolus, Cypripedium parviflorum",
- "corn", "acorn", "hip, rose hip, rosehip",
- "buckeye, horse chestnut, conker", "coral fungus", "agaric",
- "gyromitra", "stinkhorn, carrion fungus", "earthstar",
- "hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa",
- "bolete", "ear, spike, capitulum", "toilet tissue, toilet paper, bathroom tissue"
- };
- };
-}
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_DENSENET_H
diff --git a/lite/mnn/cv/mnn_efficient_emotion7.cpp b/lite/mnn/cv/mnn_efficient_emotion7.cpp
deleted file mode 100644
index 1d80abec..00000000
--- a/lite/mnn/cv/mnn_efficient_emotion7.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// Created by DefTruth on 2021/11/27.
-//
-
-#include "mnn_efficient_emotion7.h"
-#include "lite/utils.h"
-
-using mnncv::MNNEfficientEmotion7;
-
-MNNEfficientEmotion7::MNNEfficientEmotion7(const std::string &_mnn_path, unsigned int _num_threads)
- : BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-inline void MNNEfficientEmotion7::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNEfficientEmotion7::transform(const cv::Mat &mat)
-{
- cv::Mat canvas;
- cv::resize(mat, canvas, cv::Size(input_width, input_height));
- // (1,3,224,224)
- pretreat->convert(canvas.data, input_width, input_height, canvas.step[0], input_tensor);
-}
-
-void MNNEfficientEmotion7::detect(const cv::Mat &mat, types::Emotions &emotions)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. fetch.
- auto device_emotion_logits_ptr = output_tensors.at("logits"); // (1,7)
- MNN::Tensor host_emotion_logits_tensor(device_emotion_logits_ptr, device_emotion_logits_ptr->getDimensionType());
- device_emotion_logits_ptr->copyToHostTensor(&host_emotion_logits_tensor);
-
- auto emotion_dims = host_emotion_logits_tensor.shape();
- const unsigned int num_emotions = emotion_dims.at(1); // 7
-
- unsigned int pred_label = 0;
- const float *pred_logits_ptr = host_emotion_logits_tensor.host();
-
- auto softmax_probs = lite::utils::math::softmax(pred_logits_ptr, num_emotions, pred_label);
- emotions.label = pred_label;
- emotions.score = softmax_probs[pred_label];
- emotions.text = emotion_texts[pred_label];
- emotions.flag = true;
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_efficient_emotion7.h b/lite/mnn/cv/mnn_efficient_emotion7.h
deleted file mode 100644
index c0259511..00000000
--- a/lite/mnn/cv/mnn_efficient_emotion7.h
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// Created by DefTruth on 2021/11/27.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_EFFICIENT_EMOTION7_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_EFFICIENT_EMOTION7_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNEfficientEmotion7 : public BasicMNNHandler
- {
- public:
- explicit MNNEfficientEmotion7(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNEfficientEmotion7() override = default;
-
- private:
- const float mean_vals[3] = {255.f * 0.485f, 255.f * 0.456, 255.f * 0.406f};
- const float norm_vals[3] = {1.f / (255.f * 0.229f), 1.f / (255.f * 0.224f), 1.f / (255.f * 0.225f)};
- const char *emotion_texts[7] = {
- "angry", "disgust", "fear", "happiness", "neutral", "sadness", "surprise"
- };
-
- private:
- void initialize_pretreat(); //
-
- void transform(const cv::Mat &mat) override; // padding & resize & normalize.
-
- public:
- void detect(const cv::Mat &mat, types::Emotions &emotions);
- };
-}
-
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_EFFICIENT_EMOTION7_H
diff --git a/lite/mnn/cv/mnn_efficient_emotion8.cpp b/lite/mnn/cv/mnn_efficient_emotion8.cpp
deleted file mode 100644
index fbf9036c..00000000
--- a/lite/mnn/cv/mnn_efficient_emotion8.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// Created by DefTruth on 2021/11/27.
-//
-
-#include "mnn_efficient_emotion8.h"
-#include "lite/utils.h"
-
-using mnncv::MNNEfficientEmotion8;
-
-MNNEfficientEmotion8::MNNEfficientEmotion8(const std::string &_mnn_path, unsigned int _num_threads)
- : BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-inline void MNNEfficientEmotion8::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNEfficientEmotion8::transform(const cv::Mat &mat)
-{
- cv::Mat canvas;
- cv::resize(mat, canvas, cv::Size(input_width, input_height));
- // (1,3,224,224)
- pretreat->convert(canvas.data, input_width, input_height, canvas.step[0], input_tensor);
-}
-
-void MNNEfficientEmotion8::detect(const cv::Mat &mat, types::Emotions &emotions)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. fetch.
- auto device_emotion_logits_ptr = output_tensors.at("logits"); // (1,8)
- MNN::Tensor host_emotion_logits_tensor(device_emotion_logits_ptr, device_emotion_logits_ptr->getDimensionType());
- device_emotion_logits_ptr->copyToHostTensor(&host_emotion_logits_tensor);
-
- auto emotion_dims = host_emotion_logits_tensor.shape();
- const unsigned int num_emotions = emotion_dims.at(1); // 8
-
- unsigned int pred_label = 0;
- const float *pred_logits_ptr = host_emotion_logits_tensor.host();
-
- auto softmax_probs = lite::utils::math::softmax(pred_logits_ptr, num_emotions, pred_label);
- emotions.label = pred_label;
- emotions.score = softmax_probs[pred_label];
- emotions.text = emotion_texts[pred_label];
- emotions.flag = true;
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_efficient_emotion8.h b/lite/mnn/cv/mnn_efficient_emotion8.h
deleted file mode 100644
index 7cccb15d..00000000
--- a/lite/mnn/cv/mnn_efficient_emotion8.h
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// Created by DefTruth on 2021/11/27.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_EFFICIENT_EMOTION8_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_EFFICIENT_EMOTION8_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNEfficientEmotion8 : public BasicMNNHandler
- {
- public:
- explicit MNNEfficientEmotion8(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNEfficientEmotion8() override = default;
-
- private:
- const float mean_vals[3] = {255.f * 0.485f, 255.f * 0.456, 255.f * 0.406f};
- const float norm_vals[3] = {1 / (255.f * 0.229f), 1 / (255.f * 0.224f), 1 / (255.f * 0.225f)};
- const char *emotion_texts[8] = {
- "angry", "contempt", "disgust", "fear", "happiness", "neutral", "sadness", "surprise"
- };
-
- private:
- void initialize_pretreat(); //
-
- void transform(const cv::Mat &mat) override; // padding & resize & normalize.
-
- public:
- void detect(const cv::Mat &mat, types::Emotions &emotions);
- };
-}
-
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_EFFICIENT_EMOTION8_H
diff --git a/lite/mnn/cv/mnn_efficientnet_lite4.cpp b/lite/mnn/cv/mnn_efficientnet_lite4.cpp
deleted file mode 100644
index e96bdee2..00000000
--- a/lite/mnn/cv/mnn_efficientnet_lite4.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-// Created by DefTruth on 2021/11/29.
-//
-
-#include "mnn_efficientnet_lite4.h"
-#include "lite/utils.h"
-
-using mnncv::MNNEfficientNetLite4;
-
-MNNEfficientNetLite4::MNNEfficientNetLite4(const std::string &_mnn_path, unsigned int _num_threads)
- : BasicMNNHandler(_mnn_path, _num_threads)
-{
- // re-init with fixed input shape, due to the error of input
- // shape auto-detection while using MNN with NHWC input.
- // TODO: pre-process bug fix
- dimension_type = MNN::Tensor::TENSORFLOW;
- input_batch = 1;
- input_channel = 3;
- input_width = 224;
- input_height = 224;
- mnn_interpreter->resizeTensor(
- input_tensor, {input_batch, input_height, input_width, input_channel});
- mnn_interpreter->resizeSession(mnn_session);
-
- initialize_pretreat();
-}
-
-inline void MNNEfficientNetLite4::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNEfficientNetLite4::transform(const cv::Mat &mat)
-{
- cv::Mat canvas;
- cv::resize(mat, canvas, cv::Size(input_width, input_height));
- // (1,224,224,3)
- pretreat->convert(canvas.data, input_width, input_height, canvas.step[0], input_tensor);
-}
-
-void MNNEfficientNetLite4::detect(const cv::Mat &mat, types::ImageNetContent &content, unsigned int top_k)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. fetch.
- auto device_scores_ptr = output_tensors.at("Softmax:0");
- MNN::Tensor host_scores_tensor(device_scores_ptr, device_scores_ptr->getDimensionType());
- device_scores_ptr->copyToHostTensor(&host_scores_tensor);
-
- auto scores_dims = host_scores_tensor.shape();
- const unsigned int num_classes = scores_dims.at(1); // 1000
- const float *scores = host_scores_tensor.host();
-
- std::vector sorted_indices = lite::utils::math::argsort(scores, num_classes);
- if (top_k > num_classes) top_k = num_classes;
-
- content.scores.clear();
- content.labels.clear();
- content.texts.clear();
- for (unsigned int i = 0; i < top_k; ++i)
- {
- content.labels.push_back(sorted_indices[i]);
- content.scores.push_back(scores[sorted_indices[i]]);
- content.texts.push_back(class_names[sorted_indices[i]]);
- }
- content.flag = true;
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_efficientnet_lite4.h b/lite/mnn/cv/mnn_efficientnet_lite4.h
deleted file mode 100644
index 296e7c9e..00000000
--- a/lite/mnn/cv/mnn_efficientnet_lite4.h
+++ /dev/null
@@ -1,407 +0,0 @@
-//
-// Created by DefTruth on 2021/11/29.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_EFFICIENTNET_LITE4_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_EFFICIENTNET_LITE4_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNEfficientNetLite4 : public BasicMNNHandler
- {
- public:
- explicit MNNEfficientNetLite4(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNEfficientNetLite4() override = default;
-
- private:
- const float mean_vals[3] = {127.f, 127.f, 127.f};
- const float norm_vals[3] = {1.f / 128.f, 1.f / 128.f, 1.f / 128.f};
-
- private:
- void initialize_pretreat(); //
-
- void transform(const cv::Mat &mat) override; // resize & normalize.
-
- public:
- void detect(const cv::Mat &mat, types::ImageNetContent &content, unsigned int top_k = 5);
-
- private:
- const char *class_names[1000] = {
- "tench, Tinca tinca", "goldfish, Carassius auratus",
- "great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias",
- "tiger shark, Galeocerdo cuvieri", "hammerhead, hammerhead shark",
- "electric ray, crampfish, numbfish, torpedo", "stingray", "cock",
- "hen", "ostrich, Struthio camelus", "brambling, Fringilla montifringilla",
- "goldfinch, Carduelis carduelis", "house finch, linnet, Carpodacus mexicanus",
- "junco, snowbird", "indigo bunting, indigo finch, indigo bird, Passerina cyanea",
- "robin, American robin, Turdus migratorius", "bulbul", "jay",
- "magpie", "chickadee", "water ouzel, dipper",
- "kite", "bald eagle, American eagle, Haliaeetus leucocephalus",
- "vulture", "great grey owl, great gray owl, Strix nebulosa", "European fire salamander, Salamandra salamandra",
- "common newt, Triturus vulgaris", "eft", "spotted salamander, Ambystoma maculatum",
- "axolotl, mud puppy, Ambystoma mexicanum", "bullfrog, Rana catesbeiana",
- "tree frog, tree-frog", "tailed frog, bell toad, ribbed toad, tailed toad, Ascaphus trui",
- "loggerhead, loggerhead turtle, Caretta caretta", "leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea",
- "mud turtle", "terrapin", "box turtle, box tortoise",
- "banded gecko", "common iguana, iguana, Iguana iguana", "American chameleon, anole, Anolis carolinensis",
- "whiptail, whiptail lizard", "agama", "frilled lizard, Chlamydosaurus kingi",
- "alligator lizard", "Gila monster, Heloderma suspectum", "green lizard, Lacerta viridis",
- "African chameleon, Chamaeleo chamaeleon", "Komodo dragon, Komodo lizard, dragon lizard, giant lizard, Varanus komodoensis",
- "African crocodile, Nile crocodile, Crocodylus niloticus", "American alligator, Alligator mississipiensis",
- "triceratops", "thunder snake, worm snake, Carphophis amoenus",
- "ringneck snake, ring-necked snake, ring snake", "hognose snake, puff adder, sand viper",
- "green snake, grass snake", "king snake, kingsnake", "garter snake, grass snake",
- "water snake", "vine snake", "night snake, Hypsiglena torquata",
- "boa constrictor, Constrictor constrictor", "rock python, rock snake, Python sebae",
- "Indian cobra, Naja naja", "green mamba", "sea snake",
- "horned viper, cerastes, sand viper, horned asp, Cerastes cornutus",
- "diamondback, diamondback rattlesnake, Crotalus adamanteus", "sidewinder, horned rattlesnake, Crotalus cerastes",
- "trilobite", "harvestman, daddy longlegs, Phalangium opilio", "scorpion",
- "black and gold garden spider, Argiope aurantia", "barn spider, Araneus cavaticus",
- "garden spider, Aranea diademata", "black widow, Latrodectus mactans",
- "tarantula", "wolf spider, hunting spider", "tick",
- "centipede", "black grouse", "ptarmigan",
- "ruffed grouse, partridge, Bonasa umbellus", "prairie chicken, prairie grouse, prairie fowl",
- "peacock", "quail", "partridge",
- "African grey, African gray, Psittacus erithacus", "macaw", "sulphur-crested cockatoo, Kakatoe galerita, Cacatua galerita",
- "lorikeet", "coucal", "bee eater",
- "hornbill", "hummingbird", "jacamar",
- "toucan", "drake", "red-breasted merganser, Mergus serrator",
- "goose", "black swan, Cygnus atratus", "tusker",
- "echidna, spiny anteater, anteater", "platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus",
- "wallaby, brush kangaroo", "koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus",
- "wombat", "jellyfish", "sea anemone, anemone",
- "brain coral", "flatworm, platyhelminth", "nematode, nematode worm, roundworm",
- "conch", "snail", "slug",
- "sea slug, nudibranch", "chiton, coat-of-mail shell, sea cradle, polyplacophore",
- "chambered nautilus, pearly nautilus, nautilus", "Dungeness crab, Cancer magister",
- "rock crab, Cancer irroratus", "fiddler crab",
- "king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica",
- "American lobster, Northern lobster, Maine lobster, Homarus americanus",
- "spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish",
- "crayfish, crawfish, crawdad, crawdaddy", "hermit crab", "isopod",
- "white stork, Ciconia ciconia", "black stork, Ciconia nigra", "spoonbill",
- "flamingo", "little blue heron, Egretta caerulea", "American egret, great white heron, Egretta albus",
- "bittern", "crane", "limpkin, Aramus pictus",
- "European gallinule, Porphyrio porphyrio", "American coot, marsh hen, mud hen, water hen, Fulica americana",
- "bustard", "ruddy turnstone, Arenaria interpres", "red-backed sandpiper, dunlin, Erolia alpina",
- "redshank, Tringa totanus", "dowitcher", "oystercatcher, oyster catcher",
- "pelican", "king penguin, Aptenodytes patagonica", "albatross, mollymawk",
- "grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus",
- "killer whale, killer, orca, grampus, sea wolf, Orcinus orca",
- "dugong, Dugong dugon", "sea lion", "Chihuahua",
- "Japanese spaniel", "Maltese dog, Maltese terrier, Maltese", "Pekinese, Pekingese, Peke",
- "Shih-Tzu", "Blenheim spaniel", "papillon",
- "toy terrier", "Rhodesian ridgeback", "Afghan hound, Afghan",
- "basset, basset hound", "beagle", "bloodhound, sleuthhound",
- "bluetick", "black-and-tan coonhound", "Walker hound, Walker foxhound",
- "English foxhound", "redbone", "borzoi, Russian wolfhound",
- "Irish wolfhound", "Italian greyhound", "whippet",
- "Ibizan hound, Ibizan Podenco", "Norwegian elkhound, elkhound",
- "otterhound, otter hound", "Saluki, gazelle hound", "Scottish deerhound, deerhound",
- "Weimaraner", "Staffordshire bullterrier, Staffordshire bull terrier",
- "American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier",
- "Bedlington terrier", "Border terrier", "Kerry blue terrier",
- "Irish terrier", "Norfolk terrier", "Norwich terrier",
- "Yorkshire terrier", "wire-haired fox terrier", "Lakeland terrier",
- "Sealyham terrier, Sealyham", "Airedale, Airedale terrier", "cairn, cairn terrier",
- "Australian terrier", "Dandie Dinmont, Dandie Dinmont terrier",
- "Boston bull, Boston terrier", "miniature schnauzer", "giant schnauzer",
- "standard schnauzer", "Scotch terrier, Scottish terrier, Scottie",
- "Tibetan terrier, chrysanthemum dog", "silky terrier, Sydney silky",
- "soft-coated wheaten terrier", "West Highland white terrier", "Lhasa, Lhasa apso",
- "flat-coated retriever", "curly-coated retriever", "golden retriever",
- "Labrador retriever", "Chesapeake Bay retriever", "German short-haired pointer",
- "vizsla, Hungarian pointer", "English setter", "Irish setter, red setter",
- "Gordon setter", "Brittany spaniel", "clumber, clumber spaniel",
- "English springer, English springer spaniel", "Welsh springer spaniel",
- "cocker spaniel, English cocker spaniel, cocker", "Sussex spaniel",
- "Irish water spaniel", "kuvasz", "schipperke",
- "groenendael", "malinois", "briard",
- "kelpie", "komondor", "Old English sheepdog, bobtail",
- "Shetland sheepdog, Shetland sheep dog, Shetland", "collie", "Border collie",
- "Bouvier des Flandres, Bouviers des Flandres", "Rottweiler", "German shepherd, German shepherd dog, German police dog, alsatian",
- "Doberman, Doberman pinscher", "miniature pinscher", "Greater Swiss Mountain dog",
- "Bernese mountain dog", "Appenzeller", "EntleBucher",
- "boxer", "bull mastiff", "Tibetan mastiff",
- "French bulldog", "Great Dane", "Saint Bernard, St Bernard",
- "Eskimo dog, husky", "malamute, malemute, Alaskan malamute", "Siberian husky",
- "dalmatian, coach dog, carriage dog", "affenpinscher, monkey pinscher, monkey dog",
- "basenji", "pug, pug-dog", "Leonberg",
- "Newfoundland, Newfoundland dog", "Great Pyrenees", "Samoyed, Samoyede",
- "Pomeranian", "chow, chow chow", "keeshond",
- "Brabancon griffon", "Pembroke, Pembroke Welsh corgi", "Cardigan, Cardigan Welsh corgi",
- "toy poodle", "miniature poodle", "standard poodle",
- "Mexican hairless", "timber wolf, grey wolf, gray wolf, Canis lupus",
- "white wolf, Arctic wolf, Canis lupus tundrarum", "red wolf, maned wolf, Canis rufus, Canis niger",
- "coyote, prairie wolf, brush wolf, Canis latrans", "dingo, warrigal, warragal, Canis dingo",
- "dhole, Cuon alpinus", "African hunting dog, hyena dog, Cape hunting dog, Lycaon pictus",
- "hyena, hyaena", "red fox, Vulpes vulpes", "kit fox, Vulpes macrotis",
- "Arctic fox, white fox, Alopex lagopus", "grey fox, gray fox, Urocyon cinereoargenteus",
- "tabby, tabby cat", "tiger cat", "Persian cat",
- "Siamese cat, Siamese", "Egyptian cat", "cougar, puma, catamount, mountain lion, painter, panther, Felis concolor",
- "lynx, catamount", "leopard, Panthera pardus", "snow leopard, ounce, Panthera uncia",
- "jaguar, panther, Panthera onca, Felis onca", "lion, king of beasts, Panthera leo",
- "tiger, Panthera tigris", "cheetah, chetah, Acinonyx jubatus", "brown bear, bruin, Ursus arctos",
- "American black bear, black bear, Ursus americanus, Euarctos americanus",
- "ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus",
- "sloth bear, Melursus ursinus, Ursus ursinus", "mongoose", "meerkat, mierkat",
- "tiger beetle", "ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle",
- "ground beetle, carabid beetle", "long-horned beetle, longicorn, longicorn beetle",
- "leaf beetle, chrysomelid", "dung beetle", "rhinoceros beetle",
- "weevil", "fly", "bee",
- "ant, emmet, pismire", "grasshopper, hopper", "cricket",
- "walking stick, walkingstick, stick insect", "cockroach, roach",
- "mantis, mantid", "cicada, cicala", "leafhopper",
- "lacewing, lacewing fly",
- "dragonfly, darning needle, devil's darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk",
- "damselfly", "admiral", "ringlet, ringlet butterfly",
- "monarch, monarch butterfly, milkweed butterfly, Danaus plexippus",
- "cabbage butterfly", "sulphur butterfly, sulfur butterfly", "lycaenid, lycaenid butterfly",
- "starfish, sea star", "sea urchin", "sea cucumber, holothurian",
- "wood rabbit, cottontail, cottontail rabbit", "hare", "Angora, Angora rabbit",
- "hamster", "porcupine, hedgehog", "fox squirrel, eastern fox squirrel, Sciurus niger",
- "marmot", "beaver", "guinea pig, Cavia cobaya",
- "sorrel", "zebra", "hog, pig, grunter, squealer, Sus scrofa",
- "wild boar, boar, Sus scrofa", "warthog", "hippopotamus, hippo, river horse, Hippopotamus amphibius",
- "ox", "water buffalo, water ox, Asiatic buffalo, Bubalus bubalis",
- "bison", "ram, tup", "bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis",
- "ibex, Capra ibex", "hartebeest", "impala, Aepyceros melampus",
- "gazelle", "Arabian camel, dromedary, Camelus dromedarius", "llama",
- "weasel", "mink", "polecat, fitch, foulmart, foumart, Mustela putorius",
- "black-footed ferret, ferret, Mustela nigripes", "otter", "skunk, polecat, wood pussy",
- "badger", "armadillo", "three-toed sloth, ai, Bradypus tridactylus",
- "orangutan, orang, orangutang, Pongo pygmaeus", "gorilla, Gorilla gorilla",
- "chimpanzee, chimp, Pan troglodytes", "gibbon, Hylobates lar", "siamang, Hylobates syndactylus, Symphalangus syndactylus",
- "guenon, guenon monkey", "patas, hussar monkey, Erythrocebus patas",
- "baboon", "macaque", "langur",
- "colobus, colobus monkey", "proboscis monkey, Nasalis larvatus",
- "marmoset", "capuchin, ringtail, Cebus capucinus", "howler monkey, howler",
- "titi, titi monkey", "spider monkey, Ateles geoffroyi", "squirrel monkey, Saimiri sciureus",
- "Madagascar cat, ring-tailed lemur, Lemur catta", "indri, indris, Indri indri, Indri brevicaudatus",
- "Indian elephant, Elephas maximus", "African elephant, Loxodonta africana",
- "lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens",
- "giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca",
- "barracouta, snoek", "eel", "coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus kisutch",
- "rock beauty, Holocanthus tricolor", "anemone fish", "sturgeon",
- "gar, garfish, garpike, billfish, Lepisosteus osseus", "lionfish",
- "puffer, pufferfish, blowfish, globefish", "abacus", "abaya",
- "academic gown, academic robe, judge's robe", "accordion, piano accordion, squeeze box",
- "acoustic guitar", "aircraft carrier, carrier, flattop, attack aircraft carrier",
- "airliner", "airship, dirigible", "altar",
- "ambulance", "amphibian, amphibious vehicle", "analog clock",
- "apiary, bee house", "apron",
- "ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin",
- "assault rifle, assault gun", "backpack, back pack, knapsack, packsack, rucksack, haversack",
- "bakery, bakeshop, bakehouse", "balance beam, beam", "balloon",
- "ballpoint, ballpoint pen, ballpen, Biro", "Band Aid", "banjo",
- "bannister, banister, balustrade, balusters, handrail", "barbell",
- "barber chair", "barbershop", "barn",
- "barometer", "barrel, cask", "barrow, garden cart, lawn cart, wheelbarrow",
- "baseball", "basketball", "bassinet",
- "bassoon", "bathing cap, swimming cap", "bath towel",
- "bathtub, bathing tub, bath, tub", "beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon",
- "beacon, lighthouse, beacon light, pharos", "beaker", "bearskin, busby, shako",
- "beer bottle", "beer glass", "bell cote, bell cot",
- "bib", "bicycle-built-for-two, tandem bicycle, tandem", "bikini, two-piece",
- "binder, ring-binder", "binoculars, field glasses, opera glasses",
- "birdhouse", "boathouse", "bobsled, bobsleigh, bob",
- "bolo tie, bolo, bola tie, bola", "bonnet, poke bonnet", "bookcase",
- "bookshop, bookstore, bookstall", "bottlecap", "bow",
- "bow tie, bow-tie, bowtie", "brass, memorial tablet, plaque", "brassiere, bra, bandeau",
- "breakwater, groin, groyne, mole, bulwark, seawall, jetty", "breastplate, aegis, egis",
- "broom", "bucket, pail", "buckle",
- "bulletproof vest", "bullet train, bullet", "butcher shop, meat market",
- "cab, hack, taxi, taxicab", "caldron, cauldron", "candle, taper, wax light",
- "cannon", "canoe", "can opener, tin opener",
- "cardigan", "car mirror", "carousel, carrousel, merry-go-round, roundabout, whirligig",
- "carpenter's kit, tool kit", "carton", "car wheel",
- "cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM",
- "cassette", "cassette player", "castle",
- "catamaran", "CD player", "cello, violoncello",
- "cellular telephone, cellular phone, cellphone, cell, mobile phone",
- "chain", "chainlink fence", "chain mail, ring mail, mail, chain armor, chain armour, ring armor, ring armour",
- "chain saw, chainsaw", "chest", "chiffonier, commode",
- "chime, bell, gong", "china cabinet, china closet", "Christmas stocking",
- "church, church building", "cinema, movie theater, movie theatre, movie house, picture palace",
- "cleaver, meat cleaver, chopper", "cliff dwelling", "cloak",
- "clog, geta, patten, sabot", "cocktail shaker", "coffee mug",
- "coffeepot", "coil, spiral, volute, whorl, helix", "combination lock",
- "computer keyboard, keypad", "confectionery, confectionary, candy store",
- "container ship, containership, container vessel", "convertible",
- "corkscrew, bottle screw", "cornet, horn, trumpet, trump", "cowboy boot",
- "cowboy hat, ten-gallon hat", "cradle", "crane",
- "crash helmet", "crate", "crib, cot",
- "Crock Pot", "croquet ball", "crutch",
- "cuirass", "dam, dike, dyke", "desk",
- "desktop computer", "dial telephone, dial phone", "diaper, nappy, napkin",
- "digital clock", "digital watch", "dining table, board",
- "dishrag, dishcloth", "dishwasher, dish washer, dishwashing machine",
- "disk brake, disc brake", "dock, dockage, docking facility", "dogsled, dog sled, dog sleigh",
- "dome", "doormat, welcome mat", "drilling platform, offshore rig",
- "drum, membranophone, tympan", "drumstick", "dumbbell",
- "Dutch oven", "electric fan, blower", "electric guitar",
- "electric locomotive", "entertainment center", "envelope",
- "espresso maker", "face powder", "feather boa, boa",
- "file, file cabinet, filing cabinet", "fireboat", "fire engine, fire truck",
- "fire screen, fireguard", "flagpole, flagstaff", "flute, transverse flute",
- "folding chair", "football helmet", "forklift",
- "fountain", "fountain pen", "four-poster",
- "freight car", "French horn, horn", "frying pan, frypan, skillet",
- "fur coat", "garbage truck, dustcart", "gasmask, respirator, gas helmet",
- "gas pump, gasoline pump, petrol pump, island dispenser", "goblet",
- "go-kart", "golf ball", "golfcart, golf cart",
- "gondola", "gong, tam-tam", "gown",
- "grand piano, grand", "greenhouse, nursery, glasshouse", "grille, radiator grille",
- "grocery store, grocery, food market, market", "guillotine", "hair slide",
- "hair spray", "half track", "hammer",
- "hamper", "hand blower, blow dryer, blow drier, hair dryer, hair drier",
- "hand-held computer, hand-held microcomputer", "handkerchief, hankie, hanky, hankey",
- "hard disc, hard disk, fixed disk", "harmonica, mouth organ, harp, mouth harp",
- "harp", "harvester, reaper", "hatchet",
- "holster", "home theater, home theatre", "honeycomb",
- "hook, claw", "hoopskirt, crinoline", "horizontal bar, high bar",
- "horse cart, horse-cart", "hourglass", "iPod",
- "iron, smoothing iron", "jack-o'-lantern", "jean, blue jean, denim",
- "jeep, landrover", "jersey, T-shirt, tee shirt", "jigsaw puzzle",
- "jinrikisha, ricksha, rickshaw", "joystick", "kimono",
- "knee pad", "knot", "lab coat, laboratory coat",
- "ladle", "lampshade, lamp shade", "laptop, laptop computer",
- "lawn mower, mower", "lens cap, lens cover", "letter opener, paper knife, paperknife",
- "library", "lifeboat", "lighter, light, igniter, ignitor",
- "limousine, limo", "liner, ocean liner", "lipstick, lip rouge",
- "Loafer", "lotion", "loudspeaker, speaker, speaker unit, loudspeaker system, speaker system",
- "loupe, jeweler's loupe", "lumbermill, sawmill", "magnetic compass",
- "mailbag, postbag", "mailbox, letter box", "maillot",
- "maillot, tank suit", "manhole cover", "maraca",
- "marimba, xylophone", "mask", "matchstick",
- "maypole", "maze, labyrinth", "measuring cup",
- "medicine chest, medicine cabinet", "megalith, megalithic structure",
- "microphone, mike", "microwave, microwave oven", "military uniform",
- "milk can", "minibus", "miniskirt, mini",
- "minivan", "missile", "mitten",
- "mixing bowl", "mobile home, manufactured home", "Model T",
- "modem", "monastery", "monitor",
- "moped", "mortar", "mortarboard",
- "mosque", "mosquito net", "motor scooter, scooter",
- "mountain bike, all-terrain bike, off-roader", "mountain tent",
- "mouse, computer mouse", "mousetrap", "moving van",
- "muzzle", "nail", "neck brace",
- "necklace", "nipple", "notebook, notebook computer",
- "obelisk", "oboe, hautboy, hautbois", "ocarina, sweet potato",
- "odometer, hodometer, mileometer, milometer", "oil filter", "organ, pipe organ",
- "oscilloscope, scope, cathode-ray oscilloscope, CRO", "overskirt",
- "oxcart", "oxygen mask", "packet",
- "paddle, boat paddle", "paddlewheel, paddle wheel", "padlock",
- "paintbrush", "pajama, pyjama, pj's, jammies", "palace",
- "panpipe, pandean pipe, syrinx", "paper towel", "parachute, chute",
- "parallel bars, bars", "park bench", "parking meter",
- "passenger car, coach, carriage", "patio, terrace", "pay-phone, pay-station",
- "pedestal, plinth, footstall", "pencil box, pencil case", "pencil sharpener",
- "perfume, essence", "Petri dish", "photocopier",
- "pick, plectrum, plectron", "pickelhaube", "picket fence, paling",
- "pickup, pickup truck", "pier", "piggy bank, penny bank",
- "pill bottle", "pillow", "ping-pong ball",
- "pinwheel", "pirate, pirate ship", "pitcher, ewer",
- "plane, carpenter's plane, woodworking plane", "planetarium", "plastic bag",
- "plate rack", "plow, plough", "plunger, plumber's helper",
- "Polaroid camera, Polaroid Land camera", "pole", "police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria",
- "poncho", "pool table, billiard table, snooker table", "pop bottle, soda bottle",
- "pot, flowerpot", "potter's wheel", "power drill",
- "prayer rug, prayer mat", "printer", "prison, prison house",
- "projectile, missile", "projector", "puck, hockey puck",
- "punching bag, punch bag, punching ball, punchball", "purse", "quill, quill pen",
- "quilt, comforter, comfort, puff", "racer, race car, racing car",
- "racket, racquet", "radiator", "radio, wireless",
- "radio telescope, radio reflector", "rain barrel", "recreational vehicle, RV, R.V.",
- "reel", "reflex camera", "refrigerator, icebox",
- "remote control, remote", "restaurant, eating house, eating place, eatery",
- "revolver, six-gun, six-shooter", "rifle", "rocking chair, rocker",
- "rotisserie", "rubber eraser, rubber, pencil eraser", "rugby ball",
- "rule, ruler", "running shoe", "safe",
- "safety pin", "saltshaker, salt shaker", "sandal",
- "sarong", "sax, saxophone", "scabbard",
- "scale, weighing machine", "school bus", "schooner",
- "scoreboard", "screen, CRT screen", "screw",
- "screwdriver", "seat belt, seatbelt", "sewing machine",
- "shield, buckler", "shoe shop, shoe-shop, shoe store", "shoji",
- "shopping basket", "shopping cart", "shovel",
- "shower cap", "shower curtain", "ski",
- "ski mask", "sleeping bag", "slide rule, slipstick",
- "sliding door", "slot, one-armed bandit", "snorkel",
- "snowmobile", "snowplow, snowplough", "soap dispenser",
- "soccer ball", "sock", "solar dish, solar collector, solar furnace",
- "sombrero", "soup bowl", "space bar",
- "space heater", "space shuttle", "spatula",
- "speedboat", "spider web, spider's web", "spindle",
- "sports car, sport car", "spotlight, spot", "stage",
- "steam locomotive", "steel arch bridge", "steel drum",
- "stethoscope", "stole", "stone wall",
- "stopwatch, stop watch", "stove", "strainer",
- "streetcar, tram, tramcar, trolley, trolley car", "stretcher", "studio couch, day bed",
- "stupa, tope", "submarine, pigboat, sub, U-boat", "suit, suit of clothes",
- "sundial", "sunglass", "sunglasses, dark glasses, shades",
- "sunscreen, sunblock, sun blocker", "suspension bridge", "swab, swob, mop",
- "sweatshirt", "swimming trunks, bathing trunks", "swing",
- "switch, electric switch, electrical switch", "syringe", "table lamp",
- "tank, army tank, armored combat vehicle, armoured combat vehicle",
- "tape player", "teapot", "teddy, teddy bear",
- "television, television system", "tennis ball", "thatch, thatched roof",
- "theater curtain, theatre curtain", "thimble", "thresher, thrasher, threshing machine",
- "throne", "tile roof", "toaster",
- "tobacco shop, tobacconist shop, tobacconist", "toilet seat", "torch",
- "totem pole", "tow truck, tow car, wrecker", "toyshop",
- "tractor", "trailer truck, tractor trailer, trucking rig, rig, articulated lorry, semi",
- "tray", "trench coat", "tricycle, trike, velocipede",
- "trimaran", "tripod", "triumphal arch",
- "trolleybus, trolley coach, trackless trolley", "trombone", "tub, vat",
- "turnstile", "typewriter keyboard", "umbrella",
- "unicycle, monocycle", "upright, upright piano", "vacuum, vacuum cleaner",
- "vase", "vault", "velvet",
- "vending machine", "vestment", "viaduct",
- "violin, fiddle", "volleyball", "waffle iron",
- "wall clock", "wallet, billfold, notecase, pocketbook", "wardrobe, closet, press",
- "warplane, military plane", "washbasin, handbasin, washbowl, lavabo, wash-hand basin",
- "washer, automatic washer, washing machine", "water bottle", "water jug",
- "water tower", "whiskey jug", "whistle",
- "wig", "window screen", "window shade",
- "Windsor tie", "wine bottle", "wing",
- "wok", "wooden spoon", "wool, woolen, woollen",
- "worm fence, snake fence, snake-rail fence, Virginia fence", "wreck",
- "yawl", "yurt", "web site, website, internet site, site",
- "comic book", "crossword puzzle, crossword", "street sign",
- "traffic light, traffic signal, stoplight", "book jacket, dust cover, dust jacket, dust wrapper",
- "menu", "plate", "guacamole",
- "consomme", "hot pot, hotpot", "trifle",
- "ice cream, icecream", "ice lolly, lolly, lollipop, popsicle", "French loaf",
- "bagel, beigel", "pretzel", "cheeseburger",
- "hotdog, hot dog, red hot", "mashed potato", "head cabbage",
- "broccoli", "cauliflower", "zucchini, courgette",
- "spaghetti squash", "acorn squash", "butternut squash",
- "cucumber, cuke", "artichoke, globe artichoke", "bell pepper",
- "cardoon", "mushroom", "Granny Smith",
- "strawberry", "orange", "lemon",
- "fig", "pineapple, ananas", "banana",
- "jackfruit, jak, jack", "custard apple", "pomegranate",
- "hay", "carbonara", "chocolate sauce, chocolate syrup",
- "dough", "meat loaf, meatloaf", "pizza, pizza pie",
- "potpie", "burrito", "red wine",
- "espresso", "cup", "eggnog",
- "alp", "bubble", "cliff, drop, drop-off",
- "coral reef", "geyser", "lakeside, lakeshore",
- "promontory, headland, head, foreland", "sandbar, sand bar", "seashore, coast, seacoast, sea-coast",
- "valley, vale", "volcano", "ballplayer, baseball player",
- "groom, bridegroom", "scuba diver", "rapeseed",
- "daisy", "yellow lady's slipper, yellow lady-slipper, Cypripedium calceolus, Cypripedium parviflorum",
- "corn", "acorn", "hip, rose hip, rosehip",
- "buckeye, horse chestnut, conker", "coral fungus", "agaric",
- "gyromitra", "stinkhorn, carrion fungus", "earthstar",
- "hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa",
- "bolete", "ear, spike, capitulum", "toilet tissue, toilet paper, bathroom tissue"
- };
- };
-}
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_EFFICIENTNET_LITE4_H
diff --git a/lite/mnn/cv/mnn_emotion_ferplus.cpp b/lite/mnn/cv/mnn_emotion_ferplus.cpp
deleted file mode 100644
index 43f00270..00000000
--- a/lite/mnn/cv/mnn_emotion_ferplus.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// Created by DefTruth on 2021/11/27.
-//
-
-#include "mnn_emotion_ferplus.h"
-#include "lite/utils.h"
-
-using mnncv::MNNEmotionFerPlus;
-
-MNNEmotionFerPlus::MNNEmotionFerPlus(const std::string &_mnn_path, unsigned int _num_threads)
- : BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-inline void MNNEmotionFerPlus::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::GRAY,
- mean_vals, 1,
- norm_vals, 1
- )
- );
-}
-
-void MNNEmotionFerPlus::transform(const cv::Mat &mat)
-{
- cv::Mat canvas;
- cv::resize(mat, canvas, cv::Size(input_width, input_height));
- // (1,1,64,64)
- pretreat->convert(canvas.data, input_width, input_height, canvas.step[0], input_tensor);
-}
-
-void MNNEmotionFerPlus::detect(const cv::Mat &mat, types::Emotions &emotions)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. fetch.
- auto device_emotion_logits_ptr = output_tensors.at("Plus692_Output_0"); // (1,8)
- MNN::Tensor host_emotion_logits_tensor(device_emotion_logits_ptr, device_emotion_logits_ptr->getDimensionType());
- device_emotion_logits_ptr->copyToHostTensor(&host_emotion_logits_tensor);
-
- auto emotion_dims = host_emotion_logits_tensor.shape();
- const unsigned int num_emotions = emotion_dims.at(1); // 8
-
- unsigned int pred_label = 0;
- const float *pred_logits_ptr = host_emotion_logits_tensor.host();
-
- auto softmax_probs = lite::utils::math::softmax(pred_logits_ptr, num_emotions, pred_label);
- emotions.label = pred_label;
- emotions.score = softmax_probs[pred_label];
- emotions.text = emotion_texts[pred_label];
- emotions.flag = true;
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_emotion_ferplus.h b/lite/mnn/cv/mnn_emotion_ferplus.h
deleted file mode 100644
index 5325c6b9..00000000
--- a/lite/mnn/cv/mnn_emotion_ferplus.h
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// Created by DefTruth on 2021/11/27.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_EMOTION_FERPLUS_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_EMOTION_FERPLUS_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNEmotionFerPlus : public BasicMNNHandler
- {
- public:
- explicit MNNEmotionFerPlus(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNEmotionFerPlus() override = default;
-
- private:
- const float mean_vals[3] = {0.0f};
- const float norm_vals[3] = {1.0f};
- const char *emotion_texts[8] = {
- "neutral", "happiness", "surprise", "sadness", "anger",
- "disgust", "fear", "contempt"
- };
-
- private:
- void initialize_pretreat(); //
-
- void transform(const cv::Mat &mat) override; // padding & resize & normalize.
-
- public:
- void detect(const cv::Mat &mat, types::Emotions &emotions);
- };
-}
-
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_EMOTION_FERPLUS_H
diff --git a/lite/mnn/cv/mnn_face_hair_seg.cpp b/lite/mnn/cv/mnn_face_hair_seg.cpp
deleted file mode 100644
index 6e0cb29d..00000000
--- a/lite/mnn/cv/mnn_face_hair_seg.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-//
-// Created by DefTruth on 2022/6/19.
-//
-
-#include "mnn_face_hair_seg.h"
-#include "lite/utils.h"
-
-using mnncv::MNNFaceHairSeg;
-
-MNNFaceHairSeg::MNNFaceHairSeg(const std::string &_mnn_path, unsigned int _num_threads)
- : BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-void MNNFaceHairSeg::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNFaceHairSeg::transform(const cv::Mat &mat)
-{
- cv::Mat canvas;
- cv::resize(mat, canvas, cv::Size(input_width, input_height));
- // (1,3,224,224) deepcopy inside
- pretreat->convert(canvas.data, input_width, input_height, canvas.step[0], input_tensor);
-}
-
-void MNNFaceHairSeg::detect(const cv::Mat &mat, types::FaceHairSegContent &content,
- bool remove_noise)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. generate mask
- this->generate_mask(output_tensors, mat, content, remove_noise);
-}
-
-static inline float argmax(float *mutable_ptr, const unsigned int &step)
-{
- std::vector logits(3, 0.f);
- logits[0] = *mutable_ptr; // background
- logits[1] = *(mutable_ptr + step); // face
- logits[2] = *(mutable_ptr + 2 * step); // hair
- float label = 0.f;
- float max_logit = logits[0];
- for (unsigned int i = 1; i < 3; ++i)
- {
- if (logits[i] > max_logit)
- {
- max_logit = logits[i];
- label = (float) i;
- }
- }
- // normalize -> 0.~1.
- return label / 2.f; // 0. bgr 0.5 face 1. hair
-}
-
-void MNNFaceHairSeg::generate_mask(const std::map &output_tensors,
- const cv::Mat &mat, types::FaceHairSegContent &content,
- bool remove_noise)
-{
- auto device_output_ptr = output_tensors.at("output"); // e.g (1,3,224,224)
- MNN::Tensor host_output_tensor(device_output_ptr, device_output_ptr->getDimensionType());
- device_output_ptr->copyToHostTensor(&host_output_tensor);
- const unsigned int h = mat.rows;
- const unsigned int w = mat.cols;
-
- auto output_dims = host_output_tensor.shape();
- const unsigned int out_h = output_dims.at(2);
- const unsigned int out_w = output_dims.at(3);
- const unsigned int channel_step = out_h * out_w;
-
- float *output_ptr = host_output_tensor.host();
-
- std::vector elements(channel_step, 0.f); // allocate
- for (unsigned int i = 0; i < channel_step; ++i)
- elements[i] = (float) argmax(output_ptr + i, channel_step); // with normalize
-
- cv::Mat mask(out_h, out_w, CV_32FC1, elements.data());
- // post process
- if (remove_noise) lite::utils::remove_small_connected_area(mask, 0.05f);
- // already allocated a new continuous memory after resize.
- if (out_h != h || out_w != w) cv::resize(mask, mask, cv::Size(w, h));
- // need clone to allocate a new continuous memory if not performed resize.
- // The memory elements point to will release after return.
- else mask = mask.clone();
-
- content.mask = mask; // auto handle the memory inside ocv with smart ref.
- content.flag = true;
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_face_hair_seg.h b/lite/mnn/cv/mnn_face_hair_seg.h
deleted file mode 100644
index cecf835f..00000000
--- a/lite/mnn/cv/mnn_face_hair_seg.h
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// Created by DefTruth on 2022/6/19.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_FACE_HAIR_SEG_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_FACE_HAIR_SEG_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNFaceHairSeg : public BasicMNNHandler
- {
- public:
- explicit MNNFaceHairSeg(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNFaceHairSeg() override = default;
-
- private:
- const float mean_vals[3] = {0.f, 0.f, 0.f};
- const float norm_vals[3] = {1.f / 255.f, 1.f / 255.f, 1.f / 255.f};
-
- private:
- void initialize_pretreat();
-
- void transform(const cv::Mat &mat) override; // resize & normalize.
-
- void generate_mask(const std::map &output_tensors,
- const cv::Mat &mat, types::FaceHairSegContent &content,
- bool remove_noise = false);
-
- public:
- void detect(const cv::Mat &mat, types::FaceHairSegContent &content,
- bool remove_noise = false);
- };
-}
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_FACE_HAIR_SEG_H
diff --git a/lite/mnn/cv/mnn_face_landmarks_1000.cpp b/lite/mnn/cv/mnn_face_landmarks_1000.cpp
deleted file mode 100644
index 805c94df..00000000
--- a/lite/mnn/cv/mnn_face_landmarks_1000.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-// Created by DefTruth on 2021/11/21.
-//
-
-#include "mnn_face_landmarks_1000.h"
-
-using mnncv::MNNFaceLandmark1000;
-
-MNNFaceLandmark1000::MNNFaceLandmark1000(const std::string &_mnn_path, unsigned int _num_threads)
- : BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-inline void MNNFaceLandmark1000::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::GRAY,
- mean_vals, 1,
- norm_vals, 1
- )
- );
-}
-
-void MNNFaceLandmark1000::transform(const cv::Mat &mat)
-{
- cv::Mat mat_rs;
- cv::resize(mat, mat_rs, cv::Size(input_width, input_height));
- pretreat->convert(mat_rs.data, input_width, input_height, mat_rs.step[0], input_tensor);
-}
-
-void MNNFaceLandmark1000::detect(const cv::Mat &mat, types::Landmarks &landmarks)
-{
- if (mat.empty()) return;
- // this->transform(mat);
- float img_height = static_cast(mat.rows);
- float img_width = static_cast(mat.cols);
-
- // 1. make input tensor
- this->transform(mat);
- // 2. inference
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. fetch landmarks.
- auto device_landmarks_ptr = output_tensors.at("output0"); // (1,1953)
- MNN::Tensor host_landmarks_tensor(device_landmarks_ptr, device_landmarks_ptr->getDimensionType());
- device_landmarks_ptr->copyToHostTensor(&host_landmarks_tensor);
- auto landmark_dims = host_landmarks_tensor.shape();
-
- unsigned int num_landmarks = landmark_dims.at(1);
- if (num_landmarks > 1946) num_landmarks = 1946;
-
- const float *landmarks_ptr = host_landmarks_tensor.host();
-
- for (unsigned int i = 0; i < num_landmarks; i += 2)
- {
- float x = landmarks_ptr[i];
- float y = landmarks_ptr[i + 1];
-
- x = std::min(std::max(0.f, x), 1.0f);
- y = std::min(std::max(0.f, y), 1.0f);
-
- landmarks.points.push_back(cv::Point2f(x * img_width, y * img_height));
- }
- landmarks.flag = true;
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_face_landmarks_1000.h b/lite/mnn/cv/mnn_face_landmarks_1000.h
deleted file mode 100644
index 351d1816..00000000
--- a/lite/mnn/cv/mnn_face_landmarks_1000.h
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// Created by DefTruth on 2021/11/21.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_FACE_LANDMARKS_1000_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_FACE_LANDMARKS_1000_H
-
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNFaceLandmark1000 : public BasicMNNHandler
- {
- public:
- explicit MNNFaceLandmark1000(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNFaceLandmark1000() override = default;
-
- private:
- const float mean_vals[1] = {0.0f};
- const float norm_vals[1] = {1.0f};
-
- private:
- void initialize_pretreat(); //
-
- void transform(const cv::Mat &mat) override; //
-
- public:
- void detect(const cv::Mat &mat, types::Landmarks &landmarks);
- };
-}
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_FACE_LANDMARKS_1000_H
diff --git a/lite/mnn/cv/mnn_face_parsing_bisenet.cpp b/lite/mnn/cv/mnn_face_parsing_bisenet.cpp
deleted file mode 100644
index 2a367ca0..00000000
--- a/lite/mnn/cv/mnn_face_parsing_bisenet.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-//
-// Created by DefTruth on 2022/6/30.
-//
-
-#include "mnn_face_parsing_bisenet.h"
-
-using mnncv::MNNFaceParsingBiSeNet;
-
-MNNFaceParsingBiSeNet::MNNFaceParsingBiSeNet(const std::string &_mnn_path, unsigned int _num_threads)
- : BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-void MNNFaceParsingBiSeNet::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNFaceParsingBiSeNet::transform(const cv::Mat &mat)
-{
- cv::Mat canvas;
- cv::resize(mat, canvas, cv::Size(input_width, input_height));
- // (1,3,512,512) deepcopy inside
- pretreat->convert(canvas.data, input_width, input_height, canvas.step[0], input_tensor);
-}
-
-void MNNFaceParsingBiSeNet::detect(const cv::Mat &mat, types::FaceParsingContent &content,
- bool minimum_post_process)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. generate mask
- this->generate_mask(output_tensors, mat, content, minimum_post_process);
-}
-
-static inline uchar argmax(float *mutable_ptr, const unsigned int &step)
-{
- std::vector logits(19, 0.f);
- for (unsigned int i = 0; i < 19; ++i)
- logits[i] = *(mutable_ptr + i * step);
- uchar label = 0;
- float max_logit = logits[0];
- for (unsigned int i = 1; i < 19; ++i)
- {
- if (logits[i] > max_logit)
- {
- max_logit = logits[i];
- label = (uchar) i;
- }
- }
- return label;
-}
-
-static const uchar part_colors[20][3] = {
- {255, 0, 0},
- {255, 85, 0},
- {255, 170, 0},
- {255, 0, 85},
- {255, 0, 170},
- {0, 255, 0},
- {85, 255, 0},
- {170, 255, 0},
- {0, 255, 85},
- {0, 255, 170},
- {0, 0, 255},
- {85, 0, 255},
- {170, 0, 255},
- {0, 85, 255},
- {0, 170, 255},
- {255, 255, 0},
- {255, 255, 85},
- {255, 255, 170},
- {255, 0, 255},
- {255, 85, 255}
-};
-
-void MNNFaceParsingBiSeNet::generate_mask(const std::map &output_tensors,
- const cv::Mat &mat, types::FaceParsingContent &content,
- bool minimum_post_process)
-{
- auto device_output_ptr = output_tensors.at("out"); // e.g (1,19,h,w)
- MNN::Tensor host_output_tensor(device_output_ptr, device_output_ptr->getDimensionType());
- device_output_ptr->copyToHostTensor(&host_output_tensor);
- const unsigned int h = mat.rows;
- const unsigned int w = mat.cols;
-
- auto output_dims = host_output_tensor.shape();
- const unsigned int out_h = output_dims.at(2);
- const unsigned int out_w = output_dims.at(3);
- const unsigned int channel_step = out_h * out_w;
-
- float *output_ptr = host_output_tensor.host();
- std::vector elements(channel_step, 0); // allocate
- for (unsigned int i = 0; i < channel_step; ++i)
- elements[i] = argmax(output_ptr + i, channel_step);
-
- cv::Mat label(out_h, out_w, CV_8UC1, elements.data());
-
- if (!minimum_post_process)
- {
- // FaceParsingBiSeNet only predict integer label mask,
- // no fgr. So, the fake fgr and merge mat may not need,
- // let the fgr mat and merge mat empty to
- // Speed up the post processes.
- const uchar *label_ptr = label.data;
- cv::Mat color_mat(out_h, out_w, CV_8UC3, cv::Scalar(255, 255, 255));
- for (unsigned int i = 0; i < color_mat.rows; ++i)
- {
- cv::Vec3b *p = color_mat.ptr(i);
- for (unsigned int j = 0; j < color_mat.cols; ++j)
- {
- if (label_ptr[i * out_w + j] == 0) continue;
- p[j][0] = part_colors[label_ptr[i * out_w + j]][0];
- p[j][1] = part_colors[label_ptr[i * out_w + j]][1];
- p[j][2] = part_colors[label_ptr[i * out_w + j]][2];
- }
- }
- if (out_h != h || out_w != w)
- cv::resize(color_mat, color_mat, cv::Size(w, h));
- cv::addWeighted(mat, 0.4, color_mat, 0.6, 0., content.merge);
- }
- // already allocated a new continuous memory after resize.
- if (out_h != h || out_w != w) cv::resize(label, label, cv::Size(w, h));
- // need clone to allocate a new continuous memory if not performed resize.
- // The memory elements point to will release after return.
- else label = label.clone();
-
- content.label = label; // auto handle the memory inside ocv with smart ref.
- content.flag = true;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lite/mnn/cv/mnn_face_parsing_bisenet.h b/lite/mnn/cv/mnn_face_parsing_bisenet.h
deleted file mode 100644
index 51d69235..00000000
--- a/lite/mnn/cv/mnn_face_parsing_bisenet.h
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// Created by DefTruth on 2022/6/30.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_FACE_PARSING_BISENET_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_FACE_PARSING_BISENET_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNFaceParsingBiSeNet : public BasicMNNHandler
- {
- public:
- explicit MNNFaceParsingBiSeNet(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNFaceParsingBiSeNet() override = default;
-
- private:
- const float mean_vals[3] = {0.485f * 255.f, 0.456f * 255.f, 0.406f * 255.f}; // RGB
- const float norm_vals[3] = {1.f / (0.229f * 255.f), 1.f / (0.224f * 255.f), 1.f / (0.225f * 255.f)};
-
- private:
- void initialize_pretreat();
-
- void transform(const cv::Mat &mat) override; // resize & normalize.
-
- void generate_mask(const std::map &output_tensors,
- const cv::Mat &mat, types::FaceParsingContent &content,
- bool minimum_post_process = false);
-
- public:
- void detect(const cv::Mat &mat, types::FaceParsingContent &content,
- bool minimum_post_process = false);
- };
-}
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_FACE_PARSING_BISENET_H
diff --git a/lite/mnn/cv/mnn_faceboxes.cpp b/lite/mnn/cv/mnn_faceboxes.cpp
deleted file mode 100644
index 5e67f8d2..00000000
--- a/lite/mnn/cv/mnn_faceboxes.cpp
+++ /dev/null
@@ -1,244 +0,0 @@
-//
-// Created by DefTruth on 2021/11/20.
-//
-
-#include "mnn_faceboxes.h"
-#include "lite/utils.h"
-
-using mnncv::MNNFaceBoxes;
-
-MNNFaceBoxes::MNNFaceBoxes(const std::string &_mnn_path, unsigned int _num_threads) :
- BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-inline void MNNFaceBoxes::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::BGR,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNFaceBoxes::transform(const cv::Mat &mat)
-{
- cv::Mat mat_rs;
- cv::resize(mat, mat_rs, cv::Size(input_width, input_height));
- // normalize & HWC -> CHW & BGR -> BGR
- pretreat->convert(mat_rs.data, input_width, input_height, mat_rs.step[0], input_tensor);
-}
-
-void MNNFaceBoxes::detect(const cv::Mat &mat, std::vector &detected_boxes,
- float score_threshold, float iou_threshold,
- unsigned int topk, unsigned int nms_type)
-{
- if (mat.empty()) return;
- // this->transform(mat);
- float img_height = static_cast(mat.rows);
- float img_width = static_cast(mat.cols);
-
- // 1. make input tensor
- this->transform(mat);
- // 2. inference scores & boxes.
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. rescale & exclude.
- std::vector bbox_collection;
- this->generate_bboxes(bbox_collection, output_tensors, score_threshold, img_height, img_width);
- // 4. hard|blend nms with topk.
- this->nms(bbox_collection, detected_boxes, iou_threshold, topk, nms_type);
-}
-
-void MNNFaceBoxes::generate_anchors(const int target_height, const int target_width,
- std::vector &anchors)
-{
- std::vector> feature_maps;
- for (auto step: steps)
- {
- feature_maps.push_back(
- {
- (int) std::ceil((float) target_height / (float) step),
- (int) std::ceil((float) target_width / (float) step)
- } // ceil
- );
- }
-
- anchors.clear();
- const int num_feature_map = feature_maps.size();
-
- for (int k = 0; k < num_feature_map; ++k)
- {
- auto f_map = feature_maps.at(k); // e.g [640//32,640/32]
- auto tmp_min_sizes = min_sizes.at(k); // e.g [32,64,128]
- int f_h = f_map.at(0);
- int f_w = f_map.at(1);
- std::vector offset_32 = {0.f, 0.25f, 0.5f, 0.75f};
- std::vector offset_64 = {0.f, 0.5f};
-
- for (int i = 0; i < f_h; ++i)
- {
- for (int j = 0; j < f_w; ++j)
- {
- for (auto min_size: tmp_min_sizes)
- {
- float s_kx = (float) min_size / (float) target_width; // e.g 32/w
- float s_ky = (float) min_size / (float) target_height; // e.g 32/h
-
- // 32 anchor size
- if (min_size == 32)
- {
- // range y offsets first and then x
- for (auto offset_y: offset_32)
- {
- for (auto offset_x: offset_32)
- {
- // (x or y + offset) * step / w or h normalized loc mapping to input size.
- float cx = ((float) j + offset_x) * (float) steps.at(k) / (float) target_width;
- float cy = ((float) i + offset_y) * (float) steps.at(k) / (float) target_height;
- anchors.push_back(FaceBoxesAnchor{cx, cy, s_kx, s_ky}); // without clip
- }
- }
-
- } // 64 anchor size
- else if (min_size == 64)
- {
- // range y offsets first and then x
- for (auto offset_y: offset_64)
- {
- for (auto offset_x: offset_64)
- {
- float cx = ((float) j + offset_x) * (float) steps.at(k) / (float) target_width;
- float cy = ((float) i + offset_y) * (float) steps.at(k) / (float) target_height;
- anchors.push_back(FaceBoxesAnchor{cx, cy, s_kx, s_ky}); // without clip
- }
- }
-
- } // other anchor size
- else
- {
- float cx = ((float) j + 0.5f) * (float) steps.at(k) / (float) target_width;
- float cy = ((float) i + 0.5f) * (float) steps.at(k) / (float) target_height;
- anchors.push_back(FaceBoxesAnchor{cx, cy, s_kx, s_ky}); // without clip
- }
- }
- }
- }
- }
-}
-
-void MNNFaceBoxes::generate_bboxes(std::vector &bbox_collection,
- const std::map &output_tensors,
- float score_threshold, float img_height,
- float img_width)
-{
- auto device_bboxes_ptr = output_tensors.at("bbox"); // e.g (1,16800,4)
- auto device_probs_ptr = output_tensors.at("conf"); // e.g (1,16800,2) after softmax
- MNN::Tensor host_bboxes_tensor(device_bboxes_ptr, device_bboxes_ptr->getDimensionType());
- MNN::Tensor host_probs_tensor(device_probs_ptr, device_probs_ptr->getDimensionType());
- device_bboxes_ptr->copyToHostTensor(&host_bboxes_tensor);
- device_probs_ptr->copyToHostTensor(&host_probs_tensor);
-
- auto bbox_dims = host_bboxes_tensor.shape();
- const unsigned int bbox_num = bbox_dims.at(1); // n = ?
-
- std::vector anchors;
- this->generate_anchors(input_height, input_width, anchors);
-
- const unsigned int num_anchors = anchors.size();
- if (num_anchors != bbox_num)
- throw std::runtime_error("mismatch num_anchors != bbox_num");
-
- const float *bboxes_ptr = host_bboxes_tensor.host();
- const float *probs_ptr = host_probs_tensor.host();
-
- bbox_collection.clear();
- unsigned int count = 0;
- for (unsigned int i = 0; i < num_anchors; ++i)
- {
- float conf = probs_ptr[2 * i + 1];
- if (conf < score_threshold) continue; // filter first.
-
- float prior_cx = anchors.at(i).cx;
- float prior_cy = anchors.at(i).cy;
- float prior_s_kx = anchors.at(i).s_kx;
- float prior_s_ky = anchors.at(i).s_ky;
-
- float dx = bboxes_ptr[4 * i + 0];
- float dy = bboxes_ptr[4 * i + 1];
- float dw = bboxes_ptr[4 * i + 2];
- float dh = bboxes_ptr[4 * i + 3];
- // ref: https://github.com/zisianw/FaceBoxes.PyTorch/blob/master/utils/box_utils.py
- float cx = prior_cx + dx * variance[0] * prior_s_kx;
- float cy = prior_cy + dy * variance[0] * prior_s_ky;
- float w = prior_s_kx * std::exp(dw * variance[1]);
- float h = prior_s_ky * std::exp(dh * variance[1]); // norm coor (0.,1.)
-
- types::Boxf box;
- box.x1 = (cx - w / 2.f) * img_width;
- box.y1 = (cy - h / 2.f) * img_height;
- box.x2 = (cx + w / 2.f) * img_width;
- box.y2 = (cy + h / 2.f) * img_height;
- box.score = conf;
- box.label = 1;
- box.label_text = "face";
- box.flag = true;
- bbox_collection.push_back(box);
-
- count += 1; // limit boxes for nms.
- if (count > max_nms)
- break;
- }
-#if LITEMNN_DEBUG
- std::cout << "detected num_anchors: " << num_anchors << "\n";
- std::cout << "generate_bboxes num: " << bbox_collection.size() << "\n";
-#endif
-}
-
-void MNNFaceBoxes::nms(std::vector &input, std::vector &output,
- float iou_threshold, unsigned int topk,
- unsigned int nms_type)
-{
- if (nms_type == NMS::BLEND) lite::utils::blending_nms(input, output, iou_threshold, topk);
- else if (nms_type == NMS::OFFSET) lite::utils::offset_nms(input, output, iou_threshold, topk);
- else lite::utils::hard_nms(input, output, iou_threshold, topk);
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lite/mnn/cv/mnn_faceboxes.h b/lite/mnn/cv/mnn_faceboxes.h
deleted file mode 100644
index ba6eebc9..00000000
--- a/lite/mnn/cv/mnn_faceboxes.h
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-// Created by DefTruth on 2021/11/20.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_FACEBOXES_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_FACEBOXES_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNFaceBoxes : public BasicMNNHandler
- {
- public:
- explicit MNNFaceBoxes(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNFaceBoxes() override = default;
-
- private:
- // nested classes
- struct FaceBoxesAnchor
- {
- float cx;
- float cy;
- float s_kx;
- float s_ky;
- };
-
- private:
- const float mean_vals[3] = {104.f, 117.f, 123.f}; // bgr order
- const float norm_vals[3] = {1.f, 1.f, 1.f};
- const float variance[2] = {0.1f, 0.2f};
- std::vector steps = {32, 64, 128};
- std::vector> min_sizes = {
- {32, 64, 128},
- {256},
- {512}
- };
-
- enum NMS
- {
- HARD = 0, BLEND = 1, OFFSET = 2
- };
- static constexpr const unsigned int max_nms = 30000;
-
- private:
- void initialize_pretreat(); //
-
- void transform(const cv::Mat &mat) override; //
-
- void generate_anchors(const int target_height,
- const int target_width,
- std::vector &anchors);
-
- void generate_bboxes(std::vector &bbox_collection,
- const std::map &output_tensors,
- float score_threshold, float img_height,
- float img_width); // rescale & exclude
-
- void nms(std::vector &input, std::vector &output,
- float iou_threshold, unsigned int topk, unsigned int nms_type);
-
- public:
- void detect(const cv::Mat &mat, std::vector &detected_boxes,
- float score_threshold = 0.7f, float iou_threshold = 0.3f,
- unsigned int topk = 300, unsigned int nms_type = 0);
-
- };
-}
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_FACEBOXES_H
diff --git a/lite/mnn/cv/mnn_faceboxesv2.cpp b/lite/mnn/cv/mnn_faceboxesv2.cpp
deleted file mode 100644
index 819ff16f..00000000
--- a/lite/mnn/cv/mnn_faceboxesv2.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-//
-// Created by DefTruth on 2022/3/19.
-//
-
-#include "mnn_faceboxesv2.h"
-#include "lite/utils.h"
-
-using mnncv::MNNFaceBoxesV2;
-
-MNNFaceBoxesV2::MNNFaceBoxesV2(const std::string &_mnn_path, unsigned int _num_threads) :
- BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-inline void MNNFaceBoxesV2::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::BGR,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNFaceBoxesV2::transform(const cv::Mat &mat)
-{
- cv::Mat mat_rs;
- cv::resize(mat, mat_rs, cv::Size(input_width, input_height));
- // normalize & HWC -> CHW & BGR -> BGR
- pretreat->convert(mat_rs.data, input_width, input_height, mat_rs.step[0], input_tensor);
-}
-
-void MNNFaceBoxesV2::detect(const cv::Mat &mat, std::vector &detected_boxes,
- float score_threshold, float iou_threshold,
- unsigned int topk, unsigned int nms_type)
-{
- if (mat.empty()) return;
- // this->transform(mat);
- float img_height = static_cast(mat.rows);
- float img_width = static_cast(mat.cols);
-
- // 1. make input tensor
- this->transform(mat);
- // 2. inference scores & boxes.
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. rescale & exclude.
- std::vector bbox_collection;
- this->generate_bboxes(bbox_collection, output_tensors, score_threshold, img_height, img_width);
- // 4. hard|blend nms with topk.
- this->nms(bbox_collection, detected_boxes, iou_threshold, topk, nms_type);
-}
-
-void MNNFaceBoxesV2::generate_anchors(const int target_height, const int target_width,
- std::vector &anchors)
-{
- std::vector> feature_maps;
- for (auto step: steps)
- {
- feature_maps.push_back(
- {
- (int) std::ceil((float) target_height / (float) step),
- (int) std::ceil((float) target_width / (float) step)
- } // ceil
- );
- }
-
- anchors.clear();
- const int num_feature_map = feature_maps.size();
-
- for (int k = 0; k < num_feature_map; ++k)
- {
- auto f_map = feature_maps.at(k); // e.g [640//32,640/32]
- auto tmp_min_sizes = min_sizes.at(k); // e.g [32,64,128]
- int f_h = f_map.at(0);
- int f_w = f_map.at(1);
- std::vector offset_32 = {0.f, 0.25f, 0.5f, 0.75f};
- std::vector offset_64 = {0.f, 0.5f};
-
- for (int i = 0; i < f_h; ++i)
- {
- for (int j = 0; j < f_w; ++j)
- {
- for (auto min_size: tmp_min_sizes)
- {
- float s_kx = (float) min_size / (float) target_width; // e.g 32/w
- float s_ky = (float) min_size / (float) target_height; // e.g 32/h
-
- // 32 anchor size
- if (min_size == 32)
- {
- // range y offsets first and then x
- for (auto offset_y: offset_32)
- {
- for (auto offset_x: offset_32)
- {
- // (x or y + offset) * step / w or h normalized loc mapping to input size.
- float cx = ((float) j + offset_x) * (float) steps.at(k) / (float) target_width;
- float cy = ((float) i + offset_y) * (float) steps.at(k) / (float) target_height;
- anchors.push_back(FaceBoxesAnchorV2{cx, cy, s_kx, s_ky}); // without clip
- }
- }
-
- } // 64 anchor size
- else if (min_size == 64)
- {
- // range y offsets first and then x
- for (auto offset_y: offset_64)
- {
- for (auto offset_x: offset_64)
- {
- float cx = ((float) j + offset_x) * (float) steps.at(k) / (float) target_width;
- float cy = ((float) i + offset_y) * (float) steps.at(k) / (float) target_height;
- anchors.push_back(FaceBoxesAnchorV2{cx, cy, s_kx, s_ky}); // without clip
- }
- }
-
- } // other anchor size
- else
- {
- float cx = ((float) j + 0.5f) * (float) steps.at(k) / (float) target_width;
- float cy = ((float) i + 0.5f) * (float) steps.at(k) / (float) target_height;
- anchors.push_back(FaceBoxesAnchorV2{cx, cy, s_kx, s_ky}); // without clip
- }
- }
- }
- }
- }
-}
-
-void MNNFaceBoxesV2::generate_bboxes(std::vector &bbox_collection,
- const std::map &output_tensors,
- float score_threshold, float img_height,
- float img_width)
-{
- auto device_bboxes_ptr = output_tensors.at("loc"); // e.g (1,16800,4)
- auto device_probs_ptr = output_tensors.at("conf"); // e.g (1,16800,2) after softmax
- MNN::Tensor host_bboxes_tensor(device_bboxes_ptr, device_bboxes_ptr->getDimensionType());
- MNN::Tensor host_probs_tensor(device_probs_ptr, device_probs_ptr->getDimensionType());
- device_bboxes_ptr->copyToHostTensor(&host_bboxes_tensor);
- device_probs_ptr->copyToHostTensor(&host_probs_tensor);
-
- auto bbox_dims = host_bboxes_tensor.shape();
- const unsigned int bbox_num = bbox_dims.at(1); // n = ?
-
- std::vector anchors;
- this->generate_anchors(input_height, input_width, anchors);
-
- const unsigned int num_anchors = anchors.size();
- if (num_anchors != bbox_num)
- throw std::runtime_error("mismatch num_anchors != bbox_num");
-
- const float *bboxes_ptr = host_bboxes_tensor.host();
- const float *probs_ptr = host_probs_tensor.host();
-
- bbox_collection.clear();
- unsigned int count = 0;
- for (unsigned int i = 0; i < num_anchors; ++i)
- {
- float conf = probs_ptr[2 * i + 1];
- if (conf < score_threshold) continue; // filter first.
-
- float prior_cx = anchors.at(i).cx;
- float prior_cy = anchors.at(i).cy;
- float prior_s_kx = anchors.at(i).s_kx;
- float prior_s_ky = anchors.at(i).s_ky;
-
- float dx = bboxes_ptr[4 * i + 0];
- float dy = bboxes_ptr[4 * i + 1];
- float dw = bboxes_ptr[4 * i + 2];
- float dh = bboxes_ptr[4 * i + 3];
- float cx = prior_cx + dx * variance[0] * prior_s_kx;
- float cy = prior_cy + dy * variance[0] * prior_s_ky;
- float w = prior_s_kx * std::exp(dw * variance[1]);
- float h = prior_s_ky * std::exp(dh * variance[1]); // norm coor (0.,1.)
-
- types::Boxf box;
- box.x1 = (cx - w / 2.f) * img_width;
- box.y1 = (cy - h / 2.f) * img_height;
- box.x2 = (cx + w / 2.f) * img_width;
- box.y2 = (cy + h / 2.f) * img_height;
- box.score = conf;
- box.label = 1;
- box.label_text = "face";
- box.flag = true;
- bbox_collection.push_back(box);
-
- count += 1; // limit boxes for nms.
- if (count > max_nms)
- break;
- }
-#if LITEMNN_DEBUG
- std::cout << "detected num_anchors: " << num_anchors << "\n";
- std::cout << "generate_bboxes num: " << bbox_collection.size() << "\n";
-#endif
-}
-
-void MNNFaceBoxesV2::nms(std::vector &input, std::vector &output,
- float iou_threshold, unsigned int topk,
- unsigned int nms_type)
-{
- if (nms_type == NMS::BLEND) lite::utils::blending_nms(input, output, iou_threshold, topk);
- else if (nms_type == NMS::OFFSET) lite::utils::offset_nms(input, output, iou_threshold, topk);
- else lite::utils::hard_nms(input, output, iou_threshold, topk);
-}
diff --git a/lite/mnn/cv/mnn_faceboxesv2.h b/lite/mnn/cv/mnn_faceboxesv2.h
deleted file mode 100644
index 0c50b8c0..00000000
--- a/lite/mnn/cv/mnn_faceboxesv2.h
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-// Created by DefTruth on 2022/3/19.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_FACEBOXESV2_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_FACEBOXESV2_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNFaceBoxesV2 : public BasicMNNHandler
- {
- public:
- explicit MNNFaceBoxesV2(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNFaceBoxesV2() override = default;
-
- private:
- // nested classes
- struct FaceBoxesAnchorV2
- {
- float cx;
- float cy;
- float s_kx;
- float s_ky;
- };
-
- private:
- const float mean_vals[3] = {104.f, 117.f, 123.f}; // bgr order
- const float norm_vals[3] = {1.f, 1.f, 1.f};
- const float variance[2] = {0.1f, 0.2f};
- std::vector steps = {32, 64, 128};
- std::vector> min_sizes = {
- {32, 64, 128},
- {256},
- {512}
- };
-
- enum NMS
- {
- HARD = 0, BLEND = 1, OFFSET = 2
- };
- static constexpr const unsigned int max_nms = 30000;
-
- private:
- void initialize_pretreat(); //
-
- void transform(const cv::Mat &mat) override; //
-
- void generate_anchors(const int target_height,
- const int target_width,
- std::vector &anchors);
-
- void generate_bboxes(std::vector &bbox_collection,
- const std::map &output_tensors,
- float score_threshold, float img_height,
- float img_width); // rescale & exclude
-
- void nms(std::vector &input, std::vector &output,
- float iou_threshold, unsigned int topk, unsigned int nms_type);
-
- public:
- void detect(const cv::Mat &mat, std::vector &detected_boxes,
- float score_threshold = 0.35f, float iou_threshold = 0.3f,
- unsigned int topk = 300, unsigned int nms_type = 0);
-
- };
-}
-
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_FACEBOXESV2_H
diff --git a/lite/mnn/cv/mnn_facenet.cpp b/lite/mnn/cv/mnn_facenet.cpp
deleted file mode 100644
index b96048b2..00000000
--- a/lite/mnn/cv/mnn_facenet.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// Created by DefTruth on 2021/11/14.
-//
-
-#include "mnn_facenet.h"
-
-using mnncv::MNNFaceNet;
-
-MNNFaceNet::MNNFaceNet(const std::string &_mnn_path, unsigned int _num_threads) :
- BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-
-inline void MNNFaceNet::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNFaceNet::transform(const cv::Mat &mat)
-{
- // normalize & HWC -> CHW & BGR -> RGB
- cv::Mat mat_rs;
- cv::resize(mat, mat_rs, cv::Size(input_width, input_height));
- pretreat->convert(mat_rs.data, input_width, input_height, mat_rs.step[0], input_tensor);
-}
-
-void MNNFaceNet::detect(const cv::Mat &mat, types::FaceContent &face_content)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference.
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
-
- auto device_embedding_ptr = output_tensors.at("embedding");
- MNN::Tensor host_embedding_tensor(device_embedding_ptr, device_embedding_ptr->getDimensionType()); // NCHW
- device_embedding_ptr->copyToHostTensor(&host_embedding_tensor);
-
- auto embedding_dims = host_embedding_tensor.shape(); // (1,512)
- const unsigned int hidden_dim = embedding_dims.at(1);
- const float *embedding_values = host_embedding_tensor.host();
-
- std::vector embedding_norm(embedding_values, embedding_values + hidden_dim);
- cv::normalize(embedding_norm, embedding_norm); // l2 normalize
- face_content.embedding.assign(embedding_norm.begin(), embedding_norm.end());
- face_content.dim = hidden_dim;
- face_content.flag = true;
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_facenet.h b/lite/mnn/cv/mnn_facenet.h
deleted file mode 100644
index 4f6a4a42..00000000
--- a/lite/mnn/cv/mnn_facenet.h
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// Created by DefTruth on 2021/11/14.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_FACENET_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_FACENET_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNFaceNet : public BasicMNNHandler
- {
- public:
- explicit MNNFaceNet(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNFaceNet() override = default;
-
- private:
- const float mean_vals[3] = {127.5f, 127.5f, 127.5f}; // RGB
- const float norm_vals[3] = {1.f / 128.0f, 1.f / 128.0f, 1.f / 128.0f};
-
- private:
- void initialize_pretreat(); //
-
- void transform(const cv::Mat &mat) override; //
-
- public:
- void detect(const cv::Mat &mat, types::FaceContent &face_content);
- };
-}
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_FACENET_H
diff --git a/lite/mnn/cv/mnn_fast_portrait_seg.cpp b/lite/mnn/cv/mnn_fast_portrait_seg.cpp
deleted file mode 100644
index 1daf8778..00000000
--- a/lite/mnn/cv/mnn_fast_portrait_seg.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-//
-// Created by DefTruth on 2022/6/18.
-//
-
-#include "mnn_fast_portrait_seg.h"
-#include "lite/utils.h"
-
-using mnncv::MNNFastPortraitSeg;
-
-MNNFastPortraitSeg::MNNFastPortraitSeg(const std::string &_mnn_path, unsigned int _num_threads)
- : BasicMNNHandler(_mnn_path, _num_threads)
-{ initialize_pretreat(); }
-
-void MNNFastPortraitSeg::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::BGR,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNFastPortraitSeg::transform(const cv::Mat &mat_rs)
-{
- pretreat->convert(mat_rs.data, input_width, input_height,
- mat_rs.step[0], input_tensor);
-}
-
-void MNNFastPortraitSeg::resize_unscale(const cv::Mat &mat, cv::Mat &mat_rs,
- int target_height, int target_width,
- FastPortraitSegScaleParams &scale_params)
-{
- if (mat.empty()) return;
- int img_height = static_cast(mat.rows);
- int img_width = static_cast(mat.cols);
-
- mat_rs = cv::Mat(target_height, target_width, CV_8UC3,
- cv::Scalar(0, 0, 0));
- // scale ratio (new / old) new_shape(h,w)
- float w_r = (float) target_width / (float) img_width;
- float h_r = (float) target_height / (float) img_height;
- float r = std::min(w_r, h_r);
- // compute padding
- int new_unpad_w = static_cast((float) img_width * r); // floor
- int new_unpad_h = static_cast((float) img_height * r); // floor
- int pad_w = target_width - new_unpad_w; // >=0
- int pad_h = target_height - new_unpad_h; // >=0
-
- int dw = pad_w / 2;
- int dh = pad_h / 2;
-
- // resize with unscaling
- cv::Mat new_unpad_mat = mat.clone();
- cv::resize(new_unpad_mat, new_unpad_mat, cv::Size(new_unpad_w, new_unpad_h));
- new_unpad_mat.copyTo(mat_rs(cv::Rect(dw, dh, new_unpad_w, new_unpad_h)));
-
- // record scale params.
- scale_params.r = r;
- scale_params.dw = dw;
- scale_params.dh = dh;
- scale_params.new_unpad_w = new_unpad_w;
- scale_params.new_unpad_h = new_unpad_h;
- scale_params.flag = true;
-}
-
-void MNNFastPortraitSeg::detect(const cv::Mat &mat, types::PortraitSegContent &content,
- float score_threshold, bool remove_noise)
-{
- if (mat.empty()) return;
-
- // resize & unscale
- cv::Mat mat_rs;
- FastPortraitSegScaleParams scale_params;
- this->resize_unscale(mat, mat_rs, input_height, input_width, scale_params);
-
- // 1. make input tensor
- this->transform(mat_rs);
- // 2. inference
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. generate mask
- this->generate_mask(scale_params, output_tensors, mat, content, score_threshold, remove_noise);
-}
-
-static inline void softmax_inplace(float *mutable_ptr_bgr, float *mutable_ptr_fgr)
-{
- const float bgr_exp = std::exp(*mutable_ptr_bgr);
- const float fgr_exp = std::exp(*mutable_ptr_fgr);
- *mutable_ptr_bgr = bgr_exp / (bgr_exp + fgr_exp + 1e-10f);
- *mutable_ptr_fgr = 1.f - *mutable_ptr_bgr;
-}
-
-static inline void zero_if_small_inplace(float *mutable_ptr, float &score)
-{ if (*(mutable_ptr) < score) *(mutable_ptr) = 0.f; }
-
-void MNNFastPortraitSeg::generate_mask(const FastPortraitSegScaleParams &scale_params,
- const std::map &output_tensors,
- const cv::Mat &mat, types::PortraitSegContent &content,
- float score_threshold, bool remove_noise)
-{
- auto device_output_ptr = output_tensors.at("948"); // e.g (1,2,256,320)
- MNN::Tensor host_output_tensor(device_output_ptr, device_output_ptr->getDimensionType());
- device_output_ptr->copyToHostTensor(&host_output_tensor);
- const unsigned int h = mat.rows;
- const unsigned int w = mat.cols;
- auto output_dims = host_output_tensor.shape();
- const unsigned int out_h = output_dims.at(2); // e.g 256
- const unsigned int out_w = output_dims.at(3); // e.g 320
- const unsigned int channel_step = out_h * out_w;
-
- float *output_ptr = host_output_tensor.host();
-
- // softmax
- for (unsigned int i = 0; i < channel_step; ++i)
- softmax_inplace(output_ptr + i, output_ptr + i + channel_step); // bgr & fgr
-
- // remove small values
- for (unsigned int i = 0; i < channel_step; ++i)
- zero_if_small_inplace(output_ptr + channel_step + i, score_threshold);
-
- // fetch foreground score
- const int dw = scale_params.dw;
- const int dh = scale_params.dh;
- const int nw = scale_params.new_unpad_w;
- const int nh = scale_params.new_unpad_h;
-
- cv::Mat alpha_pred(out_h, out_w, CV_32FC1, output_ptr + channel_step); // only need prob of fgr
- cv::Mat mask = alpha_pred(cv::Rect(dw, dh, nw, nh)); // 0. ~ 1.
- if (remove_noise) lite::utils::remove_small_connected_area(mask, 0.05f);
- // already allocated a new continuous memory after resize.
- if (nh != h || nw != w) cv::resize(mask, mask, cv::Size(w, h));
- // need clone to allocate a new continuous memory if not performed resize.
- // The memory elements point to will release after return.
- else mask = mask.clone();
-
- content.mask = mask; // auto handle the memory inside ocv with smart ref.
- content.flag = true;
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_fast_portrait_seg.h b/lite/mnn/cv/mnn_fast_portrait_seg.h
deleted file mode 100644
index 91b2f4ac..00000000
--- a/lite/mnn/cv/mnn_fast_portrait_seg.h
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// Created by DefTruth on 2022/6/18.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_FAST_PORTRAIT_SEG_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_FAST_PORTRAIT_SEG_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNFastPortraitSeg : public BasicMNNHandler
- {
- public:
- explicit MNNFastPortraitSeg(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNFastPortraitSeg() override = default;
-
- private:
- // nested classes
- typedef struct
- {
- float r;
- int dw;
- int dh;
- int new_unpad_w;
- int new_unpad_h;
- bool flag;
- } FastPortraitSegScaleParams;
-
- private:
- const float mean_vals[3] = {107.304565f, 115.69884f, 132.35703f}; // BGR
- const float norm_vals[3] = {1.f / (63.97182f * 255.f), 1.f / (65.1337f * 255.f),
- 1.f / (68.29726f * 255.f)};
- private:
- void initialize_pretreat();
-
- void transform(const cv::Mat &mat_rs) override;
-
- void resize_unscale(const cv::Mat &mat, cv::Mat &mat_rs,
- int target_height, int target_width,
- FastPortraitSegScaleParams &scale_params);
-
- void generate_mask(const FastPortraitSegScaleParams &scale_params,
- const std::map &output_tensors,
- const cv::Mat &mat, types::PortraitSegContent &content,
- float score_threshold = 0.02f, bool remove_noise = false);
-
- public:
- void detect(const cv::Mat &mat, types::PortraitSegContent &content,
- float score_threshold = 0.02f, bool remove_noise = false);
- };
-}
-
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_FAST_PORTRAIT_SEG_H
diff --git a/lite/mnn/cv/mnn_fast_style_transfer.cpp b/lite/mnn/cv/mnn_fast_style_transfer.cpp
deleted file mode 100644
index ebd51798..00000000
--- a/lite/mnn/cv/mnn_fast_style_transfer.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-//
-// Created by DefTruth on 2021/11/29.
-//
-
-#include "mnn_fast_style_transfer.h"
-
-using mnncv::MNNFastStyleTransfer;
-
-MNNFastStyleTransfer::MNNFastStyleTransfer(const std::string &_mnn_path, unsigned int _num_threads)
- : BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-inline void MNNFastStyleTransfer::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNFastStyleTransfer::transform(const cv::Mat &mat)
-{
- cv::Mat canvas;
- cv::resize(mat, canvas, cv::Size(input_width, input_height));
- // (1,3,224,224)
- pretreat->convert(canvas.data, input_width, input_height, canvas.step[0], input_tensor);
-}
-
-void MNNFastStyleTransfer::detect(const cv::Mat &mat, types::StyleContent &style_content)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. fetch.
- auto device_pred_ptr = output_tensors.at("output1");
- MNN::Tensor host_pred_tensor(device_pred_ptr, device_pred_ptr->getDimensionType());
- device_pred_ptr->copyToHostTensor(&host_pred_tensor);
-
- auto pred_dims = host_pred_tensor.shape(); // (1,3,224,224)
- const unsigned int rows = pred_dims.at(2); // H
- const unsigned int cols = pred_dims.at(3); // W
- const unsigned int channel_step = rows * cols;
-
- float *pred_ptr = host_pred_tensor.host();
-
- // fast copy & channel transpose(CHW->HWC).
- cv::Mat rmat(rows, cols, CV_32FC1, pred_ptr); // ref only, zero-copy.
- cv::Mat gmat(rows, cols, CV_32FC1, pred_ptr + channel_step);
- cv::Mat bmat(rows, cols, CV_32FC1, pred_ptr + 2 * channel_step);
- std::vector channel_mats;
- channel_mats.push_back(bmat);
- channel_mats.push_back(gmat);
- channel_mats.push_back(rmat);
-
- cv::merge(channel_mats, style_content.mat); // BGR
-
- style_content.mat.convertTo(style_content.mat, CV_8UC3);
-
- style_content.flag = true;
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_fast_style_transfer.h b/lite/mnn/cv/mnn_fast_style_transfer.h
deleted file mode 100644
index 16ba1878..00000000
--- a/lite/mnn/cv/mnn_fast_style_transfer.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// Created by DefTruth on 2021/11/29.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_FAST_STYLE_TRANSFER_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_FAST_STYLE_TRANSFER_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNFastStyleTransfer : public BasicMNNHandler
- {
- public:
- explicit MNNFastStyleTransfer(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNFastStyleTransfer() override = default;
-
- private:
- const float mean_vals[3] = {0.f, 0.f, 0.f};
- const float norm_vals[3] = {1.f, 1.f, 1.f};
-
- private:
- void initialize_pretreat(); //
-
- void transform(const cv::Mat &mat) override; // resize & normalize.
-
- public:
- void detect(const cv::Mat &mat, types::StyleContent &style_content);
- };
-}
-
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_FAST_STYLE_TRANSFER_H
diff --git a/lite/mnn/cv/mnn_fcn_resnet101.cpp b/lite/mnn/cv/mnn_fcn_resnet101.cpp
deleted file mode 100644
index 7c39994d..00000000
--- a/lite/mnn/cv/mnn_fcn_resnet101.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-//
-// Created by DefTruth on 2021/11/29.
-//
-
-#include "mnn_fcn_resnet101.h"
-#include "lite/utils.h"
-
-using mnncv::MNNFCNResNet101;
-
-MNNFCNResNet101::MNNFCNResNet101(
- const std::string &_mnn_path, unsigned int _num_threads
-) : log_id(_mnn_path.data()),
- mnn_path(_mnn_path.data()),
- num_threads(_num_threads)
-{
- initialize_interpreter();
- initialize_pretreat();
-}
-
-MNNFCNResNet101::~MNNFCNResNet101()
-{
- mnn_interpreter->releaseModel();
- if (mnn_session)
- mnn_interpreter->releaseSession(mnn_session);
-}
-
-void MNNFCNResNet101::initialize_interpreter()
-{
- mnn_interpreter = std::shared_ptr(MNN::Interpreter::createFromFile(mnn_path));
- // 2. init schedule_config
- schedule_config.numThread = (int) num_threads;
- MNN::BackendConfig backend_config;
- backend_config.precision = MNN::BackendConfig::Precision_High; // default Precision_High
- schedule_config.backendConfig = &backend_config;
- // 3. create session
- mnn_session = mnn_interpreter->createSession(schedule_config);
- // 4. init input tensor
- input_tensor = mnn_interpreter->getSessionInput(mnn_session, nullptr);
- // 5. init input dims
- dynamic_input_height = input_tensor->height();
- dynamic_input_width = input_tensor->width();
- dimension_type = input_tensor->getDimensionType(); // CAFFE(NCHW)
- mnn_interpreter->resizeTensor(input_tensor, {1, 3, dynamic_input_height, dynamic_input_width});
- mnn_interpreter->resizeSession(mnn_session);
-#ifdef LITEMNN_DEBUG
- this->print_debug_string();
-#endif
-}
-
-void MNNFCNResNet101::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNFCNResNet101::transform(const cv::Mat &mat)
-{
- const int img_width = mat.cols;
- const int img_height = mat.rows;
- // update dynamic input dims
- dynamic_input_height = img_height;
- dynamic_input_width = img_width;
-
- // update input tensor and resize Session
- mnn_interpreter->resizeTensor(input_tensor, {1, 3, dynamic_input_height, dynamic_input_width});
- mnn_interpreter->resizeSession(mnn_session);
-
- // push data into input tensor
- pretreat->convert(mat.data, dynamic_input_width, dynamic_input_height, mat.step[0], input_tensor);
-}
-
-void MNNFCNResNet101::detect(const cv::Mat &mat, types::SegmentContent &content)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference & run session
- mnn_interpreter->runSession(mnn_session);
-
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. fetch
- auto device_scores_ptr = output_tensors.at("out"); // (1,21,h,w)
- MNN::Tensor host_scores_tensor(device_scores_ptr, device_scores_ptr->getDimensionType());
- device_scores_ptr->copyToHostTensor(&host_scores_tensor);
-#ifdef LITEMNN_DEBUG
- host_scores_tensor.printShape();
-#endif
-
- auto scores_dims = host_scores_tensor.shape();
- const unsigned int output_classes = scores_dims.at(1);
- const unsigned int output_height = scores_dims.at(2);
- const unsigned int output_width = scores_dims.at(3);
-
- const float *scores_ptr = host_scores_tensor.host();
- // time cost!
- content.names_map.clear();
- content.class_mat = cv::Mat(output_height, output_width, CV_8UC1, cv::Scalar(0));
- content.color_mat = mat.clone();
-
- const unsigned int scores_step = output_height * output_width; // h x w
-
- for (unsigned int i = 0; i < output_height; ++i)
- {
-
- uchar *p_class = content.class_mat.ptr(i);
- cv::Vec3b *p_color = content.color_mat.ptr(i);
-
- for (unsigned int j = 0; j < output_width; ++j)
- {
- // argmax
- unsigned int max_label = 0;
- float max_conf = scores_ptr[0 * scores_step + i * output_width + j];
-
- for (unsigned int l = 0; l < output_classes; ++l)
- {
- float conf = scores_ptr[l * scores_step + i * output_width + j];
- if (conf > max_conf)
- {
- max_conf = conf;
- max_label = l;
- }
- }
-
- if (max_label == 0) continue;
-
- // assign label for pixel(i,j)
- p_class[j] = cv::saturate_cast(max_label);
- // assign color for detected class at pixel(i,j).
- p_color[j][0] = cv::saturate_cast((max_label % 10) * 20);
- p_color[j][1] = cv::saturate_cast((max_label % 5) * 40);
- p_color[j][2] = cv::saturate_cast((max_label % 10) * 20);
- // assign names map
- content.names_map[max_label] = class_names[max_label - 1]; // max_label >= 1
- }
-
- }
-
- content.flag = true;
-}
-
-void MNNFCNResNet101::print_debug_string()
-{
- std::cout << "LITEMNN_DEBUG LogId: " << log_id << "\n";
- std::cout << "=============== Input-Dims ==============\n";
- if (input_tensor) input_tensor->printShape();
- if (dimension_type == MNN::Tensor::CAFFE)
- std::cout << "Dimension Type: (CAFFE/PyTorch/ONNX)NCHW" << "\n";
- else if (dimension_type == MNN::Tensor::TENSORFLOW)
- std::cout << "Dimension Type: (TENSORFLOW)NHWC" << "\n";
- else if (dimension_type == MNN::Tensor::CAFFE_C4)
- std::cout << "Dimension Type: (CAFFE_C4)NC4HW4" << "\n";
- std::cout << "=============== Output-Dims ==============\n";
- auto tmp_output_map = mnn_interpreter->getSessionOutputAll(mnn_session);
- std::cout << "getSessionOutputAll done!\n";
- for (auto it = tmp_output_map.cbegin(); it != tmp_output_map.cend(); ++it)
- {
- std::cout << "Output: " << it->first << ": ";
- it->second->printShape();
- }
- std::cout << "========================================\n";
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_fcn_resnet101.h b/lite/mnn/cv/mnn_fcn_resnet101.h
deleted file mode 100644
index de3b89ee..00000000
--- a/lite/mnn/cv/mnn_fcn_resnet101.h
+++ /dev/null
@@ -1,69 +0,0 @@
-//
-// Created by DefTruth on 2021/11/29.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_FCN_RESNET101_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_FCN_RESNET101_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNFCNResNet101
- {
- public:
- explicit MNNFCNResNet101(const std::string &_mnn_path,
- unsigned int _num_threads = 8); //
- ~MNNFCNResNet101();
-
- private:
- std::shared_ptr mnn_interpreter;
- MNN::Session *mnn_session = nullptr;
- MNN::ScheduleConfig schedule_config;
- std::shared_ptr pretreat; // init at runtime
- const char *log_id = nullptr;
- const char *mnn_path = nullptr;
- MNN::Tensor *input_tensor = nullptr;
-
- private:
- const float norm_vals[3] = {(1.f / 0.229f) * (1.f / 255.f),
- (1.f / 0.224f) * (1.f / 255.f),
- (1.f / 0.225f) * (1.f / 255.f)};
- const float mean_vals[3] = {0.485f * 255.f, 0.456f * 255.f, 0.406f * 255.f}; // RGB
-
- private:
- const unsigned int num_threads; // initialize at runtime.
- int dynamic_input_height = 512; // init only, will change according to input mat.
- int dynamic_input_width = 512; // init only, will change according to input mat.
- int dimension_type; // hint only
-
- const char *class_names[20] = {
- "aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat", "chair", "cow",
- "diningtable", "dog", "horse", "motorbike", "person", "pottedplant", "sheep", "sofa",
- "train", "tvmonitor"
- }; // 20 classes
-
- // un-copyable
- protected:
- MNNFCNResNet101(const MNNFCNResNet101 &) = delete; //
- MNNFCNResNet101(MNNFCNResNet101 &&) = delete; //
- MNNFCNResNet101 &operator=(const MNNFCNResNet101 &) = delete; //
- MNNFCNResNet101 &operator=(MNNFCNResNet101 &&) = delete; //
-
- private:
- void print_debug_string();
-
- private:
- void transform(const cv::Mat &mat);
-
- void initialize_pretreat(); //
-
- void initialize_interpreter();
-
- public:
- void detect(const cv::Mat &mat, types::SegmentContent &content);
-
- };
-}
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_FCN_RESNET101_H
diff --git a/lite/mnn/cv/mnn_female_photo2cartoon.cpp b/lite/mnn/cv/mnn_female_photo2cartoon.cpp
deleted file mode 100644
index 5bd54be1..00000000
--- a/lite/mnn/cv/mnn_female_photo2cartoon.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-//
-// Created by DefTruth on 2022/6/12.
-//
-
-#include "mnn_female_photo2cartoon.h"
-
-using mnncv::MNNFemalePhoto2Cartoon;
-
-MNNFemalePhoto2Cartoon::MNNFemalePhoto2Cartoon(const std::string &_mnn_path, unsigned int _num_threads)
- : BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-inline void MNNFemalePhoto2Cartoon::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNFemalePhoto2Cartoon::transform(const cv::Mat &mat_merged_rs)
-{
- // (1,3,256,256) deepcopy inside
- pretreat->convert(mat_merged_rs.data, input_width, input_height, mat_merged_rs.step[0], input_tensor);
-}
-
-void MNNFemalePhoto2Cartoon::detect(
- const cv::Mat &mat, const cv::Mat &mask,
- types::FemalePhoto2CartoonContent &content)
-{
- if (mat.empty() || mask.empty()) return;
- const unsigned int channels = mat.channels();
- if (channels != 3) return;
- const unsigned int mask_channels = mask.channels();
- if (mask_channels != 1 && mask_channels != 3) return;
- // model input size
- const unsigned int input_h = input_height; // 256
- const unsigned int input_w = input_width; // 256
- // resize before merging mat and mask
- cv::Mat mat_rs, mask_rs;
- cv::resize(mat, mat_rs, cv::Size(input_w, input_h));
- cv::resize(mask, mask_rs, cv::Size(input_w, input_h)); // CV_32FC1
- if (mask_channels != 3) cv::cvtColor(mask_rs, mask_rs, cv::COLOR_GRAY2BGR); // CV_32FC3
- mat_rs.convertTo(mat_rs, CV_32FC3, 1.f, 0.f); // CV_32FC3
- // merge mat_rs and mask_rs
- cv::Mat mat_merged_rs = mat_rs.mul(mask_rs) + (1.f - mask_rs) * 255.f;
- mat_merged_rs.convertTo(mat_merged_rs, CV_8UC3); // keep CV_8UC3 BGR
-
- // 1. make input tensor
- this->transform(mat_merged_rs);
- // 2. inference cartoon (1,3,256,256)
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. generate cartoon
- this->generate_cartoon(output_tensors, mask_rs, content);
-}
-
-void MNNFemalePhoto2Cartoon::generate_cartoon(
- const std::map &output_tensors,
- const cv::Mat &mask_rs, types::FemalePhoto2CartoonContent &content)
-{
- auto device_cartoon_pred = output_tensors.at("output");
- MNN::Tensor host_cartoon_tensor(device_cartoon_pred, device_cartoon_pred->getDimensionType());
- device_cartoon_pred->copyToHostTensor(&host_cartoon_tensor);
-
- auto cartoon_dims = host_cartoon_tensor.shape();
- const unsigned int out_h = cartoon_dims.at(2);
- const unsigned int out_w = cartoon_dims.at(3);
- const unsigned int channel_step = out_h * out_w;
- const unsigned int mask_h = mask_rs.rows;
- const unsigned int mask_w = mask_rs.cols;
- // fast assign & channel transpose(CHW->HWC).
- float *cartoon_ptr = host_cartoon_tensor.host();
- std::vector cartoon_channel_mats;
- cv::Mat rmat(out_h, out_w, CV_32FC1, cartoon_ptr); // R
- cv::Mat gmat(out_h, out_w, CV_32FC1, cartoon_ptr + channel_step); // G
- cv::Mat bmat(out_h, out_w, CV_32FC1, cartoon_ptr + 2 * channel_step); // B
- rmat = (rmat + 1.f) * 127.5f;
- gmat = (gmat + 1.f) * 127.5f;
- bmat = (bmat + 1.f) * 127.5f;
- cartoon_channel_mats.push_back(rmat);
- cartoon_channel_mats.push_back(gmat);
- cartoon_channel_mats.push_back(bmat);
- cv::Mat cartoon;
- cv::merge(cartoon_channel_mats, cartoon); // CV_32FC3 allocated
- if (out_h != mask_h || out_w != mask_w)
- cv::resize(cartoon, cartoon, cv::Size(mask_w, mask_h));
- // combine & RGB -> BGR -> uint8
- cartoon = cartoon.mul(mask_rs) + (1.f - mask_rs) * 255.f;
- cv::cvtColor(cartoon, cartoon, cv::COLOR_RGB2BGR);
- cartoon.convertTo(cartoon, CV_8UC3);
-
- content.cartoon = cartoon;
- content.flag = true;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lite/mnn/cv/mnn_female_photo2cartoon.h b/lite/mnn/cv/mnn_female_photo2cartoon.h
deleted file mode 100644
index 46591483..00000000
--- a/lite/mnn/cv/mnn_female_photo2cartoon.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// Created by DefTruth on 2022/6/12.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_FEMALE_PHOTO2CARTOON_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_FEMALE_PHOTO2CARTOON_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNFemalePhoto2Cartoon : public BasicMNNHandler
- {
- public:
- explicit MNNFemalePhoto2Cartoon(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNFemalePhoto2Cartoon() override = default;
-
- private:
- const float mean_vals[3] = {127.5f, 127.5f, 127.5f};
- const float norm_vals[3] = {1.f / 127.5f, 1.f / 127.5f, 1.f / 127.5f};
-
- private:
- void initialize_pretreat();
-
- void transform(const cv::Mat &mat_merged_rs /*merged & resized mat*/) override;
-
- void generate_cartoon(const std::map &output_tensors,
- const cv::Mat &mask_rs, types::FemalePhoto2CartoonContent &content);
-
- public:
- void detect(const cv::Mat &mat, const cv::Mat &mask, types::FemalePhoto2CartoonContent &content);
- };
-}
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_FEMALE_PHOTO2CARTOON_H
diff --git a/lite/mnn/cv/mnn_focal_arcface.cpp b/lite/mnn/cv/mnn_focal_arcface.cpp
deleted file mode 100644
index 9db4ded7..00000000
--- a/lite/mnn/cv/mnn_focal_arcface.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// Created by DefTruth on 2021/11/14.
-//
-
-#include "mnn_focal_arcface.h"
-
-using mnncv::MNNFocalArcFace;
-
-MNNFocalArcFace::MNNFocalArcFace(const std::string &_mnn_path, unsigned int _num_threads) :
- BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-
-inline void MNNFocalArcFace::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNFocalArcFace::transform(const cv::Mat &mat)
-{
- // normalize & HWC -> CHW & BGR -> RGB
- cv::Mat mat_rs;
- cv::resize(mat, mat_rs, cv::Size(input_width, input_height));
- pretreat->convert(mat_rs.data, input_width, input_height, mat_rs.step[0], input_tensor);
-}
-
-void MNNFocalArcFace::detect(const cv::Mat &mat, types::FaceContent &face_content)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference.
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
-
- auto device_embedding_ptr = output_tensors.at("embedding");
- MNN::Tensor host_embedding_tensor(device_embedding_ptr, device_embedding_ptr->getDimensionType()); // NCHW
- device_embedding_ptr->copyToHostTensor(&host_embedding_tensor);
-
- auto embedding_dims = host_embedding_tensor.shape(); // (1,512)
- const unsigned int hidden_dim = embedding_dims.at(1);
- const float *embedding_values = host_embedding_tensor.host();
-
- std::vector embedding_norm(embedding_values, embedding_values + hidden_dim);
- cv::normalize(embedding_norm, embedding_norm); // l2 normalize
- face_content.embedding.assign(embedding_norm.begin(), embedding_norm.end());
- face_content.dim = hidden_dim;
- face_content.flag = true;
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_focal_arcface.h b/lite/mnn/cv/mnn_focal_arcface.h
deleted file mode 100644
index 9fcb9ae7..00000000
--- a/lite/mnn/cv/mnn_focal_arcface.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// Created by DefTruth on 2021/11/14.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_FOCAL_ARCFACE_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_FOCAL_ARCFACE_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNFocalArcFace : public BasicMNNHandler
- {
- public:
- explicit MNNFocalArcFace(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNFocalArcFace() override = default;
-
- private:
- const float mean_vals[3] = {127.5f, 127.5f, 127.5f}; // RGB
- const float norm_vals[3] = {1.f / 127.5f, 1.f / 127.5f, 1.f / 127.5f};
-
- private:
- void initialize_pretreat(); //
-
- void transform(const cv::Mat &mat) override; //
-
- public:
- void detect(const cv::Mat &mat, types::FaceContent &face_content);
- };
-}
-
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_FOCAL_ARCFACE_H
diff --git a/lite/mnn/cv/mnn_focal_asia_arcface.cpp b/lite/mnn/cv/mnn_focal_asia_arcface.cpp
deleted file mode 100644
index 254dcf32..00000000
--- a/lite/mnn/cv/mnn_focal_asia_arcface.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// Created by DefTruth on 2021/11/14.
-//
-
-#include "mnn_focal_asia_arcface.h"
-
-using mnncv::MNNFocalAsiaArcFace;
-
-MNNFocalAsiaArcFace::MNNFocalAsiaArcFace(const std::string &_mnn_path, unsigned int _num_threads) :
- BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-
-inline void MNNFocalAsiaArcFace::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNFocalAsiaArcFace::transform(const cv::Mat &mat)
-{
- // normalize & HWC -> CHW & BGR -> RGB
- cv::Mat mat_rs;
- cv::resize(mat, mat_rs, cv::Size(input_width, input_height));
- pretreat->convert(mat_rs.data, input_width, input_height, mat_rs.step[0], input_tensor);
-}
-
-void MNNFocalAsiaArcFace::detect(const cv::Mat &mat, types::FaceContent &face_content)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference.
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
-
- auto device_embedding_ptr = output_tensors.at("embedding");
- MNN::Tensor host_embedding_tensor(device_embedding_ptr, device_embedding_ptr->getDimensionType()); // NCHW
- device_embedding_ptr->copyToHostTensor(&host_embedding_tensor);
-
- auto embedding_dims = host_embedding_tensor.shape(); // (1,512)
- const unsigned int hidden_dim = embedding_dims.at(1);
- const float *embedding_values = host_embedding_tensor.host();
-
- std::vector embedding_norm(embedding_values, embedding_values + hidden_dim);
- cv::normalize(embedding_norm, embedding_norm); // l2 normalize
- face_content.embedding.assign(embedding_norm.begin(), embedding_norm.end());
- face_content.dim = hidden_dim;
- face_content.flag = true;
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_focal_asia_arcface.h b/lite/mnn/cv/mnn_focal_asia_arcface.h
deleted file mode 100644
index b8929b98..00000000
--- a/lite/mnn/cv/mnn_focal_asia_arcface.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// Created by DefTruth on 2021/11/14.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_FOCAL_ASIA_ARCFACE_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_FOCAL_ASIA_ARCFACE_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNFocalAsiaArcFace : public BasicMNNHandler
- {
- public:
- explicit MNNFocalAsiaArcFace(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNFocalAsiaArcFace() override = default;
-
- private:
- const float mean_vals[3] = {127.5f, 127.5f, 127.5f}; // RGB
- const float norm_vals[3] = {1.f / 127.5f, 1.f / 127.5f, 1.f / 127.5f};
-
- private:
- void initialize_pretreat(); //
-
- void transform(const cv::Mat &mat) override; //
-
- public:
- void detect(const cv::Mat &mat, types::FaceContent &face_content);
- };
-}
-
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_FOCAL_ASIA_ARCFACE_H
diff --git a/lite/mnn/cv/mnn_fsanet.cpp b/lite/mnn/cv/mnn_fsanet.cpp
deleted file mode 100644
index f2c0ec01..00000000
--- a/lite/mnn/cv/mnn_fsanet.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-// Created by DefTruth on 2021/11/25.
-//
-
-#include "mnn_fsanet.h"
-
-using mnncv::MNNFSANet;
-
-MNNFSANet::MNNFSANet(const std::string &_mnn_path, unsigned int _num_threads)
- : BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-inline void MNNFSANet::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::BGR,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNFSANet::transform(const cv::Mat &mat)
-{
- cv::Mat canvas;
- // 0. padding
- const int h = mat.rows;
- const int w = mat.cols;
- const int nh = static_cast((static_cast(h) + pad * static_cast(h)));
- const int nw = static_cast((static_cast(w) + pad * static_cast(w)));
-
- const int nx1 = std::max(0, static_cast((nw - w) / 2));
- const int ny1 = std::max(0, static_cast((nh - h) / 2));
-
- canvas = cv::Mat(nh, nw, CV_8UC3, cv::Scalar(0, 0, 0));
- mat.copyTo(canvas(cv::Rect(nx1, ny1, w, h)));
- cv::resize(canvas, canvas, cv::Size(input_width, input_height));
-
- pretreat->convert(canvas.data, input_width, input_height, canvas.step[0], input_tensor);
-}
-
-void MNNFSANet::detect(const cv::Mat &mat, types::EulerAngles &euler_angles)
-{
- if (mat.empty()) return;
-
- // 1. make input tensor
- this->transform(mat);
- // 2. inference
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. fetch angles.
- auto device_angles_ptr = output_tensors.at("output"); // (1,3)
- MNN::Tensor host_angles_tensor(device_angles_ptr, device_angles_ptr->getDimensionType());
- device_angles_ptr->copyToHostTensor(&host_angles_tensor);
-
- const float *angles_ptr = host_angles_tensor.host();
-
- euler_angles.yaw = angles_ptr[0];
- euler_angles.pitch = angles_ptr[1];
- euler_angles.roll = angles_ptr[2];
- euler_angles.flag = true;
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_fsanet.h b/lite/mnn/cv/mnn_fsanet.h
deleted file mode 100644
index dc3c4f7a..00000000
--- a/lite/mnn/cv/mnn_fsanet.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// Created by DefTruth on 2021/11/25.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_FSANET_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_FSANET_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNFSANet : public BasicMNNHandler
- {
- public:
- explicit MNNFSANet(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNFSANet() override = default;
-
- private:
- static constexpr const float pad = 0.3f;
- const float mean_vals[3] = {127.5f, 127.5f, 127.5f};
- const float norm_vals[3] = {1.0f / 127.5f, 1.0f / 127.5f, 1.0f / 127.5f};
-
- private:
- void initialize_pretreat(); //
-
- void transform(const cv::Mat &mat) override; // padding & resize & normalize.
-
- public:
- void detect(const cv::Mat &mat, types::EulerAngles &euler_angles);
- };
-}
-
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_FSANET_H
diff --git a/lite/mnn/cv/mnn_gender_googlenet.cpp b/lite/mnn/cv/mnn_gender_googlenet.cpp
deleted file mode 100644
index 0529caec..00000000
--- a/lite/mnn/cv/mnn_gender_googlenet.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// Created by DefTruth on 2021/11/27.
-//
-
-#include "mnn_gender_googlenet.h"
-#include "lite/utils.h"
-
-using mnncv::MNNGenderGoogleNet;
-
-MNNGenderGoogleNet::MNNGenderGoogleNet(const std::string &_mnn_path, unsigned int _num_threads)
- : BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-inline void MNNGenderGoogleNet::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNGenderGoogleNet::transform(const cv::Mat &mat)
-{
- cv::Mat canvas;
- // (1,3,224,224)
- cv::resize(mat, canvas, cv::Size(input_width, input_height));
- pretreat->convert(canvas.data, input_width, input_height, canvas.step[0], input_tensor);
-}
-
-void MNNGenderGoogleNet::detect(const cv::Mat &mat, types::Gender &gender)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. fetch.
- auto device_gender_logits_ptr = output_tensors.at("loss3/loss3_Y"); // (1,2)
- MNN::Tensor host_gender_logits_tensor(device_gender_logits_ptr, device_gender_logits_ptr->getDimensionType());
- device_gender_logits_ptr->copyToHostTensor(&host_gender_logits_tensor);
-
- auto gender_dims = host_gender_logits_tensor.shape();
- const unsigned int num_genders = gender_dims.at(1); // 2
- const float *pred_logits_ptr = host_gender_logits_tensor.host();
-
- unsigned int pred_gender = 0;
- auto softmax_probs = lite::utils::math::softmax(pred_logits_ptr, num_genders, pred_gender);
- unsigned int gender_label = pred_gender == 1 ? 0 : 1;
- gender.label = gender_label;
- gender.text = gender_texts[gender_label];
- gender.score = softmax_probs[pred_gender];
- gender.flag = true;
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_gender_googlenet.h b/lite/mnn/cv/mnn_gender_googlenet.h
deleted file mode 100644
index 24cfa08f..00000000
--- a/lite/mnn/cv/mnn_gender_googlenet.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// Created by DefTruth on 2021/11/27.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_GENDER_GOOGLENET_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_GENDER_GOOGLENET_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNGenderGoogleNet : public BasicMNNHandler
- {
- public:
- explicit MNNGenderGoogleNet(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNGenderGoogleNet() override = default;
-
- private:
- const float mean_vals[3] = {104.0f, 117.0f, 123.0f};
- const float norm_vals[3] = {1.0f, 1.0f, 1.0f};
- const char *gender_texts[2] = {"female", "male"};
-
- private:
- void initialize_pretreat(); //
-
- void transform(const cv::Mat &mat) override;
-
- public:
- void detect(const cv::Mat &mat, types::Gender &gender);
- };
-}
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_GENDER_GOOGLENET_H
diff --git a/lite/mnn/cv/mnn_ghostnet.cpp b/lite/mnn/cv/mnn_ghostnet.cpp
deleted file mode 100644
index a7adb3a1..00000000
--- a/lite/mnn/cv/mnn_ghostnet.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-// Created by DefTruth on 2021/11/29.
-//
-
-#include "mnn_ghostnet.h"
-#include "lite/utils.h"
-
-using mnncv::MNNGhostNet;
-
-MNNGhostNet::MNNGhostNet(const std::string &_mnn_path, unsigned int _num_threads)
- : BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-inline void MNNGhostNet::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNGhostNet::transform(const cv::Mat &mat)
-{
- cv::Mat canvas;
- cv::resize(mat, canvas, cv::Size(input_width, input_height));
- // (1,3,224,224)
- pretreat->convert(canvas.data, input_width, input_height, canvas.step[0], input_tensor);
-}
-
-void MNNGhostNet::detect(const cv::Mat &mat, types::ImageNetContent &content, unsigned int top_k)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
- // 3. fetch.
- auto device_logits_ptr = output_tensors.at("logits");
- MNN::Tensor host_logits_tensor(device_logits_ptr, device_logits_ptr->getDimensionType());
- device_logits_ptr->copyToHostTensor(&host_logits_tensor);
-
- auto logits_dims = host_logits_tensor.shape();
- const unsigned int num_classes = logits_dims.at(1); // 1000
- const float *logits = host_logits_tensor.host();
-
- unsigned int max_id;
- std::vector scores = lite::utils::math::softmax(logits, num_classes, max_id);
- std::vector sorted_indices = lite::utils::math::argsort(scores);
- if (top_k > num_classes) top_k = num_classes;
-
- content.scores.clear();
- content.labels.clear();
- content.texts.clear();
- for (unsigned int i = 0; i < top_k; ++i)
- {
- content.labels.push_back(sorted_indices[i]);
- content.scores.push_back(scores[sorted_indices[i]]);
- content.texts.push_back(class_names[sorted_indices[i]]);
- }
- content.flag = true;
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_ghostnet.h b/lite/mnn/cv/mnn_ghostnet.h
deleted file mode 100644
index 8db3e60d..00000000
--- a/lite/mnn/cv/mnn_ghostnet.h
+++ /dev/null
@@ -1,409 +0,0 @@
-//
-// Created by DefTruth on 2021/11/29.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_GHOSTNET_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_GHOSTNET_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNGhostNet : public BasicMNNHandler
- {
- public:
- explicit MNNGhostNet(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNGhostNet() override = default;
-
- private:
- const float mean_vals[3] = {0.485f * 255.f, 0.456f * 255.f, 0.406f * 255.f};
- const float norm_vals[3] = {(1.0f / 0.229f) * (1.0 / 255.f),
- (1.0f / 0.224f) * (1.0 / 255.f),
- (1.0f / 0.225f) * (1.0 / 255.f)};
-
- private:
- void initialize_pretreat(); //
-
- void transform(const cv::Mat &mat) override; // resize & normalize.
-
- public:
- void detect(const cv::Mat &mat, types::ImageNetContent &content, unsigned int top_k = 5);
-
- private:
- const char *class_names[1000] = {
- "tench, Tinca tinca", "goldfish, Carassius auratus",
- "great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias",
- "tiger shark, Galeocerdo cuvieri", "hammerhead, hammerhead shark",
- "electric ray, crampfish, numbfish, torpedo", "stingray", "cock",
- "hen", "ostrich, Struthio camelus", "brambling, Fringilla montifringilla",
- "goldfinch, Carduelis carduelis", "house finch, linnet, Carpodacus mexicanus",
- "junco, snowbird", "indigo bunting, indigo finch, indigo bird, Passerina cyanea",
- "robin, American robin, Turdus migratorius", "bulbul", "jay",
- "magpie", "chickadee", "water ouzel, dipper",
- "kite", "bald eagle, American eagle, Haliaeetus leucocephalus",
- "vulture", "great grey owl, great gray owl, Strix nebulosa", "European fire salamander, Salamandra salamandra",
- "common newt, Triturus vulgaris", "eft", "spotted salamander, Ambystoma maculatum",
- "axolotl, mud puppy, Ambystoma mexicanum", "bullfrog, Rana catesbeiana",
- "tree frog, tree-frog", "tailed frog, bell toad, ribbed toad, tailed toad, Ascaphus trui",
- "loggerhead, loggerhead turtle, Caretta caretta", "leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea",
- "mud turtle", "terrapin", "box turtle, box tortoise",
- "banded gecko", "common iguana, iguana, Iguana iguana", "American chameleon, anole, Anolis carolinensis",
- "whiptail, whiptail lizard", "agama", "frilled lizard, Chlamydosaurus kingi",
- "alligator lizard", "Gila monster, Heloderma suspectum", "green lizard, Lacerta viridis",
- "African chameleon, Chamaeleo chamaeleon", "Komodo dragon, Komodo lizard, dragon lizard, giant lizard, Varanus komodoensis",
- "African crocodile, Nile crocodile, Crocodylus niloticus", "American alligator, Alligator mississipiensis",
- "triceratops", "thunder snake, worm snake, Carphophis amoenus",
- "ringneck snake, ring-necked snake, ring snake", "hognose snake, puff adder, sand viper",
- "green snake, grass snake", "king snake, kingsnake", "garter snake, grass snake",
- "water snake", "vine snake", "night snake, Hypsiglena torquata",
- "boa constrictor, Constrictor constrictor", "rock python, rock snake, Python sebae",
- "Indian cobra, Naja naja", "green mamba", "sea snake",
- "horned viper, cerastes, sand viper, horned asp, Cerastes cornutus",
- "diamondback, diamondback rattlesnake, Crotalus adamanteus", "sidewinder, horned rattlesnake, Crotalus cerastes",
- "trilobite", "harvestman, daddy longlegs, Phalangium opilio", "scorpion",
- "black and gold garden spider, Argiope aurantia", "barn spider, Araneus cavaticus",
- "garden spider, Aranea diademata", "black widow, Latrodectus mactans",
- "tarantula", "wolf spider, hunting spider", "tick",
- "centipede", "black grouse", "ptarmigan",
- "ruffed grouse, partridge, Bonasa umbellus", "prairie chicken, prairie grouse, prairie fowl",
- "peacock", "quail", "partridge",
- "African grey, African gray, Psittacus erithacus", "macaw", "sulphur-crested cockatoo, Kakatoe galerita, Cacatua galerita",
- "lorikeet", "coucal", "bee eater",
- "hornbill", "hummingbird", "jacamar",
- "toucan", "drake", "red-breasted merganser, Mergus serrator",
- "goose", "black swan, Cygnus atratus", "tusker",
- "echidna, spiny anteater, anteater", "platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus",
- "wallaby, brush kangaroo", "koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus",
- "wombat", "jellyfish", "sea anemone, anemone",
- "brain coral", "flatworm, platyhelminth", "nematode, nematode worm, roundworm",
- "conch", "snail", "slug",
- "sea slug, nudibranch", "chiton, coat-of-mail shell, sea cradle, polyplacophore",
- "chambered nautilus, pearly nautilus, nautilus", "Dungeness crab, Cancer magister",
- "rock crab, Cancer irroratus", "fiddler crab",
- "king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica",
- "American lobster, Northern lobster, Maine lobster, Homarus americanus",
- "spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish",
- "crayfish, crawfish, crawdad, crawdaddy", "hermit crab", "isopod",
- "white stork, Ciconia ciconia", "black stork, Ciconia nigra", "spoonbill",
- "flamingo", "little blue heron, Egretta caerulea", "American egret, great white heron, Egretta albus",
- "bittern", "crane", "limpkin, Aramus pictus",
- "European gallinule, Porphyrio porphyrio", "American coot, marsh hen, mud hen, water hen, Fulica americana",
- "bustard", "ruddy turnstone, Arenaria interpres", "red-backed sandpiper, dunlin, Erolia alpina",
- "redshank, Tringa totanus", "dowitcher", "oystercatcher, oyster catcher",
- "pelican", "king penguin, Aptenodytes patagonica", "albatross, mollymawk",
- "grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus",
- "killer whale, killer, orca, grampus, sea wolf, Orcinus orca",
- "dugong, Dugong dugon", "sea lion", "Chihuahua",
- "Japanese spaniel", "Maltese dog, Maltese terrier, Maltese", "Pekinese, Pekingese, Peke",
- "Shih-Tzu", "Blenheim spaniel", "papillon",
- "toy terrier", "Rhodesian ridgeback", "Afghan hound, Afghan",
- "basset, basset hound", "beagle", "bloodhound, sleuthhound",
- "bluetick", "black-and-tan coonhound", "Walker hound, Walker foxhound",
- "English foxhound", "redbone", "borzoi, Russian wolfhound",
- "Irish wolfhound", "Italian greyhound", "whippet",
- "Ibizan hound, Ibizan Podenco", "Norwegian elkhound, elkhound",
- "otterhound, otter hound", "Saluki, gazelle hound", "Scottish deerhound, deerhound",
- "Weimaraner", "Staffordshire bullterrier, Staffordshire bull terrier",
- "American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier",
- "Bedlington terrier", "Border terrier", "Kerry blue terrier",
- "Irish terrier", "Norfolk terrier", "Norwich terrier",
- "Yorkshire terrier", "wire-haired fox terrier", "Lakeland terrier",
- "Sealyham terrier, Sealyham", "Airedale, Airedale terrier", "cairn, cairn terrier",
- "Australian terrier", "Dandie Dinmont, Dandie Dinmont terrier",
- "Boston bull, Boston terrier", "miniature schnauzer", "giant schnauzer",
- "standard schnauzer", "Scotch terrier, Scottish terrier, Scottie",
- "Tibetan terrier, chrysanthemum dog", "silky terrier, Sydney silky",
- "soft-coated wheaten terrier", "West Highland white terrier", "Lhasa, Lhasa apso",
- "flat-coated retriever", "curly-coated retriever", "golden retriever",
- "Labrador retriever", "Chesapeake Bay retriever", "German short-haired pointer",
- "vizsla, Hungarian pointer", "English setter", "Irish setter, red setter",
- "Gordon setter", "Brittany spaniel", "clumber, clumber spaniel",
- "English springer, English springer spaniel", "Welsh springer spaniel",
- "cocker spaniel, English cocker spaniel, cocker", "Sussex spaniel",
- "Irish water spaniel", "kuvasz", "schipperke",
- "groenendael", "malinois", "briard",
- "kelpie", "komondor", "Old English sheepdog, bobtail",
- "Shetland sheepdog, Shetland sheep dog, Shetland", "collie", "Border collie",
- "Bouvier des Flandres, Bouviers des Flandres", "Rottweiler", "German shepherd, German shepherd dog, German police dog, alsatian",
- "Doberman, Doberman pinscher", "miniature pinscher", "Greater Swiss Mountain dog",
- "Bernese mountain dog", "Appenzeller", "EntleBucher",
- "boxer", "bull mastiff", "Tibetan mastiff",
- "French bulldog", "Great Dane", "Saint Bernard, St Bernard",
- "Eskimo dog, husky", "malamute, malemute, Alaskan malamute", "Siberian husky",
- "dalmatian, coach dog, carriage dog", "affenpinscher, monkey pinscher, monkey dog",
- "basenji", "pug, pug-dog", "Leonberg",
- "Newfoundland, Newfoundland dog", "Great Pyrenees", "Samoyed, Samoyede",
- "Pomeranian", "chow, chow chow", "keeshond",
- "Brabancon griffon", "Pembroke, Pembroke Welsh corgi", "Cardigan, Cardigan Welsh corgi",
- "toy poodle", "miniature poodle", "standard poodle",
- "Mexican hairless", "timber wolf, grey wolf, gray wolf, Canis lupus",
- "white wolf, Arctic wolf, Canis lupus tundrarum", "red wolf, maned wolf, Canis rufus, Canis niger",
- "coyote, prairie wolf, brush wolf, Canis latrans", "dingo, warrigal, warragal, Canis dingo",
- "dhole, Cuon alpinus", "African hunting dog, hyena dog, Cape hunting dog, Lycaon pictus",
- "hyena, hyaena", "red fox, Vulpes vulpes", "kit fox, Vulpes macrotis",
- "Arctic fox, white fox, Alopex lagopus", "grey fox, gray fox, Urocyon cinereoargenteus",
- "tabby, tabby cat", "tiger cat", "Persian cat",
- "Siamese cat, Siamese", "Egyptian cat", "cougar, puma, catamount, mountain lion, painter, panther, Felis concolor",
- "lynx, catamount", "leopard, Panthera pardus", "snow leopard, ounce, Panthera uncia",
- "jaguar, panther, Panthera onca, Felis onca", "lion, king of beasts, Panthera leo",
- "tiger, Panthera tigris", "cheetah, chetah, Acinonyx jubatus", "brown bear, bruin, Ursus arctos",
- "American black bear, black bear, Ursus americanus, Euarctos americanus",
- "ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus",
- "sloth bear, Melursus ursinus, Ursus ursinus", "mongoose", "meerkat, mierkat",
- "tiger beetle", "ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle",
- "ground beetle, carabid beetle", "long-horned beetle, longicorn, longicorn beetle",
- "leaf beetle, chrysomelid", "dung beetle", "rhinoceros beetle",
- "weevil", "fly", "bee",
- "ant, emmet, pismire", "grasshopper, hopper", "cricket",
- "walking stick, walkingstick, stick insect", "cockroach, roach",
- "mantis, mantid", "cicada, cicala", "leafhopper",
- "lacewing, lacewing fly",
- "dragonfly, darning needle, devil's darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk",
- "damselfly", "admiral", "ringlet, ringlet butterfly",
- "monarch, monarch butterfly, milkweed butterfly, Danaus plexippus",
- "cabbage butterfly", "sulphur butterfly, sulfur butterfly", "lycaenid, lycaenid butterfly",
- "starfish, sea star", "sea urchin", "sea cucumber, holothurian",
- "wood rabbit, cottontail, cottontail rabbit", "hare", "Angora, Angora rabbit",
- "hamster", "porcupine, hedgehog", "fox squirrel, eastern fox squirrel, Sciurus niger",
- "marmot", "beaver", "guinea pig, Cavia cobaya",
- "sorrel", "zebra", "hog, pig, grunter, squealer, Sus scrofa",
- "wild boar, boar, Sus scrofa", "warthog", "hippopotamus, hippo, river horse, Hippopotamus amphibius",
- "ox", "water buffalo, water ox, Asiatic buffalo, Bubalus bubalis",
- "bison", "ram, tup", "bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis",
- "ibex, Capra ibex", "hartebeest", "impala, Aepyceros melampus",
- "gazelle", "Arabian camel, dromedary, Camelus dromedarius", "llama",
- "weasel", "mink", "polecat, fitch, foulmart, foumart, Mustela putorius",
- "black-footed ferret, ferret, Mustela nigripes", "otter", "skunk, polecat, wood pussy",
- "badger", "armadillo", "three-toed sloth, ai, Bradypus tridactylus",
- "orangutan, orang, orangutang, Pongo pygmaeus", "gorilla, Gorilla gorilla",
- "chimpanzee, chimp, Pan troglodytes", "gibbon, Hylobates lar", "siamang, Hylobates syndactylus, Symphalangus syndactylus",
- "guenon, guenon monkey", "patas, hussar monkey, Erythrocebus patas",
- "baboon", "macaque", "langur",
- "colobus, colobus monkey", "proboscis monkey, Nasalis larvatus",
- "marmoset", "capuchin, ringtail, Cebus capucinus", "howler monkey, howler",
- "titi, titi monkey", "spider monkey, Ateles geoffroyi", "squirrel monkey, Saimiri sciureus",
- "Madagascar cat, ring-tailed lemur, Lemur catta", "indri, indris, Indri indri, Indri brevicaudatus",
- "Indian elephant, Elephas maximus", "African elephant, Loxodonta africana",
- "lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens",
- "giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca",
- "barracouta, snoek", "eel", "coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus kisutch",
- "rock beauty, Holocanthus tricolor", "anemone fish", "sturgeon",
- "gar, garfish, garpike, billfish, Lepisosteus osseus", "lionfish",
- "puffer, pufferfish, blowfish, globefish", "abacus", "abaya",
- "academic gown, academic robe, judge's robe", "accordion, piano accordion, squeeze box",
- "acoustic guitar", "aircraft carrier, carrier, flattop, attack aircraft carrier",
- "airliner", "airship, dirigible", "altar",
- "ambulance", "amphibian, amphibious vehicle", "analog clock",
- "apiary, bee house", "apron",
- "ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin",
- "assault rifle, assault gun", "backpack, back pack, knapsack, packsack, rucksack, haversack",
- "bakery, bakeshop, bakehouse", "balance beam, beam", "balloon",
- "ballpoint, ballpoint pen, ballpen, Biro", "Band Aid", "banjo",
- "bannister, banister, balustrade, balusters, handrail", "barbell",
- "barber chair", "barbershop", "barn",
- "barometer", "barrel, cask", "barrow, garden cart, lawn cart, wheelbarrow",
- "baseball", "basketball", "bassinet",
- "bassoon", "bathing cap, swimming cap", "bath towel",
- "bathtub, bathing tub, bath, tub", "beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon",
- "beacon, lighthouse, beacon light, pharos", "beaker", "bearskin, busby, shako",
- "beer bottle", "beer glass", "bell cote, bell cot",
- "bib", "bicycle-built-for-two, tandem bicycle, tandem", "bikini, two-piece",
- "binder, ring-binder", "binoculars, field glasses, opera glasses",
- "birdhouse", "boathouse", "bobsled, bobsleigh, bob",
- "bolo tie, bolo, bola tie, bola", "bonnet, poke bonnet", "bookcase",
- "bookshop, bookstore, bookstall", "bottlecap", "bow",
- "bow tie, bow-tie, bowtie", "brass, memorial tablet, plaque", "brassiere, bra, bandeau",
- "breakwater, groin, groyne, mole, bulwark, seawall, jetty", "breastplate, aegis, egis",
- "broom", "bucket, pail", "buckle",
- "bulletproof vest", "bullet train, bullet", "butcher shop, meat market",
- "cab, hack, taxi, taxicab", "caldron, cauldron", "candle, taper, wax light",
- "cannon", "canoe", "can opener, tin opener",
- "cardigan", "car mirror", "carousel, carrousel, merry-go-round, roundabout, whirligig",
- "carpenter's kit, tool kit", "carton", "car wheel",
- "cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM",
- "cassette", "cassette player", "castle",
- "catamaran", "CD player", "cello, violoncello",
- "cellular telephone, cellular phone, cellphone, cell, mobile phone",
- "chain", "chainlink fence", "chain mail, ring mail, mail, chain armor, chain armour, ring armor, ring armour",
- "chain saw, chainsaw", "chest", "chiffonier, commode",
- "chime, bell, gong", "china cabinet, china closet", "Christmas stocking",
- "church, church building", "cinema, movie theater, movie theatre, movie house, picture palace",
- "cleaver, meat cleaver, chopper", "cliff dwelling", "cloak",
- "clog, geta, patten, sabot", "cocktail shaker", "coffee mug",
- "coffeepot", "coil, spiral, volute, whorl, helix", "combination lock",
- "computer keyboard, keypad", "confectionery, confectionary, candy store",
- "container ship, containership, container vessel", "convertible",
- "corkscrew, bottle screw", "cornet, horn, trumpet, trump", "cowboy boot",
- "cowboy hat, ten-gallon hat", "cradle", "crane",
- "crash helmet", "crate", "crib, cot",
- "Crock Pot", "croquet ball", "crutch",
- "cuirass", "dam, dike, dyke", "desk",
- "desktop computer", "dial telephone, dial phone", "diaper, nappy, napkin",
- "digital clock", "digital watch", "dining table, board",
- "dishrag, dishcloth", "dishwasher, dish washer, dishwashing machine",
- "disk brake, disc brake", "dock, dockage, docking facility", "dogsled, dog sled, dog sleigh",
- "dome", "doormat, welcome mat", "drilling platform, offshore rig",
- "drum, membranophone, tympan", "drumstick", "dumbbell",
- "Dutch oven", "electric fan, blower", "electric guitar",
- "electric locomotive", "entertainment center", "envelope",
- "espresso maker", "face powder", "feather boa, boa",
- "file, file cabinet, filing cabinet", "fireboat", "fire engine, fire truck",
- "fire screen, fireguard", "flagpole, flagstaff", "flute, transverse flute",
- "folding chair", "football helmet", "forklift",
- "fountain", "fountain pen", "four-poster",
- "freight car", "French horn, horn", "frying pan, frypan, skillet",
- "fur coat", "garbage truck, dustcart", "gasmask, respirator, gas helmet",
- "gas pump, gasoline pump, petrol pump, island dispenser", "goblet",
- "go-kart", "golf ball", "golfcart, golf cart",
- "gondola", "gong, tam-tam", "gown",
- "grand piano, grand", "greenhouse, nursery, glasshouse", "grille, radiator grille",
- "grocery store, grocery, food market, market", "guillotine", "hair slide",
- "hair spray", "half track", "hammer",
- "hamper", "hand blower, blow dryer, blow drier, hair dryer, hair drier",
- "hand-held computer, hand-held microcomputer", "handkerchief, hankie, hanky, hankey",
- "hard disc, hard disk, fixed disk", "harmonica, mouth organ, harp, mouth harp",
- "harp", "harvester, reaper", "hatchet",
- "holster", "home theater, home theatre", "honeycomb",
- "hook, claw", "hoopskirt, crinoline", "horizontal bar, high bar",
- "horse cart, horse-cart", "hourglass", "iPod",
- "iron, smoothing iron", "jack-o'-lantern", "jean, blue jean, denim",
- "jeep, landrover", "jersey, T-shirt, tee shirt", "jigsaw puzzle",
- "jinrikisha, ricksha, rickshaw", "joystick", "kimono",
- "knee pad", "knot", "lab coat, laboratory coat",
- "ladle", "lampshade, lamp shade", "laptop, laptop computer",
- "lawn mower, mower", "lens cap, lens cover", "letter opener, paper knife, paperknife",
- "library", "lifeboat", "lighter, light, igniter, ignitor",
- "limousine, limo", "liner, ocean liner", "lipstick, lip rouge",
- "Loafer", "lotion", "loudspeaker, speaker, speaker unit, loudspeaker system, speaker system",
- "loupe, jeweler's loupe", "lumbermill, sawmill", "magnetic compass",
- "mailbag, postbag", "mailbox, letter box", "maillot",
- "maillot, tank suit", "manhole cover", "maraca",
- "marimba, xylophone", "mask", "matchstick",
- "maypole", "maze, labyrinth", "measuring cup",
- "medicine chest, medicine cabinet", "megalith, megalithic structure",
- "microphone, mike", "microwave, microwave oven", "military uniform",
- "milk can", "minibus", "miniskirt, mini",
- "minivan", "missile", "mitten",
- "mixing bowl", "mobile home, manufactured home", "Model T",
- "modem", "monastery", "monitor",
- "moped", "mortar", "mortarboard",
- "mosque", "mosquito net", "motor scooter, scooter",
- "mountain bike, all-terrain bike, off-roader", "mountain tent",
- "mouse, computer mouse", "mousetrap", "moving van",
- "muzzle", "nail", "neck brace",
- "necklace", "nipple", "notebook, notebook computer",
- "obelisk", "oboe, hautboy, hautbois", "ocarina, sweet potato",
- "odometer, hodometer, mileometer, milometer", "oil filter", "organ, pipe organ",
- "oscilloscope, scope, cathode-ray oscilloscope, CRO", "overskirt",
- "oxcart", "oxygen mask", "packet",
- "paddle, boat paddle", "paddlewheel, paddle wheel", "padlock",
- "paintbrush", "pajama, pyjama, pj's, jammies", "palace",
- "panpipe, pandean pipe, syrinx", "paper towel", "parachute, chute",
- "parallel bars, bars", "park bench", "parking meter",
- "passenger car, coach, carriage", "patio, terrace", "pay-phone, pay-station",
- "pedestal, plinth, footstall", "pencil box, pencil case", "pencil sharpener",
- "perfume, essence", "Petri dish", "photocopier",
- "pick, plectrum, plectron", "pickelhaube", "picket fence, paling",
- "pickup, pickup truck", "pier", "piggy bank, penny bank",
- "pill bottle", "pillow", "ping-pong ball",
- "pinwheel", "pirate, pirate ship", "pitcher, ewer",
- "plane, carpenter's plane, woodworking plane", "planetarium", "plastic bag",
- "plate rack", "plow, plough", "plunger, plumber's helper",
- "Polaroid camera, Polaroid Land camera", "pole", "police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria",
- "poncho", "pool table, billiard table, snooker table", "pop bottle, soda bottle",
- "pot, flowerpot", "potter's wheel", "power drill",
- "prayer rug, prayer mat", "printer", "prison, prison house",
- "projectile, missile", "projector", "puck, hockey puck",
- "punching bag, punch bag, punching ball, punchball", "purse", "quill, quill pen",
- "quilt, comforter, comfort, puff", "racer, race car, racing car",
- "racket, racquet", "radiator", "radio, wireless",
- "radio telescope, radio reflector", "rain barrel", "recreational vehicle, RV, R.V.",
- "reel", "reflex camera", "refrigerator, icebox",
- "remote control, remote", "restaurant, eating house, eating place, eatery",
- "revolver, six-gun, six-shooter", "rifle", "rocking chair, rocker",
- "rotisserie", "rubber eraser, rubber, pencil eraser", "rugby ball",
- "rule, ruler", "running shoe", "safe",
- "safety pin", "saltshaker, salt shaker", "sandal",
- "sarong", "sax, saxophone", "scabbard",
- "scale, weighing machine", "school bus", "schooner",
- "scoreboard", "screen, CRT screen", "screw",
- "screwdriver", "seat belt, seatbelt", "sewing machine",
- "shield, buckler", "shoe shop, shoe-shop, shoe store", "shoji",
- "shopping basket", "shopping cart", "shovel",
- "shower cap", "shower curtain", "ski",
- "ski mask", "sleeping bag", "slide rule, slipstick",
- "sliding door", "slot, one-armed bandit", "snorkel",
- "snowmobile", "snowplow, snowplough", "soap dispenser",
- "soccer ball", "sock", "solar dish, solar collector, solar furnace",
- "sombrero", "soup bowl", "space bar",
- "space heater", "space shuttle", "spatula",
- "speedboat", "spider web, spider's web", "spindle",
- "sports car, sport car", "spotlight, spot", "stage",
- "steam locomotive", "steel arch bridge", "steel drum",
- "stethoscope", "stole", "stone wall",
- "stopwatch, stop watch", "stove", "strainer",
- "streetcar, tram, tramcar, trolley, trolley car", "stretcher", "studio couch, day bed",
- "stupa, tope", "submarine, pigboat, sub, U-boat", "suit, suit of clothes",
- "sundial", "sunglass", "sunglasses, dark glasses, shades",
- "sunscreen, sunblock, sun blocker", "suspension bridge", "swab, swob, mop",
- "sweatshirt", "swimming trunks, bathing trunks", "swing",
- "switch, electric switch, electrical switch", "syringe", "table lamp",
- "tank, army tank, armored combat vehicle, armoured combat vehicle",
- "tape player", "teapot", "teddy, teddy bear",
- "television, television system", "tennis ball", "thatch, thatched roof",
- "theater curtain, theatre curtain", "thimble", "thresher, thrasher, threshing machine",
- "throne", "tile roof", "toaster",
- "tobacco shop, tobacconist shop, tobacconist", "toilet seat", "torch",
- "totem pole", "tow truck, tow car, wrecker", "toyshop",
- "tractor", "trailer truck, tractor trailer, trucking rig, rig, articulated lorry, semi",
- "tray", "trench coat", "tricycle, trike, velocipede",
- "trimaran", "tripod", "triumphal arch",
- "trolleybus, trolley coach, trackless trolley", "trombone", "tub, vat",
- "turnstile", "typewriter keyboard", "umbrella",
- "unicycle, monocycle", "upright, upright piano", "vacuum, vacuum cleaner",
- "vase", "vault", "velvet",
- "vending machine", "vestment", "viaduct",
- "violin, fiddle", "volleyball", "waffle iron",
- "wall clock", "wallet, billfold, notecase, pocketbook", "wardrobe, closet, press",
- "warplane, military plane", "washbasin, handbasin, washbowl, lavabo, wash-hand basin",
- "washer, automatic washer, washing machine", "water bottle", "water jug",
- "water tower", "whiskey jug", "whistle",
- "wig", "window screen", "window shade",
- "Windsor tie", "wine bottle", "wing",
- "wok", "wooden spoon", "wool, woolen, woollen",
- "worm fence, snake fence, snake-rail fence, Virginia fence", "wreck",
- "yawl", "yurt", "web site, website, internet site, site",
- "comic book", "crossword puzzle, crossword", "street sign",
- "traffic light, traffic signal, stoplight", "book jacket, dust cover, dust jacket, dust wrapper",
- "menu", "plate", "guacamole",
- "consomme", "hot pot, hotpot", "trifle",
- "ice cream, icecream", "ice lolly, lolly, lollipop, popsicle", "French loaf",
- "bagel, beigel", "pretzel", "cheeseburger",
- "hotdog, hot dog, red hot", "mashed potato", "head cabbage",
- "broccoli", "cauliflower", "zucchini, courgette",
- "spaghetti squash", "acorn squash", "butternut squash",
- "cucumber, cuke", "artichoke, globe artichoke", "bell pepper",
- "cardoon", "mushroom", "Granny Smith",
- "strawberry", "orange", "lemon",
- "fig", "pineapple, ananas", "banana",
- "jackfruit, jak, jack", "custard apple", "pomegranate",
- "hay", "carbonara", "chocolate sauce, chocolate syrup",
- "dough", "meat loaf, meatloaf", "pizza, pizza pie",
- "potpie", "burrito", "red wine",
- "espresso", "cup", "eggnog",
- "alp", "bubble", "cliff, drop, drop-off",
- "coral reef", "geyser", "lakeside, lakeshore",
- "promontory, headland, head, foreland", "sandbar, sand bar", "seashore, coast, seacoast, sea-coast",
- "valley, vale", "volcano", "ballplayer, baseball player",
- "groom, bridegroom", "scuba diver", "rapeseed",
- "daisy", "yellow lady's slipper, yellow lady-slipper, Cypripedium calceolus, Cypripedium parviflorum",
- "corn", "acorn", "hip, rose hip, rosehip",
- "buckeye, horse chestnut, conker", "coral fungus", "agaric",
- "gyromitra", "stinkhorn, carrion fungus", "earthstar",
- "hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa",
- "bolete", "ear, spike, capitulum", "toilet tissue, toilet paper, bathroom tissue"
- };
- };
-}
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_GHOSTNET_H
diff --git a/lite/mnn/cv/mnn_glint_arcface.cpp b/lite/mnn/cv/mnn_glint_arcface.cpp
deleted file mode 100644
index dca8fb18..00000000
--- a/lite/mnn/cv/mnn_glint_arcface.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// Created by DefTruth on 2021/11/13.
-//
-
-#include "mnn_glint_arcface.h"
-
-using mnncv::MNNGlintArcFace;
-
-MNNGlintArcFace::MNNGlintArcFace(const std::string &_mnn_path, unsigned int _num_threads) :
- BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-
-inline void MNNGlintArcFace::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNGlintArcFace::transform(const cv::Mat &mat)
-{
- // normalize & HWC -> CHW & BGR -> RGB
- cv::Mat mat_rs;
- cv::resize(mat, mat_rs, cv::Size(input_width, input_height));
- pretreat->convert(mat_rs.data, input_width, input_height, mat_rs.step[0], input_tensor);
-}
-
-void MNNGlintArcFace::detect(const cv::Mat &mat, types::FaceContent &face_content)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference.
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
-
- auto device_embedding_ptr = output_tensors.at("embedding");
- MNN::Tensor host_embedding_tensor(device_embedding_ptr, device_embedding_ptr->getDimensionType()); // NCHW
- device_embedding_ptr->copyToHostTensor(&host_embedding_tensor);
-
- auto embedding_dims = host_embedding_tensor.shape(); // (1,512)
- const unsigned int hidden_dim = embedding_dims.at(1);
- const float *embedding_values = host_embedding_tensor.host();
-
- std::vector embedding_norm(embedding_values, embedding_values + hidden_dim);
- cv::normalize(embedding_norm, embedding_norm); // l2 normalize
- face_content.embedding.assign(embedding_norm.begin(), embedding_norm.end());
- face_content.dim = hidden_dim;
- face_content.flag = true;
-}
\ No newline at end of file
diff --git a/lite/mnn/cv/mnn_glint_arcface.h b/lite/mnn/cv/mnn_glint_arcface.h
deleted file mode 100644
index cbec2b9e..00000000
--- a/lite/mnn/cv/mnn_glint_arcface.h
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// Created by DefTruth on 2021/11/13.
-//
-
-#ifndef LITE_AI_TOOLKIT_MNN_CV_MNN_GLINT_ARCFACE_H
-#define LITE_AI_TOOLKIT_MNN_CV_MNN_GLINT_ARCFACE_H
-
-#include "lite/mnn/core/mnn_core.h"
-
-namespace mnncv
-{
- class LITE_EXPORTS MNNGlintArcFace : public BasicMNNHandler
- {
- public:
- explicit MNNGlintArcFace(const std::string &_mnn_path, unsigned int _num_threads = 1); //
- ~MNNGlintArcFace() override = default;
-
- private:
- const float mean_vals[3] = {127.5f, 127.5f, 127.5f}; // RGB
- const float norm_vals[3] = {1.f / 127.5f, 1.f / 127.5f, 1.f / 127.5f};
-
- private:
- void initialize_pretreat(); //
-
- void transform(const cv::Mat &mat) override; //
-
- public:
- void detect(const cv::Mat &mat, types::FaceContent &face_content);
- };
-}
-
-#endif //LITE_AI_TOOLKIT_MNN_CV_MNN_GLINT_ARCFACE_H
diff --git a/lite/mnn/cv/mnn_glint_cosface.cpp b/lite/mnn/cv/mnn_glint_cosface.cpp
deleted file mode 100644
index 9b518a85..00000000
--- a/lite/mnn/cv/mnn_glint_cosface.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// Created by DefTruth on 2021/11/13.
-//
-
-#include "mnn_glint_cosface.h"
-
-using mnncv::MNNGlintCosFace;
-
-MNNGlintCosFace::MNNGlintCosFace(const std::string &_mnn_path, unsigned int _num_threads) :
- BasicMNNHandler(_mnn_path, _num_threads)
-{
- initialize_pretreat();
-}
-
-
-inline void MNNGlintCosFace::initialize_pretreat()
-{
- pretreat = std::shared_ptr(
- MNN::CV::ImageProcess::create(
- MNN::CV::BGR,
- MNN::CV::RGB,
- mean_vals, 3,
- norm_vals, 3
- )
- );
-}
-
-void MNNGlintCosFace::transform(const cv::Mat &mat)
-{
- // normalize & HWC -> CHW & BGR -> RGB
- cv::Mat mat_rs;
- cv::resize(mat, mat_rs, cv::Size(input_width, input_height));
- pretreat->convert(mat_rs.data, input_width, input_height, mat_rs.step[0], input_tensor);
-}
-
-void MNNGlintCosFace::detect(const cv::Mat &mat, types::FaceContent &face_content)
-{
- if (mat.empty()) return;
- // 1. make input tensor
- this->transform(mat);
- // 2. inference.
- mnn_interpreter->runSession(mnn_session);
- auto output_tensors = mnn_interpreter->getSessionOutputAll(mnn_session);
-
- auto device_embedding_ptr = output_tensors.at("embedding");
- MNN::Tensor host_embedding_tensor(device_embedding_ptr, device_embedding_ptr->getDimensionType()); // NCHW
- device_embedding_ptr->copyToHostTensor(&host_embedding_tensor);
-
- auto embedding_dims = host_embedding_tensor.shape(); // (1,512)
- const unsigned int hidden_dim = embedding_dims.at(1);
- const float *embedding_values = host_embedding_tensor.host