tensorflow / models

Models and examples built with TensorFlow
Other
77.04k stars 45.77k forks source link

setup.py for object detection installs tensorflow 2.3 which is incompatible and reinstalling tensorflow 2.2 doesn't train through model_main_tf2.py #9528

Open khany27 opened 3 years ago

khany27 commented 3 years ago

The setup.py script installs the false version of packages and rechanging it to Tensorflow 2.2 makes it worse. I can run the inference of pre-trained models but cannot train on custom data. the model_main_tf2.py gives an error always. Please check the packages which are compatible with the Tensorflow version.

lucaskfreitas commented 3 years ago

I'm having the same problem here. Running the docker installation, and then attempting to run model_main_tf2.py from inside the container gives me this error:

Traceback (most recent call last):
  File "object_detection/model_main_tf2.py", line 32, in <module>
    from object_detection import model_lib_v2
  File "/home/tensorflow/.local/lib/python3.6/site-packages/object_detection/model_lib_v2.py", line 29, in <module>
    from object_detection import eval_util
  File "/home/tensorflow/.local/lib/python3.6/site-packages/object_detection/eval_util.py", line 36, in <module>
    from object_detection.metrics import lvis_evaluation
  File "/home/tensorflow/.local/lib/python3.6/site-packages/object_detection/metrics/lvis_evaluation.py", line 23, in <module>
    from lvis import results as lvis_results
  File "/home/tensorflow/.local/lib/python3.6/site-packages/lvis/__init__.py", line 5, in <module>
    from lvis.vis import LVISVis
  File "/home/tensorflow/.local/lib/python3.6/site-packages/lvis/vis.py", line 1, in <module>
    import cv2
  File "/home/tensorflow/.local/lib/python3.6/site-packages/cv2/__init__.py", line 5, in <module>
    from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
double-em commented 3 years ago

I had the same issue. My workaround was installing opencv-python-headless==4.2.0.34 with: pip install opencv-python-headless==4.2.0.34 instead and it found the files.

It didn't work with versions 4.3.x.x+ so there may have been a change? I couldn't find any open issues regarding this at opencv-pyhton's GitHub repository at first glance.

xdhmoore commented 3 years ago

@double-em Thanks!

I don't understand the package chain going on here, but it also seems to work for me to add opencv-python-headless==4.2.0.34 to the REQUIRED_PACKAGES list in setup.py.