models icon indicating copy to clipboard operation
models copied to clipboard

AttributeError: module 'tensorflow.python.ops.control_flow_ops' has no attribute 'case'`

Open ShubhamModi77 opened this issue 1 year ago • 2 comments

I am facing an error while training a TensorFlow custom object detection model. Initially, I started with TensorFlow 2.13.0, but the GPU was not detected. Therefore, I upgraded to TensorFlow 2.15.0.

File "/usr/local/lib/python3.10/dist-packages/object_detection/data_decoders/tf_example_decoder.py", line 556, in decode * tensors = decoder.decode(serialized_example, items=keys) File "/usr/local/lib/python3.10/dist-packages/tf_slim/data/tfexample_decoder.py", line 722, in decode * outputs.append(handler.tensors_to_item(keys_to_tensors)) File "/usr/local/lib/python3.10/dist-packages/tf_slim/data/tfexample_decoder.py", line 405, in tensors_to_item * return self._decode(image_buffer, image_format) File "/usr/local/lib/python3.10/dist-packages/tf_slim/data/tfexample_decoder.py", line 453, in _decode * image = control_flow_ops.case(

AttributeError: module 'tensorflow.python.ops.control_flow_ops' has no attribute 'case'`

ShubhamModi77 avatar Dec 11 '24 14:12 ShubhamModi77

@ShubhamModi77 I came across this issue and would love to work on it. Looks like the problem is due to control_flow_ops.case, which isn’t available in TensorFlow 2.15. A quick fix would be swapping it with tf.case to make it compatible.

If it’s cool with you, I can start working on this and send a PR after testing.

Tanishq1030 avatar Mar 18 '25 09:03 Tanishq1030

@laxmareddyp Hey, can i get an update on my response, I'm eager to work on this issues

Tanishq1030 avatar Mar 19 '25 13:03 Tanishq1030