Code implementation – generator
The generator represents the part of the network that will generate new images based on the input sample given to it. In our case, we'll be giving input from an encoded version of an image and it will produce a 16 x 16 x 16 x 3 representation of an object (height by width by length with a color).
Getting ready
We've built out the docker
folder and the encoding code and now we're moving to create the generator. In the src
folder, create a file called generator.py
and make sure you have the same files and folders in your directory:
├── data ├── docker │ ├── build.sh │ ├── clean.sh │ ├── Dockerfile │ └── kaggle.json ├── out ├── README.md ├── run_autoencoder.sh └── src ├── encoder_model.h5 ├── encoder.py ├── generator.py ├── x_test_encoded.npy └── x_train_encoded.npy
How to do it...
There are three basic pieces to creating the generator class—the preparation, the model, and the helper functions. We'll cover each in detail throughout this...