Skip to content

deeplab tensorflow model_test.py works fine, but import error in main.py #10077

@ox-prog

Description

@ox-prog

I would like to use deeplab on macOS Python 3.7. I have to install tensorflow v1.15 (due to deeplab compatibility problem).
I install tensorflow models and extract it to:
./PROJECT_NAME/venv/lib/python3.7/site-packages/tensorflow.

Now, I have read in tensorflow installation guide, that I should execute in terminal:

>>> $ pwd
>>> ./PROJECT_NAME/venv/lib/python3.7/site-packages/tensorflow/models/research
>>> $ export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim.

After that I test it from the same path: $ python deeplab/model_test.py and it works fine:

Ran 5 tests in 35.463s
OK (skipped=1)

PROBLEM: So, I would like to test it in my project in path PROJECT_NAME/main.py simple way:

from matplotlib import pyplot as plt
import cv2

from model import Deeplabv3

deeplab_model = Deeplabv3()

and $ python main.py gives me:

    from model import Deeplabv3
ModuleNotFoundError: No module named 'model'

I have already tried to move deeplab model folder to ./PROJECT_NAME/ and in another way move main.py to deeplab folder:

from deeplab import model # this way import
deeplab_model = Deeplabv3()
NameError: name 'Deeplabv3' is not defined

I researched model_test.py code and they import in another way, but in the example (in other github repo the same import I couldn't find what I'm doing wrong. I'm not very familiar in python. Thanks!

Metadata

Metadata

Labels

models:researchmodels that come under research directorytype:bugBug in the code

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions