Bobholamovic / CDLab

Yet another repository for developing and benchmarking deep learning-based change detection methods.
The Unlicense
196 stars 30 forks source link

请问有什么办法增加建筑物变化检测的泛化能力吗 #37

Open funny000 opened 9 months ago

funny000 commented 9 months ago

现在想到一种方法是合并levir-cd数据和whu-building cd数据,用于训练变检模型,这种办法可行吗? 另外您写的模型训练怎么设置单机多卡训练的?

Bobholamovic commented 9 months ago

你好!

  1. 扩充数据集是一种常用的方法,我认为这在一定程度上可以提升训练出来的模型的泛化能力。
  2. 这个repo只支持单机单卡训练~
funny000 commented 9 months ago

好的,了解了, 另外我想保存网络+权重这样的文件,在train.py文件的trainer后面加了些语句,但是报错了,是哪里没写对吗 `args = parse_args(parser_configurator) trainer = RTrainer_switcher

print(trainer.model) p2vnet = trainer.model model_dir = "model_best_p2vnet.pth" state = torch.load(model_dir) p2vnet.load_state_dict(state) torch.save(p2vnet, "p2vnet.pth") exit(1)`

Bobholamovic commented 9 months ago

具体是什么错误呢

funny000 commented 9 months ago

image

报错信息是missing key(s) in state_dict:

funny000 commented 9 months ago

加载权重后,用模型的load_state_dict方法加载权重参数进模型,有不匹配的key

Bobholamovic commented 9 months ago

看起来model_best_p2vnet.pth中的内容和trainer.model并不匹配,所以不能直接加载~建议把trainer.model的state dict的key也打印出来,对比看看