1. Compilation
1.1 Linux / Mac
Turn on MNN_BUILD_DEMO in CMakeLists.txt in the root folder.
cd path/to/MNN
# Generate schema ,(Optional)
cd schema && ./generate.sh
# Compile
cd path/to/MNN
mkdir build && cd build
cmake -DMNN_BUILD_DEMO=ON ..
make -j8
1.2 Windows
Turn on MNN_BUILD_DEMO in CMakeLists.txt in the root folder.
cd path/to/MNN
mkdir build
cd build
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DMNN_BUILD_DEMO=ON ..
nmake
2. Demo Instructions
2.1 Pose Detection
Code location:demo/exec/multiPose.cpp
- Download the original TF model: pose model
- Convert to MNN model format using the MNNConvert tool.
- Perform pose detection.
./multiPose.out model.mnn input.jpg pose.png
Here is a showcase:
post.png:
2.2 Portait segmentation
Code loction:demo/exec/segment.cpp
Download deeplab v3 segmentation model and convert to MNN format.
https://storage.googleapis.com/download.tensorflow.org/models/tflite/gpu/deeplabv3_257_mv_gpu.tflite
./segment.out model.mnn input.jpg result.png
Here is a showcase:
input.jpg of Lana Del Rey:
result.png:
2.3 Image Labeling
Code Location:demo/exec/pictureRecognition.cpp
Download MobileNet model and convert to MNN format.
./pictureRecognition.out [MNN model location] [input image_0 location] [input image_1 location]
### Example
./pictureRecognition.out moiblenet.mnn Test.jpg
Here is a showcase:
TestMe.jpg
Output:
Can’t Find type=4 backend, use 0 instead
For Image: TestMe.jpg
386, 0.419250
101, 0.345093
385, 0.214722
347, 0.012001
346, 0.002010
348, 0.001876
294, 0.001247
349, 0.000761
354, 0.000443
345, 0.000441
First text shows the the most probable object label number, find it in sync_words.txt