Evaluating in TensorFlow Object Detection API - AttributeError

Hello,

I have successfully trained my model using the TensorFlow Object Detection API and wanted to evaluate it on it. I used the following site as a guide: Training Custom Object Detector — TensorFlow 2 Object Detection API tutorial documentation

Link for the code “model_main_tf2.py”: models/model_main_tf2.py at master · tensorflow/models · GitHub

After running the script “model_main_tf2.py”, I received the following error message:

-> INFO:tensorflow:Waiting for new checkpoint at models/my_ssd_resnet50_v1_fpn
-> I1220 17:06:56.024288 140351537808192 checkpoint_utils.py:140] Waiting for new checkpoint at models/my_ssd_resnet50_v1_fpn
-> INFO:tensorflow:Found new checkpoint at models/my_ssd_resnet50_v1_fpn/ckpt-2
-> I1220 17:06:56.024974 140351537808192 checkpoint_utils.py:149] Found new checkpoint at models/my_ssd_resnet50_v1_fpn/ckpt-2
-> 2021-12-20 17:06:56.098253: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:185] None of the MLIR Optimization Passes are enabled (registered 2)
-> /home/ameisemuhammed/anaconda3/envs/tensorflow/lib/python3.9/site-packages/keras/backend.py:401: UserWarning: `tf.keras.backend.set_learning_phase` is deprecated and will be removed after 2020-10-11. To update it, simply pass a True/False value to the `training` argument of the `__call__` method of your layer or model.
-> warnings.warn('`tf.keras.backend.set_learning_phase` is deprecated and '
-> 2021-12-20 17:07:08.993353: I tensorflow/stream_executor/cuda/cuda_dnn.cc:369] Loaded cuDNN version 8204
-> Traceback (most recent call last):
  -> File "/home/ameisemuhammed/TensorFlow/workspace/training_demo/model_main_tf2.py", line 114, in <module>
    tf.compat.v1.app.run()
  -> File "/home/ameisemuhammed/anaconda3/envs/tensorflow/lib/python3.9/site-packages/tensorflow/python/platform/app.py", line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  -> File "/home/ameisemuhammed/anaconda3/envs/tensorflow/lib/python3.9/site-packages/absl/app.py", line 303, in run
    _run_main(main, args)
  -> File "/home/ameisemuhammed/anaconda3/envs/tensorflow/lib/python3.9/site-packages/absl/app.py", line 251, in _run_main
    sys.exit(main(argv))
  -> File "/home/ameisemuhammed/TensorFlow/workspace/training_demo/model_main_tf2.py", line 81, in main
    model_lib_v2.eval_continuously(
  -> File "/home/ameisemuhammed/anaconda3/envs/tensorflow/lib/python3.9/site-packages/object_detection/model_lib_v2.py", line 1141, in eval_continuously
    optimizer.shadow_copy(detection_model)
  -> File "/home/ameisemuhammed/anaconda3/envs/tensorflow/lib/python3.9/site-packages/keras/optimizer_v2/optimizer_v2.py", line 830, in __getattribute__
    raise e
  -> File "/home/ameisemuhammed/anaconda3/envs/tensorflow/lib/python3.9/site-packages/keras/optimizer_v2/optimizer_v2.py", line 820, in __getattribute__
    return super(OptimizerV2, self).__getattribute__(name)
-> AttributeError: 'SGD' object has no attribute 'shadow_copy'

My versions:

TensorFlow = 2.6.0
TensorFlow GPU = 2.6.0
Ubuntu = 20.04
Python = 3.9.7
GPU = NVIDIA Corporation TU104 [GeForce RTX 2080]
CUDA = 11.5
cuDNN = 8.2.4

Could the problem be from the TensorFlow version or CUDA/cuDNN version?
If more information is needed, please let me know!

Please refer to the gist to train object detection and inference using Tf2.x may help you. Thank you!