KaiyangZhou / Dassl.pytorch

A PyTorch toolbox for domain generalization, domain adaptation and semi-supervised learning.
MIT License
1.23k stars 171 forks source link

Issue with FixMatch training on customs datasets #51

Closed ghost closed 1 year ago

ghost commented 2 years ago

Hello, I am having trouble training FixMatch with custom datasets. I got this error: input_x2 = batch_x["img2"] KeyError: 'img2.

As part of the config/trainer files, I set K_TRANSFORMS to 2. When DatasetWrapper.getitem() is called, it returns one image.

KaiyangZhou commented 2 years ago

what's the command to reproduce the error?

ghost commented 1 year ago

I just use your fixmatch implementation with dassl and integrated in my code. The same implementation for cdac.py worked for me like that input_x = batch_x["img"][0] but the fixmmatch did not.

KaiyangZhou commented 1 year ago

I'm a bit rusty on the part where this error could be triggered. I'd suggest you take a look at this code https://github.com/KaiyangZhou/Dassl.pytorch/blob/master/dassl/data/data_manager.py#L220 where you might find the answer. Thanks

ghost commented 1 year ago

I think I've figured out the problem. I set DATALOADER.K_TRANSFORMS = 2, but it should be DATALOADER.K_TRANSFORMS = 1. Thank you for your help.