tensorflow - 缩减轴 1 的形状为空 [x,0]

标签 tensorflow object-detection

我正在尝试训练 SVHN(街景门牌号码)数据集以在 tensorflow 中进行对象检测(对数字进行一些基本的 OCR)。
到目前为止,我已经成功地遵循了 object-detection-tensorflow 指南中的宠物训练示例。
当我基于示例 fast_rcnn_resnet101.config 训练网络时,经过几十步我得到:

    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)]]

我不知道要改变或改进什么。
有人见过这个吗?
这里出了什么问题?
它只是一个错误的配置设置吗?
我改变的唯一参数(除了路径信息)是 num_classes: 10 (10位)

感谢您的任何提示。

我的标签映射如下所示:
item {
  id: 0
  name: 'none_of_the_above'
}

item {
  id: 1
  name: '1'
}

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

正如这里所说的 https://github.com/tensorflow/models/blob/master/object_detection/g3doc/running_pets.md
我使用了预训练的 COCO 模型 faster_rcnn_resnet101 以及其中的配置文件:
https://github.com/tensorflow/models/blob/master/object_detection/samples/configs/faster_rcnn_resnet101_pets.config
我唯一适应的是路径和:
faster_rcnn {
    num_classes: 11
    image_resizer {
      keep_aspect_ratio_resizer {
        min_dimension: 64
        max_dimension: 900
      }
    }

由于来自 SVHN 的图像相当小,我在这里调整了尺寸并删除了所有高度或宽度小于 64 像素的图像。
直到现在我才注意清除培训目录。但我现在试过了,同样的错误发生了。
我目前正在尝试使用预训练的初始模型,也许这会奏效。

最佳答案

我不确定是什么导致了您的错误,但您不应该在标签映射中使用索引 0,因为它是占位符索引。所有索引应从 1 开始。

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

关于tensorflow - 缩减轴 1 的形状为空 [x,0],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44995679/

相关文章:

object-detection - (Microsoft Azure 自定义视觉服务 : Object Detection) How to find bounding box info of training data?

javascript - 解决在chrome中运行的tensorflow js的 "Uncaught (in promise) TypeError: fs.writeFile is not a function"的替代方法

python - TensorBoard:将输出图像添加到回调

torch 1.7.0 | DataLoader 错误 - TypeError : 'module' object is not callable

python - 从图像中提取表格数据

python-3.x - 如何使用opencv通过xmax xmin ymax ymin编写矩形(边界框)

object-detection - 根据测试数据集计算 YOLO mAP

python - 在 TensorFlow 中将 stop_gradient 与 AdamOptimizer 结合使用

python - gcloud ML 引擎 - Keras 未在 GPU 上运行

database - 如何从 TFX BulkInferrer 获取数据帧或数据库写入?