SteveMacenski / jetson_nano_detection_and_tracking

Jetson Nano ML install scripts, automated optimization of robotics detection models, and filter-based tracking of detections
GNU Lesser General Public License v2.1
226 stars 66 forks source link

No module named 'tf_trt_models.tf_trt_models' #7

Closed kareemelzeftawy closed 5 years ago

kareemelzeftawy commented 5 years ago

Hello

I cloned your repository after that I executed the install script without any error after that I executed this python script: python3 tf_download_and_trt_model.py ssd_mobilenet_v2_coco

But I get this error: No module named 'tf_trt_models.tf_trt_models'

Can you help me, please!

SteveMacenski commented 5 years ago

did the install work without error? this would indicate the paths werent set up or you opened a new terminal without the updated bashrc file sourced

kareemelzeftawy commented 5 years ago

yes without error and I tried to open a new terminal now also the same reults

SteveMacenski commented 5 years ago

whats your PYTHONPATH

kareemelzeftawy commented 5 years ago

PYTHONPATH=$PYTHONPATH:/home/thingtrax/workspace/jetson_nano_detection_and_tracking/tf_trt_models/third_party/models/research:/home/thingtrax/workspace/jetson_nano_detection_and_tracking/tf_trt_models/third_party/models/research/slim

kareemelzeftawy commented 5 years ago

Capture Capture1

SteveMacenski commented 5 years ago

What is the output of echo $PYTHONPATH. I know what the code says from your first comment, but I need to know if it actually took hold or not. If you didn't run with sudo it might be that the bashrc file wasnt modified. Also check that the path is indeed correct.

I've bootstrapped a couple nanos this way already so I'm surprised to see issues

kareemelzeftawy commented 5 years ago

/home/thingtrax/workspace/caffe:/home/thingtrax/workspace/caffe::/home/thingtrax/workspace/jetson_nano_detection_and_tracking:/home/thingtrax/workspace/jetson_nano_detection_and_tracking/slim:/home/thingtrax/workspace/jetson_nano_detection_and_tracking:/home/thingtrax/workspace/jetson_nano_detection_and_tracking/data:/home/thingtrax/workspace/jetson_nano_detection_and_tracking/tf_trt_models/third_party/models/research:/home/thingtrax/workspace/jetson_nano_detection_and_tracking/tf_trt_models/third_party/models/research/slim:/home/thingtrax/workspace/jetson_nano_detection_and_tracking/tf_trt_models/third_party/models/research:/home/thingtrax/workspace/jetson_nano_detection_and_tracking/tf_trt_models/third_party/models/research/slim:/home/thingtrax/workspace/jetson_nano_detection_and_tracking/tf_trt_models/third_party/models/research:/home/thingtrax/workspace/jetson_nano_detection_and_tracking/tf_trt_models/third_party/models/research/slim:/home/thingtrax/workspace/jetson_nano_detection_and_tracking/tf_trt_models/third_party/models/research:/home/thingtrax/workspace/jetson_nano_detection_and_tracking/tf_trt_models/third_party/models/research/slim:/home/thingtrax/workspace/jetson_nano_detection_and_tracking/tf_trt_models/third_party/models/research:/home/thingtrax/workspace/jetson_nano_detection_and_tracking/tf_trt_models/third_party/models/research/slim:/home/thingtrax/workspace/jetson_nano_detection_and_tracking/tf_trt_models/third_party/models/research:/home/thingtrax/workspace/jetson$:/home/thingtrax/workspace/jetson_nano_detection_and_tracking/tf_trt_models/third_party/models/research:/home/thingtrax/workspace/jetson_nano_detection_and_tracking/tf_trt_models/third_party/models/research/slim:/home/thingtrax/workspace/jetson_nano_detection_and_tracking/tf_trt_models/third_party/models/research:/home/thingtrax/workspace/jetson_nano_detection_and_tracking/tf_trt_models/third_party/models/research/slim:/home/thingtrax/workspace/jetson_nano_detection_and_tracking/tf_trt_models/third_party/models/research:/home/thingtrax/workspace/jetson$

SteveMacenski commented 5 years ago

First off, you probably shouldn't have tried to install things that many times, you should clean up your environment. Second, assuming that path is valid and where you have placed it, this should work. Open a python terminal and start seeing where things are getting hung up. Unfortunately I can't fully just tell you what to do to fix it

Tdoe4321 commented 5 years ago

So, I think it's actually a bug. I just tried to do it and I believe your import structure is messed up. To fix, you just need to change the following in tf_download_and_trt_model.py: from "from tf_trt_models.tf_trt_models.detection import download_detection_model, build_detection_graph" to "from tf_trt_models.detection import download_detection_model, build_detection_graph"

If that's hard to tell the difference, all you do it take off the first "tf_trt_models" from the import statement.

SteveMacenski commented 5 years ago

I'm curious then, where are you trying to run the script from? I suppose I have all my bash scripts on top of this go to the workspace prior -- perhaps this is when you're trying to run it while not in the same directory?

Tdoe4321 commented 5 years ago

I've been running it from the root of your repo. The "jetson_nano_detection_and_tracking" directory.

SteveMacenski commented 5 years ago

Got it -- PRs are welcome. Not sure why its happy on my systems then but more than happy to resolve

SteveMacenski commented 5 years ago

10 merged

abouroubi commented 5 years ago

Sorry to reopen the issue, but I think this PR messed things up, the import scripts were correct the first time.

The install script clone the repo "tf_trt_models" inside the working directory, and looking at the cloned repo the download_detection_model and build_detection_graph are in a nested directory with the same name "tf_trt_models", which gives us this file structure

$ PWD/tf_trt_models/tf_trt_models/detection.py

Changing back import statements to

from tf_trt_models.tf_trt_models.detection import download_detection_model, build_detection_graph

did the trick for me, hope it helps

Tdoe4321 commented 5 years ago

I actually saw the same behavior when I was doing development on my laptop. I don't understand it, but on the Nano, the single tf_trt_models worked, but on the laptop, it required two. My first thought was a python 2 vs 3 thing, but I don't know.

SteveMacenski commented 5 years ago

Feel free to open a PR!

SteveMacenski commented 5 years ago

@Tdoe4321 I just added a commit which will try to import the tf_trt_models then try that 2x. That will let let it work in both cases, I hope that resolves!