microsoft / SoftTeacher

Semi-Supervised Learning, Object Detection, ICCV2021
MIT License
904 stars 123 forks source link

KeyError: 'tag' #99

Open lws6885 opened 3 years ago

lws6885 commented 3 years ago

When I run "bash tools/dist_train.sh configs/soft_teacher/myconfig.py 1", error occured.

Traceback (most recent call last): File "/home/hefu/Downloads/SoftTeacher/tools/train.py", line 198, in main() File "/home/hefu/Downloads/SoftTeacher/tools/train.py", line 193, in main meta=meta, File "/home/hefu/Downloads/SoftTeacher/ssod/apis/train.py", line 206, in train_detector runner.run(data_loaders, cfg.workflow) File "/home/hefu/warehouse/app/anaconda3/envs/soft-teacher/lib/python3.6/site-packages/mmcv/runner/iter_based_runner.py", line 133, in run iter_runner(iter_loaders[i], kwargs) File "/home/hefu/warehouse/app/anaconda3/envs/soft-teacher/lib/python3.6/site-packages/mmcv/runner/iter_based_runner.py", line 60, in train outputs = self.model.train_step(data_batch, self.optimizer, kwargs) File "/home/hefu/warehouse/app/anaconda3/envs/soft-teacher/lib/python3.6/site-packages/mmcv/parallel/distributed.py", line 53, in train_step output = self.module.train_step(inputs[0], kwargs[0]) File "/home/hefu/Downloads/SoftTeacher/thirdparty/mmdetection/mmdet/models/detectors/base.py", line 238, in train_step losses = self(data) File "/home/hefu/warehouse/app/anaconda3/envs/soft-teacher/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(input, *kwargs) File "/home/hefu/warehouse/app/anaconda3/envs/soft-teacher/lib/python3.6/site-packages/mmcv/runner/fp16_utils.py", line 128, in new_func output = old_func(new_args, new_kwargs) File "/home/hefu/Downloads/SoftTeacher/thirdparty/mmdetection/mmdet/models/detectors/base.py", line 172, in forward return self.forward_train(img, img_metas, kwargs) File "/home/hefu/Downloads/SoftTeacher/ssod/models/soft_teacher.py", line 29, in forward_train kwargs.update({"tag": [meta["tag"] for meta in img_metas]}) File "/home/hefu/Downloads/SoftTeacher/ssod/models/soft_teacher.py", line 29, in kwargs.update({"tag": [meta["tag"] for meta in img_metas]}) KeyError: 'tag'

How can I fix it?

MendelXu commented 3 years ago

As I don't know what you have changed, I guess you have to add the dictionary ExtraAttrs in the pipeline.

lws6885 commented 3 years ago

As I don't know what you have changed, I guess you have to add the dictionary ExtraAttrs in the pipeline.

Thanks