Learn R Programming

animl (version 3.2.0)

detect: Apply MegaDetector to a Given Batch of Images

Description

Apply MegaDetector to a Given Batch of Images

Usage

detect(
  detector,
  image_file_names,
  resize_width,
  resize_height,
  letterbox = TRUE,
  confidence_threshold = 0.1,
  file_col = "filepath",
  batch_size = 1,
  num_workers = 1,
  device = NULL,
  checkpoint_path = NULL,
  checkpoint_frequency = -1
)

Value

list of dictionaries of MegaDetector detections

Arguments

detector

preloaded md model

image_file_names

list of image filenames, a single image filename, or folder

resize_width

width to resize images to

resize_height

height to resize images to

letterbox

if True, resize and pad image to keep aspect ratio, else resize without padding

confidence_threshold

only detections above this threshold are returned

file_col

select which column if image_file_names is a manifest

batch_size

size of each batch

num_workers

number of processes to handle the data

device

specify to run on cpu or gpu

checkpoint_path

path to checkpoint file

checkpoint_frequency

write results to checkpoint file every N images

Examples

Run this code
if (FALSE) mdres <- detect(md_py, allframes$Frame, 1280, 960, device='cpu')

Run the code above in your browser using DataLab