All Projects → liangfu → Mxnet Mobilenet V2

liangfu / Mxnet Mobilenet V2

Reproduction of MobileNetV2 using MXNet

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Mxnet Mobilenet V2

Sagemaker Python Sdk
A library for training and deploying machine learning models on Amazon SageMaker
Stars: ✭ 1,344 (+902.99%)
Mutual labels:  mxnet
Dlcookbook Dlbs
Deep Learning Benchmarking Suite
Stars: ✭ 114 (-14.93%)
Mutual labels:  mxnet
Deeplabv3 mobilenetv2 pytorch
A PyTorch Implementation of MobileNetv2+DeepLabv3
Stars: ✭ 130 (-2.99%)
Mutual labels:  mobilenetv2
D2l En
Interactive deep learning book with multi-framework code, math, and discussions. Adopted at 300 universities from 55 countries including Stanford, MIT, Harvard, and Cambridge.
Stars: ✭ 11,837 (+8733.58%)
Mutual labels:  mxnet
Mobilenet Yolo
MobileNetV2-YoloV3-Nano: 0.5BFlops 3MB HUAWEI P40: 6ms/img, YoloFace-500k:0.1Bflops 420KB🔥🔥🔥
Stars: ✭ 1,566 (+1068.66%)
Mutual labels:  mobilenetv2
Ivy
The templated deep learning framework, enabling framework-agnostic functions, layers and libraries.
Stars: ✭ 118 (-11.94%)
Mutual labels:  mxnet
Mxfusion
Modular Probabilistic Programming on MXNet
Stars: ✭ 95 (-29.1%)
Mutual labels:  mxnet
Mxnet.sharp
.NET Standard bindings for Apache MxNet with Imperative, Symbolic and Gluon Interface for developing, training and deploying Machine Learning models in C#. https://mxnet.tech-quantum.com/
Stars: ✭ 134 (+0%)
Mutual labels:  mxnet
Rnn Transducer
MXNet implementation of RNN Transducer (Graves 2012): Sequence Transduction with Recurrent Neural Networks
Stars: ✭ 114 (-14.93%)
Mutual labels:  mxnet
Insightface Just Works
Insightface face detection and recognition model that just works out of the box.
Stars: ✭ 127 (-5.22%)
Mutual labels:  mxnet
Mxnet Finetuner
An all-in-one Deep Learning toolkit for image classification to fine-tuning pretrained models using MXNet.
Stars: ✭ 100 (-25.37%)
Mutual labels:  mxnet
Mxnet Gluon Style Transfer
Neural Style and MSG-Net
Stars: ✭ 105 (-21.64%)
Mutual labels:  mxnet
Nlp Pretrained Model
A collection of Natural language processing pre-trained models.
Stars: ✭ 122 (-8.96%)
Mutual labels:  mxnet
Mxnet Im2rec tutorial
this simple tutorial will introduce how to use im2rec for mx.image.ImageIter , ImageDetIter and how to use im2rec for COCO DataSet
Stars: ✭ 97 (-27.61%)
Mutual labels:  mxnet
Object Localization
Object localization in images using simple CNNs and Keras
Stars: ✭ 130 (-2.99%)
Mutual labels:  mobilenetv2
Mixup
mixup: Beyond Empirical Risk Minimization
Stars: ✭ 96 (-28.36%)
Mutual labels:  mxnet
Onnx
Open standard for machine learning interoperability
Stars: ✭ 11,829 (+8727.61%)
Mutual labels:  mxnet
Deep Face Alignment
The MXNet Implementation of Stacked Hourglass and Stacked SAT for Robust 2D and 3D Face Alignment
Stars: ✭ 134 (+0%)
Mutual labels:  mxnet
Aognet
Code for CVPR 2019 paper: " Learning Deep Compositional Grammatical Architectures for Visual Recognition"
Stars: ✭ 132 (-1.49%)
Mutual labels:  mxnet
Aws Machine Learning University Accelerated Nlp
Machine Learning University: Accelerated Natural Language Processing Class
Stars: ✭ 1,695 (+1164.93%)
Mutual labels:  mxnet

Reproduction of MobileNetV2 using MXNet

This is a MXNet implementation of MobileNetV2 architecture as described in the paper Inverted Residuals and Linear Bottlenecks: Mobile Networks for Classification, Detection and Segmentation.

Pretrained Models on ImageNet

We provide pretrained MobileNet models on ImageNet, which achieve slightly lower accuracy rates than the original ones reported in the paper. We applied the augmentation strategy that use 480xN as input, and random scale between 0.533 ~ 1.0 at early training stages.

Here is the top-1/5 accuracy rates by using single center crop (crop size: 224x224, image size: 256xN) on validation set:

Network Multiplier Top-1 Top-5
MobileNet V2 1.0 71.75 90.15
MobileNet V2 1.4 73.09 91.09

More pretrained models with different multiplier settings would be uploaded later.

Normalization

The input images are substrated by mean RGB = [ 123.68, 116.78, 103.94 ].

Inference with Python upon NNVM

The inference python script is relatively independent from MXNet, it relies on nnvm to build a computation graph and perform the inference operations. Since nnvm is built to support neural network inference on any device enabled with OpenCL, therefore, it's quite efficient to predict on an Intel/AMD/Mali GPU. Here is an concrete example:

>> python from_mxnet.py
[14:52:11] src/runtime/opencl/opencl_device_api.cc:205: Initialize OpenCL platform 'Intel Gen OCL Driver'
[14:52:12] src/runtime/opencl/opencl_device_api.cc:230: opencl(0)='Intel(R) HD Graphics Skylake ULT GT2' cl_device_id=0x7f091bbd2bc0
elapsed: 2992.1 ms (2991.7 ms)
('TVM prediction top-1:', 281, 'n02123045 tabby, tabby cat\n')
('TVM prediction top-2:', 285, 'n02124075 Egyptian cat\n')
('TVM prediction top-3:', 282, 'n02123159 tiger cat\n')
('TVM prediction top-4:', 278, 'n02119789 kit fox, Vulpes macrotis\n')
('TVM prediction top-5:', 287, 'n02127052 lynx, catamount\n')
elapsed: 63.3 ms (62.8 ms)
('TVM prediction top-1:', 281, 'n02123045 tabby, tabby cat\n')
('TVM prediction top-2:', 285, 'n02124075 Egyptian cat\n')
('TVM prediction top-3:', 282, 'n02123159 tiger cat\n')
('TVM prediction top-4:', 278, 'n02119789 kit fox, Vulpes macrotis\n')
('TVM prediction top-5:', 287, 'n02127052 lynx, catamount\n')
elapsed: 62.6 ms (62.1 ms)
('TVM prediction top-1:', 281, 'n02123045 tabby, tabby cat\n')
('TVM prediction top-2:', 285, 'n02124075 Egyptian cat\n')
('TVM prediction top-3:', 282, 'n02123159 tiger cat\n')
('TVM prediction top-4:', 278, 'n02119789 kit fox, Vulpes macrotis\n')
('TVM prediction top-5:', 287, 'n02127052 lynx, catamount\n')

Inference with C++ upon TVM

The inference python script is relatively independent from MXNet, it relies on nnvm to build a computation graph and perform the inference operations. Since nnvm is built to support neural network inference on any device enabled with OpenCL, therefore, it's quite efficient to predict on an Intel/AMD/Mali GPU. Here is an concrete example:

$ cd tvm-predict-cpp
$ ./run_example.sh
Build the libraries..
make: Nothing to be done for 'all'.
Run the example
Run the deployment with all in one packed library...
The maximum position in output vector is: 281

[NEW!] Quantized Inference (INT16)

Taking advantage of the low-bit quantization feature #2116 in TVM, we can now perform 16-bit inference on CPU. Both timing and accuracy results are very promissing.

$ python eval_quantized.py
[09:26:01] src/engine/engine.cc:55: MXNet start using engine: ThreadedEngine
INFO:root:Namespace(batch_size=1, dtype_input='int16', dtype_output='int32', global_scale=256.0, log_interval=10, model='models/imagenet1k-mnetv2-1_0', nbit_input=16, nbit_output=32, num_classes=1000, original=False, rec_val='~/.mxnet/datasets/imagenet/rec/val.rec', simulated=False, target='llvm')
qconfig(nbit_input=16, nbit_weight=16, nbit_activation=32, global_scale=256.000000, skip_k_conv==0, round_for_shift==1, store_lowbit_output==0, debug_enabled_ops==(nullptr), use_stop_fusion==1)
INFO:root:Finish building model models/imagenet1k-mnetv2-1_0...
[09:26:16] src/io/iter_image_recordio_2.cc:172: ImageRecordIOParser2: /home/liangfu/.mxnet/datasets/imagenet/rec/val.rec, use 1 threads for decoding..
INFO:root:[10 samples] validation: acc-top1=0.600000 acc-top5=0.900000, speed=16.5fps
INFO:root:[20 samples] validation: acc-top1=0.700000 acc-top5=0.950000, speed=16.5fps
INFO:root:[30 samples] validation: acc-top1=0.700000 acc-top5=0.966667, speed=16.3fps
INFO:root:[40 samples] validation: acc-top1=0.700000 acc-top5=0.950000, speed=16.4fps
INFO:root:[50 samples] validation: acc-top1=0.700000 acc-top5=0.940000, speed=16.4fps
INFO:root:[60 samples] validation: acc-top1=0.700000 acc-top5=0.916667, speed=16.4fps
INFO:root:[70 samples] validation: acc-top1=0.728571 acc-top5=0.914286, speed=16.4fps
INFO:root:[80 samples] validation: acc-top1=0.725000 acc-top5=0.912500, speed=16.4fps
INFO:root:[90 samples] validation: acc-top1=0.711111 acc-top5=0.900000, speed=16.2fps
INFO:root:[100 samples] validation: acc-top1=0.690000 acc-top5=0.910000, speed=15.5fps
INFO:root:[final] validation: acc-top1=0.690000 acc-top5=0.910000

Known Issues

Current implementation of dmlc/nnvm requires a merge with the PR submission here. For a quick solution, you can simply add 'clip' to the _identity_list variable in frontend/mxnet.py .

Miscellaneous

For Gluon version of MobileNetV2, please refer to chinakook/MobileNetV2.mxnet.

License

MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].