Package 'ovml'

Title: Machine Learning Tools for Volleyball
Description: Image and video machine learning tools, for application to volleyball analytics.
Authors: Ben Raymond [aut, cre], Adrien Ickowicz [aut], openvolley.org [org]
Maintainer: Ben Raymond <[email protected]>
License: MIT + file LICENSE
Version: 0.1.6
Built: 2024-11-22 05:39:15 UTC
Source: https://github.com/openvolley/ovml

Help Index


ovml

Description

Image and video machine learning tools, for application to volleyball analytics.


Construct YOLO network

Description

Construct YOLO network

Usage

ovml_yolo(version = 4, device = "cuda", weights_file = "auto", class_labels)

Arguments

version

integer or string: one of

  • 3 : YOLO v3

  • 4 : YOLO v4

  • "4-tiny" : YOLO v4-tiny

  • "4-mvb" : an experimental network trained specifically to detect (only) volleyballs

  • "4-tiny-mvb" : the v4-tiny version of the same

  • 7 or "7-tiny" : YOLO v7 or v7-tiny

device

string: "cpu" or "cuda"

weights_file

string: either the path to the weights file that already exists on your system or "auto". If "auto", the weights file will be downloaded if necessary and stored in the directory given by ovml_cache_dir()

class_labels

character: the class labels used for network training. If missing or NULL, these default to ovml_class_labels("coco") for all models except "mvb" models, which use ovml_class_labels("mvb")

Value

A YOLO network object

References

https://github.com/pjreddie/darknet, https://github.com/WongKinYiu/yolov7

Examples

## Not run: 
  dn <- ovml_yolo()
  img <- ovml_example_image()
  res <- ovml_yolo_detect(dn, img)
  ovml_ggplot(img, res)

## End(Not run)

Detect objects in image using a YOLO network

Description

Processing of a video file requires that ffmpeg be installed on your system. ovideo::ov_install_ffmpeg() can help with this on Windows and Linux.

Usage

ovml_yolo_detect(
  net,
  image_file,
  conf = 0.6,
  nms_conf = 0.4,
  classes,
  batch_size = 4,
  ...
)

Arguments

net

yolo: as returned by ovml_yolo()

image_file

character: path to one or more image files, or a single video file (mp4, m4v, or mov extension)

conf

scalar: confidence level

nms_conf

scalar: non-max suppression confidence level

classes

character: vector of class names, only detections of these classes will be returned

batch_size

integer: the number of images to process as a batch. Increasing batch_size will make processing of multiple images faster, but requires more memory

...

: currently ignored

Value

A data.frame with columns "image_number", "image_file", "class", "score", "xmin", "xmax", "ymin", "ymax"

See Also

ovml_yolo()

Examples

## Not run: 
  dn <- ovml_yolo()
  img <- ovml_example_image()
  res <- ovml_yolo_detect(dn, img)
  ovml_ggplot(img, res)

## End(Not run)