PyTorch implementation of DeepLabV3, trained on the Cityscapes dataset.
PyTorch implementation of DeepLabV3, trained on the Cityscapes dataset.
To train models and to run pretrained models (with small batch sizes), you can use an Ubuntu 16.04 P4000 VM with 250 GB SSD on Paperspace. Below I have listed what I needed to do in order to get started, and some things I found useful.
Install docker-ce:
Install CUDA drivers:
Install nvidia-docker:
Download the PyTorch 0.4 docker image:
Create start_docker_image.sh containing:
#!/bin/bash
# DEFAULT VALUES
GPUIDS="0"
NAME="paperspace_GPU"
NV_GPU="$GPUIDS" nvidia-docker run -it --rm \
-p 5584:5584 \
--name "$NAME""$GPUIDS" \
-v /home/paperspace:/root/ \
pytorch/pytorch:0.4_cuda9_cudnn7 bash
Inside the image, /root/ will now be mapped to /home/paperspace (i.e., $ cd -- takes you to the regular home folder).
To start the image:
To commit changes to the image:
To stop the image when it’s running:
To exit the image without killing running code:
To get back into a running image:
To open more than one terminal window at the same time:
To install the needed software inside the docker image:
Do the following outside of the docker image:
print type(obj).name
on line 238 in deeplabv3/cityscapesScripts/cityscapesscripts/helpers/annotation.py (this is need for the cityscapes scripts to be runnable with Python3)
SSH into the paperspace server.
$ sudo sh start_docker_image.sh
$ cd --
$ python deeplabv3/utils/preprocess_data.py (ONLY NEED TO DO THIS ONCE!)
$ python deeplabv3/evaluation/eval_on_val.py
SSH into the paperspace server.
$ sudo sh start_docker_image.sh
$ cd --
$ python deeplabv3/utils/preprocess_data.py (ONLY NEED TO DO THIS ONCE!)
$ python deeplabv3/evaluation/eval_on_val_for_metrics.py
$ cd deeplabv3/cityscapesScripts
$ pip install . (ONLY NEED TO DO THIS ONCE!)
$ python setup.py build_ext --inplace (ONLY NEED TO DO THIS ONCE!) (this enables cython, which makes the cityscapes evaluation script run A LOT faster)
$ export CITYSCAPES_RESULTS="/root/deeplabv3/training_logs/model_eval_val_for_metrics"
$ export CITYSCAPES_DATASET="/root/deeplabv3/data/cityscapes"
$ python cityscapesscripts/evaluation/evalPixelLevelSemanticLabeling.py
classes IoU nIoU
--------------------------------
road : 0.918 nan
sidewalk : 0.715 nan
building : 0.837 nan
wall : 0.413 nan
fence : 0.397 nan
pole : 0.404 nan
traffic light : 0.411 nan
traffic sign : 0.577 nan
vegetation : 0.857 nan
terrain : 0.489 nan
sky : 0.850 nan
person : 0.637 0.491
rider : 0.456 0.262
car : 0.897 0.759
truck : 0.582 0.277
bus : 0.616 0.411
train : 0.310 0.133
motorcycle : 0.322 0.170
bicycle : 0.583 0.413
--------------------------------
Score Average : 0.593 0.364
--------------------------------
categories IoU nIoU
--------------------------------
flat : 0.932 nan
construction : 0.846 nan
object : 0.478 nan
nature : 0.869 nan
sky : 0.850 nan
human : 0.658 0.521
vehicle : 0.871 0.744
--------------------------------
Score Average : 0.786 0.632
--------------------------------
SSH into the paperspace server.
$ sudo sh start_docker_image.sh
$ cd --
$ python deeplabv3/utils/preprocess_data.py (ONLY NEED TO DO THIS ONCE!)
$ python deeplabv3/visualization/run_on_seq.py
SSH into the paperspace server.
$ sudo sh start_docker_image.sh
$ cd --
$ python deeplabv3/utils/preprocess_data.py (ONLY NEED TO DO THIS ONCE!)
$ python deeplabv3/visualization/run_on_thn_seq.py
model/resnet.py:
model/aspp.py:
model/deeplabv3.py:
utils/preprocess_data.py:
utils/utils.py:
datasets.py: