0

Hello everyone I am trying to do object detection on custom data using TensorFlow in google colab, so I used the TensorFlow model zoo when I try to do the training using this code:

import os
!pip install tf_slim
%cd '/content/models/research/object_detection'
os.environ['PYTHONPATH'] += '/content/models/research/object_detection'
!python /content/models/research/object_detection/legacy/train.py --train_dir=training/ -- 
 pipeline_config_path=training/ssd_mobilenet_v1_pets.config --logtostderr

i got this error :

    Requirement already satisfied: tf_slim in /usr/local/lib/python3.6/dist-packages (1.1.0)
Requirement already satisfied: absl-py>=0.2.2 in /usr/local/lib/python3.6/dist-packages (from tf_slim) (0.10.0)
Requirement already satisfied: six in /usr/local/lib/python3.6/dist-packages (from absl-py>=0.2.2->tf_slim) (1.15.0)
/content/models/research/object_detection
WARNING:tensorflow:
The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
  * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
  * https://github.com/tensorflow/addons
  * https://github.com/tensorflow/io (for I/O related ops)
If you depend on functionality not listed there, please file an issue.

Traceback (most recent call last):
  File "/content/try/models/research/object_detection/legacy/train.py", line 53, in <module>
    from object_detection.builders import model_builder
  File "/usr/local/lib/python3.6/dist-packages/object_detection/builders/model_builder.py", line 35, in <module>
    from object_detection.models import faster_rcnn_inception_resnet_v2_feature_extractor as frcnn_inc_res
  File "/usr/local/lib/python3.6/dist-packages/object_detection/models/faster_rcnn_inception_resnet_v2_feature_extractor.py", line 28, in <module>
    from nets import inception_resnet_v2
  File "/usr/local/lib/python3.6/dist-packages/nets/__init__.py", line 5, in <module>
    from nets.autograd import Hook, Parameter
  File "/usr/local/lib/python3.6/dist-packages/nets/autograd/__init__.py", line 3, in <module>
    from .functional import *
  File "/usr/local/lib/python3.6/dist-packages/nets/autograd/functional.py", line 15, in <module>
    import nets.autograd.function as fc
AttributeError: module 'nets' has no attribute 'autograd'

i was thinking that maybe i didn't install everything in the models directory, but i used the setup.py and i run it.

I will be happy to get the answer from you, thank you

1 Answer 1

2

I encountered the same problem on local installation. This is because you probably did

pip install nets

This installs a wrong module named nets. What you should do is

pip uninstall nets

Then go to folder research/slim and remove the whole folder build. Then perform in this folder

python setup install

Then you shouldn't have this problem anymore since nets from slim folder was used.

On Windows I also needed PYTHONPATH environmental variable to be set to the research folder.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.