Skip to content

Installation

Amira Burns edited this page Oct 24, 2023 · 15 revisions

Installation

Run the following lines of code in your R console to install CameraTrapDetectoR:

if (!require('devtools')) install.packages('devtools')  
devtools::install_github("CameraTrapDetectoR/CameraTrapDetectoR")

Agree to update all necessary packages.

Before your first time using the models, we recommend manually loading the ml-verse packages to insure all necessary software has been downloaded:

library(torch)
library(torchvision)
library(torchvisionlib)

Agree to additional software downloads in the pop-up messages.

Install from Source

If you could not install package from github, follow these instructions to install from source

Download CameraTrapDetectoR

This link holds the latest version of the package. DO NOT unzip this folder.

Install dependencies

Copy this code and paste it into your console. It will install all necessary R packages

install_dependencies <-function(packages=c('dplyr', 'exiftoolr', 'fs', 'lubridate', 'magick',
                                           'rappdirs', 'shiny', 'shinyBS', 'shinyFiles', 'shinyjs',
                                           'stringr', 'torch', 'torchvision', 'torchvisionlib')) {
  cat(paste0("checking package installation on this computer"))
  libs<-unlist(list(packages))
  req<-unlist(lapply(libs,require,character.only=TRUE))
  need<-libs[req==FALSE]
  
  if(length(need)>0){ 
    cat(paste0("The packages: ", need, "\n Need to be installed. Installing them now.\n"))
    utils::install.packages(need)
    lapply(need,require,character.only=TRUE)
  } else{
    cat("All necessary packages are installed on this computer. Proceed.\n")
  }
}
install_dependencies()

Install CameraTrapDetectoR from source

  • In RStudio, Click on Packages, then click Install (just below and to the left of Packages)
  • In the install menu, click on the arrow by Install From
  • Click on Package Achive File
  • Click Browse and navigate to the zip file that you just downloaded.
  • click install

Install for remote instance

Please visit the model_training repo for detailed setup instructions to run CameraTrapDetectoR from the command line locally or on high performance computing (HPC) environment.

Troubleshooting

Update R

You need to be running R version 4.1 or higher for this package to work. If you are unsure of your R version, type R.Version() into the console. Update if necessary.

Force install

Currently, if 32-bit and 64-bit versions of R are installed, it seems devtools tries to build for both of them. This yields a loading failed for 'i386' error. To force building the package for your currently running R version use the INSTALL_opts argument of install_github:

devtools::install_github("CameraTrapDetectoR/CameraTrapDetectoR", INSTALL_opts=c("--no-multiarch"))

Install Microsoft Visual C++ on Windows operating systems

You can install Microsoft Visual C++ from here. It is free and allows the deep learning packages to work on Windows computers. It is installed like normal software, just follow the guidance in the prompts

Clone this wiki locally