Reduction axis 1 is empty in shape [x,0]

泪湿孤枕 提交于 2019-12-23 12:26:38

问题


I'm trying to train the SVHN (street view house numbers) dataset for object-detection in tensorflow (to do some basic OCR on numbers). So far I have successfully followed the pet-training example from the object-detection-tensorflow guides. When I train the network based on the sample faster_rcnn_resnet101.config, after a few dozen steps I get:

    INFO:tensorflow:Error reported to Coordinator: 
<class 'tensorflow.python.framework.errors_impl.InvalidArgumentError'>, 
Reduction axis 1 is empty in shape [3,0]
[[Node: Loss/RPNLoss/Match/cond/ArgMax_1 = ArgMax[T=DT_FLOAT, Tidx=DT_INT32, _device="/job:localhost/replica:0/task:0/cpu:0"]
(Loss/RPNLoss/Match/cond/ArgMax/Switch:1, 
Loss/RPNLoss/Match/cond/ArgMax_1/dimension)]]

I have no clue what to change or improve. Has someone seen this before? What is going wrong here? Is it simply a wrong config-setting? The only parameter I changed (besides path-info) is num_classes: 10 (10 digits)

Thanks for any hints.

My label-map looks like this:

item {
  id: 0
  name: 'none_of_the_above'
}

item {
  id: 1
  name: '1'
}

item {
  id: 2
  name: '2'
}
... with id: 10 being '0'

As supposed here https://github.com/tensorflow/models/blob/master/object_detection/g3doc/running_pets.md I used the pretrained COCO-model faster_rcnn_resnet101 and also the config-file from that: https://github.com/tensorflow/models/blob/master/object_detection/samples/configs/faster_rcnn_resnet101_pets.config The only things I adapted are the paths and:

faster_rcnn {
    num_classes: 11
    image_resizer {
      keep_aspect_ratio_resizer {
        min_dimension: 64
        max_dimension: 900
      }
    }

Due to the fact that the images from SVHN are rather small, I adapted the dimensions here and removed all images that are smaller than 64px in height or width. I didn't pay attention to clear the training-directory until now. But I tried now and the same error occurs. I'm currently trying with the pretrained inception-model, maybe this works out.


回答1:


This happens when using the ArgMaxMatcher class when the number of proposal is 0.

If made a PR that fixes the issue here: https://github.com/tensorflow/models/pull/1986




回答2:


As the problem vanished, when I'm doing the training correctly, I will post this solution ... might be, that others are as "dumb" as me. As proposed in the pets-tutorial, I downloaded a pretrained model. But I set the path to the training-directory to the same directory where the downloaded pretrained model was. I think this caused the error.




回答3:


I'm not sure what caused your error but you shouldn't use the index 0 in your label map as it's the placeholder index. All indices should start at 1.

See: https://github.com/tensorflow/models/issues/1696



来源:https://stackoverflow.com/questions/44995679/reduction-axis-1-is-empty-in-shape-x-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!