| 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.7 |
| Built: | 2026-05-16 08:45:27 UTC |
| Source: | https://github.com/openvolley/ovml |
Image and video machine learning tools, for application to volleyball analytics.
Maintainer: Ben Raymond [email protected]
Authors:
Adrien Ickowicz
Other contributors:
openvolley.org [originator]
Install Python dependencies for ONNX inference
ovml_install_onnxruntime(gpu = FALSE)ovml_install_onnxruntime(gpu = FALSE)
Inspect ONNX model input/output names and shapes
ovml_onnx_inspect(onnx_file)ovml_onnx_inspect(onnx_file)
List available ONNX model versions
ovml_onnx_versions()ovml_onnx_versions()
Construct YOLO network
ovml_yolo(version = 4, device = "cuda", weights_file = "auto", class_labels)ovml_yolo(version = 4, device = "cuda", weights_file = "auto", class_labels)
version |
integer or string: one of
|
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 |
class_labels |
character: the class labels used for network training. If missing or NULL, these default to |
A YOLO network object
https://github.com/pjreddie/darknet, https://github.com/WongKinYiu/yolov7
## Not run: dn <- ovml_yolo() img <- ovml_example_image() res <- ovml_yolo_detect(dn, img) ovml_ggplot(img, res) ## End(Not run)## Not run: dn <- ovml_yolo() img <- ovml_example_image() res <- ovml_yolo_detect(dn, img) ovml_ggplot(img, res) ## End(Not run)
This is a convenience wrapper around ovideo::ov_video_frames() and
ovml_yolo_detect(), adding time-windowing, frame sampling and timestamps.
ovml_yolo_detect_video( net, video_file, start_time = 0, end_time, duration, fps_extract = 5, fps_video, conf = 0.6, nms_conf = 0.4, classes, batch_size = 4, outdir, keep_frames = FALSE, format = "jpg", jpg_quality = 1, debug = FALSE )ovml_yolo_detect_video( net, video_file, start_time = 0, end_time, duration, fps_extract = 5, fps_video, conf = 0.6, nms_conf = 0.4, classes, batch_size = 4, outdir, keep_frames = FALSE, format = "jpg", jpg_quality = 1, debug = FALSE )
net |
YOLO network as returned by |
video_file |
Path to a video file. |
start_time |
Numeric seconds from the start of the video (default 0). |
end_time |
Numeric seconds from the start of the video (optional). |
duration |
Numeric seconds (optional). If |
fps_extract |
Numeric. Frames per second to extract (sampling rate). If |
fps_video |
Numeric. Video framerate. If missing, inferred via |
conf, nms_conf, classes, batch_size
|
Passed to |
outdir |
Output directory for extracted frames. If missing, a temp dir is used. |
keep_frames |
Logical; if |
format |
"jpg" or "png" (passed to |
jpg_quality |
Numeric 1-31 (passed to |
debug |
Logical; passed to |
A list with elements: detections, frames, meta.
## Not run: library(ovideo) v <- ov_example_video(1) dn <- ovml_yolo() out <- ovml_yolo_detect_video(dn, v, start_time = 0, duration = 3, fps_extract = 5) head(out$detections) ## End(Not run)## Not run: library(ovideo) v <- ov_example_video(1) dn <- ovml_yolo() out <- ovml_yolo_detect_video(dn, v, start_time = 0, duration = 3, fps_extract = 5) head(out$detections) ## End(Not run)
Detect objects in image using a YOLO network
## Default S3 method: ovml_yolo_detect(net, ...)## Default S3 method: ovml_yolo_detect(net, ...)
ffmpeg be installed on your system. ovideo::ov_install_ffmpeg() can help with this on Windows and Linux.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.
## S3 method for class 'ovml_yolo' ovml_yolo_detect( net, image_file, conf = 0.6, nms_conf = 0.4, classes, batch_size = 4, ... )## S3 method for class 'ovml_yolo' ovml_yolo_detect( net, image_file, conf = 0.6, nms_conf = 0.4, classes, batch_size = 4, ... )
net |
yolo: as returned by |
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 |
... |
: currently ignored |
A data.frame with columns "image_number", "image_file", "class", "score", "xmin", "xmax", "ymin", "ymax"
## Not run: dn <- ovml_yolo() img <- ovml_example_image() res <- ovml_yolo_detect(dn, img) ovml_ggplot(img, res) ## End(Not run)## Not run: dn <- ovml_yolo() img <- ovml_example_image() res <- ovml_yolo_detect(dn, img) ovml_ggplot(img, res) ## End(Not run)
Create an ONNX-backed YOLO detector (Ultralytics export)
ovml_yolo_onnx( version = "11n-coco-nms", weights_file = "auto", providers = c("CPUExecutionProvider") )ovml_yolo_onnx( version = "11n-coco-nms", weights_file = "auto", providers = c("CPUExecutionProvider") )
providers |
Execution providers in priority order, e.g. c("CUDAExecutionProvider","CPUExecutionProvider"). |
onnx_file |
Path to an exported ONNX model (recommended: exported with nms=True). |
class_labels |
Character vector of class labels (index -> label). |
input_size |
Model input size (typically 640). |