Coder Social home page Coder Social logo

pinto0309 / play_with_mnn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from iwatake2222/play_with_mnn

0.0 2.0 0.0 56.85 MB

Sample projects to use MNN. PoseNet, SemanticSegmentation, etc.

License: Apache License 2.0

Shell 0.40% C++ 85.10% Java 7.28% CMake 7.11% Batchfile 0.12%

play_with_mnn's Introduction

00_doc/demo_multi.gif

Play with MNN

  • Sample projects to use MNN in C++ for multi-platform
  • Typical project structure is like the following diagram
    • 00_doc/design.jpg

Target environment

  • Platform
    • Linux (x64)
    • Linux (armv7)
    • Linux (aarch64)
    • Android (aarch64)
    • Windows (x64). Visual Studio 2019
  • Option
    • with Vulkan
    • without Vulkan

Usage

./main [input]

 - input = blank
    - use the default image file set in source code (main.cpp)
    - e.g. ./main
 - input = *.mp4, *.avi, *.webm
    - use video file
    - e.g. ./main test.mp4
 - input = *.jpg, *.png, *.bmp
    - use image file
    - e.g. ./main test.jpg
 - input = number (e.g. 0, 1, 2, ...)
    - use camera
    - e.g. ./main 0

How to build a project

0. Requirements

  • OpenCV 4.x
  • Vulkan SDK (optional)

1. Download

  • Download source code and pre-built libraries
    git clone https://github.com/iwatake2222/play_with_mnn.git
    cd play_with_mnn
    git submodule update --init
    sh InferenceHelper/third_party/download_prebuilt_libraries.sh
  • Download models
    sh ./download_resource.sh
  • If you want to change pre-built library to be used, modify the following file
    • InferenceHelper/third_party/cmakes/mnn.cmake

2-a. Build in Linux

cd pj_mnn_cls_mobilenet_v2   # for example
mkdir -p build && cd build
cmake ..
make
./main

2-b. Build in Windows (Visual Studio)

  • Configure and Generate a new project using cmake-gui for Visual Studio 2019 64-bit
    • Where is the source code : path-to-play_with_mnn/pj_mnn_cls_mobilenet_v2 (for example)
    • Where to build the binaries : path-to-build (any)
  • Open main.sln
  • Set main project as a startup project, then build and run!

2-c. Build in Android Studio

  • Please refer to
  • Copy resource directory to /storage/emulated/0/Android/data/com.iwatake.viewandroidmnn/files/Documents/resource
    • the directory will be created after running the app (so the first run should fail because model files cannot be read)
  • Modify ViewAndroid\app\src\main\cpp\CMakeLists.txt to select a image processor you want to use
    • set(ImageProcessor_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../../pj_mnn_cls_mobilenet_v2/image_processor")
    • replace pj_mnn_cls_mobilenet_v2 to another

License

  • Copyright 2020 iwatake2222
  • Licensed under the Apache License, Version 2.0

Acknowledgements

  • This project utilizes OSS (Open Source Software)

play_with_mnn's People

Contributors

iwatake2222 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.