Update README.md
Browse files
README.md
CHANGED
|
@@ -1,6 +1,131 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: other
|
| 3 |
-
license_name: sla0044
|
| 4 |
-
license_link: >-
|
| 5 |
-
https://github.com/STMicroelectronics/stm32ai-modelzoo/image_classification/LICENSE.md
|
| 6 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: sla0044
|
| 4 |
+
license_link: >-
|
| 5 |
+
https://github.com/STMicroelectronics/stm32ai-modelzoo/image_classification/LICENSE.md
|
| 6 |
+
pipeline_tag: image-classification
|
| 7 |
+
---
|
| 8 |
+
# ResNet50 v2
|
| 9 |
+
|
| 10 |
+
## **Use case** : `Image classification`
|
| 11 |
+
|
| 12 |
+
# Model description
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
ResNets family is a well known architecture that uses skip connections to enable stronger gradients in much deeper networks. This variant has 50 layers.
|
| 16 |
+
|
| 17 |
+
The model is quantized in int8 using tensorflow lite converter.
|
| 18 |
+
|
| 19 |
+
## Network information
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
| Network Information | Value |
|
| 23 |
+
|-------------------------|-----------------|
|
| 24 |
+
| Framework | TensorFlow Lite |
|
| 25 |
+
| MParams | 25.6 M |
|
| 26 |
+
| Quantization | int8 |
|
| 27 |
+
| Provenance | https://www.tensorflow.org/api_docs/python/tf/keras/applications/ResNet50V2 |
|
| 28 |
+
| Paper | https://arxiv.org/abs/1603.05027 |
|
| 29 |
+
|
| 30 |
+
The models are quantized using tensorflow lite converter.
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
## Network inputs / outputs
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
For an image resolution of NxM and P classes
|
| 37 |
+
|
| 38 |
+
| Input Shape | Description |
|
| 39 |
+
| ----- | ----------- |
|
| 40 |
+
| (1, N, M, 3) | Single NxM RGB image with UINT8 values between 0 and 255 |
|
| 41 |
+
|
| 42 |
+
| Output Shape | Description |
|
| 43 |
+
| ----- | ----------- |
|
| 44 |
+
| (1, P) | Per-class confidence for P classes in FLOAT32|
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
## Recommended platforms
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
| Platform | Supported | Recommended |
|
| 51 |
+
|----------|-----------|-----------|
|
| 52 |
+
| STM32L0 |[]|[]|
|
| 53 |
+
| STM32L4 |[]|[]|
|
| 54 |
+
| STM32U5 |[]|[]|
|
| 55 |
+
| STM32H7 |[x]|[]|
|
| 56 |
+
| STM32MP1 |[x]|[]|
|
| 57 |
+
| STM32MP2 |[x]|[x]|
|
| 58 |
+
| STM32N6 |[x]|[x]|
|
| 59 |
+
|
| 60 |
+
# Performances
|
| 61 |
+
|
| 62 |
+
## Metrics
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
Measures are done with default STM32Cube.AI configuration with enabled input / output allocated option.
|
| 66 |
+
|
| 67 |
+
### Reference **NPU** memory footprint on food-101 and ImageNet dataset (see Accuracy for details on dataset)
|
| 68 |
+
|Model | Dataset | Format | Resolution | Series | Internal RAM | External RAM | Weights Flash | STM32Cube.AI version | STEdgeAI Core version |
|
| 69 |
+
|----------|------------------|--------|-------------|------------------|------------------|---------------------|-------|----------------------|-------------------------|
|
| 70 |
+
| [ResNet50 v2 fft](https://github.com/STMicroelectronics/stm32ai-modelzoo/image_classification/resnet50v2/ST_pretrainedmodel_public_dataset/food-101/resnet50_v2_224_fft/resnet50_v2_224_fft_int8.tflite) | food-101 | Int8 | 224x224x3 | STM32N6 | | | | 10.0.0 | 2.0.0 |
|
| 71 |
+
| [ResNet50 v2](https://github.com/STMicroelectronics/stm32ai-modelzoo/image_classification/resnet50v2/Public_pretrainedmodel_public_dataset/ImageNet/resnet50_v2_224/resnet50_v2_224_int8.tflite) | ImageNet | Int8 | 224x224x3 | STM32N6 | | | | 10.0.0 | 2.0.0 |
|
| 72 |
+
|
| 73 |
+
### Reference **NPU** inference time on food-101 and ImageNet dataset (see Accuracy for details on dataset)
|
| 74 |
+
| Model | Dataset | Format | Resolution | Board | Execution Engine | Inference time (ms) | Inf / sec | STM32Cube.AI version | STEdgeAI Core version |
|
| 75 |
+
|--------|------------------|--------|-------------|------------------|------------------|---------------------|-------|----------------------|-------------------------|
|
| 76 |
+
| [ResNet50 v2 fft](https://github.com/STMicroelectronics/stm32ai-modelzoo/image_classification/resnet50v2/ST_pretrainedmodel_public_dataset/food-101/resnet50_v2_224_fft/resnet50_v2_224_fft_int8.tflite) | food-101 | Int8 | 224x224x3 | STM32N6570-DK | NPU/MCU | | | 10.0.0 | 2.0.0 |
|
| 77 |
+
| [ResNet50 v2](https://github.com/STMicroelectronics/stm32ai-modelzoo/image_classification/resnet50v2/Public_pretrainedmodel_public_dataset/ImageNet/resnet50_v2_224/resnet50_v2_224_int8.tflite) | ImageNet | Int8 | 224x224x3 | STM32N6570-DK | NPU/MCU | | | 10.0.0 | 2.0.0 |
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
### Reference **MCU** memory footprint based on Food-101 and ImageNet dataset (see Accuracy for details on dataset)
|
| 81 |
+
|
| 82 |
+
| Model | Format | Resolution | Series | Activation RAM | Runtime RAM | Weights Flash | Code Flash | Total RAM | Total Flash | STM32Cube.AI version |
|
| 83 |
+
|--------------------------------------------------------------------------------------------------------------------------------------|--------|------------|---------|----------------|-------------|---------------|------------|-------------|-------------|-----------------------|
|
| 84 |
+
| [ResNet50 v2 fft](https://github.com/STMicroelectronics/stm32ai-modelzoo/image_classification/resnet50v2/ST_pretrainedmodel_public_dataset/food-101/resnet50_v2_224_fft/resnet50_v2_224_fft_int8.tflite) | Int8 | 224x224x3 | STM32H7 | 2142.07 KiB | 41.02 KiB | 23240.96 KiB | 226.05 KiB | 2183.09 KiB | 23467.01 KiB | 10.0.0 |
|
| 85 |
+
| [ResNet50 v2](https://github.com/STMicroelectronics/stm32ai-modelzoo/image_classification/resnet50v2/Public_pretrainedmodel_public_dataset/ImageNet/resnet50_v2_224/resnet50_v2_224_int8.tflite) | Int8 | 224x224x3 | STM32H7 | 2142.07 KiB | 41.02 KiB | 25042.47 KiB | 226.05 KiB | 2183.09 KiB | 25268.52 KiB | 10.0.0 |
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
### Reference **MCU** inference time based on Food-101 and ImageNet dataset (see Accuracy for details on dataset)
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
| Model | Format | Resolution | Board | Execution Engine | Frequency | Inference time (ms) | STM32Cube.AI version |
|
| 92 |
+
|-------------------|--------|------------|------------------|------------------|-----------|------------------|-----------------------|
|
| 93 |
+
| [ResNet50 v2 fft](https://github.com/STMicroelectronics/stm32ai-modelzoo/image_classification/resnet50v2/ST_pretrainedmodel_public_dataset/food-101/resnet50_v2_224_fft/resnet50_v2_224_fft_int8.tflite) | Int8 | 224x224x3 | STM32H747I-DISCO | 1 CPU | 400 MHz | 11354.82 ms | 10.0.0 |
|
| 94 |
+
| [ResNet50 v2](https://github.com/STMicroelectronics/stm32ai-modelzoo/image_classification/resnet50v2/Public_pretrainedmodel_public_dataset/ImageNet/resnet50_v2_224/resnet50_v2_224_int8.tflite) | Int8 | 224x224x3 | STM32H747I-DISCO | 1 CPU | 400 MHz | 11368.81 ms | 10.0.0 |
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
### Accuracy with Food-101 dataset
|
| 99 |
+
|
| 100 |
+
Dataset details: [link](https://data.vision.ee.ethz.ch/cvl/datasets_extra/food-101/) , License [-](), Quotation[[1]](#1) , Number of classes: 101 , Number of images: 101 000
|
| 101 |
+
|
| 102 |
+
| Model | Format | Resolution | Top 1 Accuracy |
|
| 103 |
+
|-------|--------|------------|----------------|
|
| 104 |
+
| [ResNet50 v2 fft](https://github.com/STMicroelectronics/stm32ai-modelzoo/image_classification/resnet50v2/ST_pretrainedmodel_public_dataset/food-101/resnet50_v2_224_fft/resnet50_v2_224_fft.h5) | Float | 224x224x3 | 71.53 % |
|
| 105 |
+
| [ResNet50 v2 fft](https://github.com/STMicroelectronics/stm32ai-modelzoo/image_classification/resnet50v2/ST_pretrainedmodel_public_dataset/food-101/resnet50_v2_224_fft/resnet50_v2_224_fft_int8.tflite) | Int8 | 224x224x3 | 70.07 % |
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
### Accuracy with ImageNet dataset
|
| 109 |
+
|
| 110 |
+
Dataset details: [link](https://www.image-net.org), License: BSD-3-Clause, Quotation[[4]](#4)
|
| 111 |
+
Number of classes: 1000.
|
| 112 |
+
To perform the quantization, we calibrated the activations with a random subset of the training set.
|
| 113 |
+
For the sake of simplicity, the accuracy reported here was estimated on the 50000 labelled images of the validation set.
|
| 114 |
+
|
| 115 |
+
|model | Format | Resolution | Top 1 Accuracy |
|
| 116 |
+
|---------|--------|------------|----------------|
|
| 117 |
+
| [ResNet50 v2 ](https://github.com/STMicroelectronics/stm32ai-modelzoo/image_classification/resnet50v2/Public_pretrainedmodel_public_dataset/ImageNet/resnet50_v2_224/resnet50_v2_224.h5) | Float | 224x224x3 | 66.38 % |
|
| 118 |
+
| [ResNet50 v2 ](https://github.com/STMicroelectronics/stm32ai-modelzoo/image_classification/resnet50v2/Public_pretrainedmodel_public_dataset/ImageNet/resnet50_v2_224/resnet50_v2_224_int8.tflite) | Int8 | 224x224x3 | 65.99 % |
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
## Retraining and Integration in a simple example:
|
| 123 |
+
|
| 124 |
+
Please refer to the stm32ai-modelzoo-services GitHub [here](https://github.com/STMicroelectronics/stm32ai-modelzoo-services)
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
# References
|
| 129 |
+
|
| 130 |
+
<a id="1">[1]</a>
|
| 131 |
+
L. Bossard, M. Guillaumin, and L. Van Gool, "Food-101 -- Mining Discriminative Components with Random Forests." European Conference on Computer Vision, 2014.
|