bingykang / Fewshot_Detection

Few-shot Object Detection via Feature Reweighting
https://arxiv.org/abs/1812.01866
526 stars 111 forks source link

Problem about loading weights in coco training #14

Closed lzhnb closed 4 years ago

lzhnb commented 4 years ago

I've prepare the coco dataset (I think it's not easy, i've get each image2class_flag txt and change many things, i spend a long time modifing the label_voc/_1.py to fit coco dataset), it may be work.

But now i met problem just in loading weights I run python train_meta.py cfg/metayolo.data cfg/darknet_dynamic.cfg cfg/reweighting_net.cfg darknet19_448.conv.23, but get:

/mnt/Disk1/liangzh/code/Fewshot_Detection_coco/data/coco.names
('save_interval', 2)
['airplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', 'chair', 'cow', 'dining table', 'dog', 'horse', 'motorcycle', 'person', 'potted plant', 'sheep', 'couch', 'train', 'tv']
('base_ids', [7, 9, 10, 11, 12, 13, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 59, 61, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79])
logging to backup/metayolo_novel0_neg1
('class_scale', 1)
Traceback (most recent call last):
  File "train_meta.py", line 87, in <module>
    model.load_weights(weightfile)
  File "/mnt/Disk1/liangzh/code/Fewshot_Detection_coco/darknet_meta.py", line 378, in load_weights
    start = load_conv_bn(buf, start, model[0], model[1])
  File "/mnt/Disk1/liangzh/code/Fewshot_Detection_coco/cfg.py", line 461, in load_conv_bn
    conv_model.weight.data.copy_(torch.from_numpy(buf[start:start+num_w])); start = start + num_w
RuntimeError: The size of tensor a (3) must match the size of tensor b (864) at non-singleton dimension 3

Thanks

infrontofme commented 4 years ago

@lzhnb Hi, how did you solve the problem, I met the same problem

bahulkark commented 4 years ago

@lzhnb @infrontofme Hey, did you solve this issue? How? I am getting this error, The size of tensor a (13) must match the size of tensor b (70980) at non-singleton dimension 3

MartinYYYYan commented 2 years ago

@lzhnb @bahulkark Hi, how did you solve the problem, I met the same problem

have you solved this problem? I met the same thing