This repository contains the source code/demos for the book Convolutional Neural Networks with Swift for TensorFlow by Brett Koonce (Apress, 2021).
Download the files as a zip using the green button, or clone the repository to your machine using Git.
Release v1.0 corresponds to the code in the published book, without corrections or updates.
To run it locally, you will need a working swift for tensorflow installation.
Set up GCP.
export ZONE="us-central1-c"
export GPU_TYPE="t4"
gcloud compute instances create s4tf-ubuntu-${GPU_TYPE} \
--zone=${ZONE} \
--image-project=deeplearning-platform-release \
--image-family=swift-latest-gpu-ubuntu-1804 \
--maintenance-policy=TERMINATE \
--accelerator="type=nvidia-tesla-${GPU_TYPE},count=1" \
--metadata="install-nvidia-driver=True" \
--machine-type=n1-highmem-2 \
--boot-disk-size=256GB
git clone https://github.com/Apress/convolutional-neural-networks-with-swift-for-tensorflow.git
cd convolutional-neural-networks-with-swift-for-tensorflow
$ swift run
error: multiple executable products available: VGG, SqueezeNet, Resnet50, Resnet34, MobileNetV3, MobileNetV2, MobileNetV1, MNIST-XLA-TPU, MNIST-2D, MNIST-1D, EfficientNet, CIFAR
Now you can run the individual demos, eg swift run MNIST-1D
.
The book is structured as follows:
We will explore the basic building blocks of neural networks and how to combine them with convolutions to perform simple image recognition tasks.
- MNIST-1D
- MNIST-2D
- CIFAR
We will build upon the above to produce actual state of the art approaches in this field.
- VGG
- Resnet34
- Resnet50
We will look at some different approaches for mobile devices, which require us to utilize our computing resources carefully.
- SqueezeNet
- MobileNetV1
- MobileNetV2
We look at the work that leads up to EfficientNet, the current state of art for image recognition.
- EfficientNet
- MobileNetV3
We look at how swift for tensorflow's use of XLA internally allows our code to scale to large supercomputer clusters.
- MNIST-XLA-TPU
See the file Contributing.md for more information on how you can contribute to this repository.