weixin_39903477
weixin_39903477
2020-11-22 08:35

Error: cannot reshape array of size 284695 into shape (256,128,3,3)

Already saw #15 solution but didn't worked. I had made change in default yolov3.cfg file. Final layer consist of 24 filters instead if 255. my.cfg

layer filters size input output 74 Shortcut Layer: 71 75 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF 76 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF 77 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF 78 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF 79 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF 80 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF 81 conv 24 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 24 0.008 BF 82 yolo 83 route 79 84 conv 256 1 x 1 / 1 13 x 13 x 512 -> 13 x 13 x 256 0.044 BF 85 upsample 2x 13 x 13 x 256 -> 26 x 26 x 256 86 route 85 61 87 conv 256 1 x 1 / 1 26 x 26 x 768 -> 26 x 26 x 256 0.266 BF 88 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF 89 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF 90 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF 91 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF 92 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF 93 conv 24 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 24 0.017 BF 94 yolo 95 route 91 96 conv 128 1 x 1 / 1 26 x 26 x 256 -> 26 x 26 x 128 0.044 BF 97 upsample 4x 26 x 26 x 128 -> 104 x 104 x 128 98 route 97 11 99 conv 128 1 x 1 / 1 104 x 104 x 256 -> 104 x 104 x 128 0.709 BF 100 conv 256 3 x 3 / 1 104 x 104 x 128 -> 104 x 104 x 256 6.380 BF 101 conv 128 1 x 1 / 1 104 x 104 x 256 -> 104 x 104 x 128 0.709 BF 102 conv 256 3 x 3 / 1 104 x 104 x 128 -> 104 x 104 x 256 6.380 BF 103 conv 128 1 x 1 / 1 104 x 104 x 256 -> 104 x 104 x 128 0.709 BF 104 conv 256 3 x 3 / 1 104 x 104 x 128 -> 104 x 104 x 256 6.380 BF 105 conv 24 1 x 1 / 1 104 x 104 x 256 -> 104 x 104 x 24 0.133 BF 106 yolo

yolov3.cfg

layer filters size input output
71 Shortcut Layer: 68 72 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF 73 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF 74 Shortcut Layer: 71 75 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF 76 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF 77 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF 78 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF 79 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF 80 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF 81 conv 255 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 255 0.088 BF 82 yolo 83 route 79 84 conv 256 1 x 1 / 1 13 x 13 x 512 -> 13 x 13 x 256 0.044 BF 85 upsample 2x 13 x 13 x 256 -> 26 x 26 x 256 86 route 85 61 87 conv 256 1 x 1 / 1 26 x 26 x 768 -> 26 x 26 x 256 0.266 BF 88 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF 89 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF 90 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF 91 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF 92 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF 93 conv 255 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 255 0.177 BF 94 yolo 95 route 91 96 conv 128 1 x 1 / 1 26 x 26 x 256 -> 26 x 26 x 128 0.044 BF 97 upsample 2x 26 x 26 x 128 -> 52 x 52 x 128 98 route 97 36 99 conv 128 1 x 1 / 1 52 x 52 x 384 -> 52 x 52 x 128 0.266 BF 100 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF 101 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BF 102 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF 103 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BF 104 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF 105 conv 255 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 255 0.353 BF 106 yolo

I am also using custom anchors =>anchors = 41,11, 63,14, 87,18, 113,19, 143,27, 108,45, 166,44, 207,41, 267,74 So what changes should I do? Please help me. Thanking You.

该提问来源于开源项目:mystic123/tensorflow-yolo-v3

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

9条回答

  • weixin_39892800 weixin_39892800 5月前

    ValueError: cannot reshape array of size 291081 into shape (256,128,3,3)

    I have met the same problem here:

    I have change the cfg file : w ,height to 224,224 Then I change the src code:

    placeholder for detector inputs

    #inputs = tf.placeholder(tf.float32, [None, FLAGS.size, FLAGS.size, 3], "inputs")
    inputs = tf.placeholder(tf.float32, [None, 224, 224, 3], "inputs")
    

    Is there anyone who can solve the problem? Please help me. Thanking You.

    点赞 评论 复制链接分享
  • weixin_39561577 weixin_39561577 5月前

    I have seen the same issue with 1 class YoloV3 & tiny YoloV3. My conclusion is that the converter works without error only with standard Yolo configuartion -> COCO & VOC. My workaround is that I trained a 20 class (VOC) Yolov3 with just a single class. During inference I filter out all the other class erroneous detentions.

    点赞 评论 复制链接分享
  • weixin_39983051 weixin_39983051 5月前

    Did you fill you names file with dummy categories ?

    点赞 评论 复制链接分享
  • weixin_39561577 weixin_39561577 5月前

    Yes I did but you may leave them as they are except category 0 that is the custom name. Since categories >0 can be filtered out using 2 lines of code, the name of the other categories are never shown.

    点赞 评论 复制链接分享
  • weixin_39903477 weixin_39903477 5月前

    ValueError: cannot reshape array of size 291081 into shape (256,128,3,3)

    I have met the same problem here:

    I have change the cfg file : w ,height to 224,224 Then I change the src code:

    placeholder for detector inputs

    
    <h1>inputs = tf.placeholder(tf.float32, [None, FLAGS.size, FLAGS.size, 3], "inputs")</h1>
    <p>inputs = tf.placeholder(tf.float32, [None, 224, 224, 3], "inputs")
    </p>

    Is there anyone who can solve the problem? Please help me. Thanking You.

    @xiayq1 In my case, the cfg file contains default : w ,height as 416 ,416

    Thank you guys for your efforts but I found that changing upsample strides=2 to strides=3 create problem. My other model which is basically trained on default strides=2 is successfully converted to ckpt file but with loss in accuracy.

    点赞 评论 复制链接分享
  • weixin_39969143 weixin_39969143 5月前

    Change your labels.txt to appropriate length.

    点赞 评论 复制链接分享
  • weixin_39903477 weixin_39903477 5月前

    Change your labels.txt to appropriate length.

    Thank you.. but already checked label.txt and removed all possible blank newline... Issue was number of upsample strides in cfg file.

    点赞 评论 复制链接分享
  • weixin_39966130 weixin_39966130 5月前

    This happens for problem in (.names) file. You should check tow things to solve this.

    1. If you are training on all classes please check if there is extra new line at the last of class names.
    2. If you have training on specific some classes please remove the extra class from (.names) file either you used all class names during training.
    点赞 评论 复制链接分享
  • weixin_39976960 weixin_39976960 5月前

    just set the number of classes with number of classes that you have in convert.py

    点赞 评论 复制链接分享

相关推荐