% Generated by roxygen2: do not edit by hand % Please edit documentation in R/sharkDetectoR.R \name{detect_and_classify} \alias{detect_and_classify} \title{Submit a single image for combined detection + hierarchical classification (client-side)} \usage{ detect_and_classify( image_path, threshold = 0.25, draw_boxes = FALSE, crop = FALSE, topk = 1, save_dir = "./" ) } \arguments{ \item{image_path}{Path to a local image file (JPEG/PNG).} \item{threshold}{Numeric in [0,1] controlling YOLO‐confidence threshold. Default = 0.25.} \item{draw_boxes}{Logical; if TRUE, an annotated image with drawn boxes is downloaded.} \item{crop}{Logical; if TRUE, each detected shark patch (cropped) is downloaded.} \item{topk}{Integer ≥ 1: how many taxonomy candidates to return per detection. Default = 1.} \item{save_dir}{Character; directory where downloaded images are saved. Default = `"./"`. A subfolder `"images"` will be created if it does not exist.} } \value{ A data.frame with one row per detection × per candidate, with columns: \itemize{ \item \code{xmin, ymin, xmax, ymax} – bounding‐box coordinates (numeric) \item \code{score} – detection confidence (numeric) \item \code{label} – `"shark"` (character) or integer label otherwise \item \code{order, family, genus, species} (character) \item \code{p_order, p_family, p_genus, p_species, joint_score} (numeric) \item \code{annotated_image} – local filename of the annotated image (if \code{draw_boxes=TRUE}), or NA \item \code{cropped_image} – local filename of the cropped patch (if \code{crop=TRUE}), or NA } } \description{ Calls the Flask API endpoint `/detect_and_classify` at \code{http://sharkpulse.cnre.vt.edu}. Optionally downloads any annotated / cropped images into `save_dir/images/`. Returns a data frame with one row per detected bounding‐box and per taxonomy candidate. } \examples{ \dontrun{ # topk = 1: one row per detection, download annotated box df1 <- detect_and_classify( image_path = "shark.jpg", threshold = 0.3, draw_boxes = TRUE, crop = FALSE, topk = 1, save_dir = "./results" ) print(df1) # topk = 3: three rows per detection, download crops df3 <- detect_and_classify( image_path = "shark.jpg", threshold = 0.3, draw_boxes = FALSE, crop = TRUE, topk = 3, save_dir = "./results" ) print(df3) } }