alexander-pv / maskrcnn_tf2

Mask R-CNN for object detection and instance segmentation with Keras and TensorFlow V2 and ONNX and TensorRT optimization support.
Other
40 stars 11 forks source link

Error while running inference in tensorflow 2.4.3 #8

Closed VeeranjaneyuluToka closed 2 years ago

VeeranjaneyuluToka commented 2 years ago

Hi,

I am trying to load a model and run inference, getting the below error.

File "inference.py", line 136, in main() File "inference.py", line 60, in main output = inference_model([np.expand_dims(img_processed, 0), File "C:\Users\Veeru\anaconda3\envs\tf2.5_mrcnn_exp\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 1012, in call outputs = call_fn(inputs, *args, kwargs) File "C:\Users\Veeru\anaconda3\envs\tf2.5_mrcnn_exp\lib\site-packages\tensorflow\python\keras\engine\functional.py", line 424, in call return self._run_internal_graph( File "C:\Users\Veeru\anaconda3\envs\tf2.5_mrcnn_exp\lib\site-packages\tensorflow\python\keras\engine\functional.py", line 560, in _run_internal_graph outputs = node.layer(*args, *kwargs) File "C:\Users\Veeru\anaconda3\envs\tf2.5_mrcnn_exp\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 1012, in call outputs = call_fn(inputs, args, kwargs) File "C:\Users\Veeru\Downloads\source\maskrcnn_tf2-master\src\layers\mrcnn_layers.py", line 691, in call scores = utils.batch_slice([scores, ix], lambda x, y: tf.gather(x, y), File "C:\Users\Veeru\Downloads\source\maskrcnn_tf2-master\src\common\utils.py", line 752, in batch_slice inputs_slice = [x[i] for x in inputs] File "C:\Users\Veeru\Downloads\source\maskrcnn_tf2-master\src\common\utils.py", line 752, in inputs_slice = [x[i] for x in inputs] File "C:\Users\Veeru\anaconda3\envs\tf2.5_mrcnn_exp\lib\site-packages\tensorflow\python\util\dispatch.py", line 201, in wrapper return target(*args, *kwargs) File "C:\Users\Veeru\anaconda3\envs\tf2.5_mrcnn_exp\lib\site-packages\tensorflow\python\ops\array_ops.py", line 1036, in _slice_helper return strided_slice( File "C:\Users\Veeru\anaconda3\envs\tf2.5_mrcnn_exp\lib\site-packages\tensorflow\python\util\dispatch.py", line 201, in wrapper return target(args, **kwargs) File "C:\Users\Veeru\anaconda3\envs\tf2.5_mrcnn_exp\lib\site-packages\tensorflow\python\ops\array_ops.py", line 1209, in strided_slice op = gen_array_ops.strided_slice( File "C:\Users\Veeru\anaconda3\envs\tf2.5_mrcnn_exp\lib\site-packages\tensorflow\python\ops\gen_array_ops.py", line 10446, in strided_slice _ops.raise_from_not_ok_status(e, name) File "C:\Users\Veeru\anaconda3\envs\tf2.5_mrcnn_exp\lib\site-packages\tensorflow\python\framework\ops.py", line 6862, in raise_from_not_ok_status six.raise_from(core._status_to_exception(e.code, message), None) File "", line 3, in raise_from tensorflow.python.framework.errors_impl.InvalidArgumentError: slice index 1 of dimension 0 out of bounds. [Op:StridedSlice] name: mask_rcnn_inference/roi/strided_slice/

I am not getting this error if i pass an input of size [2, 512, 512, 3]. this happens when batch size is 1. did you face this issue?

Thanks, Veeru.

alexander-pv commented 2 years ago

Hi, @VeeranjaneyuluToka, I didn't face it. I believe this is related to a bug in a resolved issue #9 A recent training test showed that everything seems to work fine now. Please, pull the latest master. Is your issue resolved?