參考文章:https://gitmemory.com/issue/aim-uofa/AdelaiDet/235/731017126
出現原因
detectron2會不斷有一些更新,這就會導致BlendMask作者用的detectron2和我們自己裝的detectron2不完全一致,這就是報錯的原因,
解決方法
將BlendMask源代碼中train_net.py檔案第128行的build_detection_train_loader(cfg, mapper)修改為build_detection_train_loader(cfg, mapper=mapper),修改之后這一段代碼為:
def build_train_loader(cls, cfg):
"""
Returns:
iterable
It calls :func:`detectron2.data.build_detection_train_loader` with a customized
DatasetMapper, which adds categorical labels as a semantic mask.
"""
mapper = DatasetMapperWithBasis(cfg, True)
return build_detection_train_loader(cfg, mapper=mapper)
根據我的經驗,處理完這個問題之后后續還會有類似的報錯,如__init__() takes 1 positional argument but 4 were given等,暫時倒還沒有什么好的想法可以處理,
本來我已經放棄了跑BlendMask的,結果在評論區被追問出現__init__() takes 1 positional argument but 4 were given怎么辦,只好硬著頭皮研究了一下,,,
解決方法
將train_net.py第69行的super(DefaultTrainer, self).__init__(model, data_loader, optimizer)換成super(Trainer, self).__init__(cfg)即可,
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/236080.html
標籤:python
