megadetector 5.0.23__tar.gz → 5.0.25__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 (220) hide show
  1. {megadetector-5.0.23/megadetector.egg-info → megadetector-5.0.25}/PKG-INFO +11 -23
  2. {megadetector-5.0.23 → megadetector-5.0.25}/README-package.md +4 -17
  3. {megadetector-5.0.23 → megadetector-5.0.25}/README.md +15 -11
  4. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/synchronous/api_core/animal_detection_api/api_backend.py +2 -3
  5. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/merge_classification_detection_output.py +2 -2
  6. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/coco_to_labelme.py +2 -1
  7. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/databases/integrity_check_json_db.py +15 -14
  8. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/databases/subset_json_db.py +49 -21
  9. megadetector-5.0.25/megadetector/data_management/lila/add_locations_to_island_camera_traps.py +101 -0
  10. megadetector-5.0.25/megadetector/data_management/lila/add_locations_to_nacti.py +151 -0
  11. megadetector-5.0.25/megadetector/data_management/mewc_to_md.py +340 -0
  12. megadetector-5.0.25/megadetector/data_management/speciesnet_to_md.py +41 -0
  13. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/yolo_output_to_md_output.py +15 -8
  14. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/detection/process_video.py +24 -7
  15. megadetector-5.0.25/megadetector/detection/pytorch_detector.py +1055 -0
  16. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/detection/run_detector.py +341 -146
  17. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/detection/run_detector_batch.py +307 -70
  18. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/detection/run_inference_with_yolov5_val.py +61 -4
  19. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/detection/tf_detector.py +6 -1
  20. megadetector-5.0.23/megadetector/postprocessing/combine_api_outputs.py → megadetector-5.0.25/megadetector/postprocessing/combine_batch_outputs.py +10 -13
  21. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/postprocessing/compare_batch_results.py +236 -7
  22. megadetector-5.0.25/megadetector/postprocessing/create_crop_folder.py +358 -0
  23. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/postprocessing/md_to_labelme.py +7 -7
  24. megadetector-5.0.25/megadetector/postprocessing/md_to_wi.py +40 -0
  25. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/postprocessing/merge_detections.py +1 -1
  26. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/postprocessing/postprocess_batch_results.py +12 -5
  27. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/postprocessing/separate_detections_into_folders.py +32 -4
  28. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/postprocessing/validate_batch_results.py +9 -4
  29. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/utils/ct_utils.py +236 -45
  30. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/utils/directory_listing.py +3 -3
  31. megadetector-5.0.25/megadetector/utils/gpu_test.py +125 -0
  32. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/utils/md_tests.py +455 -116
  33. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/utils/path_utils.py +43 -2
  34. megadetector-5.0.25/megadetector/utils/wi_utils.py +2691 -0
  35. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/visualization/visualization_utils.py +95 -18
  36. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/visualization/visualize_db.py +25 -7
  37. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/visualization/visualize_detector_output.py +60 -13
  38. {megadetector-5.0.23 → megadetector-5.0.25/megadetector.egg-info}/PKG-INFO +11 -23
  39. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector.egg-info/SOURCES.txt +7 -4
  40. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector.egg-info/requires.txt +8 -3
  41. {megadetector-5.0.23 → megadetector-5.0.25}/pyproject.toml +30 -10
  42. megadetector-5.0.23/megadetector/data_management/lila/add_locations_to_island_camera_traps.py +0 -97
  43. megadetector-5.0.23/megadetector/data_management/lila/add_locations_to_nacti.py +0 -147
  44. megadetector-5.0.23/megadetector/detection/detector_training/model_main_tf2.py +0 -114
  45. megadetector-5.0.23/megadetector/detection/pytorch_detector.py +0 -374
  46. megadetector-5.0.23/megadetector/utils/torch_test.py +0 -32
  47. megadetector-5.0.23/megadetector/visualization/__init__.py +0 -0
  48. {megadetector-5.0.23 → megadetector-5.0.25}/LICENSE +0 -0
  49. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/__init__.py +0 -0
  50. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/__init__.py +0 -0
  51. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/api_core/__init__.py +0 -0
  52. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/api_core/batch_service/__init__.py +0 -0
  53. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/api_core/batch_service/score.py +0 -0
  54. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/api_core/server.py +0 -0
  55. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/api_core/server_api_config.py +0 -0
  56. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/api_core/server_app_config.py +0 -0
  57. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/api_core/server_batch_job_manager.py +0 -0
  58. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/api_core/server_job_status_table.py +0 -0
  59. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/api_core/server_orchestration.py +0 -0
  60. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/api_core/server_utils.py +0 -0
  61. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/api_core_support/__init__.py +0 -0
  62. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/api_core_support/aggregate_results_manually.py +0 -0
  63. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/api_support/__init__.py +0 -0
  64. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/api_support/summarize_daily_activity.py +0 -0
  65. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/data_preparation/__init__.py +0 -0
  66. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/integration/digiKam/setup.py +0 -0
  67. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/integration/digiKam/xmp_integration.py +0 -0
  68. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/integration/eMammal/test_scripts/config_template.py +0 -0
  69. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/integration/eMammal/test_scripts/push_annotations_to_emammal.py +0 -0
  70. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/batch_processing/integration/eMammal/test_scripts/select_images_for_testing.py +0 -0
  71. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/synchronous/__init__.py +0 -0
  72. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/synchronous/api_core/animal_detection_api/__init__.py +0 -0
  73. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/synchronous/api_core/animal_detection_api/api_frontend.py +0 -0
  74. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/synchronous/api_core/animal_detection_api/config.py +0 -0
  75. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/synchronous/api_core/tests/__init__.py +0 -0
  76. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/api/synchronous/api_core/tests/load_test.py +0 -0
  77. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/__init__.py +0 -0
  78. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/aggregate_classifier_probs.py +0 -0
  79. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/analyze_failed_images.py +0 -0
  80. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/cache_batchapi_outputs.py +0 -0
  81. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/create_classification_dataset.py +0 -0
  82. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/crop_detections.py +0 -0
  83. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/csv_to_json.py +0 -0
  84. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/detect_and_crop.py +0 -0
  85. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/efficientnet/__init__.py +0 -0
  86. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/efficientnet/model.py +0 -0
  87. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/efficientnet/utils.py +0 -0
  88. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/evaluate_model.py +0 -0
  89. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/identify_mislabeled_candidates.py +0 -0
  90. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/json_to_azcopy_list.py +0 -0
  91. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/json_validator.py +0 -0
  92. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/map_classification_categories.py +0 -0
  93. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/prepare_classification_script.py +0 -0
  94. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/prepare_classification_script_mc.py +0 -0
  95. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/run_classifier.py +0 -0
  96. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/save_mislabeled.py +0 -0
  97. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/train_classifier.py +0 -0
  98. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/train_classifier_tf.py +0 -0
  99. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/classification/train_utils.py +0 -0
  100. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/__init__.py +0 -0
  101. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/annotations/__init__.py +0 -0
  102. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/annotations/annotation_constants.py +0 -0
  103. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/camtrap_dp_to_coco.py +0 -0
  104. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/cct_json_utils.py +0 -0
  105. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/cct_to_md.py +0 -0
  106. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/cct_to_wi.py +0 -0
  107. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/coco_to_yolo.py +0 -0
  108. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/databases/__init__.py +0 -0
  109. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/databases/add_width_and_height_to_db.py +0 -0
  110. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/databases/combine_coco_camera_traps_files.py +0 -0
  111. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/generate_crops_from_cct.py +0 -0
  112. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/get_image_sizes.py +0 -0
  113. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/add_nacti_sizes.py +0 -0
  114. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/add_timestamps_to_icct.py +0 -0
  115. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/animl_results_to_md_results.py +0 -0
  116. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/auckland_doc_test_to_json.py +0 -0
  117. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/auckland_doc_to_json.py +0 -0
  118. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/awc_to_json.py +0 -0
  119. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/bellevue_to_json.py +0 -0
  120. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/cacophony-thermal-importer.py +0 -0
  121. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/carrizo_shrubfree_2018.py +0 -0
  122. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/carrizo_trail_cam_2017.py +0 -0
  123. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/cct_field_adjustments.py +0 -0
  124. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/channel_islands_to_cct.py +0 -0
  125. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/eMammal/copy_and_unzip_emammal.py +0 -0
  126. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/eMammal/eMammal_helpers.py +0 -0
  127. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/eMammal/make_eMammal_json.py +0 -0
  128. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/ena24_to_json.py +0 -0
  129. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/filenames_to_json.py +0 -0
  130. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/helena_to_cct.py +0 -0
  131. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/idaho-camera-traps.py +0 -0
  132. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/idfg_iwildcam_lila_prep.py +0 -0
  133. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/import_desert_lion_conservation_camera_traps.py +0 -0
  134. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/jb_csv_to_json.py +0 -0
  135. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/mcgill_to_json.py +0 -0
  136. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/missouri_to_json.py +0 -0
  137. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/nacti_fieldname_adjustments.py +0 -0
  138. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/noaa_seals_2019.py +0 -0
  139. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/osu-small-animals-to-json.py +0 -0
  140. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/pc_to_json.py +0 -0
  141. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/plot_wni_giraffes.py +0 -0
  142. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/prepare_zsl_imerit.py +0 -0
  143. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/raic_csv_to_md_results.py +0 -0
  144. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/rspb_to_json.py +0 -0
  145. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/save_the_elephants_survey_A.py +0 -0
  146. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/save_the_elephants_survey_B.py +0 -0
  147. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/snapshot_safari_importer.py +0 -0
  148. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/snapshot_serengeti_lila.py +0 -0
  149. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/snapshotserengeti/make_full_SS_json.py +0 -0
  150. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/snapshotserengeti/make_per_season_SS_json.py +0 -0
  151. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/sulross_get_exif.py +0 -0
  152. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/timelapse_csv_set_to_json.py +0 -0
  153. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/ubc_to_json.py +0 -0
  154. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/umn_to_json.py +0 -0
  155. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/wellington_to_json.py +0 -0
  156. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/wi_to_json.py +0 -0
  157. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/importers/zamba_results_to_md_results.py +0 -0
  158. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/labelme_to_coco.py +0 -0
  159. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/labelme_to_yolo.py +0 -0
  160. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/lila/__init__.py +0 -0
  161. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/lila/create_lila_blank_set.py +0 -0
  162. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/lila/create_lila_test_set.py +0 -0
  163. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/lila/create_links_to_md_results_files.py +0 -0
  164. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/lila/download_lila_subset.py +0 -0
  165. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/lila/generate_lila_per_image_labels.py +0 -0
  166. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/lila/get_lila_annotation_counts.py +0 -0
  167. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/lila/get_lila_image_counts.py +0 -0
  168. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/lila/lila_common.py +0 -0
  169. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/lila/test_lila_metadata_urls.py +0 -0
  170. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/ocr_tools.py +0 -0
  171. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/read_exif.py +0 -0
  172. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/remap_coco_categories.py +0 -0
  173. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/remove_exif.py +0 -0
  174. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/rename_images.py +0 -0
  175. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/resize_coco_dataset.py +0 -0
  176. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/wi_download_csv_to_coco.py +0 -0
  177. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/data_management/yolo_to_coco.py +0 -0
  178. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/detection/__init__.py +0 -0
  179. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/detection/run_tiled_inference.py +0 -0
  180. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/detection/video_utils.py +0 -0
  181. {megadetector-5.0.23/megadetector/detection/detector_training → megadetector-5.0.25/megadetector/postprocessing}/__init__.py +0 -0
  182. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/postprocessing/add_max_conf.py +0 -0
  183. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/postprocessing/categorize_detections_by_size.py +0 -0
  184. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/postprocessing/classification_postprocessing.py +0 -0
  185. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/postprocessing/convert_output_format.py +0 -0
  186. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/postprocessing/detector_calibration.py +0 -0
  187. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/postprocessing/load_api_results.py +0 -0
  188. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/postprocessing/md_to_coco.py +0 -0
  189. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/postprocessing/remap_detection_categories.py +0 -0
  190. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/postprocessing/render_detection_confusion_matrix.py +0 -0
  191. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/postprocessing/repeat_detection_elimination/find_repeat_detections.py +0 -0
  192. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/postprocessing/repeat_detection_elimination/remove_repeat_detections.py +0 -0
  193. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/postprocessing/repeat_detection_elimination/repeat_detections_core.py +0 -0
  194. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/postprocessing/subset_json_detector_output.py +0 -0
  195. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/postprocessing/top_folders_to_bottom.py +0 -0
  196. {megadetector-5.0.23/megadetector/postprocessing → megadetector-5.0.25/megadetector/taxonomy_mapping}/__init__.py +0 -0
  197. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/taxonomy_mapping/map_lila_taxonomy_to_wi_taxonomy.py +0 -0
  198. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/taxonomy_mapping/map_new_lila_datasets.py +0 -0
  199. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/taxonomy_mapping/prepare_lila_taxonomy_release.py +0 -0
  200. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/taxonomy_mapping/preview_lila_taxonomy.py +0 -0
  201. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/taxonomy_mapping/retrieve_sample_image.py +0 -0
  202. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/taxonomy_mapping/simple_image_download.py +0 -0
  203. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/taxonomy_mapping/species_lookup.py +0 -0
  204. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/taxonomy_mapping/taxonomy_csv_checker.py +0 -0
  205. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/taxonomy_mapping/taxonomy_graph.py +0 -0
  206. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/taxonomy_mapping/validate_lila_category_mappings.py +0 -0
  207. {megadetector-5.0.23/megadetector/taxonomy_mapping → megadetector-5.0.25/megadetector/utils}/__init__.py +0 -0
  208. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/utils/azure_utils.py +0 -0
  209. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/utils/process_utils.py +0 -0
  210. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/utils/sas_blob_utils.py +0 -0
  211. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/utils/split_locations_into_train_val.py +0 -0
  212. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/utils/string_utils.py +0 -0
  213. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/utils/url_utils.py +0 -0
  214. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/utils/write_html_image_list.py +0 -0
  215. {megadetector-5.0.23/megadetector/utils → megadetector-5.0.25/megadetector/visualization}/__init__.py +0 -0
  216. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/visualization/plot_utils.py +0 -0
  217. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector/visualization/render_images_with_thumbnails.py +0 -0
  218. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector.egg-info/dependency_links.txt +0 -0
  219. {megadetector-5.0.23 → megadetector-5.0.25}/megadetector.egg-info/top_level.txt +0 -0
  220. {megadetector-5.0.23 → megadetector-5.0.25}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: megadetector
3
- Version: 5.0.23
3
+ Version: 5.0.25
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>
@@ -29,26 +29,27 @@ Project-URL: Documentation, https://megadetector.readthedocs.io
29
29
  Project-URL: Bug Reports, https://github.com/agentmorris/MegaDetector/issues
30
30
  Project-URL: Source, https://github.com/agentmorris/MegaDetector
31
31
  Keywords: camera traps,conservation,wildlife,ai,megadetector
32
- Classifier: Development Status :: 3 - Alpha
33
- Classifier: License :: OSI Approved :: MIT License
34
32
  Classifier: Programming Language :: Python :: 3
35
33
  Requires-Python: <=3.13,>=3.9
36
34
  Description-Content-Type: text/markdown
37
35
  License-File: LICENSE
36
+ Requires-Dist: mkl==2024.0; sys_platform != "darwin"
37
+ Requires-Dist: numpy<2.0,>=1.26.4
38
38
  Requires-Dist: Pillow>=9.5
39
39
  Requires-Dist: tqdm>=4.64.0
40
40
  Requires-Dist: jsonpickle>=3.0.2
41
41
  Requires-Dist: humanfriendly>=10.0
42
- Requires-Dist: numpy<2.0,>=1.26.4
43
42
  Requires-Dist: matplotlib>=3.8.0
44
43
  Requires-Dist: opencv-python>=4.8.0
45
44
  Requires-Dist: requests>=2.31.0
46
45
  Requires-Dist: pyqtree>=1.0.0
47
- Requires-Dist: seaborn>=0.12.2
48
46
  Requires-Dist: scikit-learn>=1.3.1
49
47
  Requires-Dist: pandas>=2.1.1
50
- Requires-Dist: PyYAML>=6.0.1
48
+ Requires-Dist: python-dateutil
49
+ Requires-Dist: send2trash
50
+ Requires-Dist: dill
51
51
  Requires-Dist: ultralytics-yolov5==0.1.1
52
+ Requires-Dist: yolov9pip==0.0.4
52
53
  Requires-Dist: python-dateutil
53
54
 
54
55
  # MegaDetector
@@ -57,28 +58,15 @@ This package is a pip-installable version of the support/inference code for [Meg
57
58
 
58
59
  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).
59
60
 
61
+ 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.
60
62
 
61
- ## Reasons you might not be looking for this package
62
-
63
- ### If you are an ecologist...
64
-
65
- If you are an ecologist looking to use MegaDetector to help you get through your camera trap images, you probably don't want this package, or at least you probably don't want to start at this page. We recommend starting with our "[Getting started with MegaDetector](https://github.com/agentmorris/MegaDetector/blob/main/getting-started.md)" page, then digging in to the [MegaDetector User Guide](https://github.com/agentmorris/MegaDetector/blob/main/megadetector.md), which will walk you through the process of using MegaDetector.
66
-
67
- ### If you are a computer-vision-y type...
68
-
69
- If you are a computer-vision-y person looking to run or fine-tune MegaDetector programmatically, you probably don't want this package. MegaDetector is just a fine-tuned version of [YOLOv5](https://github.com/ultralytics/yolov5), and the [ultralytics](https://github.com/ultralytics/ultralytics/) package (from the developers of YOLOv5) has a zillion bells and whistles for both inference and fine-tuning that this package doesn't.
70
-
71
- ## Reasons you might want to use this package
72
-
73
- If you want to programmatically interact with the postprocessing tools from the MegaDetector repo, or programmatically run MegaDetector in a way that produces [Timelapse](https://saul.cpsc.ucalgary.ca/timelapse)-friendly output (i.e., output in the standard [MegaDetector output format](https://github.com/agentmorris/MegaDetector/tree/main/megadetector/api/batch_processing#megadetector-batch-output-format)), this package might be for you.
74
-
75
- ## If I haven't talked you out of using this package...
63
+ ## Installation
76
64
 
77
- To install:
65
+ Install with:
78
66
 
79
67
  `pip install megadetector`
80
68
 
81
- MegaDetector model weights aren't downloaded at pip-install time, but they will be (optionally) automatically downloaded the first time you run the model.
69
+ 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.
82
70
 
83
71
  ## Package reference
84
72
 
@@ -4,28 +4,15 @@ This package is a pip-installable version of the support/inference code for [Meg
4
4
 
5
5
  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).
6
6
 
7
+ 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.
7
8
 
8
- ## Reasons you might not be looking for this package
9
+ ## Installation
9
10
 
10
- ### If you are an ecologist...
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, or at least you probably don't want to start at this page. We recommend starting with our "[Getting started with MegaDetector](https://github.com/agentmorris/MegaDetector/blob/main/getting-started.md)" page, then digging in to the [MegaDetector User Guide](https://github.com/agentmorris/MegaDetector/blob/main/megadetector.md), which will walk you through the process of using MegaDetector.
13
-
14
- ### If you are a computer-vision-y type...
15
-
16
- If you are a computer-vision-y person looking to run or fine-tune MegaDetector programmatically, you probably don't want this package. MegaDetector is just a fine-tuned version of [YOLOv5](https://github.com/ultralytics/yolov5), and the [ultralytics](https://github.com/ultralytics/ultralytics/) package (from the developers of YOLOv5) has a zillion bells and whistles for both inference and fine-tuning that this package doesn't.
17
-
18
- ## Reasons you might want to use this package
19
-
20
- If you want to programmatically interact with the postprocessing tools from the MegaDetector repo, or programmatically run MegaDetector in a way that produces [Timelapse](https://saul.cpsc.ucalgary.ca/timelapse)-friendly output (i.e., output in the standard [MegaDetector output format](https://github.com/agentmorris/MegaDetector/tree/main/megadetector/api/batch_processing#megadetector-batch-output-format)), this package might be for you.
21
-
22
- ## If I haven't talked you out of using this package...
23
-
24
- To install:
11
+ Install with:
25
12
 
26
13
  `pip install megadetector`
27
14
 
28
- MegaDetector model weights aren't downloaded at pip-install time, but they will be (optionally) automatically downloaded the first time you run the model.
15
+ 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.
29
16
 
30
17
  ## Package reference
31
18
 
@@ -10,12 +10,16 @@
10
10
  5. [Repo contents](#repo-contents)
11
11
  6. [Contact](#contact)
12
12
  7. [Gratuitous camera trap picture](#gratuitous-camera-trap-picture)
13
+ 8. [License](#license)
14
+ 9. [Contributing](#contributing)
13
15
 
14
16
 
15
17
  ## What's MegaDetector all about?
16
18
 
17
19
  [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.
18
20
 
21
+ MegaDetector only finds animals, it doesn't identify them to species level. If you're looking for a species classifier, check out [SpeciesNet](https://github.com/google/cameratrapai), a species classifier that plays nicely with MegaDetector.
22
+
19
23
  Here's a &ldquo;teaser&rdquo; image of what MegaDetector output looks like:
20
24
 
21
25
  ![Red bounding box on fox](images/detector_example.jpg)<br/>Image credit University of Washington.
@@ -23,11 +27,11 @@ Here's a &ldquo;teaser&rdquo; image of what MegaDetector output looks like:
23
27
 
24
28
  ## How do I get started with MegaDetector?
25
29
 
26
- * 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).
30
+ * If you are looking for a convenient tool to run MegaDetector, you don't need anything from this repository: check out [AddaxAI](https://addaxdatascience.com/addaxai/) (formerly EcoAssist), a GUI-based tool for running AI models (including MegaDetector) on camera trap images.
27
31
  * 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](getting-started.md)" page.
28
32
  * 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.
29
33
  * If you're a programmer-type looking to use tools from this repo, check out the [MegaDetector Python package](https://pypi.org/project/megadetector/) that provides access to everything in this repo (yes, you guessed it, "pip install megadetector").
30
- * 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>!
34
+ * If you have any questions, or you want to tell us that MegaDetector was amazing/terrible on your images, or you have a zillion images and you want some help digging out of that backlog, <a href="mailto:cameratraps@lila.science">email us</a>!
31
35
 
32
36
  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;.
33
37
 
@@ -45,9 +49,9 @@ Here are a few of the organizations that have used MegaDetector... we're only li
45
49
  * [Canadian Parks and Wilderness Society (CPAWS) Northern Alberta Chapter](https://cpawsnab.org/)
46
50
  * [Conservation X Labs](https://conservationxlabs.com/)
47
51
  * [Czech University of Life Sciences Prague](https://www.czu.cz/en)
48
- * [Dudek Camera Trap AI Image Toolkit (AIT)](https://dudek.com/services/wildlife-camera-trap-ai-image-processing-and-management/)
52
+ * [Dudek Camera Trap AI Image Toolkit (AIT)](https://ait.dudek.com/)
49
53
  * [EcoLogic Consultants Ltd.](https://www.consult-ecologic.com/)
50
- * [Estación Biológica de Doñana](http://www.ebd.csic.es/inicio)
54
+ * [Estación Biológica de Doñana](https://www.ebd.csic.es/)
51
55
  * [Indigenous Desert Alliance](https://www.indigenousdesertalliance.com/)
52
56
  * [Myall Lakes Dingo Project](https://carnivorecoexistence.info/myall-lakes-dingo-project/)
53
57
  * [Norwegian Institute for Nature Research](https://www.nina.no/english/Home)
@@ -84,7 +88,6 @@ Here are a few of the organizations that have used MegaDetector... we're only li
84
88
  * [Department of Fish and Wildlife Sciences](https://www.uidaho.edu/cnr/departments/fish-and-wildlife-sciences), University of Idaho
85
89
  * [Department of Society & Conservation](https://www.umt.edu/environment/about/departments/socon/), W.A. Franke College of Forestry & Conservation, University of Montana
86
90
  * [Department of Wildlife Ecology and Conservation](https://wec.ifas.ufl.edu/), University of Florida
87
- * [Ecology and Conservation of Amazonian Vertebrates Research Group](https://www.researchgate.net/lab/Fernanda-Michalski-Lab-4), Federal University of Amapá
88
91
  * [Gola Forest Programme](https://www.rspb.org.uk/our-work/conservation/projects/scientific-support-for-the-gola-forest-programme/), Royal Society for the Protection of Birds (RSPB)
89
92
  * [Graeme Shannon's Research Group](https://wildliferesearch.co.uk/group-1), Bangor University
90
93
  * [Grizzly Bear Recovery Program](https://www.fws.gov/office/grizzly-bear-recovery-program), U.S. Fish & Wildlife Service
@@ -102,12 +105,13 @@ Here are a few of the organizations that have used MegaDetector... we're only li
102
105
  * [Santa Monica Mountains Recreation Area](https://www.nps.gov/samo/index.htm), National Park Service
103
106
  * [Seattle Urban Carnivore Project](https://www.zoo.org/seattlecarnivores), Woodland Park Zoo
104
107
  * [Serra dos Órgãos National Park](https://www.icmbio.gov.br/parnaserradosorgaos/), ICMBio
105
- * [Snapshot USA](https://emammal.si.edu/snapshot-usa), Smithsonian
108
+ * [Snapshot USA](https://www.snapshot-usa.org/), Smithsonian
106
109
  * [TROPECOLNET project](https://www.anabenitezlopez.com/research/global-change-biology/tropecolnet/), Museo Nacional de Ciencias Naturales
107
110
  * [Wildlife Coexistence Lab](https://wildlife.forestry.ubc.ca/), University of British Columbia
108
111
  * [Wildlife Research](https://www.dfw.state.or.us/wildlife/research/index.asp), Oregon Department of Fish and Wildlife
109
112
  * [Wildlife Division](https://www.michigan.gov/dnr/about/contact/wildlife), Michigan Department of Natural Resources
110
113
  * [Kohl Wildlife Lab](https://kohlwildlifelab.com/), University of Georgia
114
+ * Ecology and Conservation of Amazonian Vertebrates Research Group, Federal University of Amapá
111
115
  * Department of Ecology, TU Berlin
112
116
  * Ghost Cat Analytics
113
117
  * Protected Areas Unit, Canadian Wildlife Service
@@ -132,7 +136,7 @@ Here are a few of the organizations that have used MegaDetector... we're only li
132
136
  * [BirdLife Malta](https://birdlifemalta.org/) ([tweet](https://x.com/BirdLife_Malta/status/1817456839862173783?t=S-KRiZ5R1-CoW8-tbYNjqQ&s=03)) ([LI post](https://www.linkedin.com/posts/birdlifemalta_worldnatureconservationday-shearwater-colony-activity-7223220656589463553-X2Mc/?utm_source=share&utm_medium=member_android))
133
137
  * [Endangered Landscapes and Seascapes Programme](https://www.endangeredlandscapes.org/), Cambridge Conservation Initiative ([blog post](https://www.endangeredlandscapes.org/news/ai-for-wildlife-monitoring-a-real-time-alert-system-for-bears-and-wild-boars-in-romanias-carpathian-mountains/))
134
138
 
135
- * [Road Ecology Center](https://roadecology.ucdavis.edu/), University of California, Davis ([Wildlife Observer Network platform](https://wildlifeobserver.net/))
139
+ * [Road Ecology Center](https://roadecology.ucdavis.edu/), University of California, Davis ([Wildlife Observer Network platform](https://roadecology.ucdavis.edu/research/projects/wildlife-observer-network))
136
140
  * [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))
137
141
  * [San Diego Zoo Wildlife Alliance](https://science.sandiegozoo.org/) ([Animl R package](https://github.com/conservationtechlab/animl))
138
142
  * [TerrOïko](https://www.terroiko.fr/) ([OCAPI platform](https://www.terroiko.fr/ocapi))
@@ -141,7 +145,7 @@ Also see:
141
145
 
142
146
  * The [list of MD-related GUIs, platforms, and GitHub repos](https://github.com/agentmorris/MegaDetector/blob/main/megadetector.md#is-there-a-gui) within the MegaDetector User Guide
143
147
 
144
- * [Peter's map of EcoAssist users](https://addaxdatascience.com/ecoassist) (who are also MegaDetector users!)
148
+ * [Peter's map of AddaxAI (formerly EcoAssist) users](https://addaxdatascience.com/addaxai/) (who are also MegaDetector users!)
145
149
 
146
150
  * 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
151
 
@@ -202,9 +206,9 @@ Code for hosting our models as an API, either for synchronous operation (i.e., f
202
206
 
203
207
  #### megadetector/classification
204
208
 
205
- Experimental code for training species classifiers on new data sets, generally trained on MegaDetector crops. Currently the main pipeline described in this folder relies on a large database of labeled images that is not publicly available; therefore, this folder is not yet set up to facilitate training of your own classifiers. However, it is useful for <i>users</i> of the classifiers that we train, and contains some useful starting points if you are going to take a "DIY" approach to training classifiers on cropped images.
209
+ This folder is largely deprecated thanks to the release of [SpeciesNet](https://github.com/google/cameratrapai), a species classifier that is better than any of the classifiers we ever trained with the stuff in this folder. That said, this folder contains code for training species classifiers on new data sets, generally trained on MegaDetector crops.
206
210
 
207
- All that said, here's another "teaser image" of what you get at the end of training and running a classifier:
211
+ Here's another "teaser image" of what you get at the end of training and running a classifier:
208
212
 
209
213
  <img src="images/warthog_classifications.jpg" width="700"><br/>Image credit University of Minnesota, from the Snapshot Safari program.
210
214
 
@@ -262,6 +266,6 @@ Code written on or before April 28, 2023 is [copyright Microsoft](https://github
262
266
 
263
267
  ## Contributing
264
268
 
265
- 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 (e.g. [EcoAssist](https://github.com/PetervanLunteren/EcoAssist) and [CamTrap Detector](https://github.com/bencevans/camtrap-detector)) and work with MegaDetector results (e.g. [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!
269
+ 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!
266
270
 
267
271
  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!
@@ -14,9 +14,8 @@ import redis
14
14
  import argparse
15
15
  import PIL
16
16
 
17
- from io import BytesIO
18
-
19
- from detection.run_detector import load_detector, convert_to_tf_coords
17
+ from detection.run_detector import load_detector
18
+ from utils.ct_utils import convert_xywh_to_xyxy as convert_to_tf_coords
20
19
  import config
21
20
  import visualization.visualization_utils as vis_utils
22
21
 
@@ -70,7 +70,7 @@ from typing import Any
70
70
  import pandas as pd
71
71
  from tqdm import tqdm
72
72
 
73
- from megadetector.utils.ct_utils import truncate_float
73
+ from megadetector.utils.ct_utils import round_float
74
74
 
75
75
 
76
76
  #%% Example usage
@@ -124,7 +124,7 @@ def row_to_classification_list(row: Mapping[str, Any],
124
124
 
125
125
  # filter out confidences below the threshold, and set precision to 4
126
126
  result = [
127
- (k, truncate_float(conf, precision=4))
127
+ (k, round_float(conf, precision=4))
128
128
  for k, conf in result if conf >= threshold
129
129
  ]
130
130
 
@@ -18,6 +18,7 @@ from tqdm import tqdm
18
18
  from collections import defaultdict
19
19
 
20
20
  from megadetector.visualization.visualization_utils import open_image
21
+ from megadetector.detection.run_detector import FAILURE_IMAGE_OPEN
21
22
 
22
23
 
23
24
  #%% Functions
@@ -145,7 +146,7 @@ def coco_to_labelme(coco_data,image_base,overwrite=False,bypass_image_size_check
145
146
  except Exception:
146
147
  print('Warning: cannot open image {}'.format(im_full_path))
147
148
  if 'failure' not in im:
148
- im['failure'] = 'Failure image access'
149
+ im['failure'] = FAILURE_IMAGE_OPEN
149
150
 
150
151
  # ...if we need to read w/h information
151
152
 
@@ -86,7 +86,7 @@ def _check_image_existence_and_size(image,options=None):
86
86
  options (IntegrityCheckOptions): parameters impacting validation
87
87
 
88
88
  Returns:
89
- bool: whether this image passes validation
89
+ str: None if this image passes validation, otherwise an error string
90
90
  """
91
91
 
92
92
  if options is None:
@@ -96,23 +96,23 @@ def _check_image_existence_and_size(image,options=None):
96
96
 
97
97
  filePath = os.path.join(options.baseDir,image['file_name'])
98
98
  if not os.path.isfile(filePath):
99
- # print('Image path {} does not exist'.format(filePath))
100
- return False
99
+ s = 'Image path {} does not exist'.format(filePath)
100
+ return s
101
101
 
102
102
  if options.bCheckImageSizes:
103
103
  if not ('height' in image and 'width' in image):
104
- print('Missing image size in {}'.format(filePath))
105
- return False
104
+ s = 'Missing image size in {}'.format(filePath)
105
+ return s
106
106
 
107
107
  # width, height = Image.open(filePath).size
108
108
  pil_im = open_image(filePath)
109
109
  width,height = pil_im.size
110
110
  if (not (width == image['width'] and height == image['height'])):
111
- print('Size mismatch for image {}: {} (reported {},{}, actual {},{})'.format(
112
- image['id'], filePath, image['width'], image['height'], width, height))
113
- return False
111
+ s = 'Size mismatch for image {}: {} (reported {},{}, actual {},{})'.format(
112
+ image['id'], filePath, image['width'], image['height'], width, height)
113
+ return s
114
114
 
115
- return True
115
+ return None
116
116
 
117
117
 
118
118
  def integrity_check_json_db(jsonFile, options=None):
@@ -287,6 +287,7 @@ def integrity_check_json_db(jsonFile, options=None):
287
287
  if fn_relative not in image_paths_in_json:
288
288
  unused_files.append(fn_relative)
289
289
 
290
+ # List of (filename,error_string) tuples
290
291
  validation_errors = []
291
292
 
292
293
  # If we're checking image existence but not image size, we don't need to read the images
@@ -298,8 +299,8 @@ def integrity_check_json_db(jsonFile, options=None):
298
299
  image_paths_relative_set = set(image_paths_relative)
299
300
 
300
301
  for im in images:
301
- if im['file_name'] not in image_paths_relative_set:
302
- validation_errors.append(im['file_name'])
302
+ if im['file_name'] not in image_paths_relative_set:
303
+ validation_errors.append((im['file_name'],'not found in relative path list'))
303
304
 
304
305
  # If we're checking image size, we need to read the images
305
306
  if options.bCheckImageSizes:
@@ -321,12 +322,12 @@ def integrity_check_json_db(jsonFile, options=None):
321
322
  results = tqdm(pool.imap(_check_image_existence_and_size, images), total=len(images))
322
323
  else:
323
324
  results = []
324
- for im in tqdm(images):
325
+ for im in tqdm(images):
325
326
  results.append(_check_image_existence_and_size(im,options))
326
327
 
327
328
  for i_image,result in enumerate(results):
328
- if result is not None:
329
- validation_errors.append(images[i_image]['file_name'])
329
+ if result is not None:
330
+ validation_errors.append(images[i_image]['file_name'],result)
330
331
 
331
332
  # ...for each image
332
333
 
@@ -12,16 +12,18 @@ subset_json_detector_output.py.
12
12
 
13
13
  #%% Constants and imports
14
14
 
15
+ import os
15
16
  import sys
16
17
  import json
17
18
  import argparse
18
19
 
19
20
  from tqdm import tqdm
21
+ from copy import copy
20
22
 
21
23
 
22
24
  #%% Functions
23
25
 
24
- def subset_json_db(input_json, query, output_json=None, ignore_case=False):
26
+ def subset_json_db(input_json, query, output_json=None, ignore_case=False, verbose=False):
25
27
  """
26
28
  Given a json file (or dictionary already loaded from a json file), produce a new
27
29
  database containing only the images whose filenames contain the string 'query',
@@ -29,54 +31,80 @@ def subset_json_db(input_json, query, output_json=None, ignore_case=False):
29
31
 
30
32
  Args:
31
33
  input_json (str): COCO Camera Traps .json file to load, or an already-loaded dict
32
- query (str): string to query for, only include images in the output whose filenames
33
- contain this string.
34
+ query (str or list): string to query for, only include images in the output whose filenames
35
+ contain this string. If this is a list, test for exact matches.
34
36
  output_json (str, optional): file to write the resulting .json file to
35
37
  ignore_case (bool, optional): whether to perform a case-insensitive search for [query]
38
+ verbose (bool, optional): enable additional debug output
36
39
 
37
40
  Returns:
38
- dict: possibly-modified CCT dictionary
41
+ dict: CCT dictionary containing a subset of the images and annotations in the input dict
39
42
  """
40
-
41
- if ignore_case:
42
- query = query.lower()
43
43
 
44
44
  # Load the input file if necessary
45
45
  if isinstance(input_json,str):
46
46
  print('Loading input .json...')
47
47
  with open(input_json, 'r') as f:
48
- data = json.load(f)
48
+ input_data = json.load(f)
49
49
  else:
50
- data = input_json
50
+ input_data = input_json
51
51
 
52
52
  # Find images matching the query
53
53
  images = []
54
- image_ids = set()
55
54
 
56
- for im in tqdm(data['images']):
57
- fn = im['file_name']
55
+ if isinstance(query,str):
56
+
57
+ if ignore_case:
58
+ query = query.lower()
59
+
60
+ for im in tqdm(input_data['images']):
61
+ fn = im['file_name']
62
+ if ignore_case:
63
+ fn = fn.lower()
64
+ if query in fn:
65
+ images.append(im)
66
+
67
+ else:
68
+
69
+ query = set(query)
70
+
58
71
  if ignore_case:
59
- fn = fn.lower()
60
- if query in fn:
61
- images.append(im)
62
- image_ids.add(im['id'])
72
+ query = set([s.lower() for s in query])
73
+
74
+ for im in input_data['images']:
75
+ fn = im['file_name']
76
+ if ignore_case:
77
+ fn = fn.lower()
78
+ if fn in query:
79
+ images.append(im)
80
+
81
+ image_ids = set([im['id'] for im in images])
63
82
 
64
83
  # Find annotations referring to those images
65
84
  annotations = []
66
85
 
67
- for ann in tqdm(data['annotations']):
86
+ for ann in input_data['annotations']:
68
87
  if ann['image_id'] in image_ids:
69
88
  annotations.append(ann)
70
89
 
71
- output_data = data
90
+ output_data = copy(input_data)
72
91
  output_data['images'] = images
73
92
  output_data['annotations'] = annotations
74
93
 
75
94
  # Write the output file if requested
76
95
  if output_json is not None:
77
- print('Writing output .json...')
78
- json.dump(output_data,open(output_json,'w'),indent=1)
79
-
96
+ if verbose:
97
+ print('Writing output .json to {}'.format(output_json))
98
+ output_dir = os.path.dirname(output_json)
99
+ os.makedirs(output_dir,exist_ok=True)
100
+ with open(output_json,'w') as f:
101
+ json.dump(output_data,f,indent=1)
102
+
103
+ if verbose:
104
+ print('Keeping {} of {} images, {} of {} annotations'.format(
105
+ len(output_data['images']),len(input_data['images']),
106
+ len(output_data['annotations']),len(input_data['annotations'])))
107
+
80
108
  return output_data
81
109
 
82
110
 
@@ -0,0 +1,101 @@
1
+ """
2
+
3
+ add_locations_to_island_camera_traps.py
4
+
5
+ The Island Conservation Camera Traps dataset had unique camera identifiers embedded
6
+ in filenames, but not in the proper metadata fields. This script copies that information
7
+ to metadata.
8
+
9
+ """
10
+
11
+ #%% Imports and constants
12
+
13
+ import os
14
+ import json
15
+ from tqdm import tqdm
16
+
17
+ input_fn = os.path.expanduser('~/lila/metadata/island_conservation.json')
18
+ output_fn = os.path.expanduser('~/tmp/island_conservation.json')
19
+ preview_folder = os.path.expanduser('~/tmp/island_conservation_preview')
20
+ image_directory = os.path.expanduser('~/data/icct/public/')
21
+
22
+
23
+ #%% Prevent imports during testing
24
+
25
+ if False:
26
+
27
+ #%% Read input file
28
+
29
+ with open(input_fn,'r') as f:
30
+ d = json.load(f)
31
+
32
+ d['info']
33
+ d['info']['version'] = '1.01'
34
+
35
+
36
+ #%% Find locations
37
+
38
+ images = d['images']
39
+
40
+ locations = set()
41
+
42
+ for i_image,im in tqdm(enumerate(images),total=len(images)):
43
+ tokens_fn = im['file_name'].split('/')
44
+ tokens_id = im['id'].split('_')
45
+ assert tokens_fn[0] == tokens_id[0]
46
+ assert tokens_fn[1] == tokens_id[1]
47
+ location = tokens_fn[0] + '_' + tokens_fn[1]
48
+ im['location'] = location
49
+ locations.add(location)
50
+
51
+ locations = sorted(list(locations))
52
+
53
+ for s in locations:
54
+ print(s)
55
+
56
+
57
+ #%% Write output file
58
+
59
+ with open(output_fn,'w') as f:
60
+ json.dump(d,f,indent=1)
61
+
62
+
63
+ #%% Validate .json files
64
+
65
+ from megadetector.data_management.databases import integrity_check_json_db
66
+
67
+ options = integrity_check_json_db.IntegrityCheckOptions()
68
+ options.baseDir = image_directory
69
+ options.bCheckImageSizes = False
70
+ options.bCheckImageExistence = True
71
+ options.bFindUnusedImages = True
72
+
73
+ sorted_categories, data, error_info = integrity_check_json_db.integrity_check_json_db(output_fn, options)
74
+
75
+
76
+ #%% Preview labels
77
+
78
+ from megadetector.visualization import visualize_db
79
+
80
+ viz_options = visualize_db.DbVizOptions()
81
+ viz_options.num_to_visualize = 2000
82
+ viz_options.trim_to_images_with_bboxes = False
83
+ viz_options.add_search_links = False
84
+ viz_options.sort_by_filename = False
85
+ viz_options.parallelize_rendering = True
86
+ viz_options.classes_to_exclude = ['test']
87
+ html_output_file, image_db = visualize_db.visualize_db(db_path=output_fn,
88
+ output_dir=preview_folder,
89
+ image_base_dir=image_directory,
90
+ options=viz_options)
91
+
92
+ from megadetector.utils import path_utils
93
+ path_utils.open_file(html_output_file)
94
+
95
+
96
+ #%% Zip output file
97
+
98
+ from megadetector.utils.path_utils import zip_file
99
+
100
+ zip_file(output_fn, verbose=True)
101
+ assert os.path.isfile(output_fn + '.zip')