yolov5/models
janus-zheng a9f895d304
Apply make_divisible for ONNX models in Autoshape (#10172)
* Apply make_divisible for onnx models in Autoshape

At line 697 we have this `make_divisible` function for pytorch models. 
* Context: we want to run inference on varied input sizes instead of fixed image size.
* When I test an image of size [720, 720] for a pytorch model (e.g., yolov5n.pt), we can see that it will be reshaped to [736, 736] by the function. This is as expected.
* When I test the same image for the onnx model (e.g., yolov5n.onnx, exported with `--dynamic`), I got an error and it's due to the indivisible problem
```
onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Non-zero status code returned while running Concat node. Name:'Concat_143' Status Message: concat.cc:156 PrepareForCompute Non concat axis dimensions must match: Axis 3 has mismatched dimensions of 45 and 46
```

The simple solution is to enable the `make_divisible` function for onnx model too.

Signed-off-by: janus-zheng <106574221+janus-zheng@users.noreply.github.com>

* revise indent

Signed-off-by: janus-zheng <106574221+janus-zheng@users.noreply.github.com>

* Apply make_divisible to all formats

All formats from DetectMultiBackend should have default stride=32

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

Signed-off-by: janus-zheng <106574221+janus-zheng@users.noreply.github.com>
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-11-17 13:42:26 +01:00
..
hub New model.yaml `activation:` field (#9371) 2022-09-16 00:55:21 +02:00
segment YOLOv5 segmentation model support (#9052) 2022-09-16 00:12:46 +02:00
__init__.py add "__init__.py" file in <models> folder 2020-06-15 14:37:07 +08:00
common.py Apply make_divisible for ONNX models in Autoshape (#10172) 2022-11-17 13:42:26 +01:00
experimental.py EMA FP32 assert classification bug fix (#9016) 2022-08-18 14:06:15 +02:00
tf.py Full-size proto code (optional) (#9980) 2022-10-30 22:09:36 +01:00
yolo.py generator seed fix for DDP mAP drop (#9545) 2022-09-24 19:35:07 +02:00
yolov5l.yaml YOLOv5 release v6.0 (#5141) 2021-10-11 23:47:18 -07:00
yolov5m.yaml YOLOv5 release v6.0 (#5141) 2021-10-11 23:47:18 -07:00
yolov5n.yaml YOLOv5 release v6.0 (#5141) 2021-10-11 23:47:18 -07:00
yolov5s.yaml YOLOv5 release v6.0 (#5141) 2021-10-11 23:47:18 -07:00
yolov5x.yaml YOLOv5 release v6.0 (#5141) 2021-10-11 23:47:18 -07:00