InvalidArgumentError:对新数据集的对象检测进行微调时

时间:2018-08-13 02:56:45

标签: tensorflow object-detection

我正在尝试为我的数据集(卫星图像)实现并微调对象检测模块。

我正确地遵循了安装,配置和其他准则,并且能够对VOC模型进行微调,并且可以正常工作。

当我为我的任务(新数据集)运行管道时,出现以下错误。

    /Users/sxm239/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/ops/gradients_impl.py:100: UserWarning: Converting sparse IndexedSlices to a dense Tensor of unknown shape. This may consume a large amount of memory.
      "Converting sparse IndexedSlices to a dense Tensor of unknown shape. "
    2018-08-12 21:29:50.565371: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
    2018-08-12 21:30:20.649491: I tensorflow/core/kernels/data/shuffle_dataset_op.cc:95] Filling up shuffle buffer (this may take a while): 684 of 2048
    2018-08-12 21:30:30.649187: I tensorflow/core/kernels/data/shuffle_dataset_op.cc:95] Filling up shuffle buffer (this may take a while): 1166 of 2048
    2018-08-12 21:30:40.569140: I tensorflow/core/kernels/data/shuffle_dataset_op.cc:95] Filling up shuffle buffer (this may take a while): 1571 of 2048
    2018-08-12 21:30:50.628863: I tensorflow/core/kernels/data/shuffle_dataset_op.cc:95] Filling up shuffle buffer (this may take a while): 2046 of 2048
    2018-08-12 21:30:50.768934: I tensorflow/core/kernels/data/shuffle_dataset_op.cc:131] Shuffle buffer filled.
    Traceback (most recent call last):
      File "object_detection/model_main.py", line 118, in <module>
        tf.app.run()
      File "/Users/sxm239/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 125, in run
        _sys.exit(main(argv))
      File "object_detection/model_main.py", line 114, in main
        tf.estimator.train_and_evaluate(estimator, train_spec, eval_specs[0])
      File "/Users/sxm239/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/estimator/training.py", line 447, in train_and_evaluate
        return executor.run()
      File "/Users/sxm239/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/estimator/training.py", line 531, in run
        return self.run_local()
      File "/Users/sxm239/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/estimator/training.py", line 669, in run_local
        hooks=train_hooks)
      File "/Users/sxm239/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/estimator/estimator.py", line 366, in train
        loss = self._train_model(input_fn, hooks, saving_listeners)
      File "/Users/sxm239/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/estimator/estimator.py", line 1119, in _train_model
        return self._train_model_default(input_fn, hooks, saving_listeners)
      File "/Users/sxm239/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/estimator/estimator.py", line 1135, in _train_model_default
        saving_listeners)
      File "/Users/sxm239/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/estimator/estimator.py", line 1336, in _train_with_estimator_spec
        _, loss = mon_sess.run([estimator_spec.train_op, estimator_spec.loss])
      File "/Users/sxm239/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 577, in run
        run_metadata=run_metadata)
      File "/Users/sxm239/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 1053, in run
        run_metadata=run_metadata)
      File "/Users/sxm239/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 1144, in run
        raise six.reraise(*original_exc_info)
      File "/Users/sxm239/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 1129, in run
        return self._sess.run(*args, **kwargs)
      File "/Users/sxm239/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 1201, in run
        run_metadata=run_metadata)
      File "/Users/sxm239/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 981, in run
        return self._sess.run(*args, **kwargs)
      File "/Users/sxm239/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 900, in run
        run_metadata_ptr)
      File "/Users/sxm239/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1135, in _run
        feed_dict_tensor, options, run_metadata)
      File "/Users/sxm239/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run
        run_metadata)
      File "/Users/sxm239/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1335, in _do_call
        raise type(e)(node_def, op, message)
    tensorflow.python.framework.errors_impl.InvalidArgumentError: assertion failed: [Unable to decode bytes as JPEG, PNG, GIF, or BMP]
         [[Node: case/cond/cond_jpeg/decode_image/cond_jpeg/cond_png/cond_gif/Assert_1/Assert = Assert[T=[DT_STRING], summarize=3, _device="/device:CPU:0"](case/cond/cond_jpeg/decode_image/cond_jpeg/cond_png/cond_gif/is_bmp, case/cond/cond_jpeg/decode_image/cond_jpeg/cond_png/cond_gif/Assert_1/Assert/data_0)]]
         [[Node: IteratorGetNext = IteratorGetNext[output_shapes=[[1], [1,?,?,3], [1,3], [1,100], [1,100,4], [1,100,6], [1,100], [1,100], [1,100], [1]], output_types=[DT_INT32, DT_FLOAT, DT_INT32, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_INT32, DT_BOOL, DT_FLOAT, DT_INT32], _device="/job:localhost/replica:0/task:0/device:CPU:0"](Iterator)]]

以下是我正在使用的一些配置信息:

检查点使用:     fast_rcnn_resnet101_coco_2018_01_28

标签map.pbtxt文件

item {
  id: 1
  name: 'label1'
}

item {
  id: 2
  name: 'label2'
}

item {
  id: 3
  name: 'label3'
}

item {
  id: 4
  name: 'label4'
}

item {
  id: 5
  name: 'label5'
}

item {
  id: 6
  name: 'label6'
}

配置文件::我使用的是与fast_rcnn_resnet_voc7.config中提到的相同的配置,但是我添加了一些更改:

 1. num_classes: 6
 2. fine_tune_checkpoint: "/Users/sxm239/app/all_programs/models/research/object_detection/my_work/my_new_datamodel/checkpoints/faster_rcnn_resnet101_coco_2018_01_28/model.ckpt"
 3. input_path: "/Users/sxm239/app/all_programs/models/research/object_detection/my_work/my_new_datamodel/data/train.record"

 4. label_map_path: "/Users/sxm239/app/all_programs/models/research/object_detection/my_work/my_new_datamodel/data/label_map.pbtxt"

错误之前的log-INFO最后几行是:

2018-08-12 21:29:45,911 INFO     Done calling model_fn.
2018-08-12 21:29:45,912 INFO     Create CheckpointSaverHook.
2018-08-12 21:29:50,557 INFO     Graph was finalized.
2018-08-12 21:29:50,567 INFO     Restoring parameters from /Users/sxm239/app/all_programs/models/research/object_detection/my_new_datamodel/checkpoints/model.ckpt-0
2018-08-12 21:29:52,458 INFO     Running local_init_op.
2018-08-12 21:29:52,632 INFO     Done running local_init_op.
2018-08-12 21:30:04,580 INFO     Saving checkpoints for 0 into /Users/sxm239/app/all_programs/models/research/object_detection/my_new_datamodel/checkpoints/model.ckpt.

我还遵循正确的信息使用“ https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/using_your_own_dataset.md”将图像转换为tfrecords。我已经通过解码和绘制来自tfrecords的图像来验证它。

0 个答案:

没有答案