Skip to content

AWS Quickstart

Glenn Jocher edited this page Nov 17, 2021 · 2 revisions

This quickstart guide 📚 helps new users run YOLOv3 🚀 on an Amazon Web Services (AWS) Deep Learning instance ⭐. AWS offers a Free Tier and a credit program to get started quickly and affordably. Other quickstart options for YOLOv3 include our Colab Notebook Open In Colab Open In Kaggle, GCP Deep Learning VM and our Docker image at https://hub.docker.com/r/ultralytics/yolov3 Docker Pulls.

1. Console Sign-in

Create and account or sign-in to the AWS console at https://aws.amazon.com/console/ and then select the EC2 service. Console

2. Launch Instance

In the EC2 part of the AWS console, click the Launch instance button. Launch

Choose an Amazon Machine Image (AMI)

Enter 'Deep Learning' in the search field and select the most recent Ubuntu Deep Learning AMI (recommended), or select an alternative Deep Learning AMI. See Choosing Your DLAMI for more information on selecting an AMI. Choose AMI

Select an Instance Type

A GPU instance is recommended for most deep learning purposes. Training new models will be faster on a GPU instance than a CPU instance. You can scale sub-linearly when you have multi-GPU instances or if you use distributed training across many instances with GPUs. To set up distributed training, see Distrbuted Training.

Note: The size of your model should be a factor in selecting an instance. If your model exceeds an instance's available RAM, select a different instance type with enough memory for your application.

Check out EC2 Instance Types and choose Accelerated Computing to see the different GPU instance options.

Choose Type

DLAMI instances provide tooling to monitor and optimize your GPU processes. For more information on overseeing your GPU processes, see GPU Monitoring and Optimization. For pricing see On Demand Pricing and Spot Pricing.

Configure Instance Details

Amazon EC2 Spot Instances let you take advantage of unused EC2 capacity in the AWS cloud. Spot Instances are available at up to a 70% discount compared to On-Demand prices. We recommend a persistent spot instance, which will save your data and restart automatically when spot instance availability returns after spot instance termination. For full-price On-Demand instances leave these settings to their default values.

Spot Request

Complete Steps 4-7 to finalize your instance hardware and security settings and then launch the instance.

3. Connect to Instance

Select the check box next to your running instance, and then click connect. You can copy paste the SSH terminal command into a terminal of your choice to connect to your instance.

Connect

4. Run YOLOv3 🚀

Once you have logged in to your instance, clone this repo and install dependencies. You will want Python>=3.6.0 with all requirements.txt installed including PyTorch>=1.7.

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

Then start training, testing, detecting and exporting YOLOv3 models!

$ python train.py  # train a model
$ python val.py --weights yolov3.pt  # validate a model for Precision, Recall and mAP
$ python detect.py --weights yolov3.pt --source path/to/images  # run inference on images and videos
$ python export.py --weights yolov3.pt --include onnx coreml tflite  # export models to other formats

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