Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

ImportError: cannot import name 'model_lib_v2' from 'object_detection' (already installed an still not working)

$
0
0

**Hey guys, currently doing tensorflow object detection and stuck because of an error. Already tried all the method in the internet, still not working.**I use tensorflow == 2.10.0, the model is http://download.tensorflow.org/models/object_detection/tf2/20200711/ssd_mobilenet_v2_fpnlite_320x320_coco17_tpu-8.tar.gzand using jupyter notebook, python version = Python 3.10.9, no tensorflow gpu

Below are everything related to the error:

(odball) C:\Users\someone\Desktop\website\2023\TensorFlow Object Detection\TFODBall>python Tensorflow\models\research\object_detection\model_main_tf2.py --model_dir=Tensorflow\workspace\models\my_ssd_mobnet --pipeline_config_path=Tensorflow\workspace\models\my_ssd_mobnet\pipeline.config --num_train_steps=4000Traceback (most recent call last):  File "C:\Users\someone\Desktop\website\2023\TensorFlow Object Detection\TFODBall\Tensorflow\models\research\object_detection\model_main_tf2.py", line 31, in <module>    from object_detection import model_lib_v2ImportError: cannot import name 'model_lib_v2' from 'object_detection' (C:\Users\someone\Desktop\website\2023\TensorFlow Object Detection\TFODBall\odball\lib\site-packages\object_detection\__init__.py)[C:\Users\someone\Desktop\website\2023\TensorFlow Object Detection\TFODBall\Tensorflow\models\research\object_detection\model_main_tf2.py](https://i.stack.imgur.com/mSaqo.png)The "from object detection" of the image have indicator 

says report missing imports "object detection" could not be resolved

Solutions I have tried :

  1. pip install tensorflow-object-detection-api
  2. uninstall and reinstall tensorflow
  3. restart kernel

Below are the pip list :

Package                         Version         Editable project location------------------------------- --------------- ---------------------------------------------------------------------------------------------------------absl-py                         2.1.0anyio                           4.3.0apache-beam                     2.54.0argon2-cffi                     23.1.0argon2-cffi-bindings            21.2.0arrow                           1.3.0asttokens                       2.4.1astunparse                      1.6.3async-lru                       2.0.4attrs                           23.2.0avro-python3                    1.10.2Babel                           2.14.0beautifulsoup4                  4.12.3bleach                          6.1.0cachetools                      5.3.3certifi                         2024.2.2cffi                            1.16.0charset-normalizer              3.3.2colorama                        0.4.6comm                            0.2.1contextlib2                     21.6.0contourpy                       1.2.0cycler                          0.12.1Cython                          3.0.8debugpy                         1.8.1decorator                       5.1.1defusedxml                      0.7.1dm-tree                         0.1.8docutils                        0.20.1exceptiongroup                  1.2.0executing                       2.0.1fastjsonschema                  2.19.1flatbuffers                     23.5.26fonttools                       4.49.0fqdn                            1.5.1gast                            0.4.0google-auth                     2.28.1google-auth-oauthlib            0.4.6google-pasta                    0.2.0grpcio                          1.62.0h11                             0.14.0h5py                            3.10.0httpcore                        1.0.4httpx                           0.27.0idna                            3.6importlib-metadata              7.0.1ipykernel                       6.29.3ipython                         8.22.1ipywidgets                      8.1.2isoduration                     20.11.0jaraco.classes                  3.3.1jedi                            0.19.1Jinja2                          3.1.3json5                           0.9.17jsonpointer                     2.4jsonschema                      4.21.1jsonschema-specifications       2023.12.1jupyter                         1.0.0jupyter_client                  8.6.0jupyter-console                 6.6.3jupyter_core                    5.7.1jupyter-events                  0.9.0jupyter-lsp                     2.2.3jupyter_server                  2.12.5jupyter_server_terminals        0.5.2jupyterlab                      4.1.2jupyterlab_pygments             0.3.0jupyterlab_server               2.25.3jupyterlab_widgets              3.0.10keras                           2.10.0Keras-Preprocessing             1.1.2keyring                         24.3.1kiwisolver                      1.4.5libclang                        16.0.6lvis                            0.5.3lxml                            5.1.0Markdown                        3.5.2markdown-it-py                  3.0.0MarkupSafe                      2.1.5matplotlib                      3.8.3matplotlib-inline               0.1.6mdurl                           0.1.2mistune                         3.0.2ml-dtypes                       0.3.2more-itertools                  10.2.0namex                           0.0.7nbclient                        0.9.0nbconvert                       7.16.1nbformat                        5.9.2nest-asyncio                    1.6.0nh3                             0.2.15notebook                        7.1.1notebook_shim                   0.2.4numpy                           1.26.4oauthlib                        3.2.2object-detection                0.1opencv-python                   4.9.0.80opt-einsum                      3.3.0overrides                       7.7.0packaging                       23.2pandas                          2.2.1pandocfilters                   1.5.1parso                           0.8.3pillow                          10.2.0pip                             24.0pkginfo                         1.9.6platformdirs                    4.2.0portalocker                     2.8.2prometheus_client               0.20.0prompt-toolkit                  3.0.43protobuf                        3.19.6psutil                          5.9.8pure-eval                       0.2.2pyasn1                          0.5.1pyasn1-modules                  0.3.0pycocotools                     2.0.7pycparser                       2.21Pygments                        2.17.2pyparsing                       2.4.7PyQt5                           5.15.10PyQt5-Qt5                       5.15.2PyQt5-sip                       12.13.0python-dateutil                 2.8.2python-json-logger              2.0.7pytz                            2024.1pywin32                         306pywin32-ctypes                  0.2.2pywinpty                        2.0.13PyYAML                          6.0.1pyzmq                           25.1.2qtconsole                       5.5.1QtPy                            2.4.1readme_renderer                 43.0referencing                     0.33.0regex                           2023.12.25requests                        2.31.0requests-oauthlib               1.3.1requests-toolbelt               1.0.0rfc3339-validator               0.1.4rfc3986                         2.0.0rfc3986-validator               0.1.1rich                            13.7.0rpds-py                         0.18.0rsa                             4.9sacrebleu                       2.2.0scipy                           1.12.0Send2Trash                      1.8.2setuptools                      65.5.0six                             1.16.0slim                            0.1             c:\users\someone\desktop\website\2023\tensorflow object detection\tfodball\tensorflow\models\research\slimsniffio                         1.3.1soupsieve                       2.5stack-data                      0.6.3tabulate                        0.9.0tensorboard                     2.10.1tensorboard-data-server         0.6.1tensorboard-plugin-wit          1.8.1tensorflow                      2.10.0tensorflow-estimator            2.10.0tensorflow-io                   0.31.0tensorflow-io-gcs-filesystem    0.31.0tensorflow-object-detection-api 0.1.1termcolor                       2.4.0terminado                       0.18.0tf-models-official              2.15.0tf-slim                         1.1.0tinycss2                        1.2.1tomli                           2.0.1tornado                         6.4traitlets                       5.14.1twine                           5.0.0types-python-dateutil           2.8.19.20240106typing_extensions               4.10.0uri-template                    1.3.0urllib3                         2.2.1wcwidth                         0.2.13webcolors                       1.13webencodings                    0.5.1websocket-client                1.7.0Werkzeug                        3.0.1wget                            3.2wheel                           0.42.0widgetsnbextension              4.0.10wrapt                           1.16.0zipp                            3.17.0

Solutions I have tried :

1. pip install tensorflow-object-detection-api2. uninstall and reinstall tensorflow3. restart kernel 

i was expecting the object detection could be resolved, unfortunately its still there causing error


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>