Skip to content

Commit

Permalink
default to 'cuda' with silent fallback on cpu-only machines. Move jpe…
Browse files Browse the repository at this point in the history
…g to depends v0.1.0
  • Loading branch information
raymondben committed Jul 17, 2022
1 parent 8423cf9 commit d8cd387
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ovml
Title: Machine Learning Tools for Volleyball
Version: 0.0.15
Version: 0.1.0
Authors@R: c(person("Ben", "Raymond", role = c("aut", "cre"), email = "[email protected]"),
person("Adrien", "Ickowicz", role = "aut"))
Description: Image and video machine learning tools, for application to volleyball analytics.
Expand All @@ -11,12 +11,12 @@ Imports:
digest,
ggplot2,
grid,
jpeg,
magick,
magrittr,
rappdirs,
torch
Suggests:
jpeg,
testthat
License: MIT + file LICENSE
Encoding: UTF-8
Expand Down
7 changes: 4 additions & 3 deletions R/yolo.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@
#' }
#'
#' @export
ovml_yolo <- function(version = 4, device = "cpu", weights_file = "auto", class_labels) {
ovml_yolo <- function(version = 4, device = "cuda", weights_file = "auto", class_labels) {
if (is.numeric(version)) version <- as.character(version)
assert_that(version %in% c("3", "4", "4-tiny", "4-mvb", "4-tiny-mvb", "7"))
assert_that(is.string(device))
device_was_specified <- !missing(device)
device <- tolower(device)
device <- match.arg(device, c("cpu", "cuda"))
if (device == "cuda" && !cuda_is_available()) {
warning("'cuda' device not available, using 'cpu'")
if (device_was_specified) warning("'cuda' device not available, using 'cpu'")
device <- "cpu"
}
to_cuda <- device == "cuda"
Expand All @@ -45,7 +46,7 @@ ovml_yolo <- function(version = 4, device = "cpu", weights_file = "auto", class_
expected_sha1 <- "520878f12e97cf820529daea502acca380f1cb8e"
} else if (version == "7") {
if (missing(class_labels) || length(class_labels) < 1 || is.na(class_labels)) class_labels <- ovml_class_labels("coco")
w_url <- "https://github.com/openvolley/ovml/releases/download/yolov7/yolov7.torchscript.pt"
w_url <- "https://github.com/openvolley/ovml/releases/download/0.1.0/yolov7.torchscript.pt"
expected_sha1 <- "d8da940cd8175c2c670ad5ac86f5547b6f80c095"
from_jit <- TRUE
dn <- NULL
Expand Down
2 changes: 1 addition & 1 deletion man/ovml_yolo.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d8cd387

Please sign in to comment.