yu-changqian / TorchSeg

Fast, modular reference implementation and easy training of Semantic Segmentation algorithms in PyTorch.
MIT License
1.41k stars 253 forks source link

ModuleNotFoundError: No module named 'utils.pyt_utils' #118

Open artzimy opened 2 years ago

artzimy commented 2 years ago

Trying to run bash script.sh I got the following error

Traceback (most recent call last): File "train.py", line 17, in from dataloader import get_train_loader File "/media/D/users/Idan/Suha_Maryam/TorchSemiSeg-main/exp.voc/voc8.res50v3+.CPS/dataloader.py", line 8, in from utils.img_utils import generate_random_crop_pos, random_crop_pad_to_shape ModuleNotFoundError: No module named 'utils.img_utils' Traceback (most recent call last): File "eval.py", line 13, in from utils.pyt_utils import ensure_dir, link_file, load_model, parse_devices ModuleNotFoundError: No module named 'utils.pyt_utils'

Adding [to script.sh before import utils] PYTHONPATH="/TorchSemiSeg-main/furnace/"
Did not solve the problem

What could be the problem? Thanks Moran

Lingxuewang commented 1 year ago

You could try this: import sys sys.path.append('absolute path of you file: img_utils')

ChenShupan commented 1 year ago

I also encountered this problem when running the program. I tried your method and it didn't solve it. What is the specific reason? Is there a way to solve it?

ChenShupan commented 1 year ago

你可以试试这个:导入sys sys.path.append('你的文件的绝对路径:img_utils')

I also encountered this problem when running the program. I tried your method and it didn't solve it. What is the specific reason? Is there a way to solve it?