FOTS icon indicating copy to clipboard operation
FOTS copied to clipboard

InvalidArgumentError (see above for traceback): assertion failed: [width must be >= target + offset.]

Open lmplayer opened this issue 5 years ago • 4 comments

Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1334, in _do_call return fn(*args) File "/usr/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1319, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/usr/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: assertion failed: [width must be >= target + offset.] [[{{node scan/while/crop_to_bounding_box/Assert_4/Assert}}]] [[{{node scan/while/Cast_1}}]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "multigpu_train.py", line 223, in tf.app.run() File "/usr/lib/python3.7/site-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "multigpu_train.py", line 218, in main test_output = fots_testModel.detectRecg(d_images, sess=sess) File "/home/prir1005/.PRIRMSERdata/prir1005/LM/FOTS-master/FOTS/fots_testModel.py", line 233, in detectRecg rois, ws = self.sess.run([rois_op, ws_op]) File "/usr/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 929, in run run_metadata_ptr) File "/usr/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1152, in _run feed_dict_tensor, options, run_metadata) File "/usr/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1328, in _do_run run_metadata) File "/usr/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1348, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: assertion failed: [width must be >= target + offset.] [[node scan/while/crop_to_bounding_box/Assert_4/Assert (defined at /home/prir1005/.PRIRMSERdata/prir1005/LM/FOTS-master/FOTS/RoiRotate.py:19) ]] [[node scan/while/Cast_1 (defined at /home/prir1005/.PRIRMSERdata/prir1005/LM/FOTS-master/FOTS/RoiRotate.py:25) ]]

Caused by op 'scan/while/crop_to_bounding_box/Assert_4/Assert', defined at: File "multigpu_train.py", line 223, in tf.app.run() File "/usr/lib/python3.7/site-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "multigpu_train.py", line 218, in main test_output = fots_testModel.detectRecg(d_images, sess=sess) File "/home/prir1005/.PRIRMSERdata/prir1005/LM/FOTS-master/FOTS/fots_testModel.py", line 231, in detectRecg rois_op, ws_op = RoiRotate.RoiRotate(filter_bsharedFeatures, FLAGS.features_stride)(brotateParas) File "/home/prir1005/.PRIRMSERdata/prir1005/LM/FOTS-master/FOTS/RoiRotate.py", line 65, in call textImgFeatures = tf.scan(self.scanFunc, [ifeatures_tile, outBoxes, cropBoxes, angles], [np.zeros((self.fix_RoiHeight, self.max_RoiWidth, channels), np.float32), np.array(0, np.int32)]) File "/usr/lib/python3.7/site-packages/tensorflow/python/ops/functional_ops.py", line 724, in scan maximum_iterations=n) File "/usr/lib/python3.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 3556, in while_loop return_same_structure) File "/usr/lib/python3.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 3087, in BuildLoop pred, body, original_loop_vars, loop_vars, shape_invariants) File "/usr/lib/python3.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 3022, in _BuildLoop body_result = body(*packed_vars_for_body) File "/usr/lib/python3.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 3525, in body = lambda i, lv: (i + 1, orig_body(*lv)) File "/usr/lib/python3.7/site-packages/tensorflow/python/ops/functional_ops.py", line 703, in compute a_out = fn(packed_a, packed_elems) File "/home/prir1005/.PRIRMSERdata/prir1005/LM/FOTS-master/FOTS/RoiRotate.py", line 19, in scanFunc cropFeatures = tf.image.crop_to_bounding_box(ifeatures, outBox[1], outBox[0], outBox[3], outBox[2]) File "/usr/lib/python3.7/site-packages/tensorflow/python/ops/image_ops_impl.py", line 802, in crop_to_bounding_box 'width must be >= target + offset.') File "/usr/lib/python3.7/site-packages/tensorflow/python/ops/image_ops_impl.py", line 80, in _assert return [control_flow_ops.Assert(cond, [msg])] File "/usr/lib/python3.7/site-packages/tensorflow/python/util/tf_should_use.py", line 193, in wrapped return _add_should_use_warning(fn(*args, **kwargs)) File "/usr/lib/python3.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 160, in Assert return gen_logging_ops._assert(condition, data, summarize, name="Assert") File "/usr/lib/python3.7/site-packages/tensorflow/python/ops/gen_logging_ops.py", line 72, in _assert name=name) File "/usr/lib/python3.7/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper op_def=op_def) File "/usr/lib/python3.7/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func return func(*args, **kwargs) File "/usr/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 3300, in create_op op_def=op_def) File "/usr/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 1801, in init self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): assertion failed: [width must be >= target + offset.] [[node scan/while/crop_to_bounding_box/Assert_4/Assert (defined at /home/prir1005/.PRIRMSERdata/prir1005/LM/FOTS-master/FOTS/RoiRotate.py:19) ]] [[node scan/while/Cast_1 (defined at /home/prir1005/.PRIRMSERdata/prir1005/LM/FOTS-master/FOTS/RoiRotate.py:25) ]]

lmplayer avatar Apr 23 '19 08:04 lmplayer

I've faced this issue as you. Have you solved it?

kei6 avatar Apr 23 '19 10:04 kei6

Hi @yu20103983, Having some image lead to this issue. When debugging, I've found one sample that width is 96 and target + offset is 97 , hence the issue width must be >= target + offset. I think somehow target + offset is larger than width of the image. I'm stuck at this issue and find no way to solve it myself. Can you help to solve this issue?

kei6 avatar Apr 24 '19 10:04 kei6

I've faced this issue as you. Have you solved it? can you sent your successfully versions source code to me. my e-mail is [email protected]. thank you very much!

Marscep avatar May 15 '19 16:05 Marscep

Try to change def resize_image(self, im, max_side_len=224): . I trid with 1200, works for me ¯\_(ツ)_/¯.

overclock98 avatar Jul 02 '20 10:07 overclock98