Reading in CelebA dataset to Generate Faces w. GANS

Hello, I want to use what we learned in Lesson 7 to generate faces with GANs. I want to use the CelebA dataset. I downloaded the data from the helper files on this page: https://github.com/HACKERSHUBH/Face-Genaration-using-Generative-Adversarial-Network

But, this person is doing everything in TensorFlow and I want to use fastai to be able to read in the faces as a single-class image DataBunch since we aren’t going to do any classification.

Can someone please show me how to do that?

When I load the data in using the GANItemList code and then run

data.show_batch(rows=5)
I get the following error:

---------------------------------------------------------------------------
StopIteration                             Traceback (most recent call last)
<ipython-input-19-d4822b607749> in <module>
----> 1 data.show_batch(rows=5)

/opt/anaconda3/lib/python3.7/site-packages/fastai/basic_data.py in show_batch(self, rows, ds_type, reverse, **kwargs)
    183     def show_batch(self, rows:int=5, ds_type:DatasetType=DatasetType.Train, reverse:bool=False, **kwargs)->None:
    184         "Show a batch of data in `ds_type` on a few `rows`."
--> 185         x,y = self.one_batch(ds_type, True, True)
    186         if reverse: x,y = x.flip(0),y.flip(0)
    187         n_items = rows **2 if self.train_ds.x._square_show else rows

/opt/anaconda3/lib/python3.7/site-packages/fastai/basic_data.py in one_batch(self, ds_type, detach, denorm, cpu)
    166         w = self.num_workers
    167         self.num_workers = 0
--> 168         try:     x,y = next(iter(dl))
    169         finally: self.num_workers = w
    170         if detach: x,y = to_detach(x,cpu=cpu),to_detach(y,cpu=cpu)

StopIteration: 

Thank you so much!
Sri

1 Like

I forgot to add earlier that I figured out what the issue was. Turns out the folder I was trying to read from was empty. After I made sure that the folder I was reading had exactly what the function was trying to read, I was then able to run show_batch() with no problem.