Single Shot MultiBox Detector with Pytorch

Step 1:
Spin GPU VM on Azure - I chose NC6

Step 2: 
ssh to VM - I used Hyper which works perfectly on Windows and Linux

Step 3:
$ sudo docker login

Step 4:
sudo  docker pull azadehkhojandi/gpu-minimal-notebook

Step 5:
If you have nvidia-docker 1.0 installed: we need to remove it and all existing GPU containers
$ sudo docker volume ls -q -f driver=nvidia-docker | xargs -r -I{} -n1 docker ps -q -a -f volume={} | xargs -r docker rm -f

$ sudo apt-get purge -y nvidia-docker

Add the package repositories
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
$ sudo apt-get update

Install nvidia-docker2 and reload the Docker daemon configuration
$ sudo apt-get install -y nvidia-docker2

$ sudo pkill -SIGHUP dockerd

Test nvidia-smi with the latest official CUDA image
$ sudo docker run --runtime=nvidia --rm nvidia/cuda:9.0-base nvidia-smi


Step 6:
Add an inbound port on the Azure portal



Step 7:
Set up your workspace folder - ideally on the attached disk

$ sudo mkdir myworkspace

$ cd myworkspace/

$ sudo chmod -R 777 $PWD

Step 8:
close exit the container by pressing ctrl + c

clone the repo inside the myworkspace folder

$ git clone https://github.com/Azadehkhojandi/ssd.pytorch.git

reference: https://github.com/Azadehkhojandi/ssd.pytorch

Step 9:
under myworkspace create another folder named data

$ sudo mkdir data

download the datasets

$ sh ssd.pytorch/data/scripts/COCO2014.sh data
$ sh ssd.pytorch/data/scripts/VOC2007.sh data
$ sh ssd.pytorch/data/scripts/VOC2012.sh data

Step 10:
Download vgg weights under  ssd.pytorch/weights

$ cd  ssd.pytorch
$ mkdir weights
$ cd weights
$ wget https://s3.amazonaws.com/amdegroot-models/vgg16_reducedfc.pth
$ wget  https://s3.amazonaws.com/amdegroot-models/ssd300_mAP_77.43_v2.pth
$ wget  https://s3.amazonaws.com/amdegroot-models/ssd_300_VOC0712.pth

Step 11:
now we can run our container

$  sudo nvidia-docker run --rm -p 8888:8888 -v "$PWD/ssd.pytorch":/home/jovyan/work  -v "$PWD/data":/home/jovyan/data azadehkhojandi/gpu-minimal-notebook


browse  http://{yourvmpublicip}:8888/?token=tokenprovidedafterrunningcontainer

open notebooks/work/demo/demo.ipynb 

first, you need to install missing dependencies inside the container,

run the first three blocks, then reset your kernel and run other blocks and continue running the rest of blocks










Comments