Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tlatkowski/u-net-tpu

Tensorflow implementation of U-Net model with TPU Estimator support.
https://github.com/tlatkowski/u-net-tpu

cnn convolutional-neural-networks deep-learning distributed-training encoder-decoder google-cloud-platform image-classification image-processing image-recognition image-segmentation tensorflow tensorflow-models tpu u-net unet unet-image-segmentation unet-model unet-tensorflow vision

Last synced: about 1 month ago
JSON representation

Tensorflow implementation of U-Net model with TPU Estimator support.

Awesome Lists containing this project

README

        

**[Under development]**

# TPU-optimized U-Net model implementation

### Model description
This repository contains U-Net model implementation (originally proposed in [U-Net: Convolutional Networks for Biomedical Image Segmentation](https://arxiv.org/abs/1505.04597))
with usage of Tensoflow TPUEstimators API.

##### Model architecture

### Training U-Net on Cloud TPU

##### Config your TPU flock:

Check your current Cloud TPU configuration (in Google Cloud Shell):
```bash
ctpu print-config
```

As a result you should get the similar outcome
```bash
ctpu configuration:
name: your-user-name
project: your-project-name
zone: your-zone
```

To run CTPU flock, in Google Cloud Shell, execute the following command
```bash
ZONE=YOUR-ZONE
TPU_NAME=YOUR-TPU-NAME

ctpu up --zone $ZONE --name $TPU_NAME
```

Once the CTPU flock is ready, ssh to your instance
```bash
GCP_PROJECT=YOUR-GCP-PROJECT

gcloud compute --project $GCP_PROJECT ssh --zone $ZONE $TPU_NAME
```

##### Create bucket for storing training checkpoints:

Execute the following commands to create a bucket on your TPU VM instance:
```bash
GCP_PROJECT=YOUR-GCP-PROJECT
MODEL_DIR=gs://YOUR-GOOGLE-CLOUD-BUCKET

gsutil mb -p $GCP_PROJECT $MODEL_DIR
```

##### Training U-Net model as a classifier on Cloud TPU

In order to train your MNIST image classifier based on U-Net architecture and with the usage of Cloud TPU
use **u_net_clf_tpu.py** script with the following parameters:
```bash
# TPU configuration
GCP_PROJECT=YOUR-GCP-PROJECT
TPU_ZONE=YOUR-TPU-ZONE
TPU_NAME=YOUR-TPU-NAME
MODEL_DIR=gs://YOUR-GOOGLE-CLOUD-BUCKET

# problem/model configuration
PROBLEM=MNIST
TRAIN_DIR=PATH-TO-TRAIN-DIR
EVAL_DIR=PATH-TO-EVALUATION-DIR

python u_net_clf_tpu.py \
--train_dir=$TRAIN_DIR \
--eval_dir=$EVAL_DIR \
--problem=$PROBLEM \
--model_dir=$MODEL_DIR \
--tpu_name=$TPU_NAME \
--tpu_zone=$TPU_ZONE \
--gcp_project=$GCP_PROJECT
```

##### Vizualize model training on Tensorboard
```bash
gcloud auth application-default login
```

```bash
tensorboard --logdir $MODEL_DIR
```