Clone repo and install requirements.txt in a Python>=3.7.0 environment, including PyTorch>=1.7
git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install
Models download automatically from the latest YOLOv5 release
import torch
# Model
model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # or yolov5n - yolov5x6, custom
# Images
img = 'https://img.freepik.com/photos-gratuite/fumee-industrielle-dans-atmosphere_33799-3042.jpg?w=1380' # or file, Path, PIL, OpenCV, numpy, list
# Inference
results = model(img)
# Results
results.print() # or .show(), .save(), .crop(), .pandas(), etc.
we imported 12336 unlabeled images from kaggle, we labeled 100 images using two classes: 'smoke low density' and 'smoke high density'
The same database we found already labeled, with a single class 'smoke'.
We installed wandb to visualize the results directly on the website by creating an account
%pip install -q wandb
import wandb
wandb.login()
The commands below reproduce YOLOv5 data results. Models download automatically from the latest YOLOv5 release
python train.py --data data.yaml --cfg yolov5s.yaml --weights '' --batch-size 64
The model manages to detect both classes of smoke in this video