Open Yassine-Fak opened 3 years ago
My guess would be compatibility issue with apex. If you don't need fp16 training, I would suggest that you eliminate all the apex related code. https://github.com/jingtianyilong/YOLOv4-pytorch/blob/8a74bec5fac1438b3795edfc7cb78a1f96ab3b17/train.py#L22 https://github.com/jingtianyilong/YOLOv4-pytorch/blob/8a74bec5fac1438b3795edfc7cb78a1f96ab3b17/train.py#L143 https://github.com/jingtianyilong/YOLOv4-pytorch/blob/8a74bec5fac1438b3795edfc7cb78a1f96ab3b17/train.py#L166-L169
Hello! First of all, I want to thank you for this repository. Very good job man!!!! I am working in Ubuntu 20 and I have a GPU. While training the model, I got the following error:
Traceback (most recent call last): File "train.py", line 292, in
Trainer(log_dir,resume=args.resume, fine_tune=args.fine_tune).train()
File "train.py", line 202, in train
coco_stat = evaluator.evaluate(self.yolov4)
File "/home/yfakihani/projects/object_detection/yolov4_pytorch/first_repo_jingtianyilong/YOLOv4-pytorch/eval/cocoapievaluator.py", line 66, in evaluate
,outputs = model(img)
File "/home/yfakihani/anaconda3/envs/yolo_v4_torch/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, kwargs)
File "/home/yfakihani/projects/object_detection/yolov4_pytorch/first_repo_jingtianyilong/YOLOv4-pytorch/model/build_model.py", line 40, in forward
x_s, x_m, x_l = self.__yolov4(x)
File "/home/yfakihani/anaconda3/envs/yolo_v4_torch/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, *kwargs)
File "/home/yfakihani/projects/object_detection/yolov4_pytorch/first_repo_jingtianyilong/YOLOv4-pytorch/model/YOLOv4.py", line 226, in forward
features = self.panet(features) # TO FIX
File "/home/yfakihani/anaconda3/envs/yolo_v4_torch/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(input, kwargs) File "/home/yfakihani/projects/object_detection/yolov4_pytorch/first_repo_jingtianyilong/YOLOv4-pytorch/model/YOLOv4.py", line 138, in forward downstream_feature4 = self.downstream_conv4(torch.cat([features[1], self.resample5_4(downstream_feature5)], dim=1)) File "/home/yfakihani/anaconda3/envs/yolo_v4_torch/lib/python3.7/site-packages/apex/amp/wrap.py", line 85, in wrapper return orig_fn(cast_seq, *args, **kwargs) RuntimeError: Sizes of tensors must match except in dimension 2. Got 26 and 25 (The offending index is 0)
I think that the problem is related to the function
forward
in the YOLOv4.py file. Please, can you help me to fix this? I'm really stuck on this I thank you in advance for your help