What is Colab

Colab is a jupyter notebook tool provided by Google. It supports many such as Google Drive and tensorflow. It is mainly used for the development and research of machine learning. The biggest benefit of Colab is that it provides free GPU resources to AI developers, on which deep learning frameworks such as tensorflow, pytorch, and keras can be easily run.
More info : https://colab.google

How to use

You can use it just like JupterBook, which provides an interactive environment for writing and executing code.

One Example

Prepare Google Drive

Create Folder, Upload MaskWearing dataset.

Create Colab

Click New –> More –> Google Colaboratory

Choose Edit –> Notebook settings -> Haedware accelerator gpu -> Save.

Click Connect -> Connect to a hosted runtime, and wait for seconds, it’s done.

Code

Type !nvidia-smi to check the GPU server you’re using.
Wo, I got one `Nvida Tesla T4, so the computing task behind it must be easy.

Git

Try to git YOLOv5 code : !git clone https://github.com/ultralytics/yolov5.git.
If everything is OK, your Google Drive will get a new folder called yolov5 including raw data from Github.

Start Training

Set some parameters for the model you about to train, like such as the number of categories (2 for mask or no-mask).
Type !python train.py --data ../MaskWearing.v4-raw.yolov5pytorch/data.yaml --epochs 100 --weights '' --cfg models/yolov5s.yaml --batch-size 24 and start training.

Result