Closed denverdash closed 4 years ago
I don't know the meaning of nID exactly, however, I modified code at multitracker.py.
(https://github.com/Zhongdao/Towards-Realtime-MOT/blob/master/tracker/multitracker.py#161)
self.model = Darknet(opt.cfg , nID=14455)
or
self.model = Darknet(opt.cfg) # default: nID = 0
size mismatch was solved.
14455
Thanks that fixed it!
@Zhongdao - I created a PR to fix this and a few other bugs I found: https://github.com/Zhongdao/Towards-Realtime-MOT/pull/122
I don't know the meaning of nID exactly, however, I modified code at multitracker.py. (https://github.com/Zhongdao/Towards-Realtime-MOT/blob/master/tracker/multitracker.py#161)
self.model = Darknet(opt.cfg , nID=14455)
orself.model = Darknet(opt.cfg) # default: nID = 0
size mismatch was solved.
Thank you @imchwan . It works for me.
I am getting the following error: builtins.RuntimeError: Error(s) in loading state_dict for Darknet: size mismatch for classifier.weight: copying a param with shape torch.Size([14455, 512]) from checkpoint, the shape in current model is torch.Size([30, 512]). size mismatch for classifier.bias: copying a param with shape torch.Size([14455]) from checkpoint, the shape in current model is torch.Size([30]).
It looks like the weights are not consistent with the model architecture. I noticed the weights are "jde." while the cfg is "yolov3" - is there a jde*.cfg I need to use?
The cfg I am using looks like: Namespace(cfg='cfg/yolov3_1088x608.cfg', conf_thres=0.5, input_video='../yolov3/videos/amazon-1088x608.mp4', iou_thres=0.5, min_box_area=200, nms_thres=0.4, output_format='video', output_root='./output/', track_buffer=30, weights='./models/jde.1088x608.uncertainty.pt')
The stack trace is: File "/home/denver/work/Towards-Realtime-MOT/demo.py", line 84, in
track(opt)
File "/home/denver/work/Towards-Realtime-MOT/demo.py", line 59, in track
save_dir=frame_dir, show_image=False, frame_rate=frame_rate)
File "/home/denver/work/Towards-Realtime-MOT/track.py", line 79, in eval_seq
tracker = JDETracker(opt, frame_rate=frame_rate)
File "/home/denver/work/Towards-Realtime-MOT/tracker/multitracker.py", line 164, in init
self.model.load_state_dict(torch.load(opt.weights, map_location='cpu')['model'], strict=False)
File "/home/denver/work/venvs/py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 830, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
builtins.RuntimeError: Error(s) in loading state_dict for Darknet: size mismatch for classifier.weight: copying a param with shape torch.Size([14455, 512]) from checkpoint, the shape in current model is torch.Size([30, 512]). size mismatch for classifier.bias: copying a param with shape torch.Size([14455]) from checkpoint, the shape in current model is torch.Size([30]).