Skip to content

Error about "Unexpected key(s) in state_dict: "w_junc", "w_heatmap" #85

@GGshmily

Description

@GGshmily

Hi, I completed the step1 and got my trained model. During step2, I commented gt_source_train and gt_source_test and disable the photometric and homographic augmentations , but error occur:

python -m sold2.experiment --exp_name wireframe_train --mode export --resume_path experiments/sold2_synth/ --model_config sold2/config/train_detector.yaml --dataset_config sold2/config/wireframe_dataset.yaml --checkpoint_name checkpoint-epoch199-end.tar --export_dataset_mode train --export_batch_size 4
[Info] Export mode
Output path: ./datasets/export_datasets/wireframe_train
[Info] Export predictions with homography adaptation.
Initializing dataset and dataloader
[Info] Initializing wireframe dataset...
Found filename cache wireframe_train_cache.pkl at ./datasets/wireframe
Load filename cache...
[Info] Successfully initialized dataset
Name: wireframe
Mode: train
Gt: /media/cqw/KESU/SOLD2/datasets/synthetic_shapes/synthetic_shape_train.h5
Counts: 20000

     Successfully intialized dataset and dataloader.
    --------Initializing model----------
    Model architecture: simple
    Backbone: lcnn
    Junction decoder: superpoint_decoder
    Heatmap decoder: pixel_shuffle
    -------------------------------------

Traceback (most recent call last):
File "/media/cqw/KESU/SOLD2/sold2/export.py", line 23, in restore_weights
model.load_state_dict(state_dict)
File "/home/cqw/anaconda3/envs/SOLD2/lib/python3.6/site-packages/torch/nn/modules/module.py", line 769, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for SOLD2Net:
Unexpected key(s) in state_dict: "w_junc", "w_heatmap".

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/cqw/anaconda3/envs/SOLD2/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/home/cqw/anaconda3/envs/SOLD2/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/media/cqw/KESU/SOLD2/sold2/experiment.py", line 227, in
export_dataset_mode=args.export_dataset_mode, device=device)
File "/media/cqw/KESU/SOLD2/sold2/experiment.py", line 116, in main
export(args, dataset_cfg, model_cfg, output_path, export_dataset_mode, device=device)
File "/media/cqw/KESU/SOLD2/sold2/experiment.py", line 92, in export
export_dataset_mode, device)
File "/media/cqw/KESU/SOLD2/sold2/export.py", line 158, in export_homograpy_adaptation
model = restore_weights(model, checkpoint["model_state_dict"])
File "/media/cqw/KESU/SOLD2/sold2/export.py", line 27, in restore_weights
missing_keys = err.missing_keys
AttributeError: 'NoneType' object has no attribute 'missing_keys'

I dont know how to solve it, can you give me some suggestion?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions