TensorfFlow Object-detection API - ModuleNotFoundError: No module named 'object_detection'

installed properly (following instructions https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html) on MACos, still I keep getting this MNFE when running a script;

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

anyone else facing the same issue? Found a lot on windows, not for mac.

Upvotes: 0

Views: 452

Answers (1)

Nicolas Gervais
Nicolas Gervais

Reputation: 36624

Use these lines at the very beginning of your script:

import sys
sys.path.extend([
r'path\to\models\research\object-detection',
r'path\to\models\research\tf_slim',
r'path\to\models\research',
r'path\to\models',
])

These must be ran before this line:

from object_detection.utils import dataset_util, label_map_util

Upvotes: 1

Related Questions