简体   繁体   中英

Error: object_detection.utils ModuleNotFoundError

I'm following this tutorial ( https://towardsdatascience.com/creating-your-own-object-detector-ad69dda69c85 ) to create my own object detector.

On the topic 'Generating TFRecords for training', whe i try run this code:

python generate_tfrecord.py --csv_input=images\train_labels.csv --image_dir=images\train --output_path=train.record

I got this error:

[...]
Traceback (most recent call last):
  File "generate_tfrecord.py", line 20, in <module>
    from object_detection.utils import dataset_util
ModuleNotFoundError: No module named 'object_detection'

My folder structure:

-generate_tfrecord.py
-images/
--test_labels.csv
--train_labels.csv
--test/
---*files*
--train/
---*files*

Check this:

  1. git clone

    https://github.com/tensorflow/models

  2. Go to folder "research". Open terminal: cd models-master/research

  3. (for 3.6python) python3.6 setup.py build

    (for 3.6python) sudo python3.6 setup.py install

  4. You'll see: " Finished processing dependencies for object-detection==0.1 "

Then do the follwing

Add Libraries to PYTHONPATH

When running locally, the tensorflow/models/research/ and slim directories should be appended to PYTHONPATH. This can be done by running the following from tensorflow/models/research/:

From tensorflow/models/research/

export PYTHONPATH=$PYTHONPATH: pwd : pwd /slim

Source Source2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM