models icon indicating copy to clipboard operation
models copied to clipboard

A model training problem for plant disease detection

Open MAXTe21 opened this issue 1 year ago • 10 comments

I encountered a small problem when training tensorflow ssd_mobilenet model on Google colab. There were no problems with data set processing and preprocessing model import. However, during the final training, some modules may have been unavailable due to version incompatibility. (Or the citation keeps getting wrong), similar problems have always been there, I would like to ask those experts to help me, I have just started to contact these, and some problems have been bothering me. :(

MAXTe21 avatar Apr 06 '24 14:04 MAXTe21

Error message is: Traceback (most recent call last): File "/content/drive/MyDrive/5:30_models/research/object_detection/model_main_tf2.py", line 31, in from object_detection import model_lib_v2 ImportError: cannot import name 'model_lib_v2' from 'object_detection' (/usr/local/lib/python3.10/dist-packages/object_detection/init.py)

Error from this code: !python /content/drive/MyDrive/5:30_models/research/object_detection/model_main_tf2.py
--pipeline_config_path=/content/drive/MyDrive/5:30_models/research/object_detection/configs/tf2/ssd_mobilenet_v2_fpnlite_320x320_coco17_tpu-8.config
--model_dir=/content/drive/MyDrive/Trainingssd_Final
--num_steps=35000

I try to train but always have some problem. like: ''ImportError: cannot import name 'estimator' from 'tensorflow.compat.v1''and ''ImportError: cannot import name 'model_lib_v2' from 'object_detection'' is the most common

MAXTe21 avatar Apr 06 '24 15:04 MAXTe21

About my version information, I run '!pip list' code These (parts) appeared: keras 3.1.1 numpy 1.25.2 opencv-python 4.8.0.76 pip 23.1.2 pip-tools 6.13.0 python-apt 0.0.0 python-box 7.1.1 python-dateutil 2.8.2 python-louvain 0.16 python-slugify 8.0.4 python-utils 3.8.2 tensorboard-data-server 0.7.2 tensorflow 2.16.1 tensorflow-datasets 4.9.4 tensorflow-estimator 2.15.0 tensorflow-gcs-config 2.15.0 tensorflow-hub 0.16.1 tensorflow-io-gcs-filesystem 0.36.0 tensorflow-metadata 1.14.0 tensorflow-object-detection-api 0.1.1 tensorflow-probability 0.23.0 tensorstore 0.1.45

If you need any other module (library) version information, please tell me

MAXTe21 avatar Apr 06 '24 15:04 MAXTe21

This is the other part of the colab code that I use to get some files and modules

'' !git clone https://github.com/tensorflow/models.git '/content/drive/My Drive/5:30_models' '' and '' %%bash cd /content/drive/MyDrive/5:30_models/research/ protoc object_detection/protos/*.proto --python_out=. cp object_detection/packages/tf2/setup.py . python -m pip install . ''

MAXTe21 avatar Apr 06 '24 15:04 MAXTe21

Are you satisfied with the resolution of your issue? Yes No

google-ml-butler[bot] avatar Apr 06 '24 15:04 google-ml-butler[bot]

This is the other part of the colab code that I use to get some files and modules: '' !git clone https://github.com/tensorflow/models.git '/content/drive/My Drive/5:30_models' '' and : '' %%bash cd /content/drive/MyDrive/5:30_models/research/ protoc object_detection/protos/*.proto --python_out=. cp object_detection/packages/tf2/setup.py . python -m pip install . ''

MAXTe21 avatar Apr 06 '24 15:04 MAXTe21

I checked the relevant information on the Internet and the code that reported the same error, but I didn't find a good solution. I'm just a beginner and don't know much about these. I want to upload the tensorflow_models file I downloaded from github. I have changed the parameters of some files in it and prepared them for training, but the file is too large and the upload failed. I will provide any information you need about this project, please help me ,thank you!!! :)

MAXTe21 avatar Apr 06 '24 15:04 MAXTe21

Hi @MAXTe21 ,

Support for the older codebase has been discontinued. Could you kindly utilize the official Object Detection models provided by TensorFlow Model Garden.

Thanks.

laxmareddyp avatar Apr 08 '24 18:04 laxmareddyp

This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.

github-actions[bot] avatar Apr 16 '24 01:04 github-actions[bot]

hey MAXTe21 Please help me out if you have fixed this issue im exactly getting the same error when i try to train my model

SanjayDurai avatar Apr 18 '24 15:04 SanjayDurai

hey MAXTe21 Please help me out if you have fixed this issue im exactly getting the same error when i try to train my model

I solved it, but the method I used is not very good. After consulting a lot of online information, I found that this should be a version incompatibility problem, and no one told me how to solve it by modifying the source code of tensoflow, so I kept trying to re-download the version, and in jupyter notebook Use the conda virtual environment to keep retrying, and finally it succeeded, but I spent a lot of time, and to be honest, I don't know exactly how to solve it, I just kept retrying to download the version. For details, you can refer to this website https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/index.html I followed the steps above to download version 2.16.1 of tensorflow, then reinstalled it one by one according to its compatible versions, and finally started training successfully.

MAXTe21 avatar Apr 21 '24 15:04 MAXTe21