我试图借助模型(在下面指定)在我自己的仅包含2个类的数据集中执行训练工作。
系统信息和到目前为止已完成的事情:
Windows 10 64位(使用python 3.6)
我使用此存储库中提供的说明生成了tfrecords:-https://github.com/vijendra1125/Custom-Mask-RCNN-using-Tensorfow-Object-detection-API
使用的模型:mask_rccn_v2_coco
我的图像具有从高到低的任意分辨率,借助以下可用的labelImg工具创建的边界框类:-https://github.com/tzutalin/labelImg,并且每个图像都有两个以上的类实例。
例如,我的xml具有两个或多个s'的实例。
我使用以下内容创建蒙版图像:https://github.com/abreheret/PixelAnnotationTool
我目前正在使用GPU进行培训。 错误描述:(对不起,它的帖子很长) 步骤26之后,我发现错误
INFO:tensorflow:global step 25: loss = 3.4984 (0.626 sec/step)
INFO:tensorflow:global step 25: loss = 3.4984 (0.626 sec/step)
INFO:tensorflow:global step 26: loss = 3.9062 (0.658 sec/step)
INFO:tensorflow:global step 26: loss = 3.9062 (0.658 sec/step)
INFO:tensorflow:Error reported to Coordinator: <class 'tensorflow.python.framework.errors_impl.InvalidArgumentError'>, assertion failed: [] [Condition x == y did not hold element-wise:] [x (Loss/BoxClassifierLoss/assert_equal_1/x:0) = ] [800 1166] [y (Loss/BoxClassifierLoss/assert_equal_1/y:0) = ] [1166 800]
[[Node: Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert = Assert[T=[DT_STRING, DT_STRING, DT_STRING, DT_INT32, DT_STRING, DT_INT32], summarize=3, _device="/job:localhost/replica:0/task:0/device:CPU:0"]
(Loss/BoxClassifierLoss/assert_equal_1/All/_221, Loss/RPNLoss/assert_equal/Assert/Assert/data_0, Loss/RPNLoss/assert_equal/Assert/Assert/data_1, Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert/data_2, Loss/BoxClassifierLoss/assert_equal_1/x/_223, Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert/data_4, Loss/BoxClassifierLoss/assert_equal_1/y/_225)]]
[[Node: Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert/_1484 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_1094_Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]
Caused by op 'Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert', defined at:
File "train.py", line 184, in
tf.app.run()
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\util\deprecation.py", line 250, in new_func
return func(*args, **kwargs)
File "train.py", line 180, in main
graph_hook_fn=graph_rewriter_fn)
File "C:\tensorflow1\models\research\object_detection\legacy\trainer.py", line 291, in train
clones = model_deploy.create_clones(deploy_config, model_fn, [input_queue])
File "C:\tensorflow1\models\research\slim\deployment\model_deploy.py", line 193, in create_clones
outputs = model_fn(*args, **kwargs)
File "C:\tensorflow1\models\research\object_detection\legacy\trainer.py", line 206, in _create_losses
losses_dict = detection_model.loss(prediction_dict, true_image_shapes)
File "C:\tensorflow1\models\research\object_detection\meta_architectures\faster_rcnn_meta_arch.py", line 1711, in loss
fields.DetectionResultFields.num_detections)))
File "C:\tensorflow1\models\research\object_detection\meta_architectures\faster_rcnn_meta_arch.py", line 1983, in _loss_box_classifier
gt_weights_batch=groundtruth_weights_list)
File "C:\tensorflow1\models\research\object_detection\core\target_assigner.py", line 480, in batch_assign_targets
anchors, gt_boxes, gt_class_targets, unmatched_class_label, gt_weights)
File "C:\tensorflow1\models\research\object_detection\core\target_assigner.py", line 156, in assign
shape_utils.combined_static_and_dynamic_shape(unmatched_class_label))
File "C:\tensorflow1\models\research\object_detection\utils\shape_utils.py", line 315, in assert_shape_equal
return tf.assert_equal(shape_a, shape_b)
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\ops\check_ops.py", line 382, in assert_equal
return control_flow_ops.Assert(condition, data, summarize=summarize)
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\util\tf_should_use.py", line 118, in wrapped
return _add_should_use_warning(fn(*args, **kwargs))
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 143, in Assert
return gen_logging_ops._assert(condition, data, summarize, name="Assert")
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\ops\gen_logging_ops.py", line 51, in _assert
name=name)
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\ops.py", line 3414, in create_op
op_def=op_def)
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\ops.py", line 1740, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
InvalidArgumentError (see above for traceback): assertion failed: [] [Condition x == y did not hold element-wise:] [x (Loss/BoxClassifierLoss/assert_equal_1/x:0) = ] [800 1166] [y (Loss/BoxClassifierLoss/assert_equal_1/y:0) = ] [1166 800]
[[Node: Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert = Assert[T=[DT_STRING, DT_STRING, DT_STRING, DT_INT32, DT_STRING, DT_INT32], summarize=3, _device="/job:localhost/replica:0/task:0/device:CPU:0"](Loss/BoxClassifierLoss/assert_equal_1/All/_221, Loss/RPNLoss/assert_equal/Assert/Assert/data_0, Loss/RPNLoss/assert_equal/Assert/Assert/data_1, Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert/data_2, Loss/BoxClassifierLoss/assert_equal_1/x/_223, Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert/data_4, Loss/BoxClassifierLoss/assert_equal_1/y/_225)]]
[[Node: Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert/_1484 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_1094_Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]
INFO:tensorflow:Error reported to Coordinator: <class 'tensorflow.python.framework.errors_impl.InvalidArgumentError'>, assertion failed: [] [Condition x == y did not hold element-wise:] [x (Loss/BoxClassifierLoss/assert_equal_1/x:0) = ] [800 1166] [y (Loss/BoxClassifierLoss/assert_equal_1/y:0) = ] [1166 800]
[[Node: Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert = Assert[T=[DT_STRING, DT_STRING, DT_STRING, DT_INT32, DT_STRING, DT_INT32], summarize=3, _device="/job:localhost/replica:0/task:0/device:CPU:0"](Loss/BoxClassifierLoss/assert_equal_1/All/_221, Loss/RPNLoss/assert_equal/Assert/Assert/data_0, Loss/RPNLoss/assert_equal/Assert/Assert/data_1, Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert/data_2, Loss/BoxClassifierLoss/assert_equal_1/x/_223, Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert/data_4, Loss/BoxClassifierLoss/assert_equal_1/y/_225)]]
[[Node: Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert/_1484 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_1094_Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]
Caused by op 'Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert', defined at:
File "train.py", line 184, in
tf.app.run()
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\util\deprecation.py", line 250, in new_func
return func(*args, **kwargs)
File "train.py", line 180, in main
graph_hook_fn=graph_rewriter_fn)
File "C:\tensorflow1\models\research\object_detection\legacy\trainer.py", line 291, in train
clones = model_deploy.create_clones(deploy_config, model_fn, [input_queue])
File "C:\tensorflow1\models\research\slim\deployment\model_deploy.py", line 193, in create_clones
outputs = model_fn(*args, **kwargs)
File "C:\tensorflow1\models\research\object_detection\legacy\trainer.py", line 206, in _create_losses
losses_dict = detection_model.loss(prediction_dict, true_image_shapes)
File "C:\tensorflow1\models\research\object_detection\meta_architectures\faster_rcnn_meta_arch.py", line 1711, in loss
fields.DetectionResultFields.num_detections)))
File "C:\tensorflow1\models\research\object_detection\meta_architectures\faster_rcnn_meta_arch.py", line 1983, in _loss_box_classifier
gt_weights_batch=groundtruth_weights_list)
File "C:\tensorflow1\models\research\object_detection\core\target_assigner.py", line 480, in batch_assign_targets
anchors, gt_boxes, gt_class_targets, unmatched_class_label, gt_weights)
File "C:\tensorflow1\models\research\object_detection\core\target_assigner.py", line 156, in assign
shape_utils.combined_static_and_dynamic_shape(unmatched_class_label))
File "C:\tensorflow1\models\research\object_detection\utils\shape_utils.py", line 315, in assert_shape_equal
return tf.assert_equal(shape_a, shape_b)
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\ops\check_ops.py", line 382, in assert_equal
return control_flow_ops.Assert(condition, data, summarize=summarize)
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\util\tf_should_use.py", line 118, in wrapped
return _add_should_use_warning(fn(*args, **kwargs))
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 143, in Assert
return gen_logging_ops._assert(condition, data, summarize, name="Assert")
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\ops\gen_logging_ops.py", line 51, in _assert
name=name)
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\ops.py", line 3414, in create_op
op_def=op_def)
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\ops.py", line 1740, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
InvalidArgumentError (see above for traceback): assertion failed: [] [Condition x == y did not hold element-wise:] [x (Loss/BoxClassifierLoss/assert_equal_1/x:0) = ] [800 1166] [y (Loss/BoxClassifierLoss/assert_equal_1/y:0) = ] [1166 800]
[[Node: Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert = Assert[T=[DT_STRING, DT_STRING, DT_STRING, DT_INT32, DT_STRING, DT_INT32], summarize=3, _device="/job:localhost/replica:0/task:0/device:CPU:0"](Loss/BoxClassifierLoss/assert_equal_1/All/_221, Loss/RPNLoss/assert_equal/Assert/Assert/data_0, Loss/RPNLoss/assert_equal/Assert/Assert/data_1, Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert/data_2, Loss/BoxClassifierLoss/assert_equal_1/x/_223, Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert/data_4, Loss/BoxClassifierLoss/assert_equal_1/y/_225)]]
[[Node: Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert/_1484 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_1094_Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]
Traceback (most recent call last):
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\client\session.py", line 1322, in _do_call
return fn(*args)
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\client\session.py", line 1307, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "C:\Users\Irfan Prabaswara\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\client\session.py", line 1409, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: assertion failed: [] [Condition x == y did not hold element-wise:] [x (Loss/BoxClassifierLoss/assert_equal_1/x:0) = ] [800 1166] [y (Loss/BoxClassifierLoss/assert_equal_1/y:0) = ] [1166 800]
[[Node: Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert = Assert[T=[DT_STRING, DT_STRING, DT_STRING, DT_INT32, DT_STRING, DT_INT32], summarize=3, _device="/job:localhost/replica:0/task:0/device:CPU:0"](Loss/BoxClassifierLoss/assert_equal_1/All/_221, Loss/RPNLoss/assert_equal/Assert/Assert/data_0, Loss/RPNLoss/assert_equal/Assert/Assert/data_1, Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert/data_2, Loss/BoxClassifierLoss/assert_equal_1/x/_223, Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert/data_4, Loss/BoxClassifierLoss/assert_equal_1/y/_225)]]
[[Node: Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert/_1484 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_1094_Loss/BoxClassifierLoss/assert_equal_1/Assert/Assert", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]
如果有人为上述问题提供解决方法,我会很高兴。