Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inference code keyError #6

Closed
emredo opened this issue Jun 24, 2021 · 2 comments
Closed

Inference code keyError #6

emredo opened this issue Jun 24, 2021 · 2 comments

Comments

@emredo
Copy link

emredo commented Jun 24, 2021

(lanedet) emredo@emreninbilgisayari:~/lanedet$ python tools/detect.py configs/laneatt/resnet18_tusimple.py --img yol1.jpg --load_from /home/emredo/lanedet/work_dirs/TuSimple/20210623_163540_lr_3e-04_b_8/ckpt/best.pth --savedir ./savedimages

pretrained model: https://download.pytorch.org/models/resnet18-5c106cde.pth
Traceback (most recent call last):
File "tools/detect.py", line 84, in
process(args)
File "tools/detect.py", line 73, in process
detect.run(p)
File "tools/detect.py", line 47, in run
data = self.preprocess(data)
File "tools/detect.py", line 29, in preprocess
data = self.processes(data)
File "/home/emredo/lanedet/lanedet/datasets/process/process.py", line 35, in call
data = t(data)
File "/home/emredo/lanedet/lanedet/datasets/process/generate_lane_line.py", line 127, in call
line_strings_org = self.lane_to_linestrings(sample['lanes'])
KeyError: 'lanes'

Hi, when I try to use detect.py it gives an error which was given above. Why am I getting this error?
Thank you for repo and everything.

@Turoad
Copy link
Owner

Turoad commented Jun 24, 2021

Currently, you can try replace 'data = {'img': img}' by 'data = {'img': img, 'lanes': []}'.

     def preprocess(self, img_path):
         ori_img = cv2.imread(img_path)
         img = ori_img[self.cfg.cut_height:, :, :].astype(np.float32)
-        data = {'img': img}
+        data = {'img': img, 'lanes': []}
         data = self.processes(data)
         data['img'] = data['img'].unsqueeze(0)
         data.update({'img_path':img_path, 'ori_img':ori_img})

I will fix it at soon.

@emredo
Copy link
Author

emredo commented Jun 24, 2021

oh it worked, thanks a lot and also I appreciate for emergency answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants