Skip to main content

Seaweed Image Generation Using GANsn

Project Overview This project focuses on generating images of seaweed using Generative Adversarial Networks (GANs). Similar to typical GAN architectures, it consists of two main components:
Generator: Creates synthetic seaweed images from random noise.
Discriminator: Distinguishes between real seaweed images and those created by the generator.

Visit github
  • Import and Setup
  • Model building
  • Training Process
  • Save Generated Images
The aero lesson builder app dragging an audio component into a screen about plant cells.

Imports and Setup

The project begins by importing necessary libraries, primarily using TensorFlow to build and train the neural networks. Key components include:

  • Layers: Dense, Conv2D, UpSampling2D
  • Optimizer: Adam

  • These are used to construct the generator and discriminator models.

    A set of dark themed components for the aero design system

    Model Building

    Generator (build_generator())

  • The generator takes a latent vector as input and uses Dense, Reshape, Conv2D, and UpSampling2D layers to progressively upscale the vector into an image of size 1024x1024.
  • It starts from a small representation and increases the resolution step by step using UpSampling2D.
  • The final layer uses a tanh activation function to generate RGB images with values in the range [-1, 1].
  • A set of dark themed components for the aero design system

    Discriminator (build_discriminator())

  • The discriminator takes an image as input and attempts to classify it as real or fake.
  • It consists of a series of Conv2D layers with strides of 2, followed by LeakyReLU activations and dropout layers to reduce overfitting.
  • The output layer uses a sigmoid activation function to produce a probability score indicating whether the input image is real or fake.
  • A set of dark themed components for the aero design system

    Training Process

    The train_gan() function manages the training of both the discriminator and generator.
    Training Loop:

  • In each iteration:
  • The discriminator is trained on both real and generated images to minimize classification error for real images and maximize it for generated images.
  • The generator is trained via the combined model to produce images that the discriminator classifies as real.
  • The homepage of the aero design system docs website linking to principles and components.
    A dramatic ocean scene with lava forming a new land mass.

    Saving Generated Images

    This function generates and saves images produced by the generator during training.

  • Images are saved in PNG format, allowing the evaluation of the generator's performance at different training epochs.
  • The homepage of the aero design system docs website linking to principles and components.