PingoLH / FCHarDNet

Fully Convolutional HarDNet for Segmentation in Pytorch
MIT License
195 stars 52 forks source link

Errors in test.py #42

Open hona-p opened 4 years ago

hona-p commented 4 years ago

When I use this command to test I got error:

python test.py --model_path weights/hardnet70_cityscapes_model.pkl --dataset cityscapes --size 2048,1024 --input [input/a.jpg] --output [output]

The following error occurred. Please point out what needs to be fixed.

Error: Traceback (most recent call last): File "test.py", line 119, in test(args) File "test.py", line 36, in test device, model, loader = init_model(args) File "test.py", line 16, in init_model data_loader = get_loader("icboard") File "C:\Users\students\Desktop\rakuseki\seg\FCHarDNet-master\ptsemseg\loader__init__.py", line 27, in get_loader }[name] KeyError: 'icboard'

The weight files and input image files are located in the following paths. --model_path weights/hardnet70_cityscapes_model.pkl --input input/a.jpg]

SiftingSands commented 4 years ago

Replace icboard in line 16, data_loader = get_loader("icboard"), with whatever dataset you're running on. Or just use args.dataset instead of hard-coding it.

EchoAmor commented 4 years ago

@PingoLH @SiftingSands Hello,I met another problem when I run the test.py , my commonds like this:

--model_path ./weights/hardnet70_cityscapes_model_2.pkl --dataset cityscapes --input /media/echo/Echo/datasets/Cityscapes/leftImg8bit/test/berlin

but it keeps appearancing this error: Screenshot from 2020-08-18 11-02-19

do u know what's the problem is?thanks very much !!!

SiftingSands commented 4 years ago

Try "--input /media/echo/Echo/datasets/Cityscapes". That cityscapes dataloader is already making assumptions on your directory structure.

EchoAmor commented 4 years ago

@SiftingSands thanks I will try !

jfhauris commented 3 years ago

@SiftingSands @EchoAmor @PingoLH Hi, I am trying to use test.py to test a single (or couple of) images.
Can you share a typical test.py command line to do this? I am using the following but it is not working: python test.py --model_path '/home/arl/Documents/FCHARDNET/FCHarDNet-master/ptsemseg/models/hardnet.py' --dataset 'cityscapes' --input '/home/arl/Documents/FCHARDNET/FCHarDNet-master/test_image/index.jpeg' --output '/home/arl/Documents/FCHARDNET/FCHarDNet-master/test_image/index_output.jpeg' In particular what should the --model_path point to? hardnet.py? or the weights *.pkl? Also why does --dataset point to cityscapes if I am trying to test my own data?

I get the following error:

  File "test.py", line 122, in <module>
    test(args)
  File "test.py", line 39, in test
    device, model, loader = init_model(args)
  File "test.py", line 24, in init_model
    test_mode=True
  File "/home/arl/Documents/FCHARDNET/FCHarDNet-master/ptsemseg/loader/cityscapes_loader.py", line 82, in __init__
    self.images_base = os.path.join(self.root, "leftImg8bit", self.split)
  File "/home/arl/anaconda3/envs/rgbsemseg/lib/python3.6/posixpath.py", line 80, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType