Skip to content
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

Unable to execute OpenGraphAU #18

Open
TalBarami opened this issue Jul 30, 2023 · 2 comments
Open

Unable to execute OpenGraphAU #18

TalBarami opened this issue Jul 30, 2023 · 2 comments

Comments

@TalBarami
Copy link

Hey folks,
Thanks for this impressive work.
I couldn't execute the OpenGraphAU demo.py file, as the config file of the hybrid dataset is not included. I only need the inference phase on my dataset using your pre-trained model. Could you please elaborate on how to achieve it?

I really appreciate any help you can provide.
Tal

@altunenes
Copy link

Hello, I'm currently facing exactly the same issue right now for the OpenGraphAU. did you solve the problem?

regards,
enes.

@altunenes
Copy link

Okay I have fixed the problem, if anyone wants to run the demo.py file, here are the simple steps: :-)
the problem is mostly about the yaml.load() fn. This function requires specifying a Loader, which is a requirement in newer versions of PyYAML for some reasons.

To fix this issue, we should modify the yaml.load(f) calls in the conf.py for example:
change this

#previous:
datasets_cfg = yaml.load(f)

with this

# Updated line to use safe_load:
datasets_cfg = yaml.safe_load(f)

more precisely: (in conf.py)

def get_config():
    # args from argparser
    cfg = parser2dict()
    if cfg.dataset == 'BP4D':
        with open('config/BP4D_config.yaml', 'r') as f:
            datasets_cfg = yaml.safe_load(f)
            datasets_cfg = edict(datasets_cfg)

    elif cfg.dataset == 'DISFA':
        with open('config/DISFA_config.yaml', 'r') as f:
            datasets_cfg = yaml.safe_load(f)
            datasets_cfg = edict(datasets_cfg)

    elif cfg.dataset == 'hybrid':
        with open('config/hybrid_config.yaml', 'r') as f:
            datasets_cfg = yaml.safe_load(f)
            datasets_cfg = edict(datasets_cfg)
    else:
        raise Exception("Unknown Datasets:", cfg.dataset)

    cfg.update(datasets_cfg)
    return cfg

also you have to download following models and put them inside of the "checkpoints " (under the opengraph folder, Create it yourself (like in the original ME-GraphAU) as it is not currently provided.))

1- resnet50-19c8e357.pth
2- OpenGprahAU-ResNet50_first_stage.pth

so this command finally works on me: :-)

!python demo.py --arc resnet50 --stage 1 --exp-name demo --resume OpenGprahAU-ResNet50_first_stage.pth --input demo_imgs/1014.jpg --draw_text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants