How to use
pip install -U yolov5
- Load model and perform prediction:
import yolov5
model = yolov5.load('keremberke/yolov5m-smoke')
model.conf = 0.25
model.iou = 0.45
model.agnostic = False
model.multi_label = False
model.max_det = 1000
img = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'
results = model(img, size=640)
results = model(img, augment=True)
predictions = results.pred[0]
boxes = predictions[:, :4]
scores = predictions[:, 4]
categories = predictions[:, 5]
results.show()
results.save(save_dir='results/')
- Finetune the model on your custom dataset:
yolov5 train --data data.yaml --img 640 --batch 16 --weights keremberke/yolov5m-smoke --epochs 10