SSD-Tensorlfow:image_size must contain 3 elements[4

网友投稿 322 2022-08-26

SSD-Tensorlfow:image_size must contain 3 elements[4

今天在制作自己训练集合并且训练的时候,碰见了如下的错误。

INFO:tensorflow:global step 20: loss = 94.2404 (0.304 sec/step)INFO:tensorflow:global step 30: loss = 107.6148 (0.304 sec/step)INFO:tensorflow:Error reported to Coordinator: , image_size must contain 3 elements[4] [[Node: ssd_preprocessing_train/distorted_bounding_box_crop/sample_distorted_bounding_box/SampleDistortedBoundingBoxV2 = SampleDistortedBoundingBoxV2[T=DT_INT32, area_range=[0.1, 1], aspect_ratio_range=[0.6, 1.67], max_attempts=200, seed=0, seed2=0, use_image_if_no_bounding_boxes=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](ssd_preprocessing_train/distorted_bounding_box_crop/Shape, ssd_preprocessing_train/ExpandDims_1, ssd_preprocessing_train/distorted_bounding_box_crop/sample_distorted_bounding_box/SampleDistortedBoundingBoxV2/min_object_covered)]]INFO:tensorflow:Finished training! Saving model to disk.Traceback (most recent call last): File "train_ssd_network.py", line 391, in tf.app.run() File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "train_ssd_network.py", line 387, in main sync_optimizer=None) File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/slim/python/slim/learning.py", line 775, in train sv.stop(threads, close_summary_writer=True) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/supervisor.py", line 792, in stop stop_grace_period_secs=self._stop_grace_secs) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/coordinator.py", line 389, in join six.reraise(*self._exc_info_to_raise) File "/usr/lib/python3/dist-packages/six.py", line 686, in reraise raise value File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/queue_runner_impl.py", line 238, in _run enqueue_callable() File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1231, in _single_operation_run target_list_as_strings, status, None) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/errors_impl.py", line 473, in __exit__ c_api.TF_GetCode(self.status.status))tensorflow.python.framework.errors_impl.InvalidArgumentError: image_size must contain 3 elements[4] [[Node: ssd_preprocessing_train/distorted_bounding_box_crop/sample_distorted_bounding_box/SampleDistortedBoundingBoxV2 = SampleDistortedBoundingBoxV2[T=DT_INT32, area_range=[0.1, 1], aspect_ratio_range=[0.6, 1.67], max_attempts=200, seed=0, seed2=0, use_image_if_no_bounding_boxes=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](ssd_preprocessing_train/distorted_bounding_box_crop/Shape, ssd_preprocessing_train/ExpandDims_1, ssd_preprocessing_train/distorted_bounding_box_crop/sample_distorted_bounding_box/SampleDistortedBoundingBoxV2/min_object_covered)]]

很显然你的原始图片有的不是RGB的,所以报错了。方法是把你的图片转换成RGB的。少量的话,找个美图秀秀等软件就可以转换,大量的话,建议写代码转换了。

参考文献

[1].InvalidArgumentError: image_size must contain 3 elements[4].

​​https://github.com/tensorflow/models/issues/3349​​

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:“吃鸡”最失败的3个改动!看似是营销鬼才,实则自断业绩来源!
下一篇:[leetcode] 1105. Filling Bookcase Shelves
相关文章

 发表评论

暂时没有评论,来抢沙发吧~