GithubHelp home page GithubHelp logo

Comments (14)

akanimax avatar akanimax commented on May 29, 2024

HI @jyopari,

Please check this repository which contains some examples for other datasets -> https://github.com/akanimax/pro_gan_pytorch-examples.

Also there is an ongoing issue which could be helpful for you. -> akanimax/pro_gan_pytorch-examples#2.

Please feel free to ask if you have any questions.

I know I am due writing a detailed document for the API usage 😄. Have just been busy with other work.
Hope this helps for now.

Best regards,
@akanimax

from pro_gan_pytorch.

jyopari avatar jyopari commented on May 29, 2024

from pro_gan_pytorch.

jyopari avatar jyopari commented on May 29, 2024

from pro_gan_pytorch.

akanimax avatar akanimax commented on May 29, 2024

Good to know that you got it to work 😄 👍. Yes, sure: GAN_GEN_SHADOW is the model which contains the stable weights for the Exponential Moving Averaging of the Generator parameters. OPTIM contains the adam optimizer state and 0 is a depth of (4_x_4) and 1 is a depth of (8_x_8). Please feel free to ask if you have any further questions.

Best regards,
@akanimax

from pro_gan_pytorch.

jyopari avatar jyopari commented on May 29, 2024

from pro_gan_pytorch.

jyopari avatar jyopari commented on May 29, 2024

from pro_gan_pytorch.

talvasconcelos avatar talvasconcelos commented on May 29, 2024

@akanimax or @jyopari, sorry to dig this up, i'm trying out this on a colab notebook and want to use it with my own dataset. I'm trying this to load my data:
`def setup_data():
"""
setup the CIFAR-10 dataset for training the CNN
:param batch_size: batch_size for sgd
:param num_workers: num_readers for data reading
:param download: Boolean for whether to download the data
:return: classes, trainloader, testloader => training and testing data loaders
"""
# data setup:

transforms = tv.transforms.ToTensor()

data = tv.datasets.ImageFolder(root=data_path,
                               transform=transforms)

trainset = th.utils.data.DataLoader(data, shuffle=True, num_workers=1)


return trainset`

but running the pro-gan gives an error:
`Starting the training process ...

Currently working on Depth: 0
Current resolution: 4 x 4

Epoch: 1

TypeError Traceback (most recent call last)
in ()
22 epochs=num_epochs,
23 fade_in_percentage=fade_ins,
---> 24 batch_sizes=batch_sizes
25 )
26 # ======================================================================

2 frames
/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py in _process_next_batch(self, batch)
606 raise Exception("KeyError:" + batch.exc_msg)
607 else:
--> 608 raise batch.exc_type(batch.exc_msg)
609 return batch
610

TypeError: Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/worker.py", line 99, in
samples = collate_fn([dataset[i] for i in batch_indices])
TypeError: 'DataLoader' object does not support indexing`

Is there any example to load a folder with images, that's what i have: dir1/dir2/10k images...

Thanks,
Tiago

from pro_gan_pytorch.

akanimax avatar akanimax commented on May 29, 2024

@talvasconcelos, Seems to me that you are not using the pyTorch's ImageFolder dataset properly. Could you please provide the complete error stack for this error?

from pro_gan_pytorch.

talvasconcelos avatar talvasconcelos commented on May 29, 2024

I've solved it, i was messing the depth for my image size, 4 instead of 6. Also i pulled the examples DataLoader module to load the images, it's working now. I get an error when setting loss='hinge', though, going with the default!

I just feel that i got better results from DCGAN... need to experiment more!

from pro_gan_pytorch.

akanimax avatar akanimax commented on May 29, 2024

@talvasconcelos, ProGAN definitely gives a lot better results than DCGAN at higher resolutions. Only caveat is that you need to set the progressive schedule (no. of epochs per resolution) very carefully. Otherwise, the whole training gets messed up. You could also try our new paper which addresses this caveat MSG-GAN. There is no hyperparameter tuning required and it is very easy to use.

Could you please share the error that you are receiving for loss = hinge? I'll address this in the next version of the package as well.

from pro_gan_pytorch.

talvasconcelos avatar talvasconcelos commented on May 29, 2024

Giving it another try, with longer training.
Trying now with parameters (using example form git):

depth = 6

num_epochs = [200, 200, 200, 300, 500, 300]
fade_ins = [50, 50, 50, 50, 50, 50]
batch_sizes = [256, 256, 256, 128, 64, 32]
latent_size = 256

Dataset = dl.FlatDirectoryImageDataset

dataset = Dataset(
    data_dir=data_path,
    transform=dl.get_transform()
)

print("total examples in training: ", len(dataset))

pro_gan.train(
    dataset=dataset,
    epochs=num_epochs,
    fade_in_percentage=fade_ins,
    batch_sizes=batch_sizes,
    feedback_factor=1,
    log_dir=f"{base_dir}/logs/",
    sample_dir=f"{base_dir}/images/",
    save_dir=f"{base_dir}/models/")

this is the error i get when i set loss='hinge':
`TypeError Traceback (most recent call last)
in ()
33 log_dir=f"{base_dir}/logs/",
34 sample_dir=f"{base_dir}/images/",
---> 35 save_dir=f"{base_dir}/models/", loss="hinge")
36
37 # :param loss: the loss function to be used

TypeError: train() got an unexpected keyword argument 'loss'`

Will definitely take a look at MSG-GAN, and try to run it on colab.

from pro_gan_pytorch.

ss32 avatar ss32 commented on May 29, 2024

also I tried the lfw.conf file, but i get this error. 'EasyDict' object has no attribute 'folder_distributed'

@jyopari how did you solve this?

from pro_gan_pytorch.

ss32 avatar ss32 commented on May 29, 2024

also I tried the lfw.conf file, but i get this error. 'EasyDict' object has no attribute 'folder_distributed'

@jyopari how did you solve this?

This is solved by adding a line to configs/mnist.conf

folder_distributed: False  # whether images are distributed among folders

from pro_gan_pytorch.

akanimax avatar akanimax commented on May 29, 2024

Closing due to inactivity. Cheers!

from pro_gan_pytorch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.