KaiyangZhou / mixstyle-release

Domain Generalization with MixStyle (ICLR'21)
MIT License
268 stars 39 forks source link

I can't run this code #11

Closed PPJ001 closed 2 years ago

PPJ001 commented 2 years ago

I'm following the readme, and I get an error: FileNotFoundError: [Errno 2] No such file or directory:'/pub/data/cuiby/yjworkspace/Dassl.pytorch/data/office_home_dg/art/train' [Errno 2] No such file or directory: '/pub/data/cuiby/yjworkspace/Dassl.pytorch/data/office_home_dg/clipart/train'

I can't find the instructions for that anywhere

PPJ001 commented 2 years ago

What I want to implement is MixStyle, the DG part.

KaiyangZhou commented 2 years ago

Can you give more details? Like what steps you took and which commands led to the error?

PPJ001 commented 2 years ago

I think there may be a problem with the partition of the data set. I directly put office-Home into the data directory, but the error seems to be because there is no training set and verification set, AND I don't know how to solve it. When running this command: bash dg. Sh office_home_dg resnet18_MS_l123 random.

Console output: Collecting env info... "And started reporting errors

KaiyangZhou commented 2 years ago

Did you download and prepare the datasets following this https://github.com/KaiyangZhou/Dassl.pytorch/blob/master/DATASETS.md?

Also, it'd be helpful if you can show the entire log (at least include the lines showing where the error happens)

PPJ001 commented 2 years ago

I used the data set you provided, Office-home-DG. I don't know how your data set is divided. The code is already running properly

PPJ001 commented 2 years ago

I would like to ask if this is the result of the completed test. Or do you need to use this model to test the effect a658afc4f6b4035e4d9ff8c35c3658f

KaiyangZhou commented 2 years ago

Great to see it working.

I would like to ask if this is the result of the completed test. Or do you need to use this model to test the effect

Yes, the results are obtained on the test set using the model learned at the last step.

I notice you are using ResNet+MixStyle. For Office-Home, MixStyle works better with resnet18_ms_l12 while for PACS, MixStyle works the best with resnet18_ms_l123.

In general, I'd suggest adding MixStyle to two shallow layers, like resnet18_ms_l12, which works well across various datasets.

PPJ001 commented 2 years ago

Thank you very much for your reply. I'm going to try what you said for the Office-home dataset.

I would like to know how to find the optimal result. I found epoch=50 in the code. What can be improved about the setting of hyperparameters? For example, how do you avoid underfitting or overfitting.

I find that your code will continue to run without terminating, I wonder why this problem occurs

KaiyangZhou commented 2 years ago

I find that your code will continue to run without terminating, I wonder why this problem occurs

The training will stop once the maximum epoch is reached.