Closed ginacode closed 2 years ago
This is the code I am using, by the way. I am trying to train on 1024x512 images.
import torch as th
import pro_gan_pytorch.PRO_GAN as pg
import matplotlib.pyplot as plt
import os
from torchvision import datasets, transforms
from PIL import Image, ImageChops
device = th.device("cuda" if th.cuda.is_available() else "cpu")
def setup_data():
dataset = datasets.ImageFolder(
root = 'total_intensity/',
transform = transforms.Compose([
transforms.Resize((512,512)),
transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)) ]))
return dataset
if __name__ == '__main__':
depth = 8
num_epochs = [50, 50, 50, 50, 50, 50, 50, 50]
fade_ins = [50, 50, 50, 50, 50, 50, 50, 50]
batch_sizes = [32, 32, 32, 32, 32, 32, 32, 32]
latent_size = 512
dataset = setup_data()
pro_gan = pg.ConditionalProGAN(num_classes=1, depth=depth,
latent_size=latent_size, device=device)
pro_gan.train(
dataset=dataset,
epochs=num_epochs,
fade_in_percentage=fade_ins,
batch_sizes=batch_sizes,
feedback_factor=2
)
@ginacode,
The network architecture unfortunately doesn't support images of different shapes like 1024 x 512
that you are using. Could you try padding the second dimension to 1024 to get square images with dimension equal to a power of 2 greater than 4?
Please let me know if you have any other problems.
cheers :beers:! @akanimax
I should be resizing the images to 512 x 512 before I run progan (see setup_data()).
When I run the progan using pytorch for GPU, I get:
But when I run it using pytorch for CPU only, it works but works very, very slowly. Any idea what could be causing this and is there any way I can work with GPU support?