{"id":38655822,"url":"https://github.com/conservationtechlab/animl-r","last_synced_at":"2026-02-04T21:01:50.492Z","repository":{"id":38217405,"uuid":"440678176","full_name":"conservationtechlab/animl-r","owner":"conservationtechlab","description":"Animl comprises a variety of machine learning tools for analyzing ecological data. The package includes a set of functions to classify subjects within camera trap field data and can handle both images and videos.","archived":false,"fork":false,"pushed_at":"2026-01-27T23:22:34.000Z","size":489504,"stargazers_count":24,"open_issues_count":9,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-01-28T04:09:50.615Z","etag":null,"topics":["deep-learning","machine-learning"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/conservationtechlab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-12-21T23:34:54.000Z","updated_at":"2026-01-24T00:57:38.000Z","dependencies_parsed_at":"2023-02-17T11:31:24.590Z","dependency_job_id":"f2bb2f6b-14b2-487a-9ff6-819be1c0a12e","html_url":"https://github.com/conservationtechlab/animl-r","commit_stats":{"total_commits":125,"total_committers":7,"mean_commits":"17.857142857142858","dds":"0.33599999999999997","last_synced_commit":"73d028dd12c07e980b790ef86c727bfdc65a49bc"},"previous_names":["conservationtechlab/animl-r","conservationtechlab/animl"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/conservationtechlab/animl-r","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conservationtechlab%2Faniml-r","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conservationtechlab%2Faniml-r/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conservationtechlab%2Faniml-r/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conservationtechlab%2Faniml-r/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/conservationtechlab","download_url":"https://codeload.github.com/conservationtechlab/animl-r/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conservationtechlab%2Faniml-r/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29096329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-04T21:00:18.276Z","status":"ssl_error","status_checked_at":"2026-02-04T20:59:11.235Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","machine-learning"],"created_at":"2026-01-17T09:27:13.316Z","updated_at":"2026-02-04T21:01:50.487Z","avatar_url":"https://github.com/conservationtechlab.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# animl v3.2.0\n\nAniml comprises a variety of machine learning tools for analyzing ecological data. The package includes a set of functions to classify subjects within camera trap field data and can handle both images and videos. \n\n## Table of Contents\n1. [Tips for Use](#tips-for-use)\n2. [Models](#models)\n3. [Installation](#installation)\n4. [Release Notes](#release-notes)\n\n# Tips for Use\n\nBelow are the steps required for automatic identification of animals within camera trap images or videos. \n\n#### 1. File Manifest\n\nFirst, build the file manifest of a given directory.\n\n```R\nlibrary(animl)\n\nimagedir \u003c- \"examples/TestData\"\n\n#create save-file placeholders and working directories\nWorkingDirectory(imagedir, globalenv())\n\n# Read exif data for all images within base directory\nfiles \u003c- build_file_manifest(imagedir, out_file=filemanifest_file, exif=TRUE)\n\n# Process videos, extract frames for ID\nallframes \u003c- extract_frames(files, frames=3, out_file=imageframes_file,\n                            parallel=T, num_workers=4)\n\n```\n#### 2. Object Detection\n\nThis produces a dataframe of images, including frames taken from any videos to be fed into the classifier. The authors recommend a two-step approach using the 'MegaDector' object detector to first identify potential animals and then using a second classification model trained on the species of interest. \n\nMore info on \u003cbr\u003e\n[MegaDetector v5/v1000](https://github.com/agentmorris/MegaDetector/tree/main) \u003cbr\u003e\n[MegaDetector v6](https://microsoft.github.io/CameraTraps/megadetector/) \n\n```R\n#Load the Megadetector model\ndetector \u003c- load_detector(\"/Models/md_v5b.0.0.pt\", model_type = 'mdv5', device='cuda:0')\n\n# Obtain crop information for each image\nmdraw \u003c- detect(detector, allframes, resize_width=1280, resize_height=960, batch_size=4, device='cuda:0')\n\n# Add crop information to dataframe\nmdresults \u003c- parse_detections(mdraw, manifest = allframes, out_file = detections_file)\n```\n\n#### 3. Classification\nThen feed the crops into the classifier. We recommend only classifying crops identified by MD as animals.\n\n\n```R\n# Pull out animal crops\nanimals \u003c- get_animals(mdresults)\n\n# Set of crops with MD human, vehicle and empty MD predictions. \nempty \u003c- get_empty(mdresults)\n\n# load class list\nclasses \u003c- load_class_list(\"/Models/Southwest/v3/southwest_v3_classes.csv\")\nclass_list \u003c- classes$class\n\n# load the model\nmodel_file \u003c- \"/Models/Southwest/v3/southwest_v3.pt\"\nsouthwest \u003c- load_classifier(model_file, nrow(class_list))\n\n# obtain species predictions likelihoods\npred_raw \u003c- classify(southwest, animals, resize_width=480, resize_height=480, \n                     out_file=predictions_file, batch_size=16, num_workers=8)\n\n# apply class_list labels and combine with empty set\nmanifest \u003c- single_classification(animals, empty, pred_raw, class_list$class)\n```\n\nIf your data includes videos or sequences, we recommend using the sequence_classification algorithm.\nThis requires the raw output of the prediction algorithm.\n\n```R\n# Sequence Classification\nmanifest \u003c- sequence_classification(animals, empty=empty, pred_raw, classes=class_list,\n                                    station_col=\"station\", empty_class=\"empty\")\n```\n\n#### 4. Export\n\nYou can export the data into folders sorted by prediction: \n```\nmanifest \u003c- export_folders(manifest, out_dir=linkdir, out_file=results_file)\n```\nor into folders sorted by prediction and by station for export to camtrapR:\n```\nmanifest \u003c- export_camtrapR(manifest, out_dir=linkdir, out_file=results_file,\n                            label_col='prediction', file_col=\"filepath\", station_col='station')\n```\n \nYou can also export a .json file formatted for COCO\n```\nmanifest \u003c- export_coco(manifest, class_list=class_list, out_file='results.json')\n```\nOr a .csv file for Timelapse\n```\nmanifest \u003c- export_folders(manifest, out_dir=linkdir)\n```\n\n\n\n\n\n\n# Models\n\nThe Conservation Technology Lab has several [models](https://sandiegozoo.app.box.com/s/9f3xuqldvg9ysaix9c9ug8tdcrmc2eqx) available for use. \u003cbr\u003e\u003cbr\u003e\nDetectors:\n[MegaDetector v5/v1000](https://github.com/agentmorris/MegaDetector/tree/main) \u003cbr\u003e\n[MegaDetector v6](https://microsoft.github.io/CameraTraps/megadetector/) \n\n\n# Installation\n\n### Requirements\n* R \u003e= 4.0\n* Reticulate\n* Python \u003e= 3.12\n* [Animl-Py \u003e= 3.2.0](https://github.com/conservationtechlab/animl-py)\n\nWe recommend running animl on a computer with a dedicated GPU.\n\n### Python\naniml depends on python and will install python package dependencies if they are not available if installed via miniconda. \u003cbr\u003e \n\nThe R version of animl also depends on the python version to handle the machine learning:\n[animl-py](https://github.com/conservationtechlab/animl-py)\n\nAniml-r can be installed through CRAN:\n```R\ninstall.packages('animl')\n```\nOnce loaded, then install required pacakges with \n```R\nlibrary(animl)\n\naniml::animl_install()\n```\n\nAniml-r can also be installed by downloading this repo, opening the animl.Rproj file in RStudio and selecting Build -\u003e Install Package.\n\n\n# Release Notes \n## New for 3.2.0\n- update device handlers\n- add sequence_calculation()\n- add best arg to single_classification\n- update args in export_timelapse()\n- ensure pandas \u003c 3.0.0\n\n\n### Contributors\n\nKyra Swanson \u003cbr\u003e\nMathias Tobler \u003cbr\u003e \nEdgar Navarro \u003cbr\u003e\nJosh Kessler \u003cbr\u003e\nJon Kohler \u003cbr\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconservationtechlab%2Faniml-r","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconservationtechlab%2Faniml-r","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconservationtechlab%2Faniml-r/lists"}