如何在TensorFlow Object Detection API中添加背景图像

时间:2019-03-27 19:43:28

标签: tensorflow object-detection

我正在尝试将背景图像添加到我的训练数据中。我正在使用TensorFlow 1.4。我正在尝试将这些文件直接添加到图像目录和CSV文件train_labels.csv。但是,当我同时运行以下命令时,我会收到错误消息:faster_rcnn_inception_resnet_v2_atrous_coco.config和ssd_mobilenet_v1_coco.config。我的train_labels.csv具有以下字段:

文件名,宽度,高度,类,xmin,ymin,xmax,ymax

对于背景图像,相应的输入为: pattern.jpg,200,200,background ,,,

我尝试过:

python3 train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_coco.config

And got the error: **tensorflow.python.framework.errors_impl.InvalidArgumentError: All bounding box coordinates must be in [0.0, 1.0]: nan**

I have also tried python3 train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_resnet_v2_atrous_coco.config

INFO:tensorflow:Recording summary at step 33.
INFO:tensorflow:global step 34: loss = 0.7557 (24.100 sec/step)
INFO:tensorflow:global step 35: loss = 0.7095 (15.436 sec/step)
INFO:tensorflow:global step 36: loss = 1.4553 (16.423 sec/step)
INFO:tensorflow:global step 37: loss = 1.1022 (15.649 sec/step)
INFO:tensorflow:Error reported to Coordinator: <class **'tensorflow.python.framework.errors_impl.InvalidArgumentError'>, LossTensor is inf or nan. : Tensor had NaN values
[[Node: CheckNumerics = CheckNumericsT=DT_FLOAT, message="LossTensor is inf or nan.", _device="/job:localhost/replica:0/task:0/device:CPU:0"]]**

如果我从CSV文件和images目录中删除背景图像,则fast-rcnn和ssd可以正常工作。对于我的背景图像,我只是使用完全白色的图像,因为这是我所有训练图像中的背景。我很确定我没有正确输入背景图像。我该怎么办?

0 个答案:

没有答案