CanPeng123 / Faster-ILOD

47 stars 7 forks source link

The size of tensor a (16) must match the size of tensor b (21) at non-singleton dimension 0 #6

Closed chenfangchenf closed 2 years ago

chenfangchenf commented 2 years ago

when I run 'train_incremental.py',the following error occurred: `195 maskrcnn_benchmark_target_model.trainer INFO: Start training voc.py | incremental train | object category belongs to old categoires: bottle voc.py | incremental train | object category belongs to old categoires: person voc.py | incremental train | object category belongs to old categoires: bottle voc.py | incremental train | object category belongs to old categoires: person voc.py | incremental train | object category belongs to old categoires: person Traceback (most recent call last): File "/home/chenfang/maskrcnn-benchmark/tools/train_incremental.py", line 314, in main() File "/home/chenfang/maskrcnn-benchmark/tools/train_incremental.py", line 308, in main model_target = train(cfg_source, logger_source, cfg_target, logger_target, distributed) File "/home/chenfang/maskrcnn-benchmark/tools/train_incremental.py", line 209, in train device, checkpoint_period, arguments_source, arguments_target, summary_writer) File "/home/chenfang/maskrcnn-benchmark/tools/train_incremental.py", line 121, in do_train optimizer.step() # update learning rate File "/home/chenfang/anaconda3/envs/maskrcnn_copy/lib/python3.7/site-packages/torch/optim/lr_scheduler.py", line 67, in wrapper return wrapped(*args, *kwargs) File "/home/chenfang/anaconda3/envs/maskrcnn_copy/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 15, in decorate_context return func(args, **kwargs) File "/home/chenfang/anaconda3/envs/maskrcnncopy/lib/python3.7/site-packages/torch/optim/sgd.py", line 106, in step buf.mul(momentum).add_(d_p, alpha=1 - dampening) RuntimeError: The size of tensor a (16) must match the size of tensor b (21) at non-singleton dimension 0

Process finished with exit code 1 ` How can I solve this mistake,Can anyone help me?

Xuxiaoxiaohaha commented 3 months ago

Do you remember how to deal with it? I met the same problem...