RuntimeError: The expanded size of the tensor (44) must match the existing size (64) at non-singleton dimension 0. Target sizes: [44]. Tensor sizes: [64] #10
Firstly, I adjusted the configuration file according to the requirements and did 15+5 incremental learning. Then, I used Python tools/train_first_step. py -- config file="./configurations/e2e'faster_rcnnR_50-C4_1x. yaml" to complete the training of the basic model. However, when I used Python tools/train_increatual.py for incremental learning training, an error occurred:
Traceback (most recent call last):
File "tools/train_incremental.py", line 306, in
main()
File "tools/train_incremental.py", line 300, in main
model_target = train(cfg_source, logger_source, cfg_target, logger_target, distributed)
File "tools/train_incremental.py", line 182, in train
extra_checkpoint_data_source = checkpointer_source.load(cfg_source.MODEL.WEIGHT)
File "/home/dgp/code/maskrcnn-benchmark/maskrcnn_benchmark/utils/checkpoint.py", line 62, in load
self._load_model(checkpoint)
File "/home/dgp/code/maskrcnn-benchmark/maskrcnn_benchmark/utils/checkpoint.py", line 99, in _load_model
load_state_dict(self.model, checkpoint.pop("model"))
File "/home/dgp/code/maskrcnn-benchmark/maskrcnn_benchmark/utils/model_serialization.py", line 88, in load_state_dict
align_and_update_state_dicts(model_state_dict, loaded_state_dict)
File "/home/dgp/code/maskrcnn-benchmark/maskrcnn_benchmark/utils/model_serialization.py", line 55, in align_and_update_state_dicts
model_state_dict[key][:loaded_size[0]] = loaded_state_dict[key_old]
RuntimeError: The expanded size of the tensor (44) must match the existing size (64) at non-singleton dimension 0. Target sizes: [44]. Tensor sizes: [64]
How can I solve this problem? @CanPeng123
Firstly, I adjusted the configuration file according to the requirements and did 15+5 incremental learning. Then, I used Python tools/train_first_step. py -- config file="./configurations/e2e'faster_rcnnR_50-C4_1x. yaml" to complete the training of the basic model. However, when I used Python tools/train_increatual.py for incremental learning training, an error occurred: Traceback (most recent call last): File "tools/train_incremental.py", line 306, in
main()
File "tools/train_incremental.py", line 300, in main
model_target = train(cfg_source, logger_source, cfg_target, logger_target, distributed)
File "tools/train_incremental.py", line 182, in train
extra_checkpoint_data_source = checkpointer_source.load(cfg_source.MODEL.WEIGHT)
File "/home/dgp/code/maskrcnn-benchmark/maskrcnn_benchmark/utils/checkpoint.py", line 62, in load
self._load_model(checkpoint)
File "/home/dgp/code/maskrcnn-benchmark/maskrcnn_benchmark/utils/checkpoint.py", line 99, in _load_model
load_state_dict(self.model, checkpoint.pop("model"))
File "/home/dgp/code/maskrcnn-benchmark/maskrcnn_benchmark/utils/model_serialization.py", line 88, in load_state_dict
align_and_update_state_dicts(model_state_dict, loaded_state_dict)
File "/home/dgp/code/maskrcnn-benchmark/maskrcnn_benchmark/utils/model_serialization.py", line 55, in align_and_update_state_dicts
model_state_dict[key][:loaded_size[0]] = loaded_state_dict[key_old]
RuntimeError: The expanded size of the tensor (44) must match the existing size (64) at non-singleton dimension 0. Target sizes: [44]. Tensor sizes: [64]
How can I solve this problem? @CanPeng123