thy960112 / MDBN

MIT License
15 stars 2 forks source link

KeyError: "No object named 'MDBN' found in 'arch' registry!" #1

Open AIisCool opened 9 months ago

AIisCool commented 9 months ago
$ python basicsr/test.py -opt options/test/MDBN/test_MDBN_x2.yml
C:\Python310\lib\site-packages\torchvision\transforms\functional_tensor.py:5: UserWarning: The torchvision.transforms.functional_tensor module is deprecated in 0.15 and will be **removed in 0.17**. Please don't rely on it. You probably just need to use APIs in torchvision.transforms.functional or in torchvision.transforms.v2.functional.
  warnings.warn(
Disable distributed.
Path already exists. Rename it to C:\MDBN-main\results\001_MDBN_x2_archived_20231009_203813
2023-10-09 20:38:13,476 INFO:
                ____                _       _____  ____
               / __ ) ____ _ _____ (_)_____/ ___/ / __ \
              / __  |/ __ `// ___// // ___/\__ \ / /_/ /
             / /_/ // /_/ /(__  )/ // /__ ___/ // _, _/
            /_____/ \__,_//____//_/ \___//____//_/ |_|
     ______                   __   __                 __      __
    / ____/____   ____   ____/ /  / /   __  __ _____ / /__   / /
   / / __ / __ \ / __ \ / __  /  / /   / / / // ___// //_/  / /
  / /_/ // /_/ // /_/ // /_/ /  / /___/ /_/ // /__ / /<    /_/
  \____/ \____/ \____/ \____/  /_____/\____/ \___//_/|_|  (_)

Version Information:
        BasicSR: 1.4.2
        PyTorch: 2.0.1+cu118
        TorchVision: 0.15.2+cu118
2023-10-09 20:38:13,476 INFO:
  name: 001_MDBN_x2
  model_type: SRModel
  scale: 2
  num_gpu: 1
  manual_seed: 2023
  datasets:[
    test_1:[
      name: Set5
      type: PairedImageDataset
      dataroot_gt: datasets/Set5/GTmod12
      dataroot_lq: datasets/Set5/LRbicx2
      io_backend:[
        type: disk
      ]
      phase: test
      scale: 2
    ]
  ]
  network_g:[
    type: MDBN
    num_in_ch: 3
    num_out_ch: 3
    num_feat: 64
    num_block: 6
    upscale: 2
    res_scale: 1.0
  ]
  path:[
    pretrain_network_g: experiments/pretrained_models/MDBN_x2.pth
    strict_load_g: True
    results_root: C:\MDBN-main\results\001_MDBN_x2
    log: C:\MDBN-main\results\001_MDBN_x2
    visualization: C:\MDBN-main\results\001_MDBN_x2\visualization
  ]
  val:[
    save_img: True
    suffix: None
    metrics:[
      psnr:[
        type: calculate_psnr
        crop_border: 4
        test_y_channel: ture
      ]
      ssim:[
        type: calculate_ssim
        crop_border: 4
        test_y_channel: ture
      ]
    ]
  ]
  dist: False
  rank: 0
  world_size: 1
  auto_resume: False
  is_train: False

2023-10-09 20:38:13,476 INFO: Dataset [PairedImageDataset] - Set5 is built.
2023-10-09 20:38:13,476 INFO: Number of test images in Set5: 2
Name MDBN is not found, use name: MDBN_basicsr!
Traceback (most recent call last):
  File "C:\MDBN-main\basicsr\test.py", line 45, in <module>
    test_pipeline(root_path)
  File "C:\MDBN-main\basicsr\test.py", line 35, in test_pipeline
    model = build_model(opt)
  File "C:\Python310\lib\site-packages\basicsr\models\__init__.py", line 26, in build_model
    model = MODEL_REGISTRY.get(opt['model_type'])(opt)
  File "C:\Python310\lib\site-packages\basicsr\models\sr_model.py", line 22, in __init__
    self.net_g = build_network(opt['network_g'])
  File "C:\Python310\lib\site-packages\basicsr\archs\__init__.py", line 22, in build_network
    net = ARCH_REGISTRY.get(network_type)(**opt)
  File "C:\Python310\lib\site-packages\basicsr\utils\registry.py", line 71, in get
    raise KeyError(f"No object named '{name}' found in '{self._name}' registry!")
KeyError: "No object named 'MDBN' found in 'arch' registry!"
thy960112 commented 9 months ago

I'm sorry I've been so busy lately that I'm just now seeing this issue. Our framework is based on BasicSR, and you need to put basicsr/archs/MDBN_arch.py into the corresponding archs folder and install the environment that way before executing the training or testing commands. For more on the registration problem, you can refer to the BasicSR documentation or search in the issues, I'm sure you'll get a lot more out of it.

thy960112 commented 8 months ago

can you explain " and you need to put basicsr/archs/MDBN_arch.py into the corresponding archs folder "?

You can see that under the basicsr folder in the BasicSR project, there is the archs folder, which is the location of the file models (e.g., our MDBN_arch.py). The registration mechanism of BasicSR is based on the path and filename, so you need to pay special attention to the path and filename.

CNlearnin commented 4 months ago

大佬,我想问一下对模型每做一次修改都必须重新安装basicsr吗

thy960112 commented 4 months ago

大佬,我想问一下对模型每做一次修改都必须重新安装basicsr吗

不是的哦,只需要安装一次就好了。但是如果需要对模型做修改的话,就不能使用 pip 安装 basicsr 的方式,而是按照使用手册里面说的第二种安装方式。

CNlearnin commented 4 months ago

@thy960112 十分感谢大佬,已经弄好了

Likc0510 commented 3 months ago

@thy960112 您好,我想请问一下论文中的Inference time 是如何计算的,没有找到相关的代码

thy960112 commented 3 months ago

@thy960112 您好,我想请问一下论文中的Inference time 是如何计算的,没有找到相关的代码

你好,我新上传了测试时间代码,只需要将 Your model 部分替换为你自己的模型,然后在 Settings 部分加载你自己模型的 .pth,就可以测试时间了