Fem
Fem

Reputation: 23

No module named 'object_detection'

I downloaded Tensorflow object_detection API. I was able to run the tutorial and see the results.

However, while I want to train my own data, i have an error here at this code:

python3 train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_pets.config

The error will came out as below:

Traceback (most recent call last): File "train.py", line 49, in from object_detection.builders import dataset_builder ModuleNotFoundError: No module named 'object_detection'

Here the code snippet from train.py:

import functools 
import json
import os
import tensorflow as tf 

from object_detection.builders import dataset_builder
from object_detection.builders import graph_rewriter_builder
from object_detection.builders import model_builder
from object_detection.legacy import trainer
from object_detection.utils import config_util

Info:

I'm using Tensorflow 1.10 and Windows 10

Note

I run this code however it didn't work for me.

set PYTHONPATH=$PYTHONPATH:pwd:pwd/slim

Upvotes: 0

Views: 3639

Answers (1)

Jitesh Malipeddi
Jitesh Malipeddi

Reputation: 2385

You can try the following steps. Change to the object detection directory, activate your virtualenv and then do the following

export PYTHONPATH=$PYTHONPATH:home/<username>/<path>/models/research
export PYTHONPATH=$PYTHONPATH:home/<username>/<path>/models
export PYTHONPATH=$PYTHONPATH:home/<username>/<path>/research/slim
PATH=$PATH:$PYTHONPATH

cd .. (Make sure you are now in the research directory)
python setup.py build
python setup.py install

Now change to the object_detection directory and try the train.py command again. Hope this helps you out. Let me know in case you face any issues.

Upvotes: 1

Related Questions