Giter VIP home page Giter VIP logo

msnhnet's Introduction

Msnhnet

English| 中文 |CSDN

A mini pytorch inference framework which inspired from darknet.

License c++ Msnhnet

OS supported (you can check other OS by yourself)

windows linux mac
checked Windows Windows OSX
gpu Windows Linux Mac

CPU checked

Intel i7 raspberry 3B raspberry 4B Jeston NX
checked i7 3B 4B NX

Features

  • C++ Only. 3rdparty blas lib is optional, also you can use OpenBlas.
  • OS supported: Windows, Linux(Ubuntu checked) and Mac os(unchecked).
  • CPU supported: Intel X86, AMD(unchecked) and ARM(checked: armv7 armv8 arrch64).
  • x86 avx2 supported.(Working....)
  • arm neon supported.(Working....)。
  • NNPack supported.(arm)。
  • Keras to Msnhnet is supported. (Keras 2 and tensorflow 1.x)
  • GPU cuda supported.(Checked GTX1080Ti, Jetson NX)
  • GPU cudnn supported.(Checked GTX1080Ti, Jetson NX)
  • GPU fp16 mode supported.(Checked GTX1080Ti, Jetson NX.)
  • ps. Please check your card wheather fp16 full speed is supported.
  • c_api supported.
  • keras 2 msnhnet supported.(Keras 2 and tensorflow 1.x, part of op)
  • pytorch 2 msnhnet supported.(Part of op, working on it)
  • MsnhnetSharp supported. pic
  • A viewer for msnhnet is supported.(netron like)
  • Working on it...(Weekend Only (╮(╯_╰)╭))

Tested networks

  • lenet5
  • lenet5_bn
  • alexnet(torchvision)
  • vgg16(torchvision)
  • vgg16_bn(torchvision)
  • resnet18(torchvision)
  • resnet34(torchvision)
  • resnet50(torchvision)
  • resnet101(torchvision)
  • resnet152(torchvision)
  • darknet53(Pytorch_Darknet53)
  • googLenet(torchvision)
  • mobilenetv2(torchvision)
  • yolov3(u版yolov3)
  • yolov3_spp(u版yolov3)
  • yolov3_tiny(u版yolov3)
  • yolov4(u版yolov3)
  • fcns(pytorch-FCN-easiest-demo)
  • unet(bbuf keras)
  • deeplabv3(torchvision)
    ==============================================================
  • mobilenetv2_yolov3_lite (cudnn does not work with GTX10** Pascal Card, please use GPU model only)
  • mobilenetv2_yolov3_nano (cudnn does not work with GTX10** Pascal Card, please use GPU model only)
  • yoloface100k (cudnn does not work with GTX10** Pascal Card, please use GPU model only)
  • yoloface500k (cudnn does not work with GTX10** Pascal Card, please use GPU model only)
  • Thanks: https://github.com/dog-qiuqiu/MobileNetv2-YOLOV3 ==============================================================
  • pretrained models 链接:https://pan.baidu.com/s/1mBaJvGx7tp2ZsLKzT5ifOg 提取码:x53z

Yolo Test

  • Win10 MSVC 2017 I7-10700F

    net yolov3 yolov3_tiny yolov4
    time 380ms 50ms 432ms
  • ARM(Yolov3Tiny cpu)

    cpu raspberry 3B raspberry 4B Jeston NX
    without NNPack 6s 2.5s 1.2s
    with NNPack 2.5s 1.1s 0.6s
    with neon asm ? 0.432s ?

Yolo GPU Test

  • Ubuntu16.04 GCC Cuda10.1 GTX1080Ti

    net yolov3 yolov3_tiny yolov4
    time 30ms 8ms 30ms
  • Jetson NX

    net yolov3 yolov3_tiny yolov4
    time 200ms 20ms 210ms

Yolo GPU cuDnn FP16 Test

  • Jetson NX
    net yolov3 yolov4
    time 115ms 120ms

Mobilenet Yolo GPU cuDnn Test

  • Jetson NX
    net yoloface100k yoloface500k mobilenetv2_yolov3_nano mobilenetv2_yolov3_lite
    time 7ms 20ms 20ms 30ms

DeepLabv3 GPU Test

  • Ubuntu18.04 GCC Cuda10.1 GTX2080Ti
    net deeplabv3_resnet101 deeplabv3_resnet50
    time 22.51ms 16.46ms

Requirements

Video tutorials(bilibili)

How to build

  • With CMake 3.10+

  • Viewer can not build with GPU.

  • Options

    ps. You can change omp threads by unchecking OMP_MAX_THREAD and modifying "num" val at CMakeLists.txt:52

  • Windows

  1. Compile opencv4 and yaml-cpp.
  2. Config environment. Add "OpenCV_DIR" and "yaml-cpp_DIR"
  3. Get qt5 and install. http://download.qt.io/ (optional)
  4. Add qt5 bin path to environment.
  5. Then use cmake-gui tool and visual studio to make or use vcpkg.
  • Linux(Ubuntu)

ps. If you want to build with Jetson, please uncheck NNPACK, OPENBLAS, NEON.

sudo apt-get install qt5-default      #optional
sudo apt-get install libqt5svg5-dev   #optional
sudo apt-get install libopencv-dev

# build yaml-cpp
git clone https://github.com/jbeder/yaml-cpp.git
cd yaml-cpp
mkdir build 
cd build 
cmake .. -DYAML_BUILD_SHARED_LIBS=True -DYAML_CPP_BUILD_TESTS=False
make -j4
sudo make install 

#config 
sudo echo /usr/local/lib > /etc/ld.so.conf.d/usrlib.conf
sudo ldconfig

# build Msnhnet
git clone https://github.com/msnh2012/Msnhnet.git
mkdir build 

cd Msnhnet/build
cmake -DCMAKE_BUILD_TYPE=Release ..  
make -j4
sudo make install

vim ~/.bashrc # Last line add: export PATH=/usr/local/bin:$PATH
sudo ldconfig

Test Msnhnet

    1. Download pretrained model and extract. eg.D:/models.
    1. Open terminal and cd "Msnhnet install bin". eg. D:/Msnhnet/bin
    1. Test yolov3 "yolov3 D:/models".
    1. Test yolov3tiny_video "yolov3tiny_video D:/models".
    1. Test classify "classify D:/models".


View Msnhnet

    1. Open terminal and cd "Msnhnet install bin" eg. D:/Msnhnet/bin
    1. run "MsnhnetViewer"


PS. You can double click "ResBlock Res2Block AddBlock ConcatBlock" node to view more detail
ResBlock

Res2Block

AddBlock

ConcatBlock

How to convert your own pytorch network

  • pytorch2msnhnet
  • ps. ultralytics yolov3 is not supported. You can trans backbone first and then add some OPs manually.

About Train

Enjoy it! :D

Acknowledgement

Msnhnet got ideas and developed based on these projects:

加群交流

msnhnet's People

Contributors

msnh2012 avatar bbuf avatar

Stargazers

AnnSun avatar

Watchers

James Cloos 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.