yolov5-face icon indicating copy to clipboard operation
yolov5-face copied to clipboard

some issues when i use the pretrained models yolov5s-face.pt

Open Xiloy opened this issue 2 years ago • 0 comments

there are my paramters:

parser = argparse.ArgumentParser() parser.add_argument('--weights', type=str, default='weights/yolov5s-face.pt', help='initial weights path') parser.add_argument('--cfg', type=str, default='models/yolov5s.yaml', help='model.yaml path') parser.add_argument('--data', type=str, default='data/plate-face.yaml', help='data.yaml path')

others paramters are default.Then when i run train.py ,the error occurrs:(

**Starting training for 300 epochs...

 Epoch   gpu_mem       box       obj       cls  landmark     total   targets  img_size

0%| | 0/817 [00:00<?, ?it/s]/home/cxy/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/nn/functional.py:780: UserWarning: Note that order of the arguments: ceil_mode and return_indices will changeto match the args list in nn.MaxPool2d in a future release. warnings.warn("Note that order of the arguments: ceil_mode and return_indices will change" 0%| | 0/817 [00:02<?, ?it/s] Traceback (most recent call last): File "/home/cxy/PycharmProjects/yolov5-face-master/train.py", line 512, in train(hyp, opt, device, tb_writer, wandb) File "/home/cxy/PycharmProjects/yolov5-face-master/train.py", line 299, in train scaler.step(optimizer) # optimizer.step File "/home/cxy/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/cuda/amp/grad_scaler.py", line 338, in step retval = self._maybe_opt_step(optimizer, optimizer_state, *args, kwargs) File "/home/cxy/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/cuda/amp/grad_scaler.py", line 285, in maybe_opt_step retval = optimizer.step(*args, **kwargs) File "/home/cxy/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/optim/lr_scheduler.py", line 65, in wrapper return wrapped(*args, **kwargs) File "/home/cxy/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/optim/optimizer.py", line 88, in wrapper return func(*args, **kwargs) File "/home/cxy/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/home/cxy/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/optim/sgd.py", line 152, in step maximize=maximize,) File "/home/cxy/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/optim/functional.py", line 186, in sgd buf.mul(momentum).add(d_p, alpha=1 - dampening) RuntimeError: The size of tensor a (48) must match the size of tensor b (51) at non-singleton dimension 0

can you help me solve the problem? very apprciate to your apply...

By the way,when i use the same parameters above,and choose yolov5s.pt(NOT THE yolov5s-face.pt) as the pretrained model,no errors occurrs

Xiloy avatar Jun 12 '22 06:06 Xiloy