This repo contains four notebook tutorials in which you create a custom class using the RarePlanes data set, train a YOLOv5 model, perform inferences on the test set, and then evaluate performace.
You can either access the tutorial pipeline hosted on AWS by accessing the AMI here or reproduce the enviornment using your own GPUs by cloning this repository
For the AMI, all the relevant data and packages have been downloaded so you should easily be able to spin up and follow along with the tutorial. For more informaion on how to spin up an AMI, please visit the first half of this blog
- Spin up the AMI instance from here
- Ensure you are in the
N. Virginia
and then hitLaunch Instance
- Search for the pre-built AMI titled
CosmiQ_YOLO_Planes
- Select the
p3.2xlarge
instance type and hit theReview and Launch
,Launch
buttons succesively - Create a new key pair and download and launch this key pair
- SSH into the machine using your address. The command should look like this
ssh -i "cosmiq-yolo-planes-aws.pem" [email protected]
- Navigate to the directory
/home/ubuntu/src/yolo_planes/yolov5/
- Launch the jupyter lab using
jupyter lab --ip=0.0.0.0
- Open a browser and insert the EC2 ip into the address bar; it should look like this
ec2-3-235-146-223.compute-1.amazonaws.com:8888
- The password for the jupyter lab is
yoloplanes
- Open the notebook titled
1_yolo_start.ipynb
- Clone this repository
- Download the data from here. You will only need the real data for this tutorial
- You will need to sort the images from the PS-RGB_tiled directory per yolo specifications with the following hiearchy:
class_one (or any other name)
|--images (these are the downloaded tiled .pngs)
| |--train
| |--val
|--labels (you will create these during the tutorial)
| |--train
| |--val
- The easiest way to do this is to
mkdir class_one
outside of your yolov5 directory cd class_one
and thenmkdir images
,mkdir labels
cd images
and thenmkdir train
,mkdir val
- In your images directory,
mv
thePS_RGB_tiled
from the downloaded train directory to the one you just created and the test directory to theval
directory you just created cd ../lablels
and thenmkdir train
,mkdir val
- If you are creating your own custom class, save the image directory paths for your
data/class_one.yaml
file (they should look something like../class_one/images/train/
and../class_one/images/val/
)
- Create your docker image using the command
nvidia-docker build -t <name_of_image> ./
- Your image should now appear when you run
docker images
- Then run
NV_GPU=0,1 nvidia-docker run -it -v /dir/to/yolov5:/yolov5/ -p 9002:9002 --shm-size=64g --name <name_of_container> <name_of_image>
- Navigate to the directory
yolov5
directory on your GPU - Launch conda enviornment using
conda activate solaris
- Launch the jupyter notebook using
jupyter notebook --ip 0.0.0.0 --no-browser --allow-root --port=9002
- Open a browser and insert your ip into the address bar; it should look like this
http://gpu02:9002/
Use the token supplied in the terminal as your password. - Open the notebook titled
1_yolo_start.ipynb
This ML pipeline uses a modified implementation of the YOLOv5 implementation found here. The full RarePlanes dataset can be found here and helper functions for the dataset can be found here.
If you have any questions or errors, please don't hesitate to post an issue or email me here.