{"id":18055342,"url":"https://github.com/agentmorris/megadetector","last_synced_at":"2025-05-16T08:04:50.186Z","repository":{"id":167711819,"uuid":"643058819","full_name":"agentmorris/MegaDetector","owner":"agentmorris","description":"MegaDetector is an AI model that helps conservation folks spend less time doing boring things with camera trap images.","archived":false,"fork":false,"pushed_at":"2025-05-15T23:37:58.000Z","size":194281,"stargazers_count":156,"open_issues_count":1,"forks_count":32,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-05-16T00:27:23.835Z","etag":null,"topics":["camera-traps","cameratraps","computer-vision","conservation","ecology","machine-learning","megadetector","wildlife"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agentmorris.png","metadata":{"files":{"readme":"README-package-utils.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"citation.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-05-20T01:46:37.000Z","updated_at":"2025-05-15T23:38:02.000Z","dependencies_parsed_at":"2024-11-06T16:23:13.018Z","dependency_job_id":"5db00661-c73b-4fc9-95a6-db8c29fd7be4","html_url":"https://github.com/agentmorris/MegaDetector","commit_stats":{"total_commits":3261,"total_committers":58,"mean_commits":"56.224137931034484","dds":0.515179392824287,"last_synced_commit":"0a0afdefd1a17a35d906ebbed7f393444c6a929b"},"previous_names":["agentmorris/megadetector"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agentmorris%2FMegaDetector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agentmorris%2FMegaDetector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agentmorris%2FMegaDetector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agentmorris%2FMegaDetector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agentmorris","download_url":"https://codeload.github.com/agentmorris/MegaDetector/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254493378,"owners_count":22080126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["camera-traps","cameratraps","computer-vision","conservation","ecology","machine-learning","megadetector","wildlife"],"created_at":"2024-10-31T00:14:39.290Z","updated_at":"2025-05-16T08:04:45.170Z","avatar_url":"https://github.com/agentmorris.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MegaDetector\n\nThis package is a pip-installable version of the support/inference code for [MegaDetector](https://github.com/agentmorris/MegaDetector/?tab=readme-ov-file#megadetector), an object detection model that helps conservation biologists spend less time doing boring things with camera trap images.  Complete documentation for this Python package is available at [megadetector.readthedocs.io](https://megadetector.readthedocs.io).\n\nIf you aren't looking for the Python package specifically, and you just want to learn more about what MegaDetector is all about, head over to the [MegaDetector repo](https://github.com/agentmorris/MegaDetector/?tab=readme-ov-file#megadetector).\n\nIf you don't want to run MegaDetector, and you just want to use the utilities in this package - postprocessing, manipulating large volumes of camera trap images, etc. - you may want to check out the [megadetector-utils](https://pypi.org/project/megadetector-utils/) package, which is identical to this one, but excludes all of the PyTorch/YOLO dependencies, and is thus approximately one zillion times smaller.\n\n## Installation\n\nInstall with:\n\n`pip install megadetector`\n\nMegaDetector model weights aren't downloaded at the time you install the package, but they will be (optionally) automatically downloaded the first time you run the model.\n\n## Package reference\n\nSee [megadetector.readthedocs.io](https://megadetector.readthedocs.io).\n\n\n## Examples of things you can do with this package\n\n### Run MegaDetector on one image and count the number of detections\n\n```\nfrom megadetector.utils import url_utils\nfrom megadetector.visualization import visualization_utils as vis_utils\nfrom megadetector.detection import run_detector\n\n# This is the image at the bottom of this page, it has one animal in it\nimage_url = 'https://github.com/agentmorris/MegaDetector/raw/main/images/orinoquia-thumb-web.jpg'\ntemporary_filename = url_utils.download_url(image_url)\n\nimage = vis_utils.load_image(temporary_filename)\n\n# This will automatically download MDv5a; you can also specify a filename.\nmodel = run_detector.load_detector('MDV5A')\n\nresult = model.generate_detections_one_image(image)\n\ndetections_above_threshold = [d for d in result['detections'] if d['conf'] \u003e 0.2]\nprint('Found {} detections above threshold'.format(len(detections_above_threshold)))\n```\n\n### Run MegaDetector on a folder of images\n\n```\nfrom megadetector.detection.run_detector_batch import \\\n    load_and_run_detector_batch, write_results_to_file\nfrom megadetector.utils import path_utils\nimport os\n\n# Pick a folder to run MD on recursively, and an output file\nimage_folder = os.path.expanduser('~/megadetector_test_images')\noutput_file = os.path.expanduser('~/megadetector_output_test.json')\n\n# Recursively find images\nimage_file_names = path_utils.find_images(image_folder,recursive=True)\n\n# This will automatically download MDv5a; you can also specify a filename.\nresults = load_and_run_detector_batch('MDV5A', image_file_names)\n\n# Write results to a format that Timelapse and other downstream tools like.\nwrite_results_to_file(results,\n                      output_file,\n                      relative_path_base=image_folder,\n                      detector_file=detector_filename)\n```\n\n## Contact\n\nContact \u003ca href=\"cameratraps@lila.science\"\u003ecameratraps@lila.science\u003c/a\u003e with questions.\n\n## Gratuitous animal picture\n\n\u003cimg src=\"https://github.com/agentmorris/MegaDetector/raw/main/images/orinoquia-thumb-web_detections.jpg\"\u003e\u003cbr/\u003eImage credit University of Minnesota, from the [Orinoquía Camera Traps](http://lila.science/datasets/orinoquia-camera-traps/) data set.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagentmorris%2Fmegadetector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagentmorris%2Fmegadetector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagentmorris%2Fmegadetector/lists"}