aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManu Mathew2020-10-05 02:50:18 -0500
committerManu Mathew2020-10-07 10:22:24 -0500
commit579328239334b0821c0d338e92fa79e7f467f0f2 (patch)
tree9076b9c2b55037731f50a27b373b1352148401b0
parent75af40f473f77c12bb1d09b5bcb557a35fadc377 (diff)
downloadpytorch-mmdetection-579328239334b0821c0d338e92fa79e7f467f0f2.tar.gz
pytorch-mmdetection-579328239334b0821c0d338e92fa79e7f467f0f2.tar.xz
pytorch-mmdetection-579328239334b0821c0d338e92fa79e7f467f0f2.zip
models and results updated
release commit release commit release commit release commit release commit
-rw-r--r--README.md17
-rw-r--r--configs/retinanet/retinanet-lite_regnet_fpn_bgr.py23
-rw-r--r--configs/ssd/ssd-lite_regnet_fpn_bgr.py22
-rw-r--r--docs/det_modelzoo.md114
-rw-r--r--docs/det_quantization.md43
-rw-r--r--docs/det_usage.md24
-rw-r--r--xmmdet/models/necks/fpn.py15
7 files changed, 121 insertions, 137 deletions
diff --git a/README.md b/README.md
index 8eabb7b..7500b82 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,5 @@
1# Jacinto-AI-Detection 1# Jacinto-AI-Detection
2 2
3
4This repository is an extension of the popular [mmdetection](https://github.com/open-mmlab/mmdetection) open source repository for object detection training. While mmdetection focuses on a wide variety of models, typically at high complexity, we focus on models that are optimized for speed and accuracy so that they run efficiently on embedded devices. 3This repository is an extension of the popular [mmdetection](https://github.com/open-mmlab/mmdetection) open source repository for object detection training. While mmdetection focuses on a wide variety of models, typically at high complexity, we focus on models that are optimized for speed and accuracy so that they run efficiently on embedded devices.
5 4
6Kindly take time to read through the documentation of the original [mmdetection](https://github.com/open-mmlab/mmdetection) before attempting to use this repository. 5Kindly take time to read through the documentation of the original [mmdetection](https://github.com/open-mmlab/mmdetection) before attempting to use this repository.
@@ -8,11 +7,6 @@ Kindly take time to read through the documentation of the original [mmdetection]
8Also, please read the documentation at our landing page [jacinto-ai-devkit](https://github.com/TexasInstruments/jacinto-ai-devkit) before using this repository. 7Also, please read the documentation at our landing page [jacinto-ai-devkit](https://github.com/TexasInstruments/jacinto-ai-devkit) before using this repository.
9 8
10 9
11## License
12
13Please see [LICENSE](./LICENSE) file.
14
15
16## Installation 10## Installation
17 11
18This repository requires [**mmdetection**](https://github.com/open-mmlab/mmdetection) and [**mmcv**](https://github.com/open-mmlab/mmcv) to be installed. 12This repository requires [**mmdetection**](https://github.com/open-mmlab/mmdetection) and [**mmcv**](https://github.com/open-mmlab/mmcv) to be installed.
@@ -43,11 +37,11 @@ This tutorial explains how to do [Quantization Aware Training (QAT)](./docs/det_
43 37
44 38
45## ONNX & Prototxt Export 39## ONNX & Prototxt Export
46- **Export of ONNX model (.onnx) and additional meta information (.prototxt)** is supported. The .prototxt contains meta information specified in **[TIDL](https://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-jacinto7/latest/exports/docs/psdk_rtos_auto/docs/user_guide/sdk_components.html#ti-deep-learning-library-tidl)** for object detectors. 40**Export of ONNX model (.onnx) and additional meta information (.prototxt)** is supported. The .prototxt contains meta information specified in **[TIDL](https://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-jacinto7/latest/exports/docs/psdk_rtos_auto/docs/user_guide/sdk_components.html#ti-deep-learning-library-tidl)** for object detectors.
47 41
48- The export of meta information is now supported for **SSD** and **RetinaNet** detectors. 42The export of meta information is now supported for **SSD** and **RetinaNet** detectors.
49 43
50- For more information please see [Usage](./docs/det_usage.md) 44For more information please see [Usage](./docs/det_usage.md)
51 45
52 46
53## Acknowledgement 47## Acknowledgement
@@ -84,6 +78,11 @@ This package/toolbox is an extension of mmdetection (https://github.com/open-mml
84``` 78```
85 79
86 80
81## License
82
83Please see [LICENSE](./LICENSE) file.
84
85
87## Contact 86## Contact
88This extension of MMDetection is part of Jacinto-AI-DevKit and is maintained by the Jacinto AI team (jacinto-ai-devkit@list.ti.com). For more details, please visit: https://github.com/TexasInstruments/jacinto-ai-devkit 87This extension of MMDetection is part of Jacinto-AI-DevKit and is maintained by the Jacinto AI team (jacinto-ai-devkit@list.ti.com). For more details, please visit: https://github.com/TexasInstruments/jacinto-ai-devkit
89 88
diff --git a/configs/retinanet/retinanet-lite_regnet_fpn_bgr.py b/configs/retinanet/retinanet-lite_regnet_fpn_bgr.py
index c1a9c02..f195f3b 100644
--- a/configs/retinanet/retinanet-lite_regnet_fpn_bgr.py
+++ b/configs/retinanet/retinanet-lite_regnet_fpn_bgr.py
@@ -1,5 +1,5 @@
1###################################################### 1######################################################
2input_size = (512,512) #(512,512) #(768,384) #(768,768) #(1024,512) #(1024,1024) 2input_size = (512,512) #(320,320) #(384,384) #(512,512) #(768,384) #(768,768) #(1024,512) #(1024,1024)
3dataset_type = 'CocoDataset' 3dataset_type = 'CocoDataset'
4num_classes_dict = {'CocoDataset':80, 'VOCDataset':20, 'CityscapesDataset':8} 4num_classes_dict = {'CocoDataset':80, 'VOCDataset':20, 'CityscapesDataset':8}
5num_classes = num_classes_dict[dataset_type] 5num_classes = num_classes_dict[dataset_type]
@@ -34,10 +34,21 @@ to_rgb = False # pycls regnet backbones are tr
34decoder_fpn_type = 'FPNLite' # 'FPNLite' #'BiFPNLite' #'FPN' 34decoder_fpn_type = 'FPNLite' # 'FPNLite' #'BiFPNLite' #'FPN'
35decoder_conv_type = 'ConvDWSep' # 'ConvDWSep' #'ConvDWTripletRes' #'ConvDWTripletAlwaysRes' 35decoder_conv_type = 'ConvDWSep' # 'ConvDWSep' #'ConvDWTripletRes' #'ConvDWTripletAlwaysRes'
36fpn_width_fact = 2 if decoder_fpn_type == 'BiFPNLite' else 4 36fpn_width_fact = 2 if decoder_fpn_type == 'BiFPNLite' else 4
37decoder_width_fact = 4 37decoder_width_fact = 2 if decoder_fpn_type == 'BiFPNLite' else 4
38decoder_depth_fact = 4 38decoder_depth_fact = 4
39 39
40regnet_settings = { 40regnet_settings = {
41 'regnetx_200mf': {'bacbone_out_channels': [32, 56, 152, 368], 'group_size_dw': 8,
42 'fpn_intermediate_channels': min(64*fpn_width_fact, 256),
43 'fpn_out_channels': min(64*decoder_width_fact,256),
44 'fpn_num_blocks': decoder_depth_fact,
45 'pretrained': 'open-mmlab://regnetx_200mf'},
46 'regnetx_400mf': {'bacbone_out_channels': [32, 64, 160, 384], 'group_size_dw': 16,
47 'fpn_intermediate_channels': min(64*fpn_width_fact,256),
48 'fpn_out_channels': min(64*decoder_width_fact,256),
49 'fpn_num_blocks': decoder_depth_fact,
50 'head_stacked_convs': decoder_depth_fact,
51 'pretrained': 'open-mmlab://regnetx_400mf'},
41 'regnetx_800mf':{'bacbone_out_channels':[64, 128, 288, 672], 'group_size_dw':16, 52 'regnetx_800mf':{'bacbone_out_channels':[64, 128, 288, 672], 'group_size_dw':16,
42 'fpn_intermediate_channels':min(64*fpn_width_fact,256), 53 'fpn_intermediate_channels':min(64*fpn_width_fact,256),
43 'fpn_out_channels':min(64*decoder_width_fact,256), 54 'fpn_out_channels':min(64*decoder_width_fact,256),
@@ -45,13 +56,13 @@ regnet_settings = {
45 'head_stacked_convs':decoder_depth_fact, 56 'head_stacked_convs':decoder_depth_fact,
46 'pretrained':'open-mmlab://regnetx_800mf'}, 57 'pretrained':'open-mmlab://regnetx_800mf'},
47 'regnetx_1.6gf':{'bacbone_out_channels':[72, 168, 408, 912], 'group_size_dw':24, 58 'regnetx_1.6gf':{'bacbone_out_channels':[72, 168, 408, 912], 'group_size_dw':24,
48 'fpn_intermediate_channels':min(96*fpn_width_fact,264), 59 'fpn_intermediate_channels':min(84*fpn_width_fact,264),
49 'fpn_out_channels':min(72*decoder_width_fact,264), 60 'fpn_out_channels':min(84*decoder_width_fact,264),
50 'fpn_num_blocks':decoder_depth_fact, 61 'fpn_num_blocks':decoder_depth_fact,
51 'head_stacked_convs':decoder_depth_fact, 62 'head_stacked_convs':decoder_depth_fact,
52 'pretrained':'open-mmlab://regnetx_1.6gf'}, 63 'pretrained':'open-mmlab://regnetx_1.6gf'},
53 'regnetx_3.2gf':{'bacbone_out_channels':[96, 192, 432, 1008], 'group_size_dw':48, 64 'regnetx_3.2gf':{'bacbone_out_channels':[96, 192, 432, 1008], 'group_size_dw':48,
54 'fpn_intermediate_channels':min(120*fpn_width_fact,288), 65 'fpn_intermediate_channels':min(96*fpn_width_fact,288),
55 'fpn_out_channels':min(96*decoder_width_fact,288), 66 'fpn_out_channels':min(96*decoder_width_fact,288),
56 'fpn_num_blocks':decoder_depth_fact, 67 'fpn_num_blocks':decoder_depth_fact,
57 'head_stacked_convs':decoder_depth_fact, 68 'head_stacked_convs':decoder_depth_fact,
@@ -73,7 +84,7 @@ fpn_num_blocks = regnet_cfg['fpn_num_blocks']
73fpn_intermediate_channels = regnet_cfg['fpn_intermediate_channels'] 84fpn_intermediate_channels = regnet_cfg['fpn_intermediate_channels']
74fpn_bifpn_cfg = dict(num_blocks=fpn_num_blocks, intermediate_channels=fpn_intermediate_channels) \ 85fpn_bifpn_cfg = dict(num_blocks=fpn_num_blocks, intermediate_channels=fpn_intermediate_channels) \
75 if decoder_fpn_type == 'BiFPNLite' else dict() 86 if decoder_fpn_type == 'BiFPNLite' else dict()
76fpn_add_extra_convs = 'on_output' if decoder_fpn_type == 'BiFPNLite' else 'on_input' 87fpn_add_extra_convs = 'on_input'
77 88
78input_size_divisor = 128 if decoder_fpn_type == 'BiFPNLite' else 32 89input_size_divisor = 128 if decoder_fpn_type == 'BiFPNLite' else 32
79 90
diff --git a/configs/ssd/ssd-lite_regnet_fpn_bgr.py b/configs/ssd/ssd-lite_regnet_fpn_bgr.py
index 771da67..a6e1985 100644
--- a/configs/ssd/ssd-lite_regnet_fpn_bgr.py
+++ b/configs/ssd/ssd-lite_regnet_fpn_bgr.py
@@ -1,5 +1,5 @@
1###################################################### 1######################################################
2input_size = (512,512) #(512,512) #(768,384) #(768,768) #(1024,512) #(1024,1024) 2input_size = (512,512) #(320,320) #(384,384) #(512,512) #(768,384) #(768,768) #(1024,512) #(1024,1024)
3dataset_type = 'CocoDataset' 3dataset_type = 'CocoDataset'
4num_classes_dict = {'CocoDataset':80, 'VOCDataset':20, 'CityscapesDataset':8} 4num_classes_dict = {'CocoDataset':80, 'VOCDataset':20, 'CityscapesDataset':8}
5num_classes = num_classes_dict[dataset_type] 5num_classes = num_classes_dict[dataset_type]
@@ -34,22 +34,32 @@ to_rgb = False # pycls regnet backbones are tr
34decoder_fpn_type = 'FPNLite' # 'FPNLite' #'BiFPNLite' #'FPN' 34decoder_fpn_type = 'FPNLite' # 'FPNLite' #'BiFPNLite' #'FPN'
35decoder_conv_type = 'ConvDWSep' # 'ConvDWSep' #'ConvDWTripletRes' #'ConvDWTripletAlwaysRes' 35decoder_conv_type = 'ConvDWSep' # 'ConvDWSep' #'ConvDWTripletRes' #'ConvDWTripletAlwaysRes'
36fpn_width_fact = 2 if decoder_fpn_type == 'BiFPNLite' else 4 36fpn_width_fact = 2 if decoder_fpn_type == 'BiFPNLite' else 4
37decoder_width_fact = 4 37decoder_width_fact = 2 if decoder_fpn_type == 'BiFPNLite' else 4
38decoder_depth_fact = 4 38decoder_depth_fact = 4
39 39
40regnet_settings = { 40regnet_settings = {
41 'regnetx_200mf': {'bacbone_out_channels': [32, 56, 152, 368], 'group_size_dw': 8,
42 'fpn_intermediate_channels': min(64*fpn_width_fact, 256),
43 'fpn_out_channels': min(64*decoder_width_fact,256),
44 'fpn_num_blocks': decoder_depth_fact,
45 'pretrained': 'open-mmlab://regnetx_200mf'},
46 'regnetx_400mf': {'bacbone_out_channels': [32, 64, 160, 384], 'group_size_dw': 16,
47 'fpn_intermediate_channels': min(64*fpn_width_fact, 256),
48 'fpn_out_channels': min(64*decoder_width_fact,256),
49 'fpn_num_blocks': decoder_depth_fact,
50 'pretrained': 'open-mmlab://regnetx_400mf'},
41 'regnetx_800mf':{'bacbone_out_channels':[64, 128, 288, 672], 'group_size_dw':16, 51 'regnetx_800mf':{'bacbone_out_channels':[64, 128, 288, 672], 'group_size_dw':16,
42 'fpn_intermediate_channels':min(64*fpn_width_fact,256), 52 'fpn_intermediate_channels':min(64*fpn_width_fact,256),
43 'fpn_out_channels':min(64*decoder_width_fact,256), 53 'fpn_out_channels':min(64*decoder_width_fact,256),
44 'fpn_num_blocks':decoder_depth_fact, 54 'fpn_num_blocks':decoder_depth_fact,
45 'pretrained':'open-mmlab://regnetx_800mf'}, 55 'pretrained':'open-mmlab://regnetx_800mf'},
46 'regnetx_1.6gf':{'bacbone_out_channels':[72, 168, 408, 912], 'group_size_dw':24, 56 'regnetx_1.6gf':{'bacbone_out_channels':[72, 168, 408, 912], 'group_size_dw':24,
47 'fpn_intermediate_channels':min(96*fpn_width_fact,264), 57 'fpn_intermediate_channels':min(84*fpn_width_fact,264),
48 'fpn_out_channels':min(72*decoder_width_fact,264), 58 'fpn_out_channels':min(84*decoder_width_fact,264),
49 'fpn_num_blocks':decoder_depth_fact, 59 'fpn_num_blocks':decoder_depth_fact,
50 'pretrained':'open-mmlab://regnetx_1.6gf'}, 60 'pretrained':'open-mmlab://regnetx_1.6gf'},
51 'regnetx_3.2gf':{'bacbone_out_channels':[96, 192, 432, 1008], 'group_size_dw':48, 61 'regnetx_3.2gf':{'bacbone_out_channels':[96, 192, 432, 1008], 'group_size_dw':48,
52 'fpn_intermediate_channels':min(120*fpn_width_fact,288), 62 'fpn_intermediate_channels':min(96*fpn_width_fact,288),
53 'fpn_out_channels':min(96*decoder_width_fact,288), 63 'fpn_out_channels':min(96*decoder_width_fact,288),
54 'fpn_num_blocks':decoder_depth_fact, 64 'fpn_num_blocks':decoder_depth_fact,
55 'pretrained': 'open-mmlab://regnetx_3.2gf'} 65 'pretrained': 'open-mmlab://regnetx_3.2gf'}
@@ -70,7 +80,7 @@ fpn_num_blocks = regnet_cfg['fpn_num_blocks']
70fpn_intermediate_channels = regnet_cfg['fpn_intermediate_channels'] 80fpn_intermediate_channels = regnet_cfg['fpn_intermediate_channels']
71fpn_bifpn_cfg = dict(num_blocks=fpn_num_blocks, intermediate_channels=fpn_intermediate_channels) \ 81fpn_bifpn_cfg = dict(num_blocks=fpn_num_blocks, intermediate_channels=fpn_intermediate_channels) \
72 if decoder_fpn_type == 'BiFPNLite' else dict() 82 if decoder_fpn_type == 'BiFPNLite' else dict()
73fpn_add_extra_convs = 'on_output' if decoder_fpn_type == 'BiFPNLite' else 'on_input' 83fpn_add_extra_convs = 'on_input'
74 84
75basesize_ratio_range = (0.1, 0.9) 85basesize_ratio_range = (0.1, 0.9)
76input_size_divisor = 128 if decoder_fpn_type == 'BiFPNLite' else 32 86input_size_divisor = 128 if decoder_fpn_type == 'BiFPNLite' else 32
diff --git a/docs/det_modelzoo.md b/docs/det_modelzoo.md
index d7db911..312e82b 100644
--- a/docs/det_modelzoo.md
+++ b/docs/det_modelzoo.md
@@ -18,81 +18,75 @@ MMDetection has a huge Model Zoo, supporting a lot of models. Many of them are h
18✓ Available, ☐ In progress or partially available, ✗ TBD 18✓ Available, ☐ In progress or partially available, ✗ TBD
19 19
20 20
21We have config files for ResNet [5], RegNetX [6] and MobileNet [7] backbone architectures. However RegNetX family of backbone architectures strike a good balance between complexity, accuracy and easiness to quantize. Hence we strongly recommend to use that. 21We have config files for ResNet, RegNetX and MobileNet backbone architectures. However, the **RegNetX family of architectures strike a good balance between complexity, accuracy and easiness to quantize. Hence we strongly recommend to use those models**.
22 22
23The suffix **Lite** or **lite** in our model names or config files indicate that the model uses either Depthwise Convolutions (like in MobileNet models) or grouped convolutions (like in RegNetX models). When the backbone is a MobileNet, Depthwise convolutions are used even in FPN and the detector heads. When the backbone is a RegNetX model, Grouped convolutions are used with the same group size that the RegNetX backbone uses. But for backbones that use regular convolutions (such as ResNet) Depthwise or Grouped convolutions are not used as expected, and they are mostly compatible with the original mmdetection configurations.<br> 23We shall add support for additional low complexity models as mmdetection adds support for those architectures. Additional detectors that we are looking forward to see in mmdetection are CenterNet(Objects As Points) and EfficientDet. For more information, see the [roadmap of mmdetection](https://github.com/open-mmlab/mmdetection/issues/2931).
24
25We shall add support for additional low complexity models as mmdetection adds support for those architectures. Additional detectors that we are looking forward to see in mmdetection are CenterNet(Objects As Points), EfficientDet and YOLOv3. For more information, see the [roadmap of mmdetection](https://github.com/open-mmlab/mmdetection/issues/2931).
26 24
27 25
28#### Results for COCO 2017 Dataset 26#### Results for COCO 2017 Dataset
29- Train on COCO 2017 Train Set 27- Train on COCO 2017 Train Set
30- Test on COCO 2017 Validation Set 28- Evaluate on COCO 2017 Validation Set
31 29
32 30
33###### Single Shot Mult-Box Detector (SSD) trained on COCO dataset 31#### Notes
34Please see the reference [1] for algorithmic details of the detector. 32- Accuracy for Object Detection on COCO dataset uses the metrics AP[0.5:0.95], AP50 (in percentages). AP[0.5:0.95] is the MeanAveragePrecision values computed at IOUs ranging from 0.5 to 0.95 and averaged. AP50 is the MeanAveragePrevision computed at 0.5 IoU.
35 33- If only one accuracy metric is mentioned in a table cell, then it is AP[0.5:0.95]. Be sure to compare using the same metric when comparing across various detectors or configurations.
36|Model Arch |Backbone Model|Resolution |Complexity (Giga MACS) |AP [0.5:0.95]%|Model Config File |Download | 34
37|---------- |--------------|-----------|-----------------------|--------------|---------------------------------|---------| 35
38|SSDLite+FPN |RegNetX800MF |512x512 |**6.03** |**29.9** |ssd-lite_regnet_fpn.py | | 36#### Results
39|SSDLite+FPN |RegNetX1.6GF |768x768 | | |ssd-lite_regnet_fpn.py | | 37
40|. 38|Dataset |Model Name |Input Size |GigaMACS |Accuracy% |Config File |
41|SSD+FPN |ResNet50 |512x512 |**30.77** |**31.2** |ssd_resnet_fpn.py | | 39|--------|------------------------------|-----------|----------|---------------|------------|
42|. 40|COCO |RegNetX400MF+FPN+SSDLite |384x384 |**2.13** |**27.2**, 45.0 |ssd-lite_regnet_fpn_bgr.py |
43|SSD* |VGG16 |512x512 |**98.81** |**29.34** | |[external](https://github.com/open-mmlab/mmdetection/tree/master/configs/ssd) | 41|COCO |RegNetX800MF+FPN+SSDLite |512x512 |**6.03** |**32.8**, 52.8 |ssd-lite_regnet_fpn_bgr.py |
44 42|COCO |RegNetX1.6GF+FPN+SSDLite |768x768 |**24.19** |**37.0**, 57.3 |ssd-lite_regnet_fpn_bgr.py |
45 43|-
46###### RetinaNet Detector trained on COCO dataset 44|COCO |MobileNetV2+SSDLite |512x512 |**1.74** |**22.2** |ssd-lite_mobilenet.py |
47Please see the reference [2] for algorithmic details of the detector. 45|COCO |MobileNetV2+FPN+SSDLite |512x512 |**2.29** |**26.0** |ssd-lite_mobilenet_fpn.py |
48 46|-
49|Model Arch |Backbone Model|Resolution |Complexity (Giga MACS) |AP [0.5:0.95]%|Model Config File |Download | 47|COCO |ResNet50+FPN+SSD |512x512 |**30.77** |**31.2**, 52.2 |ssd_resnet_fpn.py |
50|---------- |--------------|-----------|-----------------------|--------------|---------------------------------|---------| 48|COCO |VGG16+SSD |512x512 |**98.81** |**29.34** | |
51|RetinaNetLite+FPN|RegNetX800MF |512x512 |**11.08** |**31.6** |retinanet-lite_regnet_fpn_bgr.py | | 49|-
52|RetinaNetLite+FPN|RegNetX1.6GF |768x768 | | |retinanet-lite_regnet_fpn.py | | 50|COCO |RegNetX800MF+FPN+RetinaNetLite|512x512 |**11.08** |**33.0**, 50.8 |retinanet-lite_regnet_fpn_bgr.py |
53|. 51|COCO |RegNetX1.6GF+FPN+RetinaNetLite|768x768 | | |retinanet-lite_regnet_fpn_bgr.py |
54|RetinaNet+FPN* |ResNet50 |512x512 |**68.88** |**29.0** | |[external](https://github.com/open-mmlab/mmdetection/tree/master/configs/retinanet) | 52|-
55|RetinaNet+FPN* |ResNet50 |768x768 |**137.75** |**34.0** | |[external](https://github.com/open-mmlab/mmdetection/tree/master/configs/retinanet) | 53|COCO |ResNet50+FPN+RetinaNet |512x512 |**68.88** |**29.0** |retinanet_resnet_fpn.py |
56|RetinaNet+FPN* |ResNet50 |(1536,768) |**275.5** |**37.0** | |[external](https://github.com/open-mmlab/mmdetection/tree/master/configs/retinanet) | 54|COCO |ResNet50+FPN+RetinaNet |768x768 |**137.75**|**34.0** |retinanet_resnet_fpn.py |
57<br> 55|COCO |ResNet50+FPN+RetinaNet |(1536,768) |**275.5** |**37.0** |retinanet_resnet_fpn.py |
58 56|-
59###### YOLOv3 Detector trained on COCO dataset 57|COCO |YOLOv3 |416x416 |**33.0** |**29.6** |yolov3_d53.py |
60Please see the reference [9] for algorithmic details of the detector. 58|COCO |YOLOv3 |(416,416) |**33.0** |**30.9** |yolov3_d53.py |
61 59|COCO |YOLOv3 |(608,608) |**70.59** |**33.4** |yolov3_d53.py |
62|Model Arch |Backbone Model|Resolution |Complexity (Giga MACS) |AP [0.5:0.95]%|Model Config File |Download | 60
63|---------- |--------------|-----------|-----------------------|--------------|---------------------------------|---------| 61
64|YOLOV3 |DarkNet53 |416x416 |**33** |**29.6** |yolov3_d53.py | | 62- The suffix 'Lite' in the name of models such as SSDLite, RetinaNetLite indicates the use of Depthwise convolutions or Grouped convolutions. If the feature extractor (encoder) uses Depthwise Convolutions (eg. MobileNet), then Depthwise convolutions are used throughout such models - even in the neck and decoder. If the feature extractor (encoder) uses grouped convolutions as in the case of RegNetX, then grouped convolutions (with the same group size as that of the feature extractor) are used even in the neck and decoder.<br>
65 63- GigaMACS: Complexity in Giga Multiply-Accumulations (lower is better). This is an important metric to watch out for when selecting models for embedded inference.<br>
66The YOLOV3 pretrained weights are obtained from the [MMDetection ModelZoo](https://github.com/open-mmlab/mmdetection/blob/master/configs/yolo/README.md) and validation accuracy is calculated with fixed resolution of 416x416 (keep_ratio=False). (Note that the original config in MMDetection used keep_ratio=True which will need different input size for different aspect ratio images and hence not suitable for embedded inference). 64- Accuracy%: Original Floating Point Validation Accuracy obtained after training.<br>
67<br> 65<br>
68 66- A resolution range in the tables is indicated with comma (1536,768) or dash (1536-768) - it means that images are resized to fit within this maximum and minimum size - and the aspect ratio of the original image is preserved (keep_ratio=True in config files). Due to this, each resized image may have a different size depending on the aspect ratio of the original image.<br>
69 67- A fixed resolution in the tables is indicated by *width x height* and it means that the inputs are to be resized to that resolution without preserving the aspect ratio of the image (keep_ratio=False in config files). The resolution after resize can be square (example: 512x512) or non-square (example: 768x384). Detectors such as SSD [1] and EfficientDet (arXiv:1911.09070) [3] uses this kind of fixed resizing. **It is preferable to use this kind of fixed resolution resize for embedded inference** - at least from an accuracy evaluation point of view (where the actual dataset with variable size images may need to be evaluated upon).<br>
70- A resolution range in the tables is indicated with comma (1536,768) or dash (1536-768) - it means that images are resized to fit within this maximum and minimum size - and the aspect ratio of the original image is preserved (keep_ratio=True in config files). Due to this, each resized image may have a different size depending on the aspect ratio of the original image. 68- *Mmdetection typically uses a resolution range to train models for most models except SSD. An interesting observation that we had is that such models trained for non-square resolutions can also be inferred or evaluated using square aspect ratios (with a bit of accuracy drop, of course). This leads to the possibility of reusing the models provided in the [mmdetection model zoo](https://github.com/open-mmlab/mmdetection/blob/master/docs/model_zoo.md) for fixed resolution inference as well.*<br>
71 69- YOLOv3 gives 30.9% AP[0.5:0.95] when evaluated with mmdetection at (416,416). But mmdetection uses variable size resize preserving the aspect ratio which means different images have different input sizes to the models within (416,416) - this kind of inference is not suitable for embedded inference. When inferred at fixed 416x416 resolution, it gives 29.6% AP[0.5:0.95] with mmdetection.<br>
72- A fixed resolution in the tables is indicated by *width x height* and it means that the inputs are to be resized to that resolution without preserving the aspect ratio of the image (keep_ratio=False in config files). The resolution after resize can be square (example: 512x512) or non-square (example: 768x384). Detectors such as SSD [1] and EfficientDet (arXiv:1911.09070) [3] uses this kind of fixed resizing. **It is preferable to use this kind of fixed resolution resize for embedded inference** - at least from an accuracy evaluation point of view (where the actual dataset with variable size images may need to be evaluated upon). <br> 70- All models in the above table are not trained for the same number of epochs. We recommend at least 120 to 240 epochs of training to get good results for MobileNet and RegNetX models (although 60 epochs of training can give reasonable results).
73
74- *Mmdetection typically uses a resolution range to train models for most models except SSD. An interesting observation that we had is that such models trained for non-square resolutions can also be inferred or evaluated using square aspect ratios (with a bit of accuracy drop, of course). This leads to the possibility of reusing the models provided in the [mmdetection model zoo](https://github.com/open-mmlab/mmdetection/blob/master/docs/model_zoo.md) for fixed resolution inference as well.* <br>
75
76- The models with a \* were not trained by us, but rather taken from mmdetection model zoo and inference is run at the said resolution.<br>
77 71
78 72
79## References 73## References
80 74
81[1] SSD: Single Shot MultiBox Detector, https://arxiv.org/abs/1512.02325, Wei Liu, Dragomir Anguelov, Dumitru Erhan, Christian Szegedy, Scott Reed, Cheng-Yang Fu, Alexander C. Berg 75[1] MMDetection: Open MMLab Detection Toolbox and Benchmark, Kai Chen, Jiaqi Wang, Jiangmiao Pang, Yuhang Cao, Yu Xiong, Xiaoxiao Li, Shuyang Sun, Wansen Feng, Ziwei Liu, Jiarui Xu, Zheng Zhang, Dazhi Cheng, Chenchen Zhu, Tianheng Cheng, Qijie Zhao, Buyu Li, Xin Lu, Rui Zhu, Yue Wu, Jifeng Dai, Jingdong Wang, Jianping Shi, Wanli Ouyang, Chen Change Loy, Dahua Lin, https://arxiv.org/abs/1906.07155
82 76
83[2] Focal Loss for Dense Object Detection, https://arxiv.org/abs/1708.02002, Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, Piotr Dollár 77[2] The PASCAL Visual Object Classes (VOC) Challenge, Everingham, M., Van Gool, L., Williams, C. K. I., Winn, J. and Zisserman, A.
78International Journal of Computer Vision, 88(2), 303-338, 2010, http://host.robots.ox.ac.uk/pascal/VOC/
84 79
85[3] EfficientDet: Scalable and Efficient Object Detection, https://arxiv.org/abs/1911.09070, Mingxing Tan, Ruoming Pang, Quoc V. Le 80[2] Microsoft COCO: Common Objects in Context, Tsung-Yi Lin, Michael Maire, Serge Belongie, Lubomir Bourdev, Ross Girshick, James Hays, Pietro Perona, Deva Ramanan, C. Lawrence Zitnick, Piotr Dollár, https://arxiv.org/abs/1405.0312
86 81
87[4] Objects as Points, https://arxiv.org/abs/1904.07850, Xingyi Zhou, Dequan Wang, Philipp Krähenbühl 82[3] SSD: Single Shot MultiBox Detector, Wei Liu, Dragomir Anguelov, Dumitru Erhan, Christian Szegedy, Scott Reed, Cheng-Yang Fu, Alexander C. Berg, https://arxiv.org/abs/1512.02325
88 83
89[5] Deep Residual Learning for Image Recognition, https://arxiv.org/abs/1512.03385, Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun 84[4] Focal Loss for Dense Object Detection, Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, Piotr Dollár, https://arxiv.org/abs/1708.02002
90 85
91[6] MobileNetV2: Inverted Residuals and Linear Bottlenecks, https://arxiv.org/abs/1801.04381, Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, Liang-Chieh Chen<br> 86[5] Feature Pyramid Networks for Object Detection Tsung-Yi Lin, Piotr Dollár, Ross Girshick, Kaiming He, Bharath Hariharan, Serge Belongie, https://arxiv.org/abs/1612.03144
92MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications, https://arxiv.org/abs/1704.04861, Andrew G. Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, Hartwig Adam
93 87
94[7] Designing Network Design Spaces, https://arxiv.org/abs/2003.13678, Ilija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, Piotr Dollár 88[6] YOLOv3: An Incremental Improvement, Joseph Redmon, Ali Farhadi, https://arxiv.org/abs/1804.02767
95 89
96[8] ONNX Runtime cross-platform inferencing software, https://github.com/microsoft/onnxruntime 90[7] Objects as Points, Xingyi Zhou, Dequan Wang, Philipp Krähenbühl, https://arxiv.org/abs/1904.07850
97 91
98[9] Yolov3: An incremental improvement, J Redmon, A Farhadi - arXiv preprint arXiv:1804.02767, 2018 \ No newline at end of file 92[8] EfficientDet: Scalable and Efficient Object Detection, Mingxing Tan, Ruoming Pang, Quoc V. Le, https://arxiv.org/abs/1911.09070 \ No newline at end of file
diff --git a/docs/det_quantization.md b/docs/det_quantization.md
index 98096ec..ec4148e 100644
--- a/docs/det_quantization.md
+++ b/docs/det_quantization.md
@@ -1,15 +1,13 @@
1# Quantization Aware Training of Object Detection Models 1# Quantization Aware Training of Object Detection Models
2 2
3Post Training Calibration for Quantization (Calibration/PTQ) or Quantization Aware Training (QAT) are often required to achieve the best acuracy for inference in fixed point. This repository can do QAT and/or Calibration on object detection models trained here. PTQ can easily be performed on the inference engine itself, it need not be done using a training framework like this. While PTQ is fast, QAT provides the best accuracy. Due to these reasons, we shall focus on QAT in this repository. However this repository also supports a mechanism to aid PTQ which we refer to as Calibration/PTQ. 3Quantization (especially 8-bit Quantization) is important to get best throughput for inference. Quantization can be done using either **Post Training Quantization (PTQ)** or **Quantization Aware Training (QAT)**.
4 4
5Although repository does QAT, the data is still kept as discrete floating point values. Activation range information is inserted into the model using Clip functions, wherever appropriate. 5Quantized inference can be done using [TI Deep Learning Library (TIDL)](https://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-jacinto7/latest/exports/docs/psdk_rtos_auto/docs/user_guide/sdk_components.html#ti-deep-learning-library-tidl) that is part of the [Processor SDK RTOS for Jacinto7](https://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-jacinto7/latest/exports/docs/psdk_rtos_auto/docs/user_guide/index.html). **TIDL natively supports PTQ**. There is no need for QAT as long as the PTQ in TIDL gives good results.
6 6
7The foundational components for Quantization are provided in [PyTorch-Jacinto-AI-DevKit](https://bitbucket.itg.ti.com/projects/JACINTO-AI/repos/pytorch-jacinto-ai-devkit/browse/). This repository uses Quantization tools from there. 7For the models that have significant accuracy drop, it is possible to improve the accuracy using **Quantization Aware Training (QAT)**. Please read more about QAT at [pytorch-jacinto-ai-devkit](https://git.ti.com/cgit/jacinto-ai/pytorch-jacinto-ai-devkit/about) and its **[quantization documentation](https://git.ti.com/cgit/jacinto-ai/pytorch-jacinto-ai-devkit/about/docs/Quantization.md)**. Although the repository does QAT, the data is still kept as discrete floating point values. Activation range information is inserted into the model using Clip functions, wherever appropriate. There are several guidelines provided there to help you set the right parameters to get best accuracy with quantization.
8 8
9Please consult the [documentation on Quantization](https://git.ti.com/cgit/jacinto-ai/pytorch-jacinto-ai-devkit/about/docs/Quantization.md) to understand the internals of our implementation of QAT and Calibration/PTQ. There are several guidelines provided there to help you set the right parameters to get best accuracy with quantization.
10 9
11 10## Features in this repository
12## Features
13 11
14| | Float | 16 bit | 8bit | 12| | Float | 16 bit | 8bit |
15|-------------------- |:--------:|:--------:|:--------:| 13|-------------------- |:--------:|:--------:|:--------:|
@@ -28,12 +26,12 @@ Please consult the [documentation on Quantization](https://git.ti.com/cgit/jacin
28- Please see [Usage](./docs/usage.md) for training and testing in floating point with this repository. 26- Please see [Usage](./docs/usage.md) for training and testing in floating point with this repository.
29 27
30 28
31#### How to do Quantization 29#### How to do Quantization Aware Training
32 30
33Everything required for quantization is already done in this repository and the only thing that user needs to be do is to set a **quantize** flag appropriately in the config file. If quantize flag is not set, the usual floating point training of evaluation will happen. These are the values of the quantize flag and their meanings: 31Everything required for quantization is already done in this repository and the only thing that user needs to be do is to set a **quantize** flag appropriately in the config file. If quantize flag is not set, the usual floating point training of evaluation will happen. These are the values of the quantize flag and their meanings:
34- False: Conventional floating point training (default). 32- False: Conventional floating point training (default).
35- True or 'training': Quantization Aware Training (QAT) 33- True or 'training': Quantization Aware Training (QAT)
36- 'calibration': Post Training Calibration for Quantization (Calibration/PTQ). 34- 'calibration': Post Training Calibration for Quantization (denoted as Calibration/PTQ) - this is an intermediate method that is close to PTQ - fast, but not as accurate as QAT.
37 35
38Accuracy Evaluation with Quantization: If quantize flag is set in the config file when test script is invoked, accuracy evalatuon with quantization is being done. 36Accuracy Evaluation with Quantization: If quantize flag is set in the config file when test script is invoked, accuracy evalatuon with quantization is being done.
39 37
@@ -48,35 +46,6 @@ Accuracy Evaluation with Quantization: If quantize flag is set in the config fil
48 46
49All this has been taken care already in the code and the description in this section is for information only. 47All this has been taken care already in the code and the description in this section is for information only.
50 48
51#### Results for COCO 2017 Dataset
52
53###### Single Shot Mult-Box Detector (SSD)
54Please see the reference [2] for algorithmic details of the detector.
55
56|Model Arch |Backbone Model|Resolution |Giga MACS |Float AP [0.5:0.95]%|8-bit QAT AP [0.5:0.95]%|Download |
57|---------- |--------------|-----------|----------|--------------------|------------------------|---------|
58|SSDLite+FPN |RegNetX800MF |512x512 |**6.03** |**29.9** |**29.4** | |
59|SSDLite+FPN |RegNetX1.6GF |768x768 | | | | |
60|.
61|SSD+FPN |ResNet50 |512x512 |**30.77** |**31.2** | | |
62
63
64###### RetinaNet Detector
65Please see the reference [3] for algorithmic details of the detector.
66
67|Model Arch |Backbone Model|Resolution |Giga MACS |Float AP [0.5:0.95]%|8-bit QAT AP [0.5:0.95]%|Download |
68|---------- |--------------|-----------|----------|--------------------|------------------------|---------|
69|RetinaNetLite+FPN|RegNetX800MF |512x512 |**11.08** |**31.6** |**30.3** | |
70|RetinaNetLite+FPN|RegNetX1.6GF |768x768 | | | | |
71|.
72|RetinaNet+FPN* |ResNet50 |512x512 |**68.88** |**29.0* | |[external](https://github.com/open-mmlab/mmdetection/tree/master/configs/retinanet) |
73|RetinaNet+FPN* |ResNet50 |768x768 |**137.75**|**34.0** | |[external](https://github.com/open-mmlab/mmdetection/tree/master/configs/retinanet) |
74|RetinaNet+FPN* |ResNet50 |(1536,768) |**275.5** |**37.0** | |[external](https://github.com/open-mmlab/mmdetection/tree/master/configs/retinanet) |
75<br>
76
77- Float AP [0.5:0.95]% : COCO Mean Average Precision metric in percentage for IoU range [0.5:0.95], with the floating point model.
78- 8-bit QAT AP [0.5:0.95]% : COCO Mean Average Precision metric in percentage for IoU range [0.5:0.95], with the the 8-bit Quantization Aware Trained Model.
79
80 49
81## References 50## References
82[1] [PyTorch-Jacinto-AI-DevKit](https://git.ti.com/cgit/jacinto-ai/pytorch-jacinto-ai-devkit/about/) and its [Quantization documentation](https://git.ti.com/cgit/jacinto-ai/pytorch-jacinto-ai-devkit/about/docs/Quantization.md). 51[1] [PyTorch-Jacinto-AI-DevKit](https://git.ti.com/cgit/jacinto-ai/pytorch-jacinto-ai-devkit/about/) and its [Quantization documentation](https://git.ti.com/cgit/jacinto-ai/pytorch-jacinto-ai-devkit/about/docs/Quantization.md).
diff --git a/docs/det_usage.md b/docs/det_usage.md
index 39a4556..9c57ac5 100644
--- a/docs/det_usage.md
+++ b/docs/det_usage.md
@@ -1,6 +1,6 @@
1# Jacinto-AI-MMDetection Usage 1# Jacinto-AI-MMDetection Usage
2 2
3#### Installation 3## Installation
4First please install mmcv and mmdet following the instructions given int he main README page of this repository. Those packages have additional requirements which can be understood by going to their respective websites. 4First please install mmcv and mmdet following the instructions given int he main README page of this repository. Those packages have additional requirements which can be understood by going to their respective websites.
5 5
6We provide a package called xmmdet which is an extension of mmdet. xmmdet is used from the local folder (without installation). In order to use a local folder as a repository, your PYTHONPATH must start with a : or a .: 6We provide a package called xmmdet which is an extension of mmdet. xmmdet is used from the local folder (without installation). In order to use a local folder as a repository, your PYTHONPATH must start with a : or a .:
@@ -11,29 +11,29 @@ export PYTHONPATH=:$PYTHONPATH
11``` 11```
12Make sure to close your current terminal or start a new one for the change in .bashrc to take effect or one can do *source ~/.bashrc* after the update. 12Make sure to close your current terminal or start a new one for the change in .bashrc to take effect or one can do *source ~/.bashrc* after the update.
13 13
14#### Scripts 14## Scripts
15Additional scripts are provided on top of mmdetection to ease the training and testing process. Several complexity optimized configurations are provided in the folder [configs](../configs). Scripts for training or evaluation with these configs are given in the [scripts](../scripts) folder. They can be executed by running the shell scripts provided. 15Additional scripts are provided on top of mmdetection to ease the training and testing process. Several complexity optimized configurations are provided in the folder [configs](../configs). Scripts for training or evaluation with these configs are given in the [scripts](../scripts) folder. They can be executed by running the shell scripts provided.
16 16
17 17
18#### Training 18## Training
19- Select the appropriate config file in [detection_configs.py](../scripts/detection_configs.py) 19Select the appropriate config file in [detection_configs.py](../scripts/detection_configs.py)
20 20
21- Start the training by running [run_detection_train.sh](../run_detection_train.sh) 21Start the training by running [run_detection_train.sh](../run_detection_train.sh)
22 22
23- After doing the floating point training, it is possible to run Qunatization Aware Training (QAT) starting from the trained checkpoint. For this, set quantize = True in the config file (see the line where it is set to False and change it to True) and run the training again. This will run a small number epochs of fine tuning with QAT at a lower learning rate. 23After doing the floating point training, it is possible to run Qunatization Aware Training (QAT) starting from the trained checkpoint. For this, set quantize = True in the config file (see the line where it is set to False and change it to True) and run the training again. This will run a small number epochs of fine tuning with QAT at a lower learning rate.
24 24
25 25
26## Evaluation/Testing 26## Evaluation/Testing
27- Make sure that the appropriate config file is selected in [detection_configs.py](../scripts/detection_configs.py) 27Make sure that the appropriate config file is selected in [detection_configs.py](../scripts/detection_configs.py)
28 28
29- Start evaluation by running [run_detection_test.sh](../run_detection_test.sh). 29Start evaluation by running [run_detection_test.sh](../run_detection_test.sh).
30 30
31- Note: If you did QAT, then the flag quantize in teh config file must be set to True even at this stage. 31Note: If you did QAT, then the flag quantize in teh config file must be set to True even at this stage.
32 32
33 33
34## ONNX & Prototxt Export 34## ONNX & Prototxt Export
35- Make sure that the appropriate config file is selected in [detection_configs.py](../scripts/detection_configs.py) 35Make sure that the appropriate config file is selected in [detection_configs.py](../scripts/detection_configs.py)
36 36
37- Start export by running [run_detection_export.sh](../run_detection_export.sh). 37Start export by running [run_detection_export.sh](../run_detection_export.sh).
38 38
39- Note: If you did QAT, then the flag quantize in the config file must be set to True even at this stage. \ No newline at end of file 39Note: If you did QAT, then the flag quantize in the config file must be set to True even at this stage. \ No newline at end of file
diff --git a/xmmdet/models/necks/fpn.py b/xmmdet/models/necks/fpn.py
index 8e4e871..e14e9df 100644
--- a/xmmdet/models/necks/fpn.py
+++ b/xmmdet/models/necks/fpn.py
@@ -244,20 +244,22 @@ class BiFPNLite(nn.Module):
244 244
245 conv_cfg = kwargs.get('conv_cfg', None) 245 conv_cfg = kwargs.get('conv_cfg', None)
246 norm_cfg = kwargs.get('norm_cfg', None) 246 norm_cfg = kwargs.get('norm_cfg', None)
247 self.num_outs_bifpn = min(self.num_outs, 5) 247 self.num_outs_bifpn = num_outs
248 248
249 blocks = [] 249 blocks = []
250 for i in range(num_blocks): 250 for i in range(num_blocks):
251 last_in_channels = [intermediate_channels for _ in self.num_outs_bifpn] if i > 0 else in_channels 251 last_in_channels = [intermediate_channels for _ in range(self.num_outs_bifpn)] if i>0 else in_channels
252 if i<(num_blocks-1): 252 if i<(num_blocks-1):
253 # the initial bifpn blocks can operate with fewer number of channels
253 block_id = i 254 block_id = i
254 bi_fpn = BiFPNLiteBlock(block_id=block_id, in_channels=last_in_channels, out_channels=intermediate_channels, 255 bi_fpn = BiFPNLiteBlock(block_id=block_id, in_channels=last_in_channels, out_channels=intermediate_channels,
255 num_outs=self.num_outs_bifpn, add_extra_convs=add_extra_convs, extra_convs_on_inputs=extra_convs_on_inputs, 256 num_outs=self.num_outs_bifpn, add_extra_convs=add_extra_convs, extra_convs_on_inputs=extra_convs_on_inputs,
256 **kwargs) 257 **kwargs)
257 else: 258 else:
258 block_id = 0 if (out_channels != intermediate_channels) else i 259 # last block can be complex if the intermediate channels are lower - so do up_only
259 # last block can be complex if the intermediate channels are lower - so do up_only 260 block_id = 0 if ((num_blocks == 1) or (out_channels != intermediate_channels)) else i
260 bi_fpn = BiFPNLiteBlock(block_id=block_id, up_only=True, in_channels=last_in_channels, out_channels=out_channels, 261 up_only = (out_channels != intermediate_channels)
262 bi_fpn = BiFPNLiteBlock(block_id=block_id, up_only=up_only, in_channels=last_in_channels, out_channels=out_channels,
261 num_outs=self.num_outs_bifpn, add_extra_convs=add_extra_convs, extra_convs_on_inputs=extra_convs_on_inputs, 263 num_outs=self.num_outs_bifpn, add_extra_convs=add_extra_convs, extra_convs_on_inputs=extra_convs_on_inputs,
262 **kwargs) 264 **kwargs)
263 # 265 #
@@ -333,7 +335,6 @@ class BiFPNLiteBlock(nn.Module):
333 self.add_extra_convs = add_extra_convs 335 self.add_extra_convs = add_extra_convs
334 self.block_id = block_id 336 self.block_id = block_id
335 337
336 assert num_outs<=5, 'this block handles only upto 5 outputs. remaining has to be handled outside.'
337 assert upsample_cfg is not None, 'upsample_cfg must not be None' 338 assert upsample_cfg is not None, 'upsample_cfg must not be None'
338 assert upsample_cfg.scale_factor == 2, 'scale_factor of 2 is recommended' 339 assert upsample_cfg.scale_factor == 2, 'scale_factor of 2 is recommended'
339 assert extra_convs_on_inputs == True, 'extra_convs_on_inputs must be True' 340 assert extra_convs_on_inputs == True, 'extra_convs_on_inputs must be True'
@@ -445,7 +446,7 @@ class BiFPNLiteBlock(nn.Module):
445 res = add_block1((ins[i+1], ups[i+1])) if (ins[i+1] is not ups[i+1]) else ins[i+1] 446 res = add_block1((ins[i+1], ups[i+1])) if (ins[i+1] is not ups[i+1]) else ins[i+1]
446 add_block2 = self.down_adds2[i] 447 add_block2 = self.down_adds2[i]
447 outs[i+1] = self.down_convs[i](self.down_acts[i]( 448 outs[i+1] = self.down_convs[i](self.down_acts[i](
448 add_block2((res,self.downs[i](ups[i]))) 449 add_block2((res,self.downs[i](outs[i])))
449 )) 450 ))
450 # 451 #
451 return tuple(outs) 452 return tuple(outs)