keremberke's picture
Add yolov5 model card
9a06a5a
|
raw
history blame
2.08 kB
metadata
tags:
  - yolov5
  - yolo
  - vision
  - object-detection
  - pytorch
library_name: yolov5
library_version: 7.0.7
inference: false
datasets:
  - keremberke/aerial-sheep-object-detection
model-index:
  - name: keremberke/yolov5n-aerial-sheep
    results:
      - task:
          type: object-detection
        dataset:
          type: keremberke/aerial-sheep-object-detection
          name: keremberke/aerial-sheep-object-detection
          split: validation
        metrics:
          - type: precision
            value: 0.9546859314717948
            name: mAP@0.5
keremberke/yolov5n-aerial-sheep

How to use

pip install -U yolov5
  • Load model and perform prediction:
import yolov5

# load model
model = yolov5.load('keremberke/yolov5n-aerial-sheep')
  
# set model parameters
model.conf = 0.25  # NMS confidence threshold
model.iou = 0.45  # NMS IoU threshold
model.agnostic = False  # NMS class-agnostic
model.multi_label = False  # NMS multiple labels per box
model.max_det = 1000  # maximum number of detections per image

# set image
img = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'

# perform inference
results = model(img, size=640)

# inference with test time augmentation
results = model(img, augment=True)

# parse results
predictions = results.pred[0]
boxes = predictions[:, :4] # x1, y1, x2, y2
scores = predictions[:, 4]
categories = predictions[:, 5]

# show detection bounding boxes on image
results.show()

# save results into "results/" folder
results.save(save_dir='results/')
  • Finetune the model on your custom dataset:
yolov5 train --data data.yaml --img 640 --batch 16 --weights keremberke/yolov5n-aerial-sheep --epochs 10

More models available at: awesome-yolov5-models