tf2-object-detection-api-tutorial icon indicating copy to clipboard operation
tf2-object-detection-api-tutorial copied to clipboard

batch size > 1 in config file for running eval script

Open Kalana304 opened this issue 5 years ago • 0 comments

I am trying to evaluate the model having batch size more than 1 and it throws me errors. I have checked in many other sources and their suggestion would be to make it 1. But for our application we need a batch size > 1. Following is the error I get.

Traceback (most recent call last): File "models/research/object_detection/model_main_tf2.py", line 114, in tf.compat.v1.app.run() File "/home/fyp3/anaconda3/envs/py3tf2/lib/python3.8/site-packages/tensorflow/python/platform/app.py", line 40, in run _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef) File "/home/fyp3/anaconda3/envs/py3tf2/lib/python3.8/site-packages/absl/app.py", line 300, in run _run_main(main, args) File "/home/fyp3/anaconda3/envs/py3tf2/lib/python3.8/site-packages/absl/app.py", line 251, in _run_main sys.exit(main(argv)) File "models/research/object_detection/model_main_tf2.py", line 81, in main model_lib_v2.eval_continuously( File "/media/fyp3/New Volume/ActivityDetection/ActivityDetection/Custom/models/research/object_detection/model_lib_v2.py", line 990, in eval_continuously eager_eval_loop( File "/media/fyp3/New Volume/ActivityDetection/ActivityDetection/Custom/models/research/object_detection/model_lib_v2.py", line 803, in eager_eval_loop eval_dict, losses_dict, class_agnostic = compute_eval_dict(features, labels) File "/home/fyp3/anaconda3/envs/py3tf2/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 780, in call result = self._call(*args, **kwds) File "/home/fyp3/anaconda3/envs/py3tf2/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 840, in _call return self._stateless_fn(*args, **kwds) File "/home/fyp3/anaconda3/envs/py3tf2/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 2829, in call return graph_function._filtered_call(args, kwargs) # pylint: disable=protected-access File "/home/fyp3/anaconda3/envs/py3tf2/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 1843, in _filtered_call return self._call_flat( File "/home/fyp3/anaconda3/envs/py3tf2/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 1923, in _call_flat return self._build_call_outputs(self._inference_function.call( File "/home/fyp3/anaconda3/envs/py3tf2/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 545, in call outputs = execute.execute( File "/home/fyp3/anaconda3/envs/py3tf2/lib/python3.8/site-packages/tensorflow/python/eager/execute.py", line 59, in quick_execute tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name, tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found. (0) Invalid argument: Shapes of all inputs must match: values[0].shape = [1] != values[3].shape = [0] [[node stack_47 (defined at /media/fyp3/New Volume/ActivityDetection/ActivityDetection/Custom/models/research/object_detection/model_lib.py:158) ]] [[ToNormalizedCoordinates/Assert/AssertGuard/pivot_f/_828/_321]] (1) Invalid argument: Shapes of all inputs must match: values[0].shape = [1] != values[3].shape = [0] [[node stack_47 (defined at /media/fyp3/New Volume/ActivityDetection/ActivityDetection/Custom/models/research/object_detection/model_lib.py:158) ]] 0 successful operations. 0 derived errors ignored. [Op:__inference_compute_eval_dict_28651]

Errors may have originated from an input operation. Input Source operations connected to node stack_47: Slice_4 (defined at /media/fyp3/New Volume/ActivityDetection/ActivityDetection/Custom/models/research/object_detection/model_lib.py:276)

Input Source operations connected to node stack_47: Slice_4 (defined at /media/fyp3/New Volume/ActivityDetection/ActivityDetection/Custom/models/research/object_detection/model_lib.py:276)

Function call stack: compute_eval_dict -> compute_eval_dict

Can you please let me know what this is and/or whether API can handle only batch_size == 1 for evaluation?

Kalana304 avatar Oct 14 '20 17:10 Kalana304