jianzhangcs / panini

Panini-Net: GAN Prior based Degradation-Aware Feature Interpolation for Face Restoration, AAAI 2022 (PyTorch Code)
112 stars 13 forks source link

KeyError: "GLEAN: 'Panini_MFR is not in the model registry'"` #1

Closed GeorvityLabs closed 2 years ago

GeorvityLabs commented 2 years ago

Getting the following error , after executing :

!python demo/restoration_single_face_demo.py --config configs/panini_mfr.py --checkpoint checkpoint/panini_mfr_latest.pth --img_path examples/MFR/00001.png --save_path examples/MFR_result/00001.png ERROR LOG

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/mmcv/utils/registry.py", line 52, in build_from_cfg
    return obj_cls(**args)
  File "/content/mmediting/mmedit/models/restorers/srgan.py", line 51, in __init__
    self.generator = build_backbone(generator)
  File "/content/mmediting/mmedit/models/builder.py", line 31, in build_backbone
    return build(cfg, BACKBONES)
  File "/content/mmediting/mmedit/models/builder.py", line 22, in build
    return build_from_cfg(cfg, registry, default_args)
  File "/usr/local/lib/python3.7/dist-packages/mmcv/utils/registry.py", line 45, in build_from_cfg
    f'{obj_type} is not in the {registry.name} registry')
KeyError: 'Panini_MFR is not in the model registry'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "demo/restoration_single_face_demo.py", line 65, in <module>
    main()
  File "demo/restoration_single_face_demo.py", line 48, in main
    args.config, args.checkpoint, device=torch.device('cuda', args.device))
  File "/content/mmediting/mmedit/apis/matting_inference.py", line 31, in init_model
    model = build_model(config.model, test_cfg=config.test_cfg)
  File "/content/mmediting/mmedit/models/builder.py", line 60, in build_model
    return build(cfg, MODELS, dict(train_cfg=train_cfg, test_cfg=test_cfg))
  File "/content/mmediting/mmedit/models/builder.py", line 22, in build
    return build_from_cfg(cfg, registry, default_args)
  File "/usr/local/lib/python3.7/dist-packages/mmcv/utils/registry.py", line 55, in build_from_cfg
    raise type(e)(f'{obj_cls.__name__}: {e}')
KeyError: "GLEAN: 'Panini_MFR is not in the model registry'"

How can this be fixed?

GeorvityLabs commented 2 years ago

This is the colab notebook i made for testing , you can edit and send a fixed copy if you've found the fix

https://colab.research.google.com/drive/1IJ8OOqdNmj2_qxexwDiyoEoZ-mRoA3yC?usp=sharing

@jianzhangcs hope you can suggest how to resolve this issue.

zhangyunming commented 2 years ago

same question

jianzhangcs commented 2 years ago

1 Thank you for asking. I tested your colab notebook and found that it mistakenly called the original Models in the official MMEditing code when it called the newly registered Models in the panini folder. All you need to do is delete the official MMEditing folder after creating the environment. If you have any further questions, please let me know.

GeorvityLabs commented 2 years ago

@jianzhangcs , thanks for the clarification. Deleting the folder did fix that issue.