height_scale = scales[2] IndexError: index 2 is out of bounds for axis 0 with size 0

eastgeneral發表於2024-05-30

1.yolov5網路層最佳化

在yolov5訓練之前最好是改一下網路層,要不會報這個錯。

Traceback (most recent call last):
File "convertCaffe.py", line 159, in <module>
convertToCaffe(graph, prototxt_path, caffemodel_path, exis_focus=True, focus_concat_name="Concat_40", focus_conv_name="Conv_41")
File "convertCaffe.py", line 83, in convertToCaffe
layer = converter_fn(node, graph, err)
File "/home/admin/code/yolov5_onnx2caffe/onnx2caffe/_operators.py", line 505, in _convert_resize
height_scale = scales[2]
IndexError: index 2 is out of bounds for axis 0 with size 0

1
2
3
4
5
6
7
8

因為我用的是yolov5s模型所以更改yolov5/models/yolov5s.yaml
將yolov5的focus層替換為conv層(stride為2),upsample層替換為deconv層
(反摺積層),因為caffe不支援focus層。

file:///root/Pictures/1814838874.jpg


————————————————

版權宣告:本文為博主原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處連結和本宣告。

原文連結:https://blog.csdn.net/qq_44181970/article/details/118094771

相關文章