megadetector 5.0.7__tar.gz → 5.0.8__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 (215) hide show
  1. {megadetector-5.0.7/megadetector.egg-info → megadetector-5.0.8}/PKG-INFO +10 -12
  2. {megadetector-5.0.7 → megadetector-5.0.8}/README-package.md +9 -11
  3. {megadetector-5.0.7 → megadetector-5.0.8}/README.md +34 -30
  4. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/data_preparation/manage_local_batch.py +28 -14
  5. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/postprocessing/combine_api_outputs.py +2 -2
  6. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/postprocessing/compare_batch_results.py +1 -1
  7. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/postprocessing/convert_output_format.py +24 -6
  8. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/postprocessing/load_api_results.py +1 -3
  9. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/postprocessing/md_to_labelme.py +118 -51
  10. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/postprocessing/merge_detections.py +30 -5
  11. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/postprocessing/postprocess_batch_results.py +24 -12
  12. megadetector-5.0.8/api/batch_processing/postprocessing/remap_detection_categories.py +163 -0
  13. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/postprocessing/render_detection_confusion_matrix.py +15 -12
  14. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/postprocessing/repeat_detection_elimination/repeat_detections_core.py +2 -2
  15. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/cct_json_utils.py +7 -2
  16. megadetector-5.0.8/data_management/coco_to_labelme.py +263 -0
  17. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/coco_to_yolo.py +7 -4
  18. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/databases/integrity_check_json_db.py +68 -59
  19. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/databases/subset_json_db.py +1 -1
  20. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/get_image_sizes.py +44 -26
  21. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/animl_results_to_md_results.py +1 -3
  22. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/noaa_seals_2019.py +1 -1
  23. megadetector-5.0.8/data_management/labelme_to_coco.py +507 -0
  24. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/labelme_to_yolo.py +95 -52
  25. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/lila/create_lila_blank_set.py +106 -23
  26. megadetector-5.0.8/data_management/lila/download_lila_subset.py +243 -0
  27. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/lila/generate_lila_per_image_labels.py +1 -1
  28. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/lila/lila_common.py +8 -38
  29. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/read_exif.py +65 -16
  30. megadetector-5.0.8/data_management/remap_coco_categories.py +84 -0
  31. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/resize_coco_dataset.py +3 -22
  32. megadetector-5.0.8/data_management/wi_download_csv_to_coco.py +239 -0
  33. megadetector-5.0.8/data_management/yolo_to_coco.py +436 -0
  34. {megadetector-5.0.7 → megadetector-5.0.8}/detection/run_detector_batch.py +12 -3
  35. {megadetector-5.0.7 → megadetector-5.0.8}/detection/run_inference_with_yolov5_val.py +10 -3
  36. {megadetector-5.0.7 → megadetector-5.0.8}/detection/run_tiled_inference.py +2 -2
  37. {megadetector-5.0.7 → megadetector-5.0.8}/detection/tf_detector.py +2 -1
  38. {megadetector-5.0.7 → megadetector-5.0.8}/detection/video_utils.py +1 -1
  39. {megadetector-5.0.7 → megadetector-5.0.8}/md_utils/ct_utils.py +22 -3
  40. {megadetector-5.0.7 → megadetector-5.0.8}/md_utils/md_tests.py +11 -2
  41. {megadetector-5.0.7 → megadetector-5.0.8}/md_utils/path_utils.py +206 -32
  42. {megadetector-5.0.7 → megadetector-5.0.8}/md_utils/url_utils.py +66 -1
  43. {megadetector-5.0.7 → megadetector-5.0.8}/md_utils/write_html_image_list.py +12 -3
  44. {megadetector-5.0.7 → megadetector-5.0.8}/md_visualization/visualization_utils.py +363 -72
  45. {megadetector-5.0.7 → megadetector-5.0.8}/md_visualization/visualize_db.py +33 -10
  46. {megadetector-5.0.7 → megadetector-5.0.8/megadetector.egg-info}/PKG-INFO +10 -12
  47. {megadetector-5.0.7 → megadetector-5.0.8}/megadetector.egg-info/SOURCES.txt +4 -1
  48. {megadetector-5.0.7 → megadetector-5.0.8}/pyproject.toml +1 -1
  49. megadetector-5.0.7/data_management/labelme_to_coco.py +0 -398
  50. megadetector-5.0.7/data_management/lila/download_lila_subset.py +0 -175
  51. megadetector-5.0.7/data_management/yolo_to_coco.py +0 -236
  52. megadetector-5.0.7/md_visualization/visualize_megadb.py +0 -183
  53. {megadetector-5.0.7 → megadetector-5.0.8}/LICENSE +0 -0
  54. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/api_core/batch_service/score.py +0 -0
  55. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/api_core/server.py +0 -0
  56. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/api_core/server_api_config.py +0 -0
  57. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/api_core/server_app_config.py +0 -0
  58. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/api_core/server_batch_job_manager.py +0 -0
  59. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/api_core/server_job_status_table.py +0 -0
  60. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/api_core/server_orchestration.py +0 -0
  61. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/api_core/server_utils.py +0 -0
  62. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/api_core_support/aggregate_results_manually.py +0 -0
  63. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/api_support/summarize_daily_activity.py +0 -0
  64. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/data_preparation/manage_video_batch.py +0 -0
  65. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/integration/digiKam/setup.py +0 -0
  66. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/integration/digiKam/xmp_integration.py +0 -0
  67. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/integration/eMammal/test_scripts/config_template.py +0 -0
  68. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/integration/eMammal/test_scripts/push_annotations_to_emammal.py +0 -0
  69. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/integration/eMammal/test_scripts/select_images_for_testing.py +0 -0
  70. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/postprocessing/add_max_conf.py +0 -0
  71. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/postprocessing/categorize_detections_by_size.py +0 -0
  72. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/postprocessing/md_to_coco.py +0 -0
  73. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/postprocessing/repeat_detection_elimination/find_repeat_detections.py +0 -0
  74. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/postprocessing/repeat_detection_elimination/remove_repeat_detections.py +0 -0
  75. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/postprocessing/separate_detections_into_folders.py +0 -0
  76. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/postprocessing/subset_json_detector_output.py +0 -0
  77. {megadetector-5.0.7 → megadetector-5.0.8}/api/batch_processing/postprocessing/top_folders_to_bottom.py +0 -0
  78. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/api_backend.py +0 -0
  79. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/api_frontend.py +0 -0
  80. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/config.py +0 -0
  81. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/data_management/annotations/annotation_constants.py +0 -0
  82. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/detection/detector_training/copy_checkpoints.py +0 -0
  83. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/detection/detector_training/model_main_tf2.py +0 -0
  84. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/detection/process_video.py +0 -0
  85. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/detection/pytorch_detector.py +0 -0
  86. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/detection/run_detector.py +0 -0
  87. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/detection/run_detector_batch.py +0 -0
  88. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/detection/run_inference_with_yolov5_val.py +0 -0
  89. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/detection/run_tiled_inference.py +0 -0
  90. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/detection/tf_detector.py +0 -0
  91. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/detection/video_utils.py +0 -0
  92. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/md_utils/azure_utils.py +0 -0
  93. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/md_utils/ct_utils.py +0 -0
  94. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/md_utils/directory_listing.py +0 -0
  95. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/md_utils/matlab_porting_tools.py +0 -0
  96. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/md_utils/path_utils.py +0 -0
  97. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/md_utils/process_utils.py +0 -0
  98. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/md_utils/sas_blob_utils.py +0 -0
  99. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/md_utils/string_utils.py +0 -0
  100. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/md_utils/url_utils.py +0 -0
  101. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/md_utils/write_html_image_list.py +0 -0
  102. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/animal_detection_api/md_visualization/visualization_utils.py +0 -0
  103. {megadetector-5.0.7 → megadetector-5.0.8}/api/synchronous/api_core/tests/load_test.py +0 -0
  104. {megadetector-5.0.7 → megadetector-5.0.8}/classification/aggregate_classifier_probs.py +0 -0
  105. {megadetector-5.0.7 → megadetector-5.0.8}/classification/analyze_failed_images.py +0 -0
  106. {megadetector-5.0.7 → megadetector-5.0.8}/classification/cache_batchapi_outputs.py +0 -0
  107. {megadetector-5.0.7 → megadetector-5.0.8}/classification/create_classification_dataset.py +0 -0
  108. {megadetector-5.0.7 → megadetector-5.0.8}/classification/crop_detections.py +0 -0
  109. {megadetector-5.0.7 → megadetector-5.0.8}/classification/csv_to_json.py +0 -0
  110. {megadetector-5.0.7 → megadetector-5.0.8}/classification/detect_and_crop.py +0 -0
  111. {megadetector-5.0.7 → megadetector-5.0.8}/classification/efficientnet/__init__.py +0 -0
  112. {megadetector-5.0.7 → megadetector-5.0.8}/classification/efficientnet/model.py +0 -0
  113. {megadetector-5.0.7 → megadetector-5.0.8}/classification/efficientnet/utils.py +0 -0
  114. {megadetector-5.0.7 → megadetector-5.0.8}/classification/evaluate_model.py +0 -0
  115. {megadetector-5.0.7 → megadetector-5.0.8}/classification/identify_mislabeled_candidates.py +0 -0
  116. {megadetector-5.0.7 → megadetector-5.0.8}/classification/json_to_azcopy_list.py +0 -0
  117. {megadetector-5.0.7 → megadetector-5.0.8}/classification/json_validator.py +0 -0
  118. {megadetector-5.0.7 → megadetector-5.0.8}/classification/map_classification_categories.py +0 -0
  119. {megadetector-5.0.7 → megadetector-5.0.8}/classification/merge_classification_detection_output.py +0 -0
  120. {megadetector-5.0.7 → megadetector-5.0.8}/classification/prepare_classification_script.py +0 -0
  121. {megadetector-5.0.7 → megadetector-5.0.8}/classification/prepare_classification_script_mc.py +0 -0
  122. {megadetector-5.0.7 → megadetector-5.0.8}/classification/run_classifier.py +0 -0
  123. {megadetector-5.0.7 → megadetector-5.0.8}/classification/save_mislabeled.py +0 -0
  124. {megadetector-5.0.7 → megadetector-5.0.8}/classification/train_classifier.py +0 -0
  125. {megadetector-5.0.7 → megadetector-5.0.8}/classification/train_classifier_tf.py +0 -0
  126. {megadetector-5.0.7 → megadetector-5.0.8}/classification/train_utils.py +0 -0
  127. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/annotations/annotation_constants.py +0 -0
  128. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/cct_json_to_filename_json.py +0 -0
  129. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/cct_to_csv.py +0 -0
  130. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/cct_to_md.py +0 -0
  131. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/cct_to_wi.py +0 -0
  132. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/databases/add_width_and_height_to_db.py +0 -0
  133. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/databases/combine_coco_camera_traps_files.py +0 -0
  134. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/databases/remove_corrupted_images_from_db.py +0 -0
  135. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/generate_crops_from_cct.py +0 -0
  136. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/add_nacti_sizes.py +0 -0
  137. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/add_timestamps_to_icct.py +0 -0
  138. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/auckland_doc_test_to_json.py +0 -0
  139. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/auckland_doc_to_json.py +0 -0
  140. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/awc_to_json.py +0 -0
  141. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/bellevue_to_json.py +0 -0
  142. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/cacophony-thermal-importer.py +0 -0
  143. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/carrizo_shrubfree_2018.py +0 -0
  144. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/carrizo_trail_cam_2017.py +0 -0
  145. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/cct_field_adjustments.py +0 -0
  146. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/channel_islands_to_cct.py +0 -0
  147. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/eMammal/copy_and_unzip_emammal.py +0 -0
  148. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/eMammal/eMammal_helpers.py +0 -0
  149. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/eMammal/make_eMammal_json.py +0 -0
  150. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/ena24_to_json.py +0 -0
  151. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/filenames_to_json.py +0 -0
  152. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/helena_to_cct.py +0 -0
  153. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/idaho-camera-traps.py +0 -0
  154. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/idfg_iwildcam_lila_prep.py +0 -0
  155. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/jb_csv_to_json.py +0 -0
  156. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/mcgill_to_json.py +0 -0
  157. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/missouri_to_json.py +0 -0
  158. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/nacti_fieldname_adjustments.py +0 -0
  159. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/pc_to_json.py +0 -0
  160. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/plot_wni_giraffes.py +0 -0
  161. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/prepare-noaa-fish-data-for-lila.py +0 -0
  162. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/prepare_zsl_imerit.py +0 -0
  163. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/rspb_to_json.py +0 -0
  164. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/save_the_elephants_survey_A.py +0 -0
  165. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/save_the_elephants_survey_B.py +0 -0
  166. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/snapshot_safari_importer.py +0 -0
  167. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/snapshot_safari_importer_reprise.py +0 -0
  168. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/snapshot_serengeti_lila.py +0 -0
  169. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/snapshotserengeti/make_full_SS_json.py +0 -0
  170. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/snapshotserengeti/make_per_season_SS_json.py +0 -0
  171. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/sulross_get_exif.py +0 -0
  172. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/timelapse_csv_set_to_json.py +0 -0
  173. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/ubc_to_json.py +0 -0
  174. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/umn_to_json.py +0 -0
  175. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/wellington_to_json.py +0 -0
  176. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/wi_to_json.py +0 -0
  177. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/importers/zamba_results_to_md_results.py +0 -0
  178. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/lila/add_locations_to_island_camera_traps.py +0 -0
  179. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/lila/add_locations_to_nacti.py +0 -0
  180. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/lila/create_lila_test_set.py +0 -0
  181. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/lila/create_links_to_md_results_files.py +0 -0
  182. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/lila/get_lila_annotation_counts.py +0 -0
  183. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/lila/get_lila_image_counts.py +0 -0
  184. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/lila/test_lila_metadata_urls.py +0 -0
  185. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/ocr_tools.py +0 -0
  186. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/remove_exif.py +0 -0
  187. {megadetector-5.0.7 → megadetector-5.0.8}/data_management/yolo_output_to_md_output.py +0 -0
  188. {megadetector-5.0.7 → megadetector-5.0.8}/detection/detector_training/copy_checkpoints.py +0 -0
  189. {megadetector-5.0.7 → megadetector-5.0.8}/detection/detector_training/model_main_tf2.py +0 -0
  190. {megadetector-5.0.7 → megadetector-5.0.8}/detection/process_video.py +0 -0
  191. {megadetector-5.0.7 → megadetector-5.0.8}/detection/pytorch_detector.py +0 -0
  192. {megadetector-5.0.7 → megadetector-5.0.8}/detection/run_detector.py +0 -0
  193. {megadetector-5.0.7 → megadetector-5.0.8}/md_utils/azure_utils.py +0 -0
  194. {megadetector-5.0.7 → megadetector-5.0.8}/md_utils/directory_listing.py +0 -0
  195. {megadetector-5.0.7 → megadetector-5.0.8}/md_utils/process_utils.py +0 -0
  196. {megadetector-5.0.7 → megadetector-5.0.8}/md_utils/sas_blob_utils.py +0 -0
  197. {megadetector-5.0.7 → megadetector-5.0.8}/md_utils/split_locations_into_train_val.py +0 -0
  198. {megadetector-5.0.7 → megadetector-5.0.8}/md_utils/string_utils.py +0 -0
  199. {megadetector-5.0.7 → megadetector-5.0.8}/md_visualization/plot_utils.py +0 -0
  200. {megadetector-5.0.7 → megadetector-5.0.8}/md_visualization/render_images_with_thumbnails.py +0 -0
  201. {megadetector-5.0.7 → megadetector-5.0.8}/md_visualization/visualize_detector_output.py +0 -0
  202. {megadetector-5.0.7 → megadetector-5.0.8}/megadetector.egg-info/dependency_links.txt +0 -0
  203. {megadetector-5.0.7 → megadetector-5.0.8}/megadetector.egg-info/requires.txt +0 -0
  204. {megadetector-5.0.7 → megadetector-5.0.8}/megadetector.egg-info/top_level.txt +0 -0
  205. {megadetector-5.0.7 → megadetector-5.0.8}/setup.cfg +0 -0
  206. {megadetector-5.0.7 → megadetector-5.0.8}/taxonomy_mapping/map_lila_taxonomy_to_wi_taxonomy.py +0 -0
  207. {megadetector-5.0.7 → megadetector-5.0.8}/taxonomy_mapping/map_new_lila_datasets.py +0 -0
  208. {megadetector-5.0.7 → megadetector-5.0.8}/taxonomy_mapping/prepare_lila_taxonomy_release.py +0 -0
  209. {megadetector-5.0.7 → megadetector-5.0.8}/taxonomy_mapping/preview_lila_taxonomy.py +0 -0
  210. {megadetector-5.0.7 → megadetector-5.0.8}/taxonomy_mapping/retrieve_sample_image.py +0 -0
  211. {megadetector-5.0.7 → megadetector-5.0.8}/taxonomy_mapping/simple_image_download.py +0 -0
  212. {megadetector-5.0.7 → megadetector-5.0.8}/taxonomy_mapping/species_lookup.py +0 -0
  213. {megadetector-5.0.7 → megadetector-5.0.8}/taxonomy_mapping/taxonomy_csv_checker.py +0 -0
  214. {megadetector-5.0.7 → megadetector-5.0.8}/taxonomy_mapping/taxonomy_graph.py +0 -0
  215. {megadetector-5.0.7 → megadetector-5.0.8}/taxonomy_mapping/validate_lila_category_mappings.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: megadetector
3
- Version: 5.0.7
3
+ Version: 5.0.8
4
4
  Summary: MegaDetector is an AI model that helps conservation folks spend less time doing boring things with camera trap images.
5
5
  Author-email: Your friendly neighborhood MegaDetector team <cameratraps@lila.science>
6
6
  Maintainer-email: Your friendly neighborhood MegaDetector team <cameratraps@lila.science>
@@ -60,7 +60,7 @@ If you want to learn more about what MegaDetector is all about, head over to the
60
60
 
61
61
  ### If you are an ecologist...
62
62
 
63
- 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. We recommend starting with our "[Getting started with MegaDetector](https://github.com/agentmorris/MegaDetector/blob/main/collaborations.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. That journey will <i>not</i> involve this package.
63
+ 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. We recommend starting with our "[Getting started with MegaDetector](https://github.com/agentmorris/MegaDetector/blob/main/collaborations.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. That journey will <i>not</i> involve this Python package.
64
64
 
65
65
  ### If you are a computer-vision-y type...
66
66
 
@@ -95,15 +95,13 @@ temporary_filename = url_utils.download_url(image_url)
95
95
 
96
96
  image = vis_utils.load_image(temporary_filename)
97
97
 
98
- # This will automatically download MDv5a to the system temp folder;
99
- # you can also specify a filename explicitly, or set the $MDV5A
100
- # environment variable to point to the model file.
98
+ # This will automatically download MDv5a; you can also specify a filename.
101
99
  model = run_detector.load_detector('MDV5A')
102
100
 
103
101
  result = model.generate_detections_one_image(image)
104
102
 
105
103
  detections_above_threshold = [d for d in result['detections'] if d['conf'] > 0.2]
106
- print('Found {} detection above threshold'.format(len(detections_above_threshold)))
104
+ print('Found {} detections above threshold'.format(len(detections_above_threshold)))
107
105
  ```
108
106
 
109
107
  #### Run MegaDetector on a folder of images
@@ -120,14 +118,14 @@ output_file = os.path.expanduser('~/megadetector_output_test.json')
120
118
  # Recursively find images
121
119
  image_file_names = path_utils.find_images(image_folder,recursive=True)
122
120
 
123
- # This will automatically download MDv5a to the system temp folder;
124
- # you can also specify a filename explicitly, or set the $MDV5A
125
- # environment variable to point to the model file.
121
+ # This will automatically download MDv5a; you can also specify a filename.
126
122
  results = load_and_run_detector_batch('MDV5A', image_file_names)
127
123
 
128
- # Write results as relative filenames, this is what Timelapse
129
- # and other downstream tools expect.
130
- write_results_to_file(results,output_file,relative_path_base=image_folder)
124
+ # Write results to a format that Timelapse and other downstream tools like.
125
+ write_results_to_file(results,
126
+ output_file,
127
+ relative_path_base=image_folder,
128
+ detector_file=detector_filename)
131
129
  ```
132
130
 
133
131
  ## Contact
@@ -9,7 +9,7 @@ If you want to learn more about what MegaDetector is all about, head over to the
9
9
 
10
10
  ### If you are an ecologist...
11
11
 
12
- 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. We recommend starting with our "[Getting started with MegaDetector](https://github.com/agentmorris/MegaDetector/blob/main/collaborations.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. That journey will <i>not</i> involve this package.
12
+ 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. We recommend starting with our "[Getting started with MegaDetector](https://github.com/agentmorris/MegaDetector/blob/main/collaborations.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. That journey will <i>not</i> involve this Python package.
13
13
 
14
14
  ### If you are a computer-vision-y type...
15
15
 
@@ -44,15 +44,13 @@ temporary_filename = url_utils.download_url(image_url)
44
44
 
45
45
  image = vis_utils.load_image(temporary_filename)
46
46
 
47
- # This will automatically download MDv5a to the system temp folder;
48
- # you can also specify a filename explicitly, or set the $MDV5A
49
- # environment variable to point to the model file.
47
+ # This will automatically download MDv5a; you can also specify a filename.
50
48
  model = run_detector.load_detector('MDV5A')
51
49
 
52
50
  result = model.generate_detections_one_image(image)
53
51
 
54
52
  detections_above_threshold = [d for d in result['detections'] if d['conf'] > 0.2]
55
- print('Found {} detection above threshold'.format(len(detections_above_threshold)))
53
+ print('Found {} detections above threshold'.format(len(detections_above_threshold)))
56
54
  ```
57
55
 
58
56
  #### Run MegaDetector on a folder of images
@@ -69,14 +67,14 @@ output_file = os.path.expanduser('~/megadetector_output_test.json')
69
67
  # Recursively find images
70
68
  image_file_names = path_utils.find_images(image_folder,recursive=True)
71
69
 
72
- # This will automatically download MDv5a to the system temp folder;
73
- # you can also specify a filename explicitly, or set the $MDV5A
74
- # environment variable to point to the model file.
70
+ # This will automatically download MDv5a; you can also specify a filename.
75
71
  results = load_and_run_detector_batch('MDV5A', image_file_names)
76
72
 
77
- # Write results as relative filenames, this is what Timelapse
78
- # and other downstream tools expect.
79
- write_results_to_file(results,output_file,relative_path_base=image_folder)
73
+ # Write results to a format that Timelapse and other downstream tools like.
74
+ write_results_to_file(results,
75
+ output_file,
76
+ relative_path_base=image_folder,
77
+ detector_file=detector_filename)
80
78
  ```
81
79
 
82
80
  ## Contact
@@ -4,35 +4,16 @@
4
4
 
5
5
  ## Table of contents
6
6
 
7
- 1. [Repo overview](#repo-overview)
8
- 2. [What's MegaDetector all about?](#whats-megadetector-all-about)
7
+ 1. [What's MegaDetector all about?](#whats-megadetector-all-about)
9
8
  3. [How do I get started with MegaDetector?](#how-do-i-get-started-with-megadetector)
10
9
  4. [Who is using MegaDetector?](#who-is-using-megadetector)
11
10
  5. [Repo contents](#repo-contents)
12
11
  6. [Contact](#contact)
13
12
  7. [Gratuitous camera trap picture](#gratuitous-camera-trap-picture)
14
13
 
15
-
16
- ## Repo overview
17
-
18
- This repo contains the tools for training and running [MegaDetector](megadetector.md), an object detection model that does a pretty good job finding animals, people, and vehicles (and therefore is pretty good at finding empty images) in camera trap images in a variety of terrestrial ecosystems.
19
-
20
- The core functionality provided is:
21
-
22
- - Training and running [MegaDetector](megadetector.md).
23
- - Training and running some [species classifiers](classification) that are used in conjunction with MegaDetector.
24
- - Tools to [convert](data_management) frequently-used camera trap metadata formats into a common format.
25
- - A [batch processing API](https://github.com/agentmorris/MegaDetector/tree/main/api/batch_processing) that runs MegaDetector on large image collections, to accelerate population surveys.
26
- - A [real-time API](https://github.com/agentmorris/MegaDetector/tree/main/api/synchronous) that runs MegaDetector (and some species classifiers) synchronously, primarily to support biosecurity applications.
27
-
28
- MegaDetector was initially developed by the [Microsoft AI for Earth program](https://www.microsoft.com/en-us/ai/ai-for-earth); this repo was forked from the microsoft/cameratraps repo and is maintained by the original MegaDetector developers (who are no longer at Microsoft, but are absolutely fantastically eternally grateful to Microsoft for the investment and commitment that made MegaDetector happen).
29
-
30
-
31
14
  ## What's MegaDetector all about?
32
15
 
33
- [MegaDetector](megadetector.md) is an object detection model that identifies animals, people, and vehicles in camera trap images (which also makes it useful for eliminating blank images). This model is trained on several hundred thousand bounding boxes from a variety of ecosystems. Lots more information &ndash; including download links and instructions for running the model &ndash; is available in the [MegaDetector User Guide](megadetector.md).
34
-
35
- This repo does not host the data used to train MegaDetector, but we work with our collaborators to make data and annotations available whenever possible on [lila.science](http://lila.science). See the [MegaDetector training data](megadetector.md#can-you-share-the-training-data) section to learn more about the data used to train MegaDetector.
16
+ [MegaDetector](megadetector.md) is an AI model that identifies animals, people, and vehicles in camera trap images (which also makes it useful for eliminating blank images). This model is trained on several million images from a variety of ecosystems.
36
17
 
37
18
  Here's a &ldquo;teaser&rdquo; image of what MegaDetector output looks like:
38
19
 
@@ -41,11 +22,11 @@ Here's a &ldquo;teaser&rdquo; image of what MegaDetector output looks like:
41
22
 
42
23
  ## How do I get started with MegaDetector?
43
24
 
44
- If you're just considering the use of AI in your workflow, and you aren't even sure yet whether MegaDetector would be useful to you, we recommend reading the "[getting started with MegaDetector](collaborations.md)" page.
45
-
46
- If you're already familiar with MegaDetector and you're ready to run it on your data (and you have some familiarity with running Python code), see the [MegaDetector User Guide](megadetector.md) for instructions on downloading and running MegaDetector.
47
-
48
- If you're a programmer-type looking to use tools from this repo, we generally recommend cloning the repo, but there is also a [Python package](https://pypi.org/project/megadetector/) that provides access to everything in this repo (yes, you guessed it, "pip install megadetector").
25
+ * If you are looking for a convenient tool to run MegaDetector, you don't need anything from this repository: check out [EcoAssist](https://github.com/PetervanLunteren/EcoAssist?tab=readme-ov-file).
26
+ * If you're just <i>considering</i> the use of AI in your workflow, and you aren't even sure yet whether MegaDetector would be useful to you, we recommend reading the "[getting started with MegaDetector](collaborations.md)" page.
27
+ * If you're already familiar with MegaDetector and you're ready to run it on your data, see the [MegaDetector User Guide](megadetector.md) for instructions on running MegaDetector.
28
+ * If you're a programmer-type looking to use tools from this repo, check out the [Python package](https://pypi.org/project/megadetector/) that provides access to everything in this repo (yes, you guessed it, "pip install megadetector").
29
+ * If you have any questions, or you want to tell us that MegaDetector was amazing/terrible on your images, <a href="mailto:cameratraps@lila.science">email us</a>!
49
30
 
50
31
  MegaDetector is just one of many tools that aims to make conservation biologists more efficient with AI. If you want to learn about other ways to use AI to accelerate camera trap workflows, check out our of the field, affectionately titled &ldquo;[Everything I know about machine learning and camera traps](https://agentmorris.github.io/camera-trap-ml-survey/)&rdquo;.
51
32
 
@@ -57,6 +38,7 @@ We work with ecologists all over the world to help them spend less time annotati
57
38
  Here are a few of the organizations that have used MegaDetector... we're only listing organizations who (a) we know about and (b) have given us permission to refer to them here (or have posted publicly about their use of MegaDetector), so if you're using MegaDetector or other tools from this repo and would like to be added to this list, <a href="mailto:cameratraps@lila.science">email us</a>!
58
39
 
59
40
  * [Arizona Department of Environmental Quality](http://azdeq.gov/)
41
+ * [Biometrio.earth](https://biometrio.earth/)
60
42
  * [Blackbird Environmental](https://blackbirdenv.com/)
61
43
  * [Camelot](https://camelotproject.org/)
62
44
  * [Canadian Parks and Wilderness Society (CPAWS) Northern Alberta Chapter](https://cpawsnab.org/)
@@ -65,10 +47,10 @@ Here are a few of the organizations that have used MegaDetector... we're only li
65
47
  * [Dudek Camera Trap AI Image Toolkit (AIT)](https://dudek.com/services/wildlife-camera-trap-ai-image-processing-and-management/)
66
48
  * [EcoLogic Consultants Ltd.](https://www.consult-ecologic.com/)
67
49
  * [Estación Biológica de Doñana](http://www.ebd.csic.es/inicio)
68
- * [Idaho Department of Fish and Game](https://idfg.idaho.gov/)
69
- * [Island Conservation](https://www.islandconservation.org/)
50
+ * [Indigenous Desert Alliance](https://www.indigenousdesertalliance.com/)
70
51
  * [Myall Lakes Dingo Project](https://carnivorecoexistence.info/myall-lakes-dingo-project/)
71
52
  * [Norwegian Institute for Nature Research](https://www.nina.no/english/Home)
53
+ * [Okala](https://www.okala.io/)
72
54
  * [Point No Point Treaty Council](https://pnptc.org/)
73
55
  * [Ramat Hanadiv Nature Park](https://www.ramat-hanadiv.org.il/en/)
74
56
  * [SPEA (Portuguese Society for the Study of Birds)](https://spea.pt/en/)
@@ -94,10 +76,12 @@ Here are a few of the organizations that have used MegaDetector... we're only li
94
76
  * [Cross-Cultural Ecology Lab](https://crossculturalecology.net/), Macquarie University
95
77
  * [DC Cat Count](https://hub.dccatcount.org/), led by the Humane Rescue Alliance
96
78
  * [Department of Fish and Wildlife Sciences](https://www.uidaho.edu/cnr/departments/fish-and-wildlife-sciences), University of Idaho
79
+ * [Department of Society & Conservation](https://www.umt.edu/environment/about/departments/socon/), W.A. Franke College of Forestry & Conservation, University of Montana
97
80
  * [Department of Wildlife Ecology and Conservation](https://wec.ifas.ufl.edu/), University of Florida
98
81
  * [Ecology and Conservation of Amazonian Vertebrates Research Group](https://www.researchgate.net/lab/Fernanda-Michalski-Lab-4), Federal University of Amapá
99
82
  * [Gola Forest Programma](https://www.rspb.org.uk/our-work/conservation/projects/scientific-support-for-the-gola-forest-programme/), Royal Society for the Protection of Birds (RSPB)
100
83
  * [Graeme Shannon's Research Group](https://wildliferesearch.co.uk/group-1), Bangor University
84
+ * [Grizzly Bear Recovery Program](https://www.fws.gov/office/grizzly-bear-recovery-program), U.S. Fish & Wildlife Service
101
85
  * [Hamaarag](https://hamaarag.org.il/), The Steinhardt Museum of Natural History, Tel Aviv University
102
86
  * [Institut des Science de la Forêt Tempérée](https://isfort.uqo.ca/) (ISFORT), Université du Québec en Outaouais
103
87
  * [Lab of Dr. Bilal Habib](https://bhlab.in/about), the Wildlife Institute of India
@@ -111,6 +95,7 @@ Here are a few of the organizations that have used MegaDetector... we're only li
111
95
  * [Seattle Urban Carnivore Project](https://www.zoo.org/seattlecarnivores), Woodland Park Zoo
112
96
  * [Serra dos Órgãos National Park](https://www.icmbio.gov.br/parnaserradosorgaos/), ICMBio
113
97
  * [Snapshot USA](https://emammal.si.edu/snapshot-usa), Smithsonian
98
+ * [TROPECOLNET project](https://www.anabenitezlopez.com/research/global-change-biology/tropecolnet/), Museo Nacional de Ciencias Naturales
114
99
  * [Wildlife Coexistence Lab](https://wildlife.forestry.ubc.ca/), University of British Columbia
115
100
  * [Wildlife Research](https://www.dfw.state.or.us/wildlife/research/index.asp), Oregon Department of Fish and Wildlife
116
101
  * [Wildlife Division](https://www.michigan.gov/dnr/about/contact/wildlife), Michigan Department of Natural Resources
@@ -122,9 +107,12 @@ Here are a few of the organizations that have used MegaDetector... we're only li
122
107
  * [School of Natural Sciences](https://www.utas.edu.au/natural-sciences), University of Tasmania ([story](https://www.utas.edu.au/about/news-and-stories/articles/2022/1204-innovative-camera-network-keeps-close-eye-on-tassie-wildlife))
123
108
  * [Kenai National Wildlife Refuge](https://www.fws.gov/refuge/kenai), U.S. Fish & Wildlife Service ([story](https://www.peninsulaclarion.com/sports/refuge-notebook-new-technology-increases-efficiency-of-refuge-cameras/))
124
109
 
125
- * [Australian Wildlife Conservancy](https://www.australianwildlife.org/) (blog posts [1](https://www.australianwildlife.org/cutting-edge-technology-delivering-efficiency-gains-in-conservation/), [2](https://www.australianwildlife.org/efficiency-gains-at-the-cutting-edge-of-technology/))
110
+ * [Idaho Department of Fish and Game](https://idfg.idaho.gov/) ([fancy PBS video](https://www.youtube.com/watch?v=uEsL8EZKpbA&t=261s&ab_channel=OutdoorIdaho))
111
+ * [Australian Wildlife Conservancy](https://www.australianwildlife.org/) (blog posts [1](https://www.australianwildlife.org/cutting-edge-technology-delivering-efficiency-gains-in-conservation/), [2](https://www.australianwildlife.org/efficiency-gains-at-the-cutting-edge-of-technology/), [3](https://www.australianwildlife.org/federal-grant-to-fund-ai-supported-wildlife-recognisers))
126
112
  * [Bavarian Forest National Park](https://www.nationalpark-bayerischer-wald.bayern.de/english/index.htm) ([story](https://customers.microsoft.com/en-au/story/1667539539271247797-nationalparkbayerischerwald-azure-en))
113
+ * [Environs Kimberley](https://www.environskimberley.org.au) ([blog post](https://www.environskimberley.org.au/ai_megadetector))
127
114
  * [Felidae Conservation Fund](https://felidaefund.org/) ([WildePod platform](https://wildepod.org/)) ([blog post](https://abhaykashyap.com/blog/ai-powered-camera-trap-image-annotation-system/))
115
+ * [Island Conservation](https://www.islandconservation.org/) (blog posts [1](https://www.islandconservation.org/conservation-machine-learning/),[2](https://news.lenovo.com/island-conservation-machine-learning-solutions-nvidia-island-ecosystems/?sprinklrid=12869857824&linkId=356951919)) ([video](https://www.lenovo.com/content/dam/lenovo/iso/customer-references-coe/one-lenovo-customer-stories/wfh/videos/WFH-One-Lenovo-ENG-subtitles.mp4))
128
116
  * [Alberta Biodiversity Monitoring Institute (ABMI)](https://www.abmi.ca/home.html) ([WildTrax platform](https://www.wildtrax.ca/)) (blog posts [1](https://wildcams.ca/blog/the-abmi-visits-the-zoo/),[2](http://blog.abmi.ca/2023/06/14/making-wildtrax-its-not-a-kind-of-magic-behind-the-screen/))
129
117
  * [Shan Shui Conservation Center](http://en.shanshui.org/) ([blog post](https://mp.weixin.qq.com/s/iOIQF3ckj0-rEG4yJgerYw?fbclid=IwAR0alwiWbe3udIcFvqqwm7y5qgr9hZpjr871FZIa-ErGUukZ7yJ3ZhgCevs)) ([translated blog post](https://mp-weixin-qq-com.translate.goog/s/iOIQF3ckj0-rEG4yJgerYw?fbclid=IwAR0alwiWbe3udIcFvqqwm7y5qgr9hZpjr871FZIa-ErGUukZ7yJ3ZhgCevs&_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp)) ([Web demo](https://cameratrap-ai.hinature.cn/home))
130
118
  * [Irvine Ranch Conservancy](http://www.irconservancy.org/) ([story](https://www.ocregister.com/2022/03/30/ai-software-is-helping-researchers-focus-on-learning-about-ocs-wild-animals/))
@@ -134,8 +122,9 @@ Here are a few of the organizations that have used MegaDetector... we're only li
134
122
  * [Trapper](https://trapper-project.readthedocs.io/en/latest/overview.html) ([tutorial](https://trapper-project.readthedocs.io/en/latest/tutorial.html))
135
123
 
136
124
  * [Road Ecology Center](https://roadecology.ucdavis.edu/), University of California, Davis ([Wildlife Observer Network platform](https://wildlifeobserver.net/))
137
- * [The Nature Conservancy in California](https://www.nature.org/en-us/about-us/where-we-work/united-states/california/) ([Animl platform](https://github.com/tnc-ca-geo/animl-frontend))
125
+ * [The Nature Conservancy in California](https://www.nature.org/en-us/about-us/where-we-work/united-states/california/) ([Animl platform](https://github.com/tnc-ca-geo/animl-frontend)) ([story](https://www.vision-systems.com/non-factory/environment-agriculture/article/14304433/the-nature-conservancy-brings-cameras-ai-to-invasive-species-prevention))
138
126
  * [San Diego Zoo Wildlife Alliance](https://science.sandiegozoo.org/) ([Animl R package](https://github.com/conservationtechlab/animl))
127
+ * [TerrOïko](https://www.terroiko.fr/) ([OCAPI platform](https://www.terroiko.fr/ocapi))
139
128
 
140
129
  Also see:
141
130
 
@@ -145,10 +134,25 @@ Also see:
145
134
 
146
135
  * The list of papers tagged "MegaDetector" on our [list of papers about ML and camera traps](https://agentmorris.github.io/camera-trap-ml-survey/#camera-trap-ml-papers)
147
136
 
137
+
148
138
  ## Repo contents
149
139
 
150
140
  This repo is organized into the following folders...
151
141
 
142
+ This repo contains the tools for training and running [MegaDetector](megadetector.md), an object detection model that does a pretty good job finding animals, people, and vehicles (and therefore is pretty good at finding empty images) in camera trap images in a variety of terrestrial ecosystems.
143
+
144
+ The core functionality provided is:
145
+
146
+ - Training and running [MegaDetector](megadetector.md).
147
+ - Training and running some [species classifiers](classification) that are used in conjunction with MegaDetector.
148
+ - Tools to [convert](data_management) frequently-used camera trap metadata formats into a common format.
149
+ - A [batch processing API](https://github.com/agentmorris/MegaDetector/tree/main/api/batch_processing) that runs MegaDetector on large image collections, to accelerate population surveys.
150
+ - A [real-time API](https://github.com/agentmorris/MegaDetector/tree/main/api/synchronous) that runs MegaDetector (and some species classifiers) synchronously, primarily to support biosecurity applications.
151
+
152
+ This repo does not host the data used to train MegaDetector, but we work with our collaborators to make data and annotations available whenever possible on [lila.science](http://lila.science). See the [MegaDetector training data](megadetector.md#can-you-share-the-training-data) section to learn more about the data used to train MegaDetector.
153
+
154
+ MegaDetector was initially developed by the [Microsoft AI for Earth program](https://www.microsoft.com/en-us/ai/ai-for-earth); this repo was forked from the microsoft/cameratraps repo and is maintained by the original MegaDetector developers (who are no longer at Microsoft, but are absolutely fantastically eternally grateful to Microsoft for the investment and commitment that made MegaDetector happen).
155
+
152
156
 
153
157
  ### api
154
158
 
@@ -86,6 +86,8 @@ from api.batch_processing.postprocessing.postprocess_batch_results import (
86
86
  from detection.run_detector import get_detector_version_from_filename
87
87
  from md_utils.ct_utils import image_file_to_camera_folder
88
88
 
89
+ ## Inference options
90
+
89
91
  # To specify a non-default confidence threshold for including detections in the .json file
90
92
  json_threshold = None
91
93
 
@@ -109,6 +111,11 @@ quiet_mode = True
109
111
  # will use its default size, which is 1280 * 1.3, which is almost always what you want.
110
112
  image_size = None
111
113
 
114
+ # Should we include image size, timestamp, and/or EXIF data in MD output?
115
+ include_image_size = False
116
+ include_image_timestamp = False
117
+ include_exif_data = False
118
+
112
119
  # Only relevant when running on CPU
113
120
  ncores = 1
114
121
 
@@ -187,7 +194,7 @@ augment = False
187
194
 
188
195
  ## Constants related to tiled inference
189
196
 
190
- use_tiled_inference = True
197
+ use_tiled_inference = False
191
198
 
192
199
  # Should we delete tiles after each job? Only set this to False for debugging;
193
200
  # large jobs will take up a lot of space if you keep tiles around after each task.
@@ -234,7 +241,7 @@ checkpoint_frequency = 10000
234
241
  approx_images_per_second = estimate_md_images_per_second(model_file)
235
242
 
236
243
  # Rough estimate for the inference time cost of augmentation
237
- if augment:
244
+ if augment and (approx_images_per_second is not None):
238
245
  approx_images_per_second = approx_images_per_second * 0.7
239
246
 
240
247
  base_task_name = organization_name_short + '-' + job_date + job_description_string + '-' + \
@@ -268,6 +275,10 @@ filename_base = os.path.join(base_output_folder_name, base_task_name)
268
275
  combined_api_output_folder = os.path.join(filename_base, 'combined_api_outputs')
269
276
  postprocessing_output_folder = os.path.join(filename_base, 'preview')
270
277
 
278
+ combined_api_output_file = os.path.join(
279
+ combined_api_output_folder,
280
+ '{}_detections.json'.format(base_task_name))
281
+
271
282
  os.makedirs(filename_base, exist_ok=True)
272
283
  os.makedirs(combined_api_output_folder, exist_ok=True)
273
284
  os.makedirs(postprocessing_output_folder, exist_ok=True)
@@ -494,7 +505,14 @@ for i_task,task in enumerate(task_info):
494
505
 
495
506
  overwrite_handling_string = '--overwrite_handling {}'.format(overwrite_handling)
496
507
  cmd = f'{cuda_string} python run_detector_batch.py "{model_file}" "{chunk_file}" "{output_fn}" {checkpoint_frequency_string} {checkpoint_path_string} {use_image_queue_string} {ncores_string} {quiet_string} {image_size_string} {confidence_threshold_string} {overwrite_handling_string}'
497
-
508
+
509
+ if include_image_size:
510
+ cmd += ' --include_image_size'
511
+ if include_image_timestamp:
512
+ cmd += ' --include_image_timestamp'
513
+ if include_exif_data:
514
+ cmd += ' --include_exif_data'
515
+
498
516
  cmd_file = os.path.join(filename_base,'run_chunk_{}_gpu_{}{}'.format(str(i_task).zfill(3),
499
517
  str(gpu_number).zfill(2),script_extension))
500
518
 
@@ -747,10 +765,6 @@ for im in combined_results['images']:
747
765
  else:
748
766
  im['file'] = im['file'].replace(input_path + '/','',1)
749
767
 
750
- combined_api_output_file = os.path.join(
751
- combined_api_output_folder,
752
- '{}_detections.json'.format(base_task_name))
753
-
754
768
  with open(combined_api_output_file,'w') as f:
755
769
  json.dump(combined_results,f,indent=1)
756
770
 
@@ -793,7 +807,7 @@ options.api_output_file = combined_api_output_file
793
807
  options.output_dir = output_base
794
808
  ppresults = process_batch_results(options)
795
809
  html_output_file = ppresults.output_html_file
796
- path_utils.open_file(html_output_file,attempt_to_open_in_wsl_host=True)
810
+ path_utils.open_file(html_output_file,attempt_to_open_in_wsl_host=True,browser_name='chrome')
797
811
  # import clipboard; clipboard.copy(html_output_file)
798
812
 
799
813
 
@@ -823,7 +837,7 @@ options.otherDetectionsThreshold = options.confidenceMin
823
837
 
824
838
  options.bRenderDetectionTiles = True
825
839
  options.maxOutputImageWidth = 2000
826
- options.detectionTilesMaxCrops = 300
840
+ options.detectionTilesMaxCrops = 250
827
841
 
828
842
  # options.lineThickness = 5
829
843
  # options.boxExpansion = 8
@@ -930,7 +944,7 @@ options.output_dir = output_base
930
944
  ppresults = process_batch_results(options)
931
945
  html_output_file = ppresults.output_html_file
932
946
 
933
- path_utils.open_file(html_output_file,attempt_to_open_in_wsl_host=True)
947
+ path_utils.open_file(html_output_file,attempt_to_open_in_wsl_host=True,browser_name='chrome')
934
948
  # import clipboard; clipboard.copy(html_output_file)
935
949
 
936
950
 
@@ -2003,7 +2017,7 @@ print('Processing {} to {}'.format(base_task_name, output_base))
2003
2017
  options.api_output_file = sequence_smoothed_classification_file
2004
2018
  options.output_dir = output_base
2005
2019
  ppresults = process_batch_results(options)
2006
- path_utils.open_file(ppresults.output_html_file,attempt_to_open_in_wsl_host=True)
2020
+ path_utils.open_file(ppresults.output_html_file,attempt_to_open_in_wsl_host=True,browser_name='chrome')
2007
2021
  # import clipboard; clipboard.copy(ppresults.output_html_file)
2008
2022
 
2009
2023
  #% Zip .json files
@@ -2071,7 +2085,7 @@ for i, j in itertools.combinations(list(range(0,len(filenames))),2):
2071
2085
  results = compare_batch_results(options)
2072
2086
 
2073
2087
  from md_utils.path_utils import open_file
2074
- open_file(results.html_output_file,attempt_to_open_in_wsl_host=True)
2088
+ open_file(results.html_output_file,attempt_to_open_in_wsl_host=True,browser_name='chrome')
2075
2089
 
2076
2090
 
2077
2091
  #%% Merge in high-confidence detections from another results file
@@ -2125,7 +2139,7 @@ options.output_dir = output_base_large_boxes
2125
2139
 
2126
2140
  ppresults = process_batch_results(options)
2127
2141
  html_output_file = ppresults.output_html_file
2128
- path_utils.open_file(html_output_file,attempt_to_open_in_wsl_host=True)
2142
+ path_utils.open_file(html_output_file,attempt_to_open_in_wsl_host=True,browser_name='chrome')
2129
2143
 
2130
2144
 
2131
2145
  #%% .json splitting
@@ -2280,7 +2294,7 @@ import nbformat as nbf
2280
2294
  if os.name == 'nt':
2281
2295
  git_base = r'c:\git'
2282
2296
  else:
2283
- git_base = os.path.expanduer('~/git')
2297
+ git_base = os.path.expanduser('~/git')
2284
2298
 
2285
2299
  input_py_file = git_base + '/MegaDetector/api/batch_processing/data_preparation/manage_local_batch.py'
2286
2300
  assert os.path.isfile(input_py_file)
@@ -48,7 +48,7 @@ def combine_api_output_files(input_files: List[str],
48
48
  input_files: list of str, paths to JSON detection files
49
49
  output_file: optional str, path to write merged JSON
50
50
  require_uniqueness: bool, whether to require that the images in
51
- each input_dict be unique
51
+ each list of images be unique
52
52
  """
53
53
 
54
54
  def print_if_verbose(s):
@@ -84,7 +84,7 @@ def combine_api_output_dictionaries(input_dicts: Iterable[Mapping[str, Any]],
84
84
  input_dicts: list of dicts, each dict is the JSON of the detections
85
85
  output file from the Batch Processing API
86
86
  require_uniqueness: bool, whether to require that the images in
87
- each input_dict be unique
87
+ each input dict be unique
88
88
 
89
89
  Returns: dict, represents the merged JSON
90
90
  """
@@ -291,7 +291,7 @@ def pairwise_compare_batch_results(options,output_index,pairwise_options):
291
291
  filenames_b_set = set([im['file'] for im in images_b])
292
292
 
293
293
  if len(images_a) != len(images_b):
294
- s = 'set A has {} iamges, set B has {}'.format(len(images_a),len(images_b))
294
+ s = 'set A has {} images, set B has {}'.format(len(images_a),len(images_b))
295
295
  if options.error_on_non_matching_lists:
296
296
  raise ValueError(s)
297
297
  else:
@@ -4,8 +4,8 @@
4
4
  #
5
5
  # Converts between file formats output by our batch processing API. Currently
6
6
  # supports json <--> csv conversion, but this should be the landing place for any
7
- # conversion - including between future .json versions - that we support in the
8
- # future.
7
+ # conversion - including between hypothetical alternative .json versions - that we support
8
+ # in the future.
9
9
  #
10
10
  ########
11
11
 
@@ -30,10 +30,13 @@ CONF_DIGITS = 3
30
30
  #%% Conversion functions
31
31
 
32
32
  def convert_json_to_csv(input_path,output_path=None,min_confidence=None,
33
- omit_bounding_boxes=False,output_encoding=None):
33
+ omit_bounding_boxes=False,output_encoding=None,
34
+ overwrite=True):
34
35
  """
35
36
  Convert .json to .csv
36
37
 
38
+ If output_path is None, will convert x.json to x.csv.
39
+
37
40
  TODO: this function should obviously be using Pandas or some other sensible structured
38
41
  representation of tabular data. Even a list of dicts. This implementation is quite
39
42
  brittle and depends on adding fields to every row in exactly the right order.
@@ -42,6 +45,10 @@ def convert_json_to_csv(input_path,output_path=None,min_confidence=None,
42
45
  if output_path is None:
43
46
  output_path = os.path.splitext(input_path)[0]+'.csv'
44
47
 
48
+ if os.path.isfile(output_path) and (not overwrite):
49
+ print('File {} exists, skipping json --> csv conversion'.format(output_path))
50
+ return
51
+
45
52
  print('Loading json results from {}...'.format(input_path))
46
53
  json_output = json.load(open(input_path))
47
54
 
@@ -73,7 +80,7 @@ def convert_json_to_csv(input_path,output_path=None,min_confidence=None,
73
80
 
74
81
  n_classification_categories = len(classification_category_ids)
75
82
 
76
- # There are several fields for which we add columns, other random bespoke fields
83
+ # There are several .json fields for which we add .csv columns; other random bespoke fields
77
84
  # will be ignored.
78
85
  optional_fields = ['width','height','datetime','exif_metadata']
79
86
  optional_fields_present = set()
@@ -104,7 +111,7 @@ def convert_json_to_csv(input_path,output_path=None,min_confidence=None,
104
111
  if 'failure' in im and im['failure'] is not None:
105
112
  row = [image_id, 'failure', im['failure']]
106
113
  rows.append(row)
107
- print('Skipping failed image {} ({})'.format(im['file'],im['failure']))
114
+ # print('Skipping failed image {} ({})'.format(im['file'],im['failure']))
108
115
  continue
109
116
 
110
117
  max_conf = ct_utils.get_max_conf(im)
@@ -193,12 +200,21 @@ def convert_json_to_csv(input_path,output_path=None,min_confidence=None,
193
200
  writer.writerow(header)
194
201
  writer.writerows(rows)
195
202
 
203
+ # ...def convert_json_to_csv(...)
204
+
196
205
 
197
- def convert_csv_to_json(input_path,output_path=None):
206
+ def convert_csv_to_json(input_path,output_path=None,overwrite=True):
207
+ """
208
+ Convert .csv to .json. If output_path is None, will convert x.csv to x.json.
209
+ """
198
210
 
199
211
  if output_path is None:
200
212
  output_path = os.path.splitext(input_path)[0]+'.json'
201
213
 
214
+ if os.path.isfile(output_path) and (not overwrite):
215
+ print('File {} exists, skipping csv --> json conversion'.format(output_path))
216
+ return
217
+
202
218
  # Format spec:
203
219
  #
204
220
  # https://github.com/agentmorris/MegaDetector/tree/master/api/batch_processing
@@ -259,6 +275,8 @@ def convert_csv_to_json(input_path,output_path=None):
259
275
  json_out['images'] = images
260
276
 
261
277
  json.dump(json_out,open(output_path,'w'),indent=1)
278
+
279
+ # ...def convert_csv_to_json(...)
262
280
 
263
281
 
264
282
  #%% Interactive driver
@@ -64,11 +64,9 @@ def load_api_results(api_output_path: str, normalize_paths: bool = True,
64
64
  if k != 'images':
65
65
  other_fields[k] = v
66
66
 
67
- # Normalize paths to simplify comparisons later
68
67
  if normalize_paths:
69
68
  for image in detection_results['images']:
70
- image['file'] = os.path.normpath(image['file'])
71
- # image['file'] = image['file'].replace('\\','/')
69
+ image['file'] = os.path.normpath(image['file'])
72
70
 
73
71
  if force_forward_slashes:
74
72
  for image in detection_results['images']: