Conversation
Signed-off-by: Mengni Wang <mengni.wang@intel.com>
Signed-off-by: Mengni Wang <mengni.wang@intel.com>
Signed-off-by: Mengni Wang <mengni.wang@intel.com>
Signed-off-by: Mengni Wang <mengni.wang@intel.com>
Signed-off-by: Mengni Wang <mengni.wang@intel.com>
Signed-off-by: Mengni Wang <mengni.wang@intel.com>
|
@wenbingl Hi Wenbing, we proposed this PR previously but reverted it due to some issues. Currently, I have fixed the issue and proposed it again. |
|
Thanks a lot for the update. I prefer to merge the table together. just leave some 'latency' blank if there is no value for the legacy model. Even, can we also merge the 'quantization.md' into README.md to be a section? |
|
Sure, I will merge the table together. |
Signed-off-by: Mengni Wang <mengni.wang@intel.com>
cfe2bda to
5f2b72c
Compare
Signed-off-by: Mengni Wang <mengni.wang@intel.com>
Signed-off-by: Mengni Wang <mengni.wang@intel.com>
Signed-off-by: Mengni Wang <mengni.wang@intel.com>
|
@wenbingl Hi Wenbing, I have confirmed with our legal team and fixed it. Please review it when you are available and I will update asap. Thx |
wenbingl
left a comment
There was a problem hiding this comment.
Thanks a lot for this contribution.
It's the first quantized model for the zoo and it shows the great performance improvement.
* Add int8 resnet50 Signed-off-by: Mengni Wang <mengni.wang@intel.com> * update valid model Signed-off-by: Mengni Wang <mengni.wang@intel.com> * update test data name Signed-off-by: Mengni Wang <mengni.wang@intel.com> * update data Signed-off-by: Mengni Wang <mengni.wang@intel.com> * fix readme Signed-off-by: Mengni Wang <mengni.wang@intel.com> * add model info Signed-off-by: Mengni Wang <mengni.wang@intel.com> * add model Signed-off-by: Mengni Wang <mengni.wang@intel.com> * merge table Signed-off-by: Mengni Wang <mengni.wang@intel.com> * remove unused link Signed-off-by: Mengni Wang <mengni.wang@intel.com> * update model link Signed-off-by: Mengni Wang <mengni.wang@intel.com> * update config Signed-off-by: Mengni Wang <mengni.wang@intel.com>
* Add int8 resnet50 Signed-off-by: Mengni Wang <mengni.wang@intel.com> * update valid model Signed-off-by: Mengni Wang <mengni.wang@intel.com> * update test data name Signed-off-by: Mengni Wang <mengni.wang@intel.com> * update data Signed-off-by: Mengni Wang <mengni.wang@intel.com> * fix readme Signed-off-by: Mengni Wang <mengni.wang@intel.com> * add model info Signed-off-by: Mengni Wang <mengni.wang@intel.com> * add model Signed-off-by: Mengni Wang <mengni.wang@intel.com> * merge table Signed-off-by: Mengni Wang <mengni.wang@intel.com> * remove unused link Signed-off-by: Mengni Wang <mengni.wang@intel.com> * update model link Signed-off-by: Mengni Wang <mengni.wang@intel.com> * update config Signed-off-by: Mengni Wang <mengni.wang@intel.com>
ResNet
Use cases
ResNet models perform image classification - they take images as input and classify the major object in the image into a set of pre-defined classes. They are trained on ImageNet dataset which contains images from 1000 classes. ResNet models provide very high accuracies with affordable model sizes. They are ideal for cases when high accuracy of classification is required.
Description
Deeper neural networks are more difficult to train. Residual learning framework ease the training of networks that are substantially deeper. The research explicitly reformulate the layers as learning residual functions with reference to the layer inputs, instead of learning unreferenced functions. It also provide comprehensive empirical evidence showing that these residual networks are easier to optimize, and can gain accuracy from considerably increased depth. On the ImageNet dataset the residual nets were evaluated with a depth of up to 152 layers — 8× deeper than VGG nets but still having lower complexity.
MXNet ResNet-v1 ==> ONNX ResNet-v1 [18, 34, 50, 101, 152]
MXNet ResNet-v2 ==> ONNX ResNet-v2 [18, 34, 50, 101, 152]
Caffe2 ResNet-50 ==> ONNX ResNet [50-caffe2]
ONNX ResNet50-v1 ==> Quantized ONNX ResNet50-v1
Model
The model below are ResNet v1 and v2. ResNet models consists of residual blocks and came up to counter the effect of deteriorating accuracies with more layers due to network not learning the initial layers.
ResNet v2 uses pre-activation function whereas ResNet v1 uses post-activation for the residual blocks. The models below have 18, 34, 50, 101 and 152 layers for with ResNetv1 and ResNetv2 architecture.
Run ResNet-50 in browser - implemented by ONNX.js with ResNet50-Caffe2 release 1.2
Details of Resnet-50 quantization & evaluation - implemented by Intel® Low Precision Optimization Tool (LPOT)
Inference
We used MXNet as framework with gluon APIs to perform inference. View the notebook imagenet_inference to understand how to use above models for doing inference. Make sure to specify the appropriate model name in the notebook.
Input
All pre-trained models expect input images normalized in the same way, i.e. mini-batches of 3-channel RGB images of shape (N x 3 x H x W), where N is the batch size, and H and W are expected to be at least 224.
The inference was done using jpeg image.
Preprocessing
The images have to be loaded in to a range of [0, 1] and then normalized using mean = [0.485, 0.456, 0.406] and std = [0.229, 0.224, 0.225]. The transformation should preferably happen at preprocessing.
The following code shows how to preprocess a NCHW tensor:
Check imagenet_preprocess.py for additional sample code.
Output
The model outputs image scores for each of the 1000 classes of ImageNet.
Postprocessing
The post-processing involves calculating the softmax probability scores for each class. You can also sort them to report the most probable classes. Check imagenet_postprocess.py for code.
To do quick inference with the model, check out Model Server.
Dataset
Dataset used for train and validation: ImageNet (ILSVRC2012). Check imagenet_prep for guidelines on preparing the dataset.
Caffe2 Version of ResNet50 uses the ImageNet dataset from 2015 -- ILSVRC2015.
Validation accuracy
The accuracies obtained by the models on the validation set are mentioned above. The validation was done using center cropping of images unlike the paper which uses ten-cropping. We expect an increase of 1-2% in accuracies using ten cropping and that would lead to accuracies similar to the paper.
Training
We used MXNet as framework with gluon APIs to perform training. View the training notebook to understand details for parameters and network for each of the above variants of ResNet.
Validation
We used MXNet as framework with gluon APIs to perform validation. Use the notebook imagenet_validation to verify the accuracy of the model on the validation set. Make sure to specify the appropriate model name in the notebook.
References
ResNetv1
Deep residual learning for image recognition
He, Kaiming, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770-778. 2016.
ResNetv2
Identity mappings in deep residual networks
He, Kaiming, Xiangyu Zhang, Shaoqing Ren, and Jian Sun.
In European Conference on Computer Vision, pp. 630-645. Springer, Cham, 2016.
MXNet, Gluon model zoo, GluonCV
Contributors
License
Apache 2.0