ovmlpy

The ovmlpy package provides image and video machine learning tools for volleyball analytics. It provides similar functionality to the ovml package, but ovmlpy uses a Python-based implementation which should offer improved performance. ovmlpy takes care of installing Python and required dependencies: you do not need an existing Python installation on your system.

Installation

install.packages("ovmlpy", repos = c("https://openvolley.r-universe.dev",
                                         "https://cloud.r-project.org"))

## or

## install.packages("remotes") ## if needed
remotes::install_github("openvolley/ovmlpy")

On first use, you need to tell ovmlpy to install Python and some required packages. It will install these into a virtual environment, so that they do not interfere with other Python installation(s) that you might already have on your system:

ovmlpy::ovml_yolo7_python_setup()

Some other setup/installation notes:

ovmlpy includes the YOLO v7 object detection algorithm and an experimental version of this network specifically for detecting volleyballs. This implementation draws heavily from WongKinYiu/yolov7.

Example

Create the network object once …

library(ovmlpy)
dn <- ovml_yolo()

… then we can use the network to detect objects in an image:

img <- ovml_example_image()
dets <- ovml_yolo_detect(dn, img)
ovml_ggplot(img, dets)

Or detect human poses (experimental!):

dn2 <- ovml_yolo("7-w6-pose")
dets2 <- ovml_yolo_detect(dn2, img)

library(ggplot2)
library(ggsci)
ovml_ggplot(img) +
    geom_segment(data = dets2, aes(x1, y1, xend = x2, yend = y2, col = segment), size = 1.5) +
    scale_color_d3(palette = "category20", guide = "none")