Tensorflow Tutorial: Train a Keras Model

In this tutorial, we will train a simple convolutional neural network for binary classification with tensorflow Keras.

First, install tensorflow via pip:

pip install tensorflow

Next, we import the required libraries:

import tensorflow as tf

Additionally, we create the configuration dictionary with certain properties which we use in the actual data loading process:

config = {
    "batch_size": 2,

    "num_train_rounds": 5,
}

Data

In this tutorial, we deal with a binary classification for the FloodNet dataset. Note that we have transformed the image labels of the dataset into binary response labels in order to obtain an appropriate dataset for binary classification. The respective loading and transformation procedures are described in Tensorflow Tutorial: Load Custom Image Dataset. The dataset contains 2343 (1445 train, 450 validation, 448 test) colored images with a size of $3000 \times 3000$ pixels. Each of these images is associated to a binary response that indicates whether more than a quarter of the images is flooded.

Construct the Model


This tutorial was never completed. The implementation can be found on GitHub.




Enjoy Reading This Article?

Here are some more articles you might like to read next:

  • Tensorflow Tutorial: Load Custom Image Dataset
  • Gradient Evolution
  • Partition Data using Dirichlet Distribution
  • Tensorflow Federated Tutorial
  • Data Spaces