简体   繁体   中英

ModuleNotFoundError: No module named 'lanenet_model' - Google Colab

I'm trying to use this repository for a lanenet implementation in google colab. After cloning the repository I'm want to test out the model by calling:

!python ./tools/test_lanenet.py --weights_path tusimple_lanenet.ckpt.data-00000-of-00001 --image_path test_img.jpg

I'm calling the file "test_lanenet.py" in the "tools" subfolder. This file tries to import another python file, which is in another subfolder (lanenet_model/lanenet.py) with:

from lanenet_model import lanenet

But then I get the Error

Traceback (most recent call last):
  File "./tools/test_lanenet.py", line 20, in <module>
    from lanenet_model import lanenet
ModuleNotFoundError: No module named 'lanenet_model'
  • every subfolder has an __init__.py file
  • I already tried to add the subfolders to the pythonpath - didn't work
  • When I print the Pythonpath, regardless of whether I print it in the colab command line or in the.py file, I see that I'm in the right folder (/content/lanenet-lane-detection)

Does anybody has an idea what I can do to fix the problem?

Here's the folder tree: lanenet folders

Try moving the.py file you want to run to the project root path, then run. such as

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM