megadetector 10.0.2__tar.gz → 10.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of megadetector might be problematic. Click here for more details.

Files changed (153) hide show
  1. {megadetector-10.0.2 → megadetector-10.0.4}/LICENSE +0 -0
  2. {megadetector-10.0.2/megadetector.egg-info → megadetector-10.0.4}/PKG-INFO +134 -135
  3. {megadetector-10.0.2 → megadetector-10.0.4}/README-package.md +0 -0
  4. {megadetector-10.0.2 → megadetector-10.0.4}/README.md +1 -1
  5. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/__init__.py +0 -0
  6. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/api/__init__.py +0 -0
  7. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/api/batch_processing/integration/digiKam/setup.py +0 -0
  8. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/api/batch_processing/integration/digiKam/xmp_integration.py +0 -0
  9. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/api/batch_processing/integration/eMammal/test_scripts/config_template.py +0 -0
  10. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/api/batch_processing/integration/eMammal/test_scripts/push_annotations_to_emammal.py +0 -0
  11. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/api/batch_processing/integration/eMammal/test_scripts/select_images_for_testing.py +0 -0
  12. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/__init__.py +0 -0
  13. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/aggregate_classifier_probs.py +0 -0
  14. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/analyze_failed_images.py +0 -0
  15. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/cache_batchapi_outputs.py +0 -0
  16. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/create_classification_dataset.py +0 -0
  17. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/crop_detections.py +0 -0
  18. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/csv_to_json.py +0 -0
  19. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/detect_and_crop.py +0 -0
  20. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/efficientnet/__init__.py +0 -0
  21. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/efficientnet/model.py +0 -0
  22. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/efficientnet/utils.py +0 -0
  23. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/evaluate_model.py +0 -0
  24. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/identify_mislabeled_candidates.py +0 -0
  25. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/json_to_azcopy_list.py +0 -0
  26. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/json_validator.py +0 -0
  27. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/map_classification_categories.py +0 -0
  28. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/merge_classification_detection_output.py +0 -0
  29. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/prepare_classification_script.py +0 -0
  30. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/prepare_classification_script_mc.py +0 -0
  31. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/run_classifier.py +0 -0
  32. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/save_mislabeled.py +0 -0
  33. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/train_classifier.py +0 -0
  34. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/train_classifier_tf.py +0 -0
  35. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/classification/train_utils.py +0 -0
  36. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/__init__.py +0 -0
  37. megadetector-10.0.4/megadetector/data_management/animl_to_md.py +158 -0
  38. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/annotations/__init__.py +0 -0
  39. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/annotations/annotation_constants.py +0 -0
  40. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/camtrap_dp_to_coco.py +0 -0
  41. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/cct_json_utils.py +0 -0
  42. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/cct_to_md.py +0 -0
  43. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/cct_to_wi.py +0 -0
  44. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/coco_to_labelme.py +0 -0
  45. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/coco_to_yolo.py +0 -0
  46. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/databases/__init__.py +0 -0
  47. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/databases/add_width_and_height_to_db.py +0 -0
  48. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/databases/combine_coco_camera_traps_files.py +0 -0
  49. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/databases/integrity_check_json_db.py +0 -0
  50. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/databases/subset_json_db.py +0 -0
  51. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/generate_crops_from_cct.py +0 -0
  52. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/get_image_sizes.py +0 -0
  53. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/labelme_to_coco.py +0 -0
  54. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/labelme_to_yolo.py +0 -0
  55. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/lila/__init__.py +0 -0
  56. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/lila/create_lila_blank_set.py +0 -0
  57. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/lila/create_lila_test_set.py +0 -0
  58. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/lila/create_links_to_md_results_files.py +0 -0
  59. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/lila/download_lila_subset.py +0 -0
  60. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/lila/generate_lila_per_image_labels.py +0 -0
  61. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/lila/get_lila_annotation_counts.py +0 -0
  62. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/lila/get_lila_image_counts.py +0 -0
  63. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/lila/lila_common.py +0 -0
  64. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/lila/test_lila_metadata_urls.py +0 -0
  65. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/mewc_to_md.py +0 -0
  66. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/ocr_tools.py +0 -0
  67. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/read_exif.py +0 -0
  68. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/remap_coco_categories.py +0 -0
  69. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/remove_exif.py +0 -0
  70. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/rename_images.py +0 -0
  71. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/resize_coco_dataset.py +0 -0
  72. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/speciesnet_to_md.py +0 -0
  73. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/wi_download_csv_to_coco.py +0 -0
  74. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/yolo_output_to_md_output.py +0 -0
  75. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/data_management/yolo_to_coco.py +0 -0
  76. megadetector-10.0.4/megadetector/data_management/zamba_to_md.py +188 -0
  77. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/detection/__init__.py +0 -0
  78. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/detection/change_detection.py +0 -0
  79. megadetector-10.0.4/megadetector/detection/process_video.py +470 -0
  80. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/detection/pytorch_detector.py +575 -276
  81. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/detection/run_detector.py +0 -0
  82. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/detection/run_detector_batch.py +629 -202
  83. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/detection/run_inference_with_yolov5_val.py +0 -0
  84. megadetector-10.0.4/megadetector/detection/run_md_and_speciesnet.py +1319 -0
  85. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/detection/run_tiled_inference.py +0 -0
  86. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/detection/tf_detector.py +0 -0
  87. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/detection/video_utils.py +243 -107
  88. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/__init__.py +0 -0
  89. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/add_max_conf.py +0 -0
  90. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/categorize_detections_by_size.py +0 -0
  91. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/classification_postprocessing.py +12 -1
  92. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/combine_batch_outputs.py +2 -0
  93. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/compare_batch_results.py +21 -2
  94. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/convert_output_format.py +0 -0
  95. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/create_crop_folder.py +0 -0
  96. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/detector_calibration.py +0 -0
  97. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/generate_csv_report.py +0 -0
  98. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/load_api_results.py +0 -0
  99. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/md_to_coco.py +0 -0
  100. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/md_to_labelme.py +0 -0
  101. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/md_to_wi.py +0 -0
  102. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/merge_detections.py +16 -12
  103. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/postprocess_batch_results.py +0 -0
  104. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/remap_detection_categories.py +0 -0
  105. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/render_detection_confusion_matrix.py +0 -0
  106. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/repeat_detection_elimination/find_repeat_detections.py +0 -0
  107. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/repeat_detection_elimination/remove_repeat_detections.py +0 -0
  108. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/repeat_detection_elimination/repeat_detections_core.py +0 -0
  109. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/separate_detections_into_folders.py +1 -1
  110. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/subset_json_detector_output.py +1 -3
  111. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/top_folders_to_bottom.py +0 -0
  112. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/postprocessing/validate_batch_results.py +25 -2
  113. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/taxonomy_mapping/__init__.py +0 -0
  114. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/taxonomy_mapping/map_lila_taxonomy_to_wi_taxonomy.py +0 -0
  115. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/taxonomy_mapping/map_new_lila_datasets.py +0 -0
  116. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/taxonomy_mapping/prepare_lila_taxonomy_release.py +0 -0
  117. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/taxonomy_mapping/preview_lila_taxonomy.py +0 -0
  118. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/taxonomy_mapping/retrieve_sample_image.py +0 -0
  119. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/taxonomy_mapping/simple_image_download.py +0 -0
  120. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/taxonomy_mapping/species_lookup.py +0 -0
  121. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/taxonomy_mapping/taxonomy_csv_checker.py +0 -0
  122. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/taxonomy_mapping/taxonomy_graph.py +0 -0
  123. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/taxonomy_mapping/validate_lila_category_mappings.py +0 -0
  124. {megadetector-10.0.2/megadetector/utils → megadetector-10.0.4/megadetector/tests}/__init__.py +0 -0
  125. megadetector-10.0.4/megadetector/tests/test_nms_synthetic.py +335 -0
  126. {megadetector-10.0.2/megadetector/visualization → megadetector-10.0.4/megadetector/utils}/__init__.py +0 -0
  127. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/utils/ct_utils.py +69 -5
  128. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/utils/directory_listing.py +0 -0
  129. megadetector-10.0.4/megadetector/utils/extract_frames_from_video.py +303 -0
  130. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/utils/gpu_test.py +0 -0
  131. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/utils/md_tests.py +583 -524
  132. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/utils/path_utils.py +4 -15
  133. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/utils/process_utils.py +0 -0
  134. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/utils/split_locations_into_train_val.py +0 -0
  135. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/utils/string_utils.py +0 -0
  136. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/utils/url_utils.py +0 -0
  137. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/utils/wi_utils.py +20 -4
  138. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/utils/write_html_image_list.py +0 -0
  139. megadetector-10.0.4/megadetector/visualization/__init__.py +0 -0
  140. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/visualization/plot_utils.py +0 -0
  141. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/visualization/render_images_with_thumbnails.py +0 -0
  142. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/visualization/visualization_utils.py +1 -1
  143. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/visualization/visualize_db.py +8 -22
  144. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector/visualization/visualize_detector_output.py +7 -5
  145. megadetector-10.0.4/megadetector/visualization/visualize_video_output.py +607 -0
  146. {megadetector-10.0.2 → megadetector-10.0.4/megadetector.egg-info}/PKG-INFO +134 -135
  147. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector.egg-info/SOURCES.txt +8 -1
  148. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector.egg-info/dependency_links.txt +0 -0
  149. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector.egg-info/requires.txt +0 -1
  150. {megadetector-10.0.2 → megadetector-10.0.4}/megadetector.egg-info/top_level.txt +0 -0
  151. {megadetector-10.0.2 → megadetector-10.0.4}/pyproject.toml +1 -2
  152. {megadetector-10.0.2 → megadetector-10.0.4}/setup.cfg +4 -4
  153. megadetector-10.0.2/megadetector/detection/process_video.py +0 -1251
File without changes
@@ -1,135 +1,134 @@
1
- Metadata-Version: 2.4
2
- Name: megadetector
3
- Version: 10.0.2
4
- Summary: MegaDetector is an AI model that helps conservation folks spend less time doing boring things with camera trap images.
5
- Author-email: Your friendly neighborhood MegaDetector team <cameratraps@lila.science>
6
- Maintainer-email: Your friendly neighborhood MegaDetector team <cameratraps@lila.science>
7
- License: MIT License
8
-
9
- Permission is hereby granted, free of charge, to any person obtaining a copy
10
- of this software and associated documentation files (the "Software"), to deal
11
- in the Software without restriction, including without limitation the rights
12
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
- copies of the Software, and to permit persons to whom the Software is
14
- furnished to do so, subject to the following conditions:
15
-
16
- The above copyright notice and this permission notice shall be included in all
17
- copies or substantial portions of the Software.
18
-
19
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
- SOFTWARE.
26
-
27
- Project-URL: Homepage, https://github.com/agentmorris/MegaDetector
28
- Project-URL: Documentation, https://megadetector.readthedocs.io
29
- Project-URL: Bug Reports, https://github.com/agentmorris/MegaDetector/issues
30
- Project-URL: Source, https://github.com/agentmorris/MegaDetector
31
- Keywords: camera traps,conservation,wildlife,ai,megadetector
32
- Classifier: Programming Language :: Python :: 3
33
- Requires-Python: <3.14,>=3.9
34
- Description-Content-Type: text/markdown
35
- License-File: LICENSE
36
- Requires-Dist: mkl==2024.0; sys_platform != "darwin"
37
- Requires-Dist: numpy>=1.26.4
38
- Requires-Dist: Pillow>=9.5
39
- Requires-Dist: tqdm>=4.64.0
40
- Requires-Dist: jsonpickle>=3.0.2
41
- Requires-Dist: humanfriendly>=10.0
42
- Requires-Dist: matplotlib>=3.8.0
43
- Requires-Dist: opencv-python>=4.8.0
44
- Requires-Dist: requests>=2.31.0
45
- Requires-Dist: pyqtree>=1.0.0
46
- Requires-Dist: scikit-learn>=1.3.1
47
- Requires-Dist: pandas>=2.1.1
48
- Requires-Dist: python-dateutil
49
- Requires-Dist: send2trash
50
- Requires-Dist: python-dateutil
51
- Requires-Dist: clipboard
52
- Requires-Dist: dill
53
- Requires-Dist: ruff
54
- Requires-Dist: pytest
55
- Requires-Dist: ultralytics-yolov5==0.1.1
56
- Requires-Dist: yolov9pip==0.0.4
57
- Dynamic: license-file
58
-
59
- # MegaDetector
60
-
61
- 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).
62
-
63
- 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).
64
-
65
- If 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.
66
-
67
- ## Installation
68
-
69
- Install with:
70
-
71
- `pip install megadetector`
72
-
73
- MegaDetector 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.
74
-
75
- ## Package reference
76
-
77
- See [megadetector.readthedocs.io](https://megadetector.readthedocs.io).
78
-
79
-
80
- ## Examples of things you can do with this package
81
-
82
- ### Run MegaDetector on one image and count the number of detections
83
-
84
- ```
85
- from megadetector.utils import url_utils
86
- from megadetector.visualization import visualization_utils as vis_utils
87
- from megadetector.detection import run_detector
88
-
89
- # This is the image at the bottom of this page, it has one animal in it
90
- image_url = 'https://github.com/agentmorris/MegaDetector/raw/main/images/orinoquia-thumb-web.jpg'
91
- temporary_filename = url_utils.download_url(image_url)
92
-
93
- image = vis_utils.load_image(temporary_filename)
94
-
95
- # This will automatically download MDv5a; you can also specify a filename.
96
- model = run_detector.load_detector('MDV5A')
97
-
98
- result = model.generate_detections_one_image(image)
99
-
100
- detections_above_threshold = [d for d in result['detections'] if d['conf'] > 0.2]
101
- print('Found {} detections above threshold'.format(len(detections_above_threshold)))
102
- ```
103
-
104
- ### Run MegaDetector on a folder of images
105
-
106
- ```
107
- from megadetector.detection.run_detector_batch import \
108
- load_and_run_detector_batch, write_results_to_file
109
- from megadetector.utils import path_utils
110
- import os
111
-
112
- # Pick a folder to run MD on recursively, and an output file
113
- image_folder = os.path.expanduser('~/megadetector_test_images')
114
- output_file = os.path.expanduser('~/megadetector_output_test.json')
115
-
116
- # Recursively find images
117
- image_file_names = path_utils.find_images(image_folder,recursive=True)
118
-
119
- # This will automatically download MDv5a; you can also specify a filename.
120
- results = load_and_run_detector_batch('MDV5A', image_file_names)
121
-
122
- # Write results to a format that Timelapse and other downstream tools like.
123
- write_results_to_file(results,
124
- output_file,
125
- relative_path_base=image_folder,
126
- detector_file=detector_filename)
127
- ```
128
-
129
- ## Contact
130
-
131
- Contact <a href="cameratraps@lila.science">cameratraps@lila.science</a> with questions.
132
-
133
- ## Gratuitous animal picture
134
-
135
- <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.
1
+ Metadata-Version: 2.4
2
+ Name: megadetector
3
+ Version: 10.0.4
4
+ Summary: MegaDetector is an AI model that helps conservation folks spend less time doing boring things with camera trap images.
5
+ Author-email: Your friendly neighborhood MegaDetector team <cameratraps@lila.science>
6
+ Maintainer-email: Your friendly neighborhood MegaDetector team <cameratraps@lila.science>
7
+ License: MIT License
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ Project-URL: Homepage, https://github.com/agentmorris/MegaDetector
28
+ Project-URL: Documentation, https://megadetector.readthedocs.io
29
+ Project-URL: Bug Reports, https://github.com/agentmorris/MegaDetector/issues
30
+ Project-URL: Source, https://github.com/agentmorris/MegaDetector
31
+ Keywords: camera traps,conservation,wildlife,ai,megadetector
32
+ Classifier: Programming Language :: Python :: 3
33
+ Requires-Python: <3.14,>=3.9
34
+ Description-Content-Type: text/markdown
35
+ License-File: LICENSE
36
+ Requires-Dist: mkl==2024.0; sys_platform != "darwin"
37
+ Requires-Dist: numpy>=1.26.4
38
+ Requires-Dist: Pillow>=9.5
39
+ Requires-Dist: tqdm>=4.64.0
40
+ Requires-Dist: jsonpickle>=3.0.2
41
+ Requires-Dist: humanfriendly>=10.0
42
+ Requires-Dist: matplotlib>=3.8.0
43
+ Requires-Dist: opencv-python>=4.8.0
44
+ Requires-Dist: requests>=2.31.0
45
+ Requires-Dist: pyqtree>=1.0.0
46
+ Requires-Dist: scikit-learn>=1.3.1
47
+ Requires-Dist: pandas>=2.1.1
48
+ Requires-Dist: python-dateutil
49
+ Requires-Dist: send2trash
50
+ Requires-Dist: clipboard
51
+ Requires-Dist: dill
52
+ Requires-Dist: ruff
53
+ Requires-Dist: pytest
54
+ Requires-Dist: ultralytics-yolov5==0.1.1
55
+ Requires-Dist: yolov9pip==0.0.4
56
+ Dynamic: license-file
57
+
58
+ # MegaDetector
59
+
60
+ 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).
61
+
62
+ 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).
63
+
64
+ If 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.
65
+
66
+ ## Installation
67
+
68
+ Install with:
69
+
70
+ `pip install megadetector`
71
+
72
+ MegaDetector 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.
73
+
74
+ ## Package reference
75
+
76
+ See [megadetector.readthedocs.io](https://megadetector.readthedocs.io).
77
+
78
+
79
+ ## Examples of things you can do with this package
80
+
81
+ ### Run MegaDetector on one image and count the number of detections
82
+
83
+ ```
84
+ from megadetector.utils import url_utils
85
+ from megadetector.visualization import visualization_utils as vis_utils
86
+ from megadetector.detection import run_detector
87
+
88
+ # This is the image at the bottom of this page, it has one animal in it
89
+ image_url = 'https://github.com/agentmorris/MegaDetector/raw/main/images/orinoquia-thumb-web.jpg'
90
+ temporary_filename = url_utils.download_url(image_url)
91
+
92
+ image = vis_utils.load_image(temporary_filename)
93
+
94
+ # This will automatically download MDv5a; you can also specify a filename.
95
+ model = run_detector.load_detector('MDV5A')
96
+
97
+ result = model.generate_detections_one_image(image)
98
+
99
+ detections_above_threshold = [d for d in result['detections'] if d['conf'] > 0.2]
100
+ print('Found {} detections above threshold'.format(len(detections_above_threshold)))
101
+ ```
102
+
103
+ ### Run MegaDetector on a folder of images
104
+
105
+ ```
106
+ from megadetector.detection.run_detector_batch import \
107
+ load_and_run_detector_batch, write_results_to_file
108
+ from megadetector.utils import path_utils
109
+ import os
110
+
111
+ # Pick a folder to run MD on recursively, and an output file
112
+ image_folder = os.path.expanduser('~/megadetector_test_images')
113
+ output_file = os.path.expanduser('~/megadetector_output_test.json')
114
+
115
+ # Recursively find images
116
+ image_file_names = path_utils.find_images(image_folder,recursive=True)
117
+
118
+ # This will automatically download MDv5a; you can also specify a filename.
119
+ results = load_and_run_detector_batch('MDV5A', image_file_names)
120
+
121
+ # Write results to a format that Timelapse and other downstream tools like.
122
+ write_results_to_file(results,
123
+ output_file,
124
+ relative_path_base=image_folder,
125
+ detector_file=detector_filename)
126
+ ```
127
+
128
+ ## Contact
129
+
130
+ Contact <a href="cameratraps@lila.science">cameratraps@lila.science</a> with questions.
131
+
132
+ ## Gratuitous animal picture
133
+
134
+ <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.
@@ -274,7 +274,7 @@ Code written on or before April 28, 2023 is [copyright Microsoft](https://github
274
274
 
275
275
  ## Contributing
276
276
 
277
- This project welcomes contributions, as pull requests, issues, or suggestions by [email](mailto:cameratraps@lila.science). We have a [list](https://github.com/agentmorris/MegaDetector/issues/84) of issues that we're hoping to address, many of which would be good starting points for new contributors. We also depend on other open-source tools that help users run MegaDetector (particularly [AddaxAI](https://github.com/PetervanLunteren/AddaxAI) (formerly EcoAssist), and open-source tools that help users work with MegaDetector results (particularly [Timelapse](https://github.com/saulgreenberg/Timelapse)). If you are looking to get involved in GUI development, reach out to the developers of those tools as well!
277
+ This project welcomes contributions, as pull requests, issues, or suggestions by [email](mailto:cameratraps@lila.science). We have a [list](https://dmorris.net/task-viewer/?file=https://raw.githubusercontent.com/agentmorris/MegaDetector/refs/heads/main/TODO.md) of issues that we're hoping to address, many of which would be good starting points for new contributors. We also depend on other open-source tools that help users run MegaDetector (particularly [AddaxAI](https://github.com/PetervanLunteren/AddaxAI) (formerly EcoAssist), and open-source tools that help users work with MegaDetector results (particularly [Timelapse](https://github.com/saulgreenberg/Timelapse)). If you are looking to get involved in GUI development, reach out to the developers of those tools as well!
278
278
 
279
279
  If you are interesting in getting involved in the conservation technology space, and MegaDetector just happens to be the first page you landed on, and none of our open issues are getting you fired up, don't fret! Head over to the [WILDLABS discussion forums](https://wildlabs.net/discussions) and let the community know you're a developer looking to get involved. Someone needs your help!
280
280
 
@@ -0,0 +1,158 @@
1
+ """
2
+
3
+ animl_to_md.py
4
+
5
+ Convert a .csv file produced by the Animl package:
6
+
7
+ https://github.com/conservationtechlab/animl-py
8
+
9
+ ...to a MD results file suitable for import into Timelapse.
10
+
11
+ Columns are expected to be:
12
+
13
+ file
14
+ category (MD category identifies: 1==animal, 2==person, 3==vehicle)
15
+ detection_conf
16
+ bbox1,bbox2,bbox3,bbox4
17
+ class
18
+ classification_conf
19
+
20
+ """
21
+
22
+ #%% Imports and constants
23
+
24
+ import sys
25
+ import argparse
26
+
27
+ import pandas as pd
28
+
29
+ from megadetector.utils.ct_utils import write_json
30
+ from megadetector.detection.run_detector import DEFAULT_DETECTOR_LABEL_MAP
31
+ detection_category_id_to_name = DEFAULT_DETECTOR_LABEL_MAP
32
+
33
+
34
+ #%% Main function
35
+
36
+ def animl_results_to_md_results(input_file,output_file=None):
37
+ """
38
+ Converts the .csv file [input_file] to the MD-formatted .json file [output_file].
39
+
40
+ If [output_file] is None, '.json' will be appended to the input file.
41
+ """
42
+
43
+ if output_file is None:
44
+ output_file = input_file + '.json'
45
+
46
+ df = pd.read_csv(input_file)
47
+
48
+ expected_columns = ('file','category','detection_conf',
49
+ 'bbox1','bbox2','bbox3','bbox4','class','classification_conf')
50
+
51
+ for s in expected_columns:
52
+ assert s in df.columns,\
53
+ 'Expected column {} not found'.format(s)
54
+
55
+ classification_category_name_to_id = {}
56
+ filename_to_results = {}
57
+
58
+ # i_row = 0; row = df.iloc[i_row]
59
+ for i_row,row in df.iterrows():
60
+
61
+ # Is this the first detection we've seen for this file?
62
+ if row['file'] in filename_to_results:
63
+ im = filename_to_results[row['file']]
64
+ else:
65
+ im = {}
66
+ im['detections'] = []
67
+ im['file'] = row['file']
68
+ filename_to_results[im['file']] = im
69
+
70
+ assert isinstance(row['category'],int),'Invalid category identifier in row {}'.format(im['file'])
71
+ detection_category_id = str(row['category'])
72
+ assert detection_category_id in detection_category_id_to_name,\
73
+ 'Unrecognized detection category ID {}'.format(detection_category_id)
74
+
75
+ detection = {}
76
+ detection['category'] = detection_category_id
77
+ detection['conf'] = row['detection_conf']
78
+ bbox = [row['bbox1'],row['bbox2'],row['bbox3'],row['bbox4']]
79
+ detection['bbox'] = bbox
80
+ classification_category_name = row['class']
81
+
82
+ # Have we seen this classification category before?
83
+ if classification_category_name in classification_category_name_to_id:
84
+ classification_category_id = \
85
+ classification_category_name_to_id[classification_category_name]
86
+ else:
87
+ classification_category_id = str(len(classification_category_name_to_id))
88
+ classification_category_name_to_id[classification_category_name] = \
89
+ classification_category_id
90
+
91
+ classifications = [[classification_category_id,row['classification_conf']]]
92
+ detection['classifications'] = classifications
93
+
94
+ im['detections'].append(detection)
95
+
96
+ # ...for each row
97
+
98
+ info = {}
99
+ info['format_version'] = '1.3'
100
+ info['detector'] = 'Animl'
101
+ info['classifier'] = 'Animl'
102
+
103
+ results = {}
104
+ results['info'] = info
105
+ results['detection_categories'] = detection_category_id_to_name
106
+ results['classification_categories'] = \
107
+ {v: k for k, v in classification_category_name_to_id.items()}
108
+ results['images'] = list(filename_to_results.values())
109
+
110
+ write_json(output_file,results)
111
+
112
+ # ...animl_results_to_md_results(...)
113
+
114
+
115
+ #%% Interactive driver
116
+
117
+ if False:
118
+
119
+ pass
120
+
121
+ #%%
122
+
123
+ input_file = r"G:\temp\animl-runs\animl-runs\Coati_v2\manifest.csv"
124
+ output_file = None
125
+ animl_results_to_md_results(input_file,output_file)
126
+
127
+
128
+ #%% Command-line driver
129
+
130
+ def main():
131
+ """
132
+ Command-line driver for animl_to_md
133
+ """
134
+
135
+ parser = argparse.ArgumentParser(
136
+ description='Convert an Animl-formatted .csv results file to MD-formatted .json results file')
137
+
138
+ parser.add_argument(
139
+ 'input_file',
140
+ type=str,
141
+ help='input .csv file')
142
+
143
+ parser.add_argument(
144
+ '--output_file',
145
+ type=str,
146
+ default=None,
147
+ help='output .json file (defaults to input file appended with ".json")')
148
+
149
+ if len(sys.argv[1:]) == 0:
150
+ parser.print_help()
151
+ parser.exit()
152
+
153
+ args = parser.parse_args()
154
+
155
+ animl_results_to_md_results(args.input_file,args.output_file)
156
+
157
+ if __name__ == '__main__':
158
+ main()