Skip to content

GCP Quickstart

Glenn Jocher edited this page Jan 26, 2021 · 24 revisions

To get started using this repo quickly using a Google Cloud Platform (GCP) Deep Learning Virtual Machine (VM) follow the instructions below. New GCP users are eligible for a $300 free credit offer. Other quickstart options for this repo include our Jupyter Notebook Open In Colab and our Docker image at https://hub.docker.com/r/ultralytics/yolov3 Docker Pulls.

1. Create VM

Select a Deep Learning VM from the GCP marketplace, select an n1-standard-8 instance (with 8 vCPUs and 30 GB memory), add a GPU of your choice, check 'Install NVIDIA GPU driver automatically on first startup?', and select a 300 GB SSD Persistent Disk for sufficient I/O speed, then click 'Deploy'. All dependencies are included in the preinstalled Anaconda Python environment. GCP Marketplace

2. Setup VM

Clone this repo and install requirements.txt dependencies, including Python>=3.8 and PyTorch>=1.7.

$ git clone https://github.com/ultralytics/yolov3  # clone repo
$ cd yolov3
$ pip install -r requirements.txt  # install dependencies

3. Start

$ python train.py  # train a model
$ python test.py --weights yolov5s.pt  # test a model for Precision, Recall and mAP
$ python detect.py --weights yolov5s.pt --source path/to/images  # run inference on images and videos
GCP terminal

Optional Extras

Add 64GB of swap memory (to --cache large datasets).

sudo fallocate -l 64G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
free -h  # check memory

Mount local SSD

lsblk
sudo mkfs.ext4 -F /dev/nvme0n1
sudo mkdir -p /mnt/disks/nvme0n1
sudo mount /dev/nvme0n1 /mnt/disks/nvme0n1
sudo chmod a+w /mnt/disks/nvme0n1
cp -r coco /mnt/disks/nvme0n1
Clone this wiki locally