Tianxiaomo / pytorch-YOLOv4

PyTorch ,ONNX and TensorRT implementation of YOLOv4
Apache License 2.0
4.46k stars 1.49k forks source link

how to train the img with size of 1920*1080 #574

Open 1-etudiant opened 3 months ago

1-etudiant commented 3 months ago

if i want to train the image with size of 1920*1080,how to change the code

GeorgeTsio commented 3 months ago

Did you manage to run this inference? python models.py <namefile(optional)>

1-etudiant commented 3 months ago

Did you manage to run this inference? python models.py <namefile(optional)>

no,i want to train my model using images with size of 19201080,i changed my cfg.py,and the content that has been altered is:"Cfg.batch = 16,Cfg.width = 1920,Cfg.height = 1080".but it output error: Traceback (most recent call last): File "train.py", line 626, in train(model=model, File "train.py", line 379, in train bboxes_pred = model(images) File "/home/sh/miniconda3/envs/yolov5/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(input, **kwargs) File "/home/sh/pytorch-YOLOv4/tool/darknet2pytorch.py", line 179, in forward x = torch.cat((x1, x2), 1) RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 135 but got size 136 for tensor number 1 in the list.

GeorgeTsio commented 3 months ago

Did you manage to run this inference? python models.py <namefile(optional)>

no,i want to train my model using images with size of 19201080,i changed my cfg.py,and the content that has been altered is:"Cfg.batch = 16,Cfg.width = 1920,Cfg.height = 1080".but it output error: Traceback (most recent call last): File "train.py", line 626, in train(model=model, File "train.py", line 379, in train bboxes_pred = model(images) File "/home/sh/miniconda3/envs/yolov5/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(input, **kwargs) File "/home/sh/pytorch-YOLOv4/tool/darknet2pytorch.py", line 179, in forward x = torch.cat((x1, x2), 1) RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 135 but got size 136 for tensor number 1 in the list.

Please try to run first the recommended inferences with his examples to see if there are any mistakes in his model (because I found some, especially in yolov4.pth), then try your training

GeorgeTsio commented 1 month ago

if i want to train the image with size of 1920*1080,how to change the code

Did you manage to do it?