Error while loading pretrained model weights from `detectron2://ImageNetPretrained/MSRA/R-101.pkl` for training with custom dataset
hnanacc opened this issue · 0 comments
hnanacc commented
Hello authors, thanks for code.
I was trying to adapt the model to our custom dataset and faced the following issue.
Traceback (most recent call last):
File "models/adaptive_teacher/train_net.py", line 84, in <module>
args=(args,),
File "/no_backups/s1437/.pyenv/versions/adaptiveteacher/lib/python3.7/site-packages/detectron2/engine/launch.py", line 59, in launch
daemon=False,
File "/no_backups/s1437/.pyenv/versions/adaptiveteacher/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 199, in spawn
return start_processes(fn, args, nprocs, join, daemon, start_method='spawn')
File "/no_backups/s1437/.pyenv/versions/adaptiveteacher/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 157, in start_processes
while not context.join():
File "/no_backups/s1437/.pyenv/versions/adaptiveteacher/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 118, in join
raise Exception(msg)
Exception:
-- Process 0 terminated with the following error:
Traceback (most recent call last):
File "/no_backups/s1437/.pyenv/versions/adaptiveteacher/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 19, in _wrap
fn(i, *args)
File "/no_backups/s1437/.pyenv/versions/adaptiveteacher/lib/python3.7/site-packages/detectron2/engine/launch.py", line 94, in _distributed_worker
main_func(*args)
File "/misc/no_backups/s1437/DA-Multimodal-OD/models/adaptive_teacher/train_net.py", line 69, in main
trainer.resume_or_load(resume=args.resume)
File "/misc/no_backups/s1437/DA-Multimodal-OD/models/adaptive_teacher/adapteacher/engine/trainer.py", line 377, in resume_or_load
self.cfg.MODEL.WEIGHTS, resume=resume
File "/no_backups/s1437/.pyenv/versions/adaptiveteacher/lib/python3.7/site-packages/fvcore/common/checkpoint.py", line 229, in resume_or_load
return self.load(path, checkpointables=[])
File "/no_backups/s1437/.pyenv/versions/adaptiveteacher/lib/python3.7/site-packages/fvcore/common/checkpoint.py", line 158, in load
incompatible = self._load_model(checkpoint)
File "/misc/no_backups/s1437/DA-Multimodal-OD/models/adaptive_teacher/adapteacher/checkpoint/detection_checkpoint.py", line 28, in _load_model
incompatible = self._load_student_model(checkpoint)
File "/misc/no_backups/s1437/DA-Multimodal-OD/models/adaptive_teacher/adapteacher/checkpoint/detection_checkpoint.py", line 70, in _load_student_model
self._convert_ndarray_to_tensor(checkpoint_state_dict)
File "/no_backups/s1437/.pyenv/versions/adaptiveteacher/lib/python3.7/site-packages/fvcore/common/checkpoint.py", line 368, in _convert_ndarray_to_tensor
for k in list(state_dict.keys()):
AttributeError: 'NoneType' object has no attribute 'keys'
Configuration used:
_BASE_: "./Base-RCNN-C4.yaml"
MODEL:
META_ARCHITECTURE: "DAobjTwoStagePseudoLabGeneralizedRCNN"
WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl"
MASK_ON: False
RESNETS:
DEPTH: 101
PROPOSAL_GENERATOR:
NAME: "PseudoLabRPN"
PIXEL_MEAN: [87.0, 91.0, 95.0]
# RPN:
# POSITIVE_FRACTION: 0.25
ROI_HEADS:
NAME: "StandardROIHeadsPseudoLab"
LOSS: "CrossEntropy" # variant: "CrossEntropy"
NUM_CLASSES: 4 # this doesn't include background.
ROI_BOX_HEAD:
NAME: "FastRCNNConvFCHead"
NUM_FC: 2
POOLER_RESOLUTION: 7
SOLVER:
LR_SCHEDULER_NAME: "WarmupTwoStageMultiStepLR"
STEPS: (60000, 80000, 90000, 360000)
FACTOR_LIST: (1, 1, 1, 1, 1)
MAX_ITER: 100000
IMG_PER_BATCH_LABEL: 4
IMG_PER_BATCH_UNLABEL: 4
BASE_LR: 0.04
CHECKPOINT_PERIOD: 1000
DATALOADER:
SUP_PERCENT: 100.0
DATASETS:
CROSS_DATASET: True
TRAIN_LABEL: ("train_clear_day",) #voc_2012_train
TRAIN_UNLABEL: ("train_dense_fog_day",) #Clipart1k_train
TEST: ("test_clear_day",) #Clipart1k_test
SEMISUPNET:
Trainer: "ateacher"
BBOX_THRESHOLD: 0.8
TEACHER_UPDATE_ITER: 1
BURN_UP_STEP: 20000
EMA_KEEP_RATE: 0.9996
UNSUP_LOSS_WEIGHT: 1.0
SUP_LOSS_WEIGHT: 1.0
DIS_TYPE: "res4" #["concate","p2","multi"]
TEST:
EVAL_PERIOD: 1000
Please have look into it.