-
Notifications
You must be signed in to change notification settings - Fork 4
Shiny Tutorial
This tutorial goes over how to use the CameraTrapDetectoR Shiny application. Anyone new to using CameraTrapDetectoR can benefit from this detailed example, even experienced R users. Users who are less comfortable with coding in R or RStudio may find the Shiny app interface more efficient than running the model directly in the R console. We provide the printout of your coded arguments inside the Shiny app so you can transition to the R console if desired.
This document will be extremely helpful using the CameraTrapDetectoR desktop application. The interface is exactly the same as the Shiny application, without any R coding to open the application.
If you haven't already, install the package.
We've provided five test images you can use to follow along with the demo and test out different model arguments. Download and extract the images, save them to an easily accessible directory, and proceed to launching the interactive application.
An organized image directory is essential to making sure your CameraTrapDetectoR session runs smoothly. Place all images to be run through the model in the same directory. You may set up a recursive directory with images in different folders, but make sure to remove any images you do not wish to run through the model. CameraTrapDetectoR only searches for file types specified in the file_extensions argument; it will ignore all other file types.
The model was trained on images of size 408 x 307 pixels, and will resize your images before running them through the neural network. You may see a slight decrease in model run time if you resize your images to these dimensions before running the model.
You have the option to enter location data for your images (latitude / longitude) to help narrow down potential species. However, this option can only be set once for all images in a given model run. If you would like to use this option, all your images must originate from the same location. Alternatively, you can split your image directory by location, and run the model separately on images from each location.
Copy + paste the following line of code into your R console to launch the Shiny application:
library(CameraTrapDetectoR)
runShiny("deploy")
You should see a pop-up window with the drop-down arguments on the left, and brief explanations of each argument on the right.
The only argument you must specify is the location of your images. Click the data_dir button to open your file directory, then use the black arrows to the left of the folders to navigate to your image directory. Once you navigate to the folder that contains all your images, click the text on the left pane to select that folder. If you have organized your images in multiple folders, select the folder that contains all your separate image folders and set the recursive argument to TRUE so the model sees all your images. If you wish to only run images in a particular folder or sub-directory, make that selection carefully so you do not send extra images through the model.
You are technically able to run the model with all other arguments set at default values. However, we encourage you to carefully consider your research questions and thoughtfully set the remaining model arguments.