-
Notifications
You must be signed in to change notification settings - Fork 45.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InvalidArgumentError (see above for traceback): Reduction axis 1 is empty in shape [1,0] #4433
Comments
Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks. |
This is my configuration file: model { train_config: { num_steps: 200000 train_input_reader: { eval_config: { max_evals: 10 eval_input_reader: { My training image size is 5000x250, which will cause this error。But changing the size of the training data to 500x250,its will allow it to train normally. |
Could someone please provide some clarification here? I have seen this error message posted several times but people have offered different solutions none of which solve my problem: https://stackoverflow.com/questions/49272943/reduction-axis-1-is-empty-in-shape-9-0 |
Sorry for the late response. Is this issue still happening? |
@pkulzc I made the following changes:
|
|
This is the only way I was able to avoid #170, while training a different dataset. |
This solution doesn't work for my case. The issue still presents in the current version. My image size is kinda small (~50 - 70 pixels) which might cause the issue. I use the pre-trained model However, this problem didn't happen to |
Hi there. Maybe solution I suggested on similar question will help: matterport/Mask_RCNN#494 (comment) |
I had the same problem. This question has been bothering me. |
I solved this problem by deleting some images that contained small annotations. |
@zonasw how small annotations did you remove? |
I solved the problema adjusting the fixed_shape_resizer { |
What is the top-level directory of the model you are using:object_detection
Have I written custom code (as opposed to using a stock example script provided in TensorFlow):No
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04
TensorFlow installed from (source or binary): source
TensorFlow version (use command below): 1.8
Bazel version (if compiling from source):
CUDA/cuDNN version: 9.0
GPU model and memory:GTX 1080
Exact command to reproduce:
I am using the fasterrcnn-resnet50 training data to report an error:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "train.py", line 184, in
tf.app.run()
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "train.py", line 180, in main
graph_hook_fn=graph_rewriter_fn)
File "/home/wangyutang/models-master/research/object_detection/trainer.py", line 399, in train
saver=saver)
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/slim/python/slim/learning.py", line 784, in train
ignore_live_threads=ignore_live_threads)
File "/home/wangyutang/anaconda3/lib/python3.6/contextlib.py", line 99, in exit
self.gen.throw(type, value, traceback)
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/supervisor.py", line 1000, in managed_session
self.stop(close_summary_writer=close_summary_writer)
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/supervisor.py", line 828, in stop
ignore_live_threads=ignore_live_threads)
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/coordinator.py", line 389, in join
six.reraise(*self._exc_info_to_raise)
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/six.py", line 693, in reraise
raise value
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/coordinator.py", line 297, in stop_on_exception
yield
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/coordinator.py", line 495, in run
self.run_loop()
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/supervisor.py", line 1030, in run_loop
self._sv.global_step])
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 900, in run
run_metadata_ptr)
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1135, in _run
feed_dict_tensor, options, run_metadata)
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run
run_metadata)
File "/home/wangyutang/anaconda3/lib/python3.6/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: Reduction axis 1 is empty in shape [1,0]
[[Node: Loss/RPNLoss/Match/cond/ArgMax_1 = ArgMax[T=DT_FLOAT, Tidx=DT_INT32, output_type=DT_INT32, _device="/job:localhost/replica:0/task:0/device:GPU:0"](Loss/RPNLoss/Match/cond/Shape_1/Switch:1, Loss/RPNLoss/Match/cond/ArgMax_1/dimension)]]
[[Node: Loss/RPNLoss/objectness_loss/_961 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_3809_Loss/RPNLoss/objectness_loss", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]]
Caused by op 'Loss/RPNLoss/Match/cond/ArgMax_1', defined at:
File "train.py", line 184, in
tf.app.run()
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "train.py", line 180, in main
graph_hook_fn=graph_rewriter_fn)
File "/home/wangyutang/models-master/research/object_detection/trainer.py", line 275, in train
clones = model_deploy.create_clones(deploy_config, model_fn, [input_queue])
File "/home/wangyutang/models-master/research/slim/deployment/model_deploy.py", line 193, in create_clones
outputs = model_fn(args, **kwargs)
File "/home/wangyutang/models-master/research/object_detection/trainer.py", line 200, in _create_losses
losses_dict = detection_model.loss(prediction_dict, true_image_shapes)
File "/home/wangyutang/models-master/research/object_detection/meta_architectures/faster_rcnn_meta_arch.py", line 1596, in loss
groundtruth_classes_with_background_list)
File "/home/wangyutang/models-master/research/object_detection/meta_architectures/faster_rcnn_meta_arch.py", line 1650, in _loss_rpn
groundtruth_boxlists, len(groundtruth_boxlists)[None])
File "/home/wangyutang/models-master/research/object_detection/core/target_assigner.py", line 447, in batch_assign_targets
anchors, gt_boxes, gt_class_targets, gt_weights)
File "/home/wangyutang/models-master/research/object_detection/core/target_assigner.py", line 162, in assign
match = self._matcher.match(match_quality_matrix, **params)
File "/home/wangyutang/models-master/research/object_detection/core/matcher.py", line 239, in match
return Match(self._match(similarity_matrix, **params),
File "/home/wangyutang/models-master/research/object_detection/matchers/argmax_matcher.py", line 190, in _match
_match_when_rows_are_non_empty, _match_when_rows_are_empty)
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 432, in new_func
return func(*args, **kwargs)
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2063, in cond
orig_res_t, res_t = context_t.BuildCondBranch(true_fn)
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 1913, in BuildCondBranch
original_result = fn()
File "/home/wangyutang/models-master/research/object_detection/matchers/argmax_matcher.py", line 169, in _match_when_rows_are_non_empty
output_type=tf.int32)
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 432, in new_func
return func(*args, **kwargs)
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 220, in argmax
return gen_math_ops.arg_max(input, axis, name=name, output_type=output_type)
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 783, in arg_max
name=name)
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
op_def=op_def)
File "/home/wangyutang/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1718, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
InvalidArgumentError (see above for traceback): Reduction axis 1 is empty in shape [1,0]
[[Node: Loss/RPNLoss/Match/cond/ArgMax_1 = ArgMax[T=DT_FLOAT, Tidx=DT_INT32, output_type=DT_INT32, _device="/job:localhost/replica:0/task:0/device:GPU:0"](Loss/RPNLoss/Match/cond/Shape_1/Switch:1, Loss/RPNLoss/Match/cond/ArgMax_1/dimension)]]
[[Node: Loss/RPNLoss/objectness_loss/_961 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_3809_Loss/RPNLoss/objectness_loss", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]]
I need help for this error pls
The text was updated successfully, but these errors were encountered: