Git Product home page Git Product logo

Comments (4)

carshadi avatar carshadi commented on July 2, 2024 14

You just need to add a few lines to data_loader.py and parameter.py

For data_loader.py just specify a custom loader function as well as a data path. The data can simply be a directory of jpegs or whatever. Just place the data in ./data/custom/custom as it will look in the innermost directory for the actual image files.

    def load_custom(self):
        transforms = self.transform(True, True, True, False) # last arg is crop
        dataset = dsets.ImageFolder(self.path+'/custom', transform=transforms)
        return dataset


    def loader(self):
        if self.dataset == 'lsun':
            dataset = self.load_lsun()
        elif self.dataset == 'celeb':
            dataset = self.load_celeb()
        elif self.dataset == 'custom': 
            dataset = self.load_custom()

        loader = torch.utils.data.DataLoader(dataset=dataset,
                                              batch_size=self.batch,
                                              shuffle=self.shuf,
                                              num_workers=2,
                                              drop_last=True)
        return loader

In the parameter.py file just add the name of your dataset to choices=['lsun', 'celeb', 'custom'] in line 38

from self-attention-gan.

cscss avatar cscss commented on July 2, 2024

i have the same problem. I change the path to a new dataset. I get error but I can't figure it out.

from self-attention-gan.

fanage avatar fanage commented on July 2, 2024

You just need to add a few lines to data_loader.py and parameter.py

for data_loader.py just specify a custom loader function as well as a data path. The data can simply be a directory of jpegs or whatever. Just place the data in ./data/custom/custom as it will look in the innermost directory for the actual image files

def load_custom(self):
    transforms = self.transform(True, True, True, False) # last arg is crop
    dataset = dsets.ImageFolder(self.path+'/custom', transform=transforms)
    return dataset


def loader(self):
    if self.dataset == 'lsun':
        dataset = self.load_lsun()
    elif self.dataset == 'celeb':
        dataset = self.load_celeb()
    elif self.dataset == 'custom': 
        dataset = self.load_custom()

    loader = torch.utils.data.DataLoader(dataset=dataset,
                                          batch_size=self.batch,
                                          shuffle=self.shuf,
                                          num_workers=2,
                                          drop_last=True)
    return loader

In the parameter.py file just add the name of your dataset to choices=['lsun', 'celeb', 'custom'] in line 38

But when I modified it by your introduction, it shows that he found 0 files. Do you have the same problem? How to figure it out?

from self-attention-gan.

wennzheng avatar wennzheng commented on July 2, 2024

I meet this question too. it show "RuntineError: Found 0 files in subfolders " .

The reson is your data path is not correct. you path should be ./data/celebA/"class_name"/1.jpg ........

you can reference The functiong "torchvision.datasets.ImageFolder()",

from self-attention-gan.

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.