deploy_model | R Documentation |
This function deploys a model trained to identify and count the objects in camera trap images.
deploy_model( data_dir = NULL, model_type = "general", recursive = TRUE, file_extensions = c(".jpg", ".JPG"), make_plots = TRUE, plot_label = TRUE, output_dir = NULL, sample50 = FALSE, write_bbox_csv = FALSE, overlap_correction = TRUE, overlap_threshold = 0.9, score_threshold = 0.6, return_data_frame = TRUE, prediction_format = "wide", h = 307, w = 408, lty = 1, lwd = 2, col = "red", labeled = FALSE )
data_dir |
Absolute path to the folder containing your images |
model_type |
Options are c('general', 'species', 'family'). The 'general' model predicts to the level of mammal, bird, humans, vehicles. The 'species' model recognizes 77 species. The 'family' model recognizes 33 families. |
recursive |
boolean. Do you have images in subfolders within your data_dir that you want to analyze, if so, set to TRUE. If you only want to analyze images within your data_dir and not within sub-folders, set to FALSE. |
file_extensions |
The types of extensions on your image files. Default is c(".jpg", ".JPG") |
make_plots |
boolean. Do you want to make plots of the images with their predicted bounding boxes? |
plot_label |
boolean. Do you want the plots to contain the predicted class of object |
output_dir |
You can specify absolute path to output. Default is 'NULL', and creates a folder within your data_dir. Only specify a path if you want the results stored somewhere else on your computer. |
sample50 |
boolean. Do you want to run the model only on a subset of 50 images from your dataset? This is a good idea if you are experimenting with settings. |
write_bbox_csv |
boolean. Do you want to create a csv with all of the information on predicted bounding boxes? This csv will include all bounding boxes, even those with low probability. |
overlap_correction |
boolean. Should overlapping detections be evaluated for overlap and highest confidence detection be returned |
overlap_threshold |
Overlap threshold used when determining if bounding box detections are to be considered a single detection. Accepts values from 0-1 representing the proportion of bounding box overlap. |
score_threshold |
Confidence threshold for using a bounding box. Default is 0.6. A lower number will produce more bboxes (it will be less stringent in deciding to make a bbox). A higher number will produce fewer bboxes (it will be more stringent). |
return_data_frame |
boolean. Do you want a dataframe returned |
prediction_format |
The format to be used for the prediction file. Accepts values of 'wide' or 'long'. |
h |
The image height (in pixels) for the annotated plot. Only used if
|
w |
The image width (in pixels) for the annotated plot. |
lty |
line type for bbox plot. See |
lwd |
line width for bbox plot. See |
col |
line color for bbox plot. See |
labeled |
This is not functional |
This function deploys a model to detect and classify objects in camera
trap images. The function will find all files matching the 'file_extension's
specified within the 'data_dir' specified and deploy the 'model_type' on these
images. If you specify recusive=TRUE
, the function will find relevant image
files within all subdirectories of your 'data_dir'. 'deploy_model' returns a
dataframe of predicted number of individuals within each category in each
image. This dataframe is also written as a csv file within your 'output_dir'.
If you specify make_plots=TRUE
, the function will plot predicted bounding
boxes for each image in your 'output_dir'. If you are working with many images,
you may wish to specify sample50=TRUE
the first time you use this function,
which will only deploy the model on 50 of your images. There are three options for
model_type
: 'general' recognizes mammals, birds, humans, and vehicles.
'species' recognizes 77 species. 'family' recognizes 33 families. If you want
to see all of the information for each bounding box (including coordinates,
labels, and confidence), specify write_bbox_csv=TRUE
and it will be
produced in your 'output_dir'. Additionally,
A file called "arguments" will be produced in your 'output_dir' this is a list
of all of the arguments you passed to this function for reference.
Returns a dataframe of predictions for each file. The rows in this dataframe are the file names in your 'data_dir'; the columns are the categories in the model. If any of your images were not loaded properly, there will be a column in the dataframe called 'image_error'. Images with a 1 in this column had issues and the model was not deployed on them.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.