XPixelGroup / HAT

CVPR2023 - Activating More Pixels in Image Super-Resolution Transformer Arxiv - HAT: Hybrid Attention Transformer for Image Restoration
Apache License 2.0
1.2k stars 144 forks source link

No object named 'HATModel' found in 'model' registry!" #28

Open Univercp opened 1 year ago

Univercp commented 1 year ago

Hello,when I train my custom dataset ,it will happens like:

E4IAYU_8BB VW P{P{CC_6L

No object named 'HATModel' found in 'model' registry!"

how can I slove it.

chxy95 commented 1 year ago

https://github.com/XPixelGroup/HAT#installation

fanke123 commented 1 year ago

请问这个问题解决了吗,我匹配了requirement.txt还是会报这个错

rlaphoenix commented 1 year ago

You tried to use BasicSR code to run the model. You need to use the code from this specific repository.

chaishuhang commented 1 year ago

同样的问题

1144181135 commented 1 year ago

You tried to use BasicSR code to run the model. You need to use the code from this specific repository.

image I follow the installation from https://github.com/XPixelGroup/HAT#installation, and run the HAT/test.py, and then this bug appear. I cannot understand "use the code from this specific repository". How can I solve this problem? Thank you

chxy95 commented 1 year ago

This error occurs because there is a problem with the basicsr environment. The reason may be 1) the hat environment is not installed correctly (python setup.py develop is not implemented), referring to https://github.com/XPixelGroup/HAT#installation. 2) there are more than one basicsr existing in the current environment, and the wrong library is used.

xu1zhiyuan commented 1 year ago

Is it solved, please? I'm having the same issue too 请问解决了吗?我也遇到相同的问题了

xu1zhiyuan commented 1 year ago

You tried to use BasicSR code to run the model. You need to use the code from this specific repository.

image I follow the installation from https://github.com/XPixelGroup/HAT#installation, and run the HAT/test.py, and then this bug appear. I cannot understand "use the code from this specific repository". How can I solve this problem? Thank you

https://blog.csdn.net/qq_41620742/article/details/129267462

dkobayas-cyber commented 1 year ago

I'm having the same problem. When I run python setup.py develop, I get a long warning message like the one below at the beginning. @chxy95, do you think this is the root cause? II'm not sure if it helps, but I also attach the full messages on the terminal.

message-full.txt

depot/cfrueh/apps/env_hat/lib/python3.8/site-packages/setuptools/__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
!!

        ********************************************************************************
        Requirements should be satisfied by a PEP 517 installer.
        If you are using pip, you can try `pip install --use-pep517`.
        ********************************************************************************

!!
  dist.fetch_build_eggs(dist.setup_requires)
running develop
/depot/cfrueh/apps/env_hat/lib/python3.8/site-packages/setuptools/command/develop.py:40: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` and ``easy_install``.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://github.com/pypa/setuptools/issues/917 for details.
        ********************************************************************************

!!
  easy_install.initialize_options(self)
/depot/cfrueh/apps/env_hat/lib/python3.8/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
chxy95 commented 1 year ago

I am not certain if the reported error is due to the installation order of Pytorch and BasicSR environment. Generally, in a clean conda environment, I would install Pytorch first, then execute the hat environment installation. I have never encountered the error reported. If you have encountered similar issues and are certain that the installation process is correct, you may refer to the following blog to see if it can be resolved.

You tried to use BasicSR code to run the model. You need to use the code from this specific repository.

image I follow the installation from https://github.com/XPixelGroup/HAT#installation, and run the HAT/test.py, and then this bug appear. I cannot understand "use the code from this specific repository". How can I solve this problem? Thank you

https://blog.csdn.net/qq_41620742/article/details/129267462

dkobayas-cyber commented 1 year ago

@chxy95 Thanks for the link. If I understand correctly, I need to change the lines:

import hat.arch
import hat.data
import hat.models

into

from hat.models import *

Is my understanding correct? I'm not sure in which file I need to make this modification. Do I need to do it only in train.py and test.py? Any other code in which I need to make this modification?

By the way, I printed the MODEL_REGISTRY variable by:

from basicsr.utils.registry import MODEL_REGISTRY
print(MODEL_REGITSTRY._obj_map) 

and it shows:

{'SRModel': basicsr.models.sr_model.SRModel,
 'VideoBaseModel': basicsr.models.video_base_model.VideoBaseModel,
 'VideoRecurrentModel': basicsr.models.video_recurrent_model.VideoRecurrentModel,
 'VideoRecurrentGANModel': basicsr.models.video_recurrent_gan_model.VideoRecurrentGANModel,
 'SRGANModel': basicsr.models.srgan_model.SRGANModel,
 'VideoGANModel': basicsr.models.video_gan_model.VideoGANModel,
 'SwinIRModel': basicsr.models.swinir_model.SwinIRModel,
 'EDVRModel': basicsr.models.edvr_model.EDVRModel,
 'StyleGAN2Model': basicsr.models.stylegan2_model.StyleGAN2Model,
 'HiFaceGANModel': basicsr.models.hifacegan_model.HiFaceGANModel,
 'ESRGANModel': basicsr.models.esrgan_model.ESRGANModel

It seems like some models are successfully registered but not the HATModel for some reason...

chxy95 commented 1 year ago

@dkobayas-cyber The blog means to add the three modules to the system path.

dkobayas-cyber commented 1 year ago

@chxy95 I was misunderstanding something because of a mistranslation. The model works perfectly after the modifications. Thanks!