Giter Site home page Giter Site logo

Comments (5)

kseuro avatar kseuro commented on May 29, 2024 4

@nassarofficial From the readme, do the following:

"To prep your own dataset, you will need to add it to datasets.py and modify the convenience dicts in utils.py (dset_dict, imsize_dict, root_dict, nclass_dict, classes_per_sheet_dict) to have the appropriate metadata for your dataset. Repeat the process in prepare_data.sh (optionally produce an HDF5 preprocessed copy, and calculate the Inception Moments for FID)."

You can see the modifications I made for my dataset in my original post. If your images are larger than 256x256, you'll have to modify the discriminator architecture accordingly.

from biggan-pytorch.

ajbrock avatar ajbrock commented on May 29, 2024

The architecture modifications should be sufficient, but I'm guessing you're not handling the dataset properly. Make sure the outputs of the dataset itself are actually single channel first (you'll probably also need to modify the dataloader transforms in utils.py, as those all use three-channel inputs for norm_mean and norm_std. I'm guessing that even though your PNGs are greyscale they might still be loaded by the ImageFolder dataset as three-channel images where all three channels are the same. Make sure your data is correct first!

Regardless, if you want to use the HDF5 you'll also need to make sure the HDF5 you're producing from your dataset has only 1 channel. These lines have a 3 in the channel dim for the max_shape and chunk args.

You might also consider training on the non-HDF5 version of the dataset to make sure you're loading single-channel images before producing the HDF5.

from biggan-pytorch.

kseuro avatar kseuro commented on May 29, 2024

Thanks for the quick response.

I've made the changes to the max_shape and chunks arguments and changed the data loader transforms in utils.py to norm_mean, norm_std = [0.5], [0.5].

I tried to check whether I'm actually loading single-channel images by running the non-HDF5 version by using the flag --dataset larcv_png in the launch script. The ImageFolder loads a numpy array of strings where each string is a full path to a training image. That is, imgs.shape: (400,2). The routine then fails at return transforms.functional.center_crop(img, min(img.size)) in utils.py with the message: TypeError: 'int' object is not iterable.

I'm apologize if I've missed something here but I am unsure of how to proceed.

from biggan-pytorch.

kseuro avatar kseuro commented on May 29, 2024

Update:

I changed the line:
path, target = self.transform(imgs[index][0]), imgs[index][1] in ImageFolder to
path, target = imgs[index][0], imgs[index][1]. This allows the PNG data to load as PIL images.

However, this change caused an error at for n, item in enumerate(items): in the progress function in utils.py. item is expected to be a torch tensor but is a PIL image instead. I found that this problem occurred because the image transforms were not being applied inside of the __getitem__ attribute in the ImageFolder class because this line is indented too far. I fixed the indent and the model began training.

Hope this is helpful and thank you so much for pointing me in the right direction!

from biggan-pytorch.

nassarofficial avatar nassarofficial commented on May 29, 2024

@kseuro how did you load your own dataset?

from biggan-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.