1. Compilation

1.1 Linux / Mac

Turn on MNN_BUILD_DEMO in CMakeLists.txt in the root folder.

  1. cd path/to/MNN
  2. # Generate schema ,(Optional)
  3. cd schema && ./generate.sh
  4. # Compile
  5. cd path/to/MNN
  6. mkdir build && cd build
  7. cmake -DMNN_BUILD_DEMO=ON ..
  8. make -j8

1.2 Windows

Turn on MNN_BUILD_DEMO in CMakeLists.txt in the root folder.

  1. cd path/to/MNN
  2. mkdir build
  3. cd build
  4. cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DMNN_BUILD_DEMO=ON ..
  5. nmake

2. Demo Instructions

2.1 Pose Detection

Code location:demo/exec/multiPose.cpp

  1. Download the original TF model: pose model
  2. Convert to MNN model format using the MNNConvert tool.
  3. Perform pose detection.
  1. ./multiPose.out model.mnn input.jpg pose.png

Here is a showcase:

post.png:
image.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

  1. ./segment.out model.mnn input.jpg result.png

Here is a showcase:
input.jpg of Lana Del Rey:
image.png

result.png:
image.png

2.3 Image Labeling

Code Location:demo/exec/pictureRecognition.cpp

Download MobileNet model and convert to MNN format.

  1. ./pictureRecognition.out [MNN model location] [input image_0 location] [input image_1 location]
  2. ### Example
  3. ./pictureRecognition.out moiblenet.mnn Test.jpg

Here is a showcase:
TestMe.jpg
image.png

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