megadetector


Namemegadetector JSON
Version 5.0.21 PyPI version JSON
download
home_pageNone
SummaryMegaDetector is an AI model that helps conservation folks spend less time doing boring things with camera trap images.
upload_time2024-11-08 01:25:35
maintainerNone
docs_urlNone
authorNone
requires_python<3.12,>=3.9
licenseMIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords camera traps conservation wildlife ai megadetector
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MegaDetector

This 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).

If 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).


## Reasons you might not be looking for this package

### If you are an ecologist...

If you are an ecologist looking to use MegaDetector to help you get through your camera trap images, you probably don't want this package, or at least you probably don't want to start at this page.  We recommend starting with our "[Getting started with MegaDetector](https://github.com/agentmorris/MegaDetector/blob/main/getting-started.md)" page, then digging in to the [MegaDetector User Guide](https://github.com/agentmorris/MegaDetector/blob/main/megadetector.md), which will walk you through the process of using MegaDetector.

### If you are a computer-vision-y type...

If you are a computer-vision-y person looking to run or fine-tune MegaDetector programmatically, you probably don't want this package.  MegaDetector is just a fine-tuned version of [YOLOv5](https://github.com/ultralytics/yolov5), and the [ultralytics](https://github.com/ultralytics/ultralytics/) package (from the developers of YOLOv5) has a zillion bells and whistles for both inference and fine-tuning that this package doesn't.

## Reasons you might want to use this package

If you want to programmatically interact with the postprocessing tools from the MegaDetector repo, or programmatically run MegaDetector in a way that produces [Timelapse](https://saul.cpsc.ucalgary.ca/timelapse)-friendly output (i.e., output in the standard [MegaDetector output format](https://github.com/agentmorris/MegaDetector/tree/main/megadetector/api/batch_processing#megadetector-batch-output-format)), this package might be for you.

## If I haven't talked you out of using this package...

To install:

`pip install megadetector`

MegaDetector model weights aren't downloaded at pip-install time, but they will be (optionally) automatically downloaded the first time you run the model.

## Package reference

See [megadetector.readthedocs.io](https://megadetector.readthedocs.io).


## Examples of things you can do with this package

### Run MegaDetector on one image and count the number of detections

```
from megadetector.utils import url_utils
from megadetector.visualization import visualization_utils as vis_utils
from megadetector.detection import run_detector

# This is the image at the bottom of this page, it has one animal in it
image_url = 'https://github.com/agentmorris/MegaDetector/raw/main/images/orinoquia-thumb-web.jpg'
temporary_filename = url_utils.download_url(image_url)

image = vis_utils.load_image(temporary_filename)

# This will automatically download MDv5a; you can also specify a filename.
model = run_detector.load_detector('MDV5A')

result = model.generate_detections_one_image(image)

detections_above_threshold = [d for d in result['detections'] if d['conf'] > 0.2]
print('Found {} detections above threshold'.format(len(detections_above_threshold)))
```

### Run MegaDetector on a folder of images

```
from megadetector.detection.run_detector_batch import \
    load_and_run_detector_batch, write_results_to_file
from megadetector.utils import path_utils
import os

# Pick a folder to run MD on recursively, and an output file
image_folder = os.path.expanduser('~/megadetector_test_images')
output_file = os.path.expanduser('~/megadetector_output_test.json')

# Recursively find images
image_file_names = path_utils.find_images(image_folder,recursive=True)

# This will automatically download MDv5a; you can also specify a filename.
results = load_and_run_detector_batch('MDV5A', image_file_names)

# Write results to a format that Timelapse and other downstream tools like.
write_results_to_file(results,
                      output_file,
                      relative_path_base=image_folder,
                      detector_file=detector_filename)
```

## Contact

Contact <a href="cameratraps@lila.science">cameratraps@lila.science</a> with questions.

## Gratuitous animal picture

<img src="https://github.com/agentmorris/MegaDetector/raw/main/images/orinoquia-thumb-web_detections.jpg"><br/>Image credit University of Minnesota, from the [OrinoquĂ­a Camera Traps](http://lila.science/datasets/orinoquia-camera-traps/) data set.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "megadetector",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.12,>=3.9",
    "maintainer_email": "Your friendly neighborhood MegaDetector team <cameratraps@lila.science>",
    "keywords": "camera traps, conservation, wildlife, ai, megadetector",
    "author": null,
    "author_email": "Your friendly neighborhood MegaDetector team <cameratraps@lila.science>",
    "download_url": "https://files.pythonhosted.org/packages/57/ca/2f74ca53a8bea44be9fb5f7432424150cff6b7e9562f1b953f5a122d48b3/megadetector-5.0.21.tar.gz",
    "platform": null,
    "description": "# 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\n\n## Reasons you might not be looking for this package\n\n### If you are an ecologist...\n\nIf you are an ecologist looking to use MegaDetector to help you get through your camera trap images, you probably don't want this package, or at least you probably don't want to start at this page.  We recommend starting with our \"[Getting started with MegaDetector](https://github.com/agentmorris/MegaDetector/blob/main/getting-started.md)\" page, then digging in to the [MegaDetector User Guide](https://github.com/agentmorris/MegaDetector/blob/main/megadetector.md), which will walk you through the process of using MegaDetector.\n\n### If you are a computer-vision-y type...\n\nIf you are a computer-vision-y person looking to run or fine-tune MegaDetector programmatically, you probably don't want this package.  MegaDetector is just a fine-tuned version of [YOLOv5](https://github.com/ultralytics/yolov5), and the [ultralytics](https://github.com/ultralytics/ultralytics/) package (from the developers of YOLOv5) has a zillion bells and whistles for both inference and fine-tuning that this package doesn't.\n\n## Reasons you might want to use this package\n\nIf you want to programmatically interact with the postprocessing tools from the MegaDetector repo, or programmatically run MegaDetector in a way that produces [Timelapse](https://saul.cpsc.ucalgary.ca/timelapse)-friendly output (i.e., output in the standard [MegaDetector output format](https://github.com/agentmorris/MegaDetector/tree/main/megadetector/api/batch_processing#megadetector-batch-output-format)), this package might be for you.\n\n## If I haven't talked you out of using this package...\n\nTo install:\n\n`pip install megadetector`\n\nMegaDetector model weights aren't downloaded at pip-install time, 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'] > 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 <a href=\"cameratraps@lila.science\">cameratraps@lila.science</a> with questions.\n\n## Gratuitous animal picture\n\n<img src=\"https://github.com/agentmorris/MegaDetector/raw/main/images/orinoquia-thumb-web_detections.jpg\"><br/>Image credit University of Minnesota, from the [Orinoqu\u00eda Camera Traps](http://lila.science/datasets/orinoquia-camera-traps/) data set.\n",
    "bugtrack_url": null,
    "license": "MIT License  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "MegaDetector is an AI model that helps conservation folks spend less time doing boring things with camera trap images.",
    "version": "5.0.21",
    "project_urls": {
        "Bug Reports": "https://github.com/agentmorris/MegaDetector/issues",
        "Documentation": "https://megadetector.readthedocs.io",
        "Homepage": "https://github.com/agentmorris/MegaDetector",
        "Source": "https://github.com/agentmorris/MegaDetector"
    },
    "split_keywords": [
        "camera traps",
        " conservation",
        " wildlife",
        " ai",
        " megadetector"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1dd88950c28c91f17985b92d26b2bae66844b75c84382c51c0e5bd3b3536c81e",
                "md5": "9b78a19f9a60c3304b88cfff9da07040",
                "sha256": "fdb7317eeddde993f9483b1d6ad84cf78f8255e1ca56429d8341c26f9de67cf6"
            },
            "downloads": -1,
            "filename": "megadetector-5.0.21-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9b78a19f9a60c3304b88cfff9da07040",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.12,>=3.9",
            "size": 708720,
            "upload_time": "2024-11-08T01:25:33",
            "upload_time_iso_8601": "2024-11-08T01:25:33.668481Z",
            "url": "https://files.pythonhosted.org/packages/1d/d8/8950c28c91f17985b92d26b2bae66844b75c84382c51c0e5bd3b3536c81e/megadetector-5.0.21-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "57ca2f74ca53a8bea44be9fb5f7432424150cff6b7e9562f1b953f5a122d48b3",
                "md5": "7a6d7c59ec68672bfed1c59b6e4fa85e",
                "sha256": "8f0f2a4debca6fc6e51f5cebdfe9f9f2d4f5378a1c94d6c8f83433188328c2d2"
            },
            "downloads": -1,
            "filename": "megadetector-5.0.21.tar.gz",
            "has_sig": false,
            "md5_digest": "7a6d7c59ec68672bfed1c59b6e4fa85e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.12,>=3.9",
            "size": 585415,
            "upload_time": "2024-11-08T01:25:35",
            "upload_time_iso_8601": "2024-11-08T01:25:35.199757Z",
            "url": "https://files.pythonhosted.org/packages/57/ca/2f74ca53a8bea44be9fb5f7432424150cff6b7e9562f1b953f5a122d48b3/megadetector-5.0.21.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-08 01:25:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "agentmorris",
    "github_project": "MegaDetector",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "megadetector"
}
        
Elapsed time: 0.95245s