Models: ImportError: cannot import name 'mobilenet_v3'

Created on 5 Nov 2019  路  8Comments  路  Source: tensorflow/models

I am experiencing an issue when i test object detection or when i train

this error keeps occuring:
Traceback (most recent call last):
File "object_detection/builders/model_builder_test.py", line 23, in
from object_detection.builders import model_builder
File "/root/dia/tensorflow/models/research/object_detection/builders/model_builder.py", line 56, in
from object_detection.models.ssd_mobilenet_v3_feature_extractor import SSDMobileNetV3LargeFeatureExtractor
File "/root/dia/tensorflow/models/research/object_detection/models/ssd_mobilenet_v3_feature_extractor.py", line 25, in
from nets.mobilenet import mobilenet_v3
ImportError: cannot import name 'mobilenet_v3'

i have no problem with path or anything
cuda version : CUDA Version 9.0.176
tensorflow version 1.12 and 1.14 (tried with both)
python version (3.5,3.6,3.7) tried them all

research support

All 8 comments

Same here. Using TF.1.13.1

Have it fixed. Check your PYTHONPATH

Have it fixed. Check your PYTHONPATH
i checked and everything alright
its not the first installation of object detection api i make
this is weird this time

i guess it's due to the last commit of 15-october

i fixed that error by git checkout "ID"
ID of the commit before adding mobilenet_v3
now it works perfectly

So may I ask that how did you fix that?

i fixed that error by git checkout "ID"
ID of the commit before adding mobilenet_v3
now it works perfectly
can you explain more, what do you mean with gut checkout 'ID' ?

For future readers, I've faced the same problem. Turns out it's because the nets folder is probably outdated In the version you're using.
A quick workaround is to download the latest version of TensorFlow models.
https://github.com/tensorflow/models
then copy contents of "/models/research/slim/nets/mobilenet" from the latest version to your project directory following a similar path, must be "/models/research/slim/nets/mobilenet" again. Just replace the files when prompted, and you've gotta build slim after this copy.

in the folder dir "~/model/research/slim"
python setup.py build
python setup.py install

Worked like a charm for me.
PS: Also make sure your PYTHONPATHs are all good.

Was this page helpful?
0 / 5 - 0 ratings