tabakm / cameratrapdetector Goto Github PK
View Code? Open in Web Editor NEWAutomatically detect, count, and classify animals in camera trap images.
Automatically detect, count, and classify animals in camera trap images.
First, I love the R interface. Very helpful and I think this has great potential! I wanted to provide feedback on accuracy. It's my understand more training data will be used in the future, but for now, I'm have issues with accuracy. I'm not expecting a fix here, just providing a baseline for the future.
For test data, I'm using 50 camera trap images manually assigned as coyote (Canis latrans), 50 images manually assigned as domestic cat (Felis catus), and 50 assigned as striped skunk (Mephitis mephitis). Each species was analyzed separately. Code for the coyote test provided, only thing that changed between tests was the folder of photos.
Accuracy:
Skunk: 20%
Coyote 4%
Cat: 0%
Coyote Code and Results:
library(CameraTrapDetectoR)
library(tidyverse)
#### COYOTE #####
predictions <-
deploy_model(
data_dir = "Cuddeback Coyotes",
model_type = 'species',
recursive = FALSE,
file_extensions = c('.jpg', '.JPG'),
labeled = FALSE,
make_plots = TRUE,
plot_label = TRUE,
output_dir = NULL,
sample50 = T,
write_bbox_csv = FALSE,
score_threshold = 0.6,
h = 307,
w = 408,
lty = 1,
lwd = 2,
col = 'red'
)
predictions_long <- predictions %>% select(-filename) %>%
pivot_longer(
cols = 1:77, # columns that should pivot from wide to long (unquoted)
names_to = "species", # name of the new category column as a quoted string
values_to = "count" # name of the new value column as a quoted string
)
predictions_long %>% group_by(species) %>% summarize(count = sum(count)) %>% arrange(desc(count))
Cat Results:
Skunk Results:
> runShiny("deploy")
Loading required package: shiny
Listening on http://127.0.0.1:3486
trying URL 'https://www.dropbox.com/s/r1pazpf8db2o003/fasterrcnn_5classes.pt?raw=1'
Warning in utils::download.file(url, path, mode = "wb") :
cannot open URL 'https://www.dropbox.com/s/r1pazpf8db2o003/fasterrcnn_5classes.pt?raw=1': HTTP status was '404 Not Found'
Warning: Error in utils::download.file: cannot open URL 'https://www.dropbox.com/s/r1pazpf8db2o003/fasterrcnn_5classes.pt?raw=1'
2: shiny::runApp
1: runShiny
Got the package installed and running (didn't work until I upgraded from R v 3.6 to v4), got the shiny app to run, then hit this snag. Typo perhaps?
Hello, I'm running into an error when trying to install the package:
devtools::install_github("https://github.com/TabakM/CameraTrapDetectoR.git")
I get the following:
Downloading GitHub repo TabakM/CameraTrapDetectoR@HEAD
Running R CMD build
...
Session info:
R version 4.2.0 (2022-04-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.4
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] nlme_3.1-157 fs_1.5.2 usethis_2.1.6 lubridate_1.8.0
[5] devtools_2.4.3 rprojroot_2.0.3 tools_4.2.0 utf8_1.2.2
[9] R6_2.5.1 rpart_4.1.16 DBI_1.1.2 colorspace_2.0-3
[13] nnet_7.3-17 withr_2.5.0 tidyselect_1.1.2 gridExtra_2.3
[17] prettyunits_1.1.1 processx_3.7.0 curl_4.3.2 compiler_4.2.0
[21] cli_3.3.0 desc_1.4.1 scales_1.2.0 callr_3.7.0
[25] stringr_1.4.0 digest_0.6.29 rmarkdown_2.14 pkgconfig_2.0.3
[29] htmltools_0.5.2 parallelly_1.31.1 sessioninfo_1.2.2 fastmap_1.1.0
[33] rlang_1.0.3 rstudioapi_0.13 generics_0.1.2 dplyr_1.0.9
[37] ModelMetrics_1.2.2.2 magrittr_2.0.3 Matrix_1.4-1 Rcpp_1.0.9
[41] munsell_0.5.0 fansi_1.0.3 lifecycle_1.0.1 stringi_1.7.6
[45] pROC_1.18.0 yaml_2.3.5 MASS_7.3-56 brio_1.1.3
[49] pkgbuild_1.3.1 plyr_1.8.7 recipes_0.2.0 grid_4.2.0
[53] parallel_4.2.0 listenv_0.8.0 crayon_1.5.1 lattice_0.20-45
[57] splines_4.2.0 knitr_1.39 ps_1.7.1 pillar_1.7.0
[61] future.apply_1.9.0 reshape2_1.4.4 codetools_0.2-18 stats4_4.2.0
[65] pkgload_1.2.4 glue_1.6.2 evaluate_0.15 data.table_1.14.2
[69] remotes_2.4.2 vctrs_0.4.1 foreach_1.5.2 testthat_3.1.4
[73] gtable_0.3.0 purrr_0.3.4 future_1.25.0 assertthat_0.2.1
[77] cachem_1.0.6 ggplot2_3.3.6 xfun_0.31 gower_1.0.0
[81] prodlim_2019.11.13 vip_0.3.2 class_7.3-20 survival_3.3-1
[85] timeDate_3043.102 tibble_3.1.7 iterators_1.0.14 memoise_2.0.1
[89] hardhat_0.2.0 lava_1.6.10 globals_0.15.0 ellipsis_0.3.2
[93] caret_6.0-92 ipred_0.9-12
Hi
Great work on this, I just started testing and it seems it will save us a LOT of time. I was wondering if you're planning a function that would subset pictures, ie run the general model first, then subset mammals only for example, and then run the family/species model.
I am getting an error that the torchvision.dll can not be loaded (the file downloaded and is present in the Cache folder). Same error on two different machines. Visual C++ was installed. R version is 4.1.3, 64bit. Any suggestions?
Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'C:/Users/Mathias/AppData/Local/CameraTrapDetector/CameraTrapDetector/Cache/torchvision.dll': LoadLibrary failure: The specified procedure could not be found.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.