YOLOv3v4-ModelCompression-MultidatasetTraining-Multibackbone icon indicating copy to clipboard operation
YOLOv3v4-ModelCompression-MultidatasetTraining-Multibackbone copied to clipboard

训练Dior遥感数据集,报错shape '[256, 128, 3, 3]' is invalid for input of size 37347

Open wagnzi opened this issue 3 years ago • 1 comments

训练命令是: python train.py --data data/dior.data --batch-size 4 --weights weights/yolov3-dior-best.weights -pt --cfg cfg/yolov3/yolov3-onDIOR.cfg --epochs 10 --img-size 608 报错: Traceback (most recent call last): File "train.py", line 956, in train(hyp) # train normally File "train.py", line 163, in train load_darknet_weights(model, weights, pt=opt.pt, BN_Fold=opt.BN_Fold, FPGA=opt.FPGA) File "/home/wjw/code/model-compress/yolov3/YOLOv3v4-ModelCompression-MultidatasetTraining-Multibackbone-master/models.py", line 629, in load_darknet_weights conv_w = torch.from_numpy(weights[ptr:ptr + num_w]).view_as(conv_layer.weight) RuntimeError: shape '[256, 128, 3, 3]' is invalid for input of size 37347

把训练命令里pt去掉后,就不会报错。pt的作用是什么尼

wagnzi avatar Sep 30 '20 06:09 wagnzi

-pt是在使用coco预训练模型的时候才使用的,如果你用训练好的模型不需要用-pt

SpursLipu avatar Oct 14 '20 13:10 SpursLipu