GithubHelp home page GithubHelp logo

makeyourownneuralnetwork / gan Goto Github PK

View Code? Open in Web Editor NEW
354.0 354.0 203.0 20.47 MB

python notebooks accompanying the book Make Your Own GAN

License: GNU General Public License v2.0

Jupyter Notebook 100.00%

gan's People

Contributors

makeyourownneuralnetwork avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gan's Issues

celeba download error

Hello,
first of all thank you very much for your books. I hope to see more and as soon as passible :).

I have a problem with downloading of celeba dataset. I will just continue on my own hardware, but wanted to share the issue

`BadZipFile Traceback (most recent call last)

in ()
1
----> 2 mnist_dataset = torchvision.datasets.CelebA(root='.', download=True)

3 frames

/usr/lib/python3.6/zipfile.py in _RealGetContents(self)
1196 raise BadZipFile("File is not a zip file")
1197 if not endrec:
-> 1198 raise BadZipFile("File is not a zip file")
1199 if self.debug > 1:
1200 print(endrec)

BadZipFile: File is not a zip file`

Second code cell in 10_celeba_download_make_hdf5.ipynb zip file error

Running this notebook in Google Colab results in the following error:

BadZipFile Traceback (most recent call last)
in ()
1 # download data
2
----> 3 mnist_dataset = torchvision.datasets.CelebA(root='.', download=True)

3 frames
/usr/lib/python3.6/zipfile.py in _RealGetContents(self)
1196 raise BadZipFile("File is not a zip file")
1197 if not endrec:
-> 1198 raise BadZipFile("File is not a zip file")
1199 if self.debug > 1:
1200 print(endrec)

BadZipFile: File is not a zip file

I can not find celeba_aligned_small.h5py

with h5py.File('mount/My Drive/Colab Notebooks/myo_gan/
celeba_dataset/celeba_aligned_small.h5py', 'r') as file_object:

for group in file_object:
print(group)
pass

CelebA dataset download/import issue, a workaround

First of all, I really enjoy reading "Make Your First GAN with PyTorch." The book explains the idea behind GAN and its training clearly. A wonderful book for anyone who is interested in this subject.

I'm creating this ticket because I was having issue accessing the CelebA dataset following the book's instructions. The issue seems to be caused by the imageio package. In particular, I got the following error:

`ValueError: Could not find a backend to open `/Users/cchang/Projects/torch/celeba_data/__MACOSX/img_align_celeba/._052628.jpg`` with iomode `ri`.
Based on the extension, the following plugins might add capable backends:
  pyav:  pip install imageio[pyav]
  opencv:  pip install imageio[opencv]`

I installed the plugins as instructed, then this came up:

`ValueError: Could not find a backend to open `xxx.jpg` with iomode `ri`.`

Anyhow, in order to proceed, I decided to download the CelebA dataset from the source (either from the link provided in the book or from kaggle), and created the h5py file as follows:

import matplotlib.image as mpimg

hdf5_file = 'celeba_aligned_small.h5py'
with h5py.File(hdf5_file, 'w') as hf:
    for i in range(1, 20000):
        img = mpimg.imread('./img_align_celeba/{0:06d}.jpg'.format(i))
        hf.create_dataset('img_align_celeba/{0:06d}.jpg'.format(i), 
                                  data=img, 
                                  compression="gzip",
                                  compression_opts=9)
        if (i%1000 == 0):
            print("images done .. ", count)
            pass      

Note that

  • I used matplotlib's image class for reading the CelebA image files. There are many other options available for this.
  • I followed CelebA's file naming convention. As a result, the book's CelebADataset() class needs a little adjustment for the convention.

Hope this can be of a little help for those who also encountered a similar issue.

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.