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

Train AnoGAN on pcam dataset in h5 format #18

Closed
tymsoncyferki opened this issue Apr 19, 2023 · 3 comments
Closed

Train AnoGAN on pcam dataset in h5 format #18

tymsoncyferki opened this issue Apr 19, 2023 · 3 comments

Comments

@tymsoncyferki
Copy link

Hi @A03ki,
I want to train f-anogan using pcam dataset. I have two questions:

  1. How should I edit the code/directory structure to get it to work with training files in h5 format?
  2. Will the code work with 96x96x3 images? (shape of one image when parsed to numpy array)

or maybe I have to generate jpgs myself and put them all in the folder?

Thanks

@A03ki
Copy link
Owner

A03ki commented Apr 20, 2023

Hi, @tymsoncyferki.
Thanks for using this repository.

  1. If you use the PCAM dataset, you can modify code as follows.

First, replace ImageFolder with PCAM in your_own_dataset.

# from torchvision.datasets import ImageFolder
from torchvision.datasets import PCAM

Next, change dataset = ImageFolder() to dataset = PCAM().

# dataset = ImageFolder(opt.train_root, transform=transform)
dataset = PCAM(opt.train_root, split="train", transform=transform,
               download=opt.force_download)

If the file is your_own_dataset/save_compared_images.py or test_anomaly_detection.py, replace split="train" with split="test"and opt.train_root with opt.test_root.

Then run the following command:

python train_wgangp.py "." -f
  1. Yes, it will work. It will resize 96x96x3 to 64x64x3. If you want to train models on 96x96x3 images, please include the following option --img_size 96.
python train_wgangp.py "." -f --img_size 96

I hope you will go well.

@tymsoncyferki
Copy link
Author

Thanks a lot.

Just wanted to say that every time I tried running python train_wgangp.py "." -f my computer crashed after couple of gigabytes downloaded. I guess it was a problem with memory leak. However I have downloaded PCAM manually, pasted it in pcam folder and I guess it's working:)

@A03ki
Copy link
Owner

A03ki commented Apr 21, 2023

I'm glad to hear that you managed to get it working!

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