-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error about "Unexpected key(s) in state_dict: "w_junc", "w_heatmap" #85
Comments
Hi, when running Step 1, did you change any parameter in the config/train_detector.yaml file? In particular, did you keep the 'dynamic' policy for the junction and heatmap losses? |
Hi, I didn't change any parameter in the config/train_detector.yaml file. Here is my parameter in the train_detector.yaml [Model parameters]model_name: "lcnn_simple" Backbone related configbackbone: "lcnn" Junction decoder related configjunction_decoder: "superpoint_decoder" Heatmap decoder related configheatmap_decoder: "pixel_shuffle" Shared configurationsgrid_size: 8 Threshold of junction detectiondetection_thresh: 0.0153846 # 1/65 Threshold of heatmap detectionprob_thresh: 0.5 [Loss parameters]weighting_policy: "dynamic" [Heatmap loss]w_heatmap: 0. [Junction loss]w_junc: 0. [Training parameters]learning_rate: 0.0005 It seems that the policy for the junction and heatmap losses are 'dynamic' |
What is your torch version? It might just be a compatibility issue. Note that you can probably solve this issue with a quick fix: replace the lines 22 to 36 of |
Hi, thank you for your reply. I retrained the model and finished the step 1. The model seems to work. But when running step 2, error occurs: I used the wireframe datasets you provided and I check the './datasets/wireframe/train', there is no picture named '000000', can you give me some suggestions. Sorry to bother you. |
Hi, did you keep the fields 'gt_source_train' and 'gt_source_test' commented in |
Hi, thank you for your help. I finished step2. But when running step3, error occurs: Traceback (most recent call last): My pytorch version is 1.4.0. Sorry to bother you once again, can you give me some suggestions. |
Hi, I just pushed a small fix. Can you try again with the latest version of the code? |
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
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?
The text was updated successfully, but these errors were encountered: