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

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

posted @ 2024-05-30 18:13  eastgeneral  阅读(5)  评论(0编辑  收藏  举报