megadetector 5.0.12__tar.gz → 5.0.14__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 (208) hide show
  1. {megadetector-5.0.12 → megadetector-5.0.14}/LICENSE +0 -0
  2. {megadetector-5.0.12/megadetector.egg-info → megadetector-5.0.14}/PKG-INFO +2 -2
  3. {megadetector-5.0.12 → megadetector-5.0.14}/README-package.md +1 -1
  4. {megadetector-5.0.12 → megadetector-5.0.14}/README.md +38 -34
  5. {megadetector-5.0.12/megadetector/visualization → megadetector-5.0.14/megadetector/api}/__init__.py +0 -0
  6. {megadetector-5.0.12/megadetector/utils → megadetector-5.0.14/megadetector/api/batch_processing}/__init__.py +0 -0
  7. {megadetector-5.0.12/megadetector/taxonomy_mapping → megadetector-5.0.14/megadetector/api/batch_processing/api_core}/__init__.py +0 -0
  8. {megadetector-5.0.12/megadetector/postprocessing → megadetector-5.0.14/megadetector/api/batch_processing/api_core/batch_service}/__init__.py +0 -0
  9. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/api/batch_processing/api_core/batch_service/score.py +0 -0
  10. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/api/batch_processing/api_core/server.py +1 -1
  11. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/api/batch_processing/api_core/server_api_config.py +0 -1
  12. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/api/batch_processing/api_core/server_app_config.py +0 -0
  13. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/api/batch_processing/api_core/server_batch_job_manager.py +0 -0
  14. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/api/batch_processing/api_core/server_job_status_table.py +0 -3
  15. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/api/batch_processing/api_core/server_orchestration.py +0 -0
  16. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/api/batch_processing/api_core/server_utils.py +0 -4
  17. {megadetector-5.0.12/megadetector/detection/detector_training → megadetector-5.0.14/megadetector/api/batch_processing/api_core_support}/__init__.py +0 -0
  18. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/api/batch_processing/api_core_support/aggregate_results_manually.py +0 -0
  19. {megadetector-5.0.12/megadetector/detection → megadetector-5.0.14/megadetector/api/batch_processing/api_support}/__init__.py +0 -0
  20. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/api/batch_processing/api_support/summarize_daily_activity.py +0 -0
  21. {megadetector-5.0.12/megadetector/data_management/lila → megadetector-5.0.14/megadetector/api/batch_processing/data_preparation}/__init__.py +0 -0
  22. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/api/batch_processing/integration/digiKam/setup.py +0 -0
  23. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/api/batch_processing/integration/digiKam/xmp_integration.py +0 -0
  24. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/api/batch_processing/integration/eMammal/test_scripts/config_template.py +0 -0
  25. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/api/batch_processing/integration/eMammal/test_scripts/push_annotations_to_emammal.py +0 -1
  26. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/api/batch_processing/integration/eMammal/test_scripts/select_images_for_testing.py +0 -0
  27. {megadetector-5.0.12/megadetector/data_management/databases → megadetector-5.0.14/megadetector/api/synchronous}/__init__.py +0 -0
  28. {megadetector-5.0.12/megadetector/data_management/annotations → megadetector-5.0.14/megadetector/api/synchronous/api_core/animal_detection_api}/__init__.py +0 -0
  29. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/api/synchronous/api_core/animal_detection_api/api_backend.py +0 -0
  30. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/api/synchronous/api_core/animal_detection_api/api_frontend.py +0 -3
  31. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/api/synchronous/api_core/animal_detection_api/config.py +0 -0
  32. {megadetector-5.0.12/megadetector/data_management → megadetector-5.0.14/megadetector/api/synchronous/api_core/tests}/__init__.py +0 -0
  33. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/api/synchronous/api_core/tests/load_test.py +0 -0
  34. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/__init__.py +0 -0
  35. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/aggregate_classifier_probs.py +0 -0
  36. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/analyze_failed_images.py +0 -0
  37. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/cache_batchapi_outputs.py +0 -0
  38. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/create_classification_dataset.py +0 -0
  39. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/crop_detections.py +0 -0
  40. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/csv_to_json.py +0 -0
  41. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/detect_and_crop.py +0 -0
  42. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/efficientnet/__init__.py +0 -0
  43. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/efficientnet/utils.py +0 -3
  44. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/evaluate_model.py +0 -0
  45. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/identify_mislabeled_candidates.py +0 -0
  46. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/json_to_azcopy_list.py +0 -0
  47. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/json_validator.py +0 -0
  48. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/map_classification_categories.py +0 -0
  49. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/merge_classification_detection_output.py +0 -0
  50. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/prepare_classification_script.py +0 -0
  51. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/prepare_classification_script_mc.py +0 -0
  52. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/run_classifier.py +0 -0
  53. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/save_mislabeled.py +0 -0
  54. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/train_classifier.py +0 -0
  55. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/train_classifier_tf.py +0 -0
  56. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/train_utils.py +0 -0
  57. {megadetector-5.0.12/megadetector/api/synchronous/api_core/tests → megadetector-5.0.14/megadetector/data_management}/__init__.py +0 -0
  58. {megadetector-5.0.12/megadetector/api/synchronous/api_core/animal_detection_api → megadetector-5.0.14/megadetector/data_management/annotations}/__init__.py +0 -0
  59. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/annotations/annotation_constants.py +0 -0
  60. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/camtrap_dp_to_coco.py +0 -2
  61. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/cct_json_utils.py +15 -6
  62. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/cct_to_md.py +0 -0
  63. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/cct_to_wi.py +0 -0
  64. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/coco_to_labelme.py +12 -1
  65. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/coco_to_yolo.py +0 -0
  66. {megadetector-5.0.12/megadetector/api/synchronous → megadetector-5.0.14/megadetector/data_management/databases}/__init__.py +0 -0
  67. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/databases/add_width_and_height_to_db.py +0 -0
  68. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/databases/combine_coco_camera_traps_files.py +0 -0
  69. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/databases/integrity_check_json_db.py +43 -27
  70. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/databases/subset_json_db.py +0 -0
  71. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/generate_crops_from_cct.py +0 -0
  72. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/get_image_sizes.py +0 -0
  73. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/add_nacti_sizes.py +0 -0
  74. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/add_timestamps_to_icct.py +0 -0
  75. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/animl_results_to_md_results.py +0 -0
  76. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/auckland_doc_test_to_json.py +0 -0
  77. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/auckland_doc_to_json.py +0 -0
  78. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/awc_to_json.py +0 -0
  79. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/bellevue_to_json.py +0 -0
  80. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/cacophony-thermal-importer.py +1 -4
  81. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/carrizo_shrubfree_2018.py +0 -0
  82. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/carrizo_trail_cam_2017.py +0 -0
  83. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/cct_field_adjustments.py +0 -0
  84. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/channel_islands_to_cct.py +0 -0
  85. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/eMammal/copy_and_unzip_emammal.py +0 -0
  86. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/eMammal/eMammal_helpers.py +0 -0
  87. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/eMammal/make_eMammal_json.py +0 -0
  88. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/ena24_to_json.py +0 -0
  89. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/filenames_to_json.py +0 -0
  90. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/helena_to_cct.py +0 -0
  91. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/idaho-camera-traps.py +0 -0
  92. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/idfg_iwildcam_lila_prep.py +0 -0
  93. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/jb_csv_to_json.py +0 -0
  94. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/mcgill_to_json.py +0 -0
  95. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/missouri_to_json.py +0 -0
  96. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/nacti_fieldname_adjustments.py +0 -0
  97. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/noaa_seals_2019.py +0 -0
  98. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/pc_to_json.py +0 -0
  99. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/plot_wni_giraffes.py +0 -0
  100. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/prepare-noaa-fish-data-for-lila.py +0 -0
  101. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/prepare_zsl_imerit.py +0 -0
  102. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/rspb_to_json.py +0 -0
  103. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/save_the_elephants_survey_A.py +0 -0
  104. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/save_the_elephants_survey_B.py +0 -0
  105. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/snapshot_safari_importer.py +0 -0
  106. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/snapshot_safari_importer_reprise.py +0 -0
  107. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/snapshot_serengeti_lila.py +0 -0
  108. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/snapshotserengeti/make_full_SS_json.py +0 -0
  109. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/snapshotserengeti/make_per_season_SS_json.py +0 -0
  110. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/sulross_get_exif.py +0 -0
  111. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/timelapse_csv_set_to_json.py +0 -0
  112. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/ubc_to_json.py +0 -0
  113. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/umn_to_json.py +0 -0
  114. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/wellington_to_json.py +0 -0
  115. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/wi_to_json.py +0 -0
  116. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/importers/zamba_results_to_md_results.py +0 -0
  117. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/labelme_to_coco.py +0 -0
  118. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/labelme_to_yolo.py +0 -0
  119. {megadetector-5.0.12/megadetector/api/batch_processing/data_preparation → megadetector-5.0.14/megadetector/data_management/lila}/__init__.py +0 -0
  120. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/lila/add_locations_to_island_camera_traps.py +0 -0
  121. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/lila/add_locations_to_nacti.py +0 -0
  122. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/lila/create_lila_blank_set.py +0 -0
  123. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/lila/create_lila_test_set.py +0 -0
  124. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/lila/create_links_to_md_results_files.py +0 -0
  125. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/lila/download_lila_subset.py +0 -0
  126. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/lila/generate_lila_per_image_labels.py +0 -0
  127. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/lila/get_lila_annotation_counts.py +0 -0
  128. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/lila/get_lila_image_counts.py +0 -0
  129. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/lila/lila_common.py +0 -0
  130. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/lila/test_lila_metadata_urls.py +0 -0
  131. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/ocr_tools.py +0 -4
  132. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/read_exif.py +178 -44
  133. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/remap_coco_categories.py +0 -0
  134. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/remove_exif.py +0 -0
  135. megadetector-5.0.14/megadetector/data_management/rename_images.py +187 -0
  136. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/resize_coco_dataset.py +0 -0
  137. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/wi_download_csv_to_coco.py +3 -2
  138. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/yolo_output_to_md_output.py +7 -2
  139. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/data_management/yolo_to_coco.py +0 -0
  140. {megadetector-5.0.12/megadetector/api/batch_processing/api_support → megadetector-5.0.14/megadetector/detection}/__init__.py +0 -0
  141. {megadetector-5.0.12/megadetector/api/batch_processing/api_core_support → megadetector-5.0.14/megadetector/detection/detector_training}/__init__.py +0 -0
  142. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/detection/detector_training/model_main_tf2.py +0 -0
  143. megadetector-5.0.14/megadetector/detection/process_video.py +1006 -0
  144. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/detection/pytorch_detector.py +33 -14
  145. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/detection/run_detector.py +17 -5
  146. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/detection/run_detector_batch.py +179 -65
  147. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/detection/run_inference_with_yolov5_val.py +527 -357
  148. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/detection/run_tiled_inference.py +0 -0
  149. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/detection/tf_detector.py +14 -3
  150. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/detection/video_utils.py +284 -61
  151. {megadetector-5.0.12/megadetector/api/batch_processing/api_core/batch_service → megadetector-5.0.14/megadetector/postprocessing}/__init__.py +0 -0
  152. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/postprocessing/add_max_conf.py +0 -0
  153. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/postprocessing/categorize_detections_by_size.py +16 -14
  154. megadetector-5.0.14/megadetector/postprocessing/classification_postprocessing.py +716 -0
  155. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/postprocessing/combine_api_outputs.py +0 -0
  156. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/postprocessing/compare_batch_results.py +101 -93
  157. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/postprocessing/convert_output_format.py +12 -5
  158. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/postprocessing/load_api_results.py +0 -0
  159. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/postprocessing/md_to_coco.py +0 -0
  160. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/postprocessing/md_to_labelme.py +0 -0
  161. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/postprocessing/merge_detections.py +18 -7
  162. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/postprocessing/postprocess_batch_results.py +133 -127
  163. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/postprocessing/remap_detection_categories.py +0 -0
  164. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/postprocessing/render_detection_confusion_matrix.py +0 -0
  165. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/postprocessing/repeat_detection_elimination/find_repeat_detections.py +0 -0
  166. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/postprocessing/repeat_detection_elimination/remove_repeat_detections.py +0 -0
  167. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/postprocessing/repeat_detection_elimination/repeat_detections_core.py +236 -232
  168. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/postprocessing/separate_detections_into_folders.py +0 -0
  169. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/postprocessing/subset_json_detector_output.py +66 -62
  170. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/postprocessing/top_folders_to_bottom.py +0 -0
  171. {megadetector-5.0.12/megadetector/api/batch_processing/api_core → megadetector-5.0.14/megadetector/taxonomy_mapping}/__init__.py +0 -0
  172. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/taxonomy_mapping/map_lila_taxonomy_to_wi_taxonomy.py +0 -0
  173. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/taxonomy_mapping/map_new_lila_datasets.py +0 -0
  174. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/taxonomy_mapping/prepare_lila_taxonomy_release.py +0 -0
  175. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/taxonomy_mapping/preview_lila_taxonomy.py +0 -2
  176. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/taxonomy_mapping/retrieve_sample_image.py +0 -0
  177. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/taxonomy_mapping/simple_image_download.py +0 -0
  178. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/taxonomy_mapping/species_lookup.py +0 -0
  179. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/taxonomy_mapping/taxonomy_csv_checker.py +0 -0
  180. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/taxonomy_mapping/taxonomy_graph.py +0 -0
  181. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/taxonomy_mapping/validate_lila_category_mappings.py +0 -0
  182. {megadetector-5.0.12/megadetector/api/batch_processing → megadetector-5.0.14/megadetector/utils}/__init__.py +0 -0
  183. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/utils/azure_utils.py +0 -0
  184. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/utils/ct_utils.py +5 -4
  185. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/utils/directory_listing.py +0 -0
  186. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/utils/md_tests.py +380 -128
  187. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/utils/path_utils.py +39 -6
  188. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/utils/process_utils.py +13 -4
  189. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/utils/sas_blob_utils.py +0 -0
  190. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/utils/split_locations_into_train_val.py +0 -0
  191. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/utils/string_utils.py +0 -0
  192. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/utils/url_utils.py +0 -0
  193. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/utils/write_html_image_list.py +0 -0
  194. {megadetector-5.0.12/megadetector/api → megadetector-5.0.14/megadetector/visualization}/__init__.py +0 -0
  195. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/visualization/plot_utils.py +0 -0
  196. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/visualization/render_images_with_thumbnails.py +0 -0
  197. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/visualization/visualization_utils.py +7 -2
  198. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/visualization/visualize_db.py +79 -77
  199. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/visualization/visualize_detector_output.py +0 -1
  200. {megadetector-5.0.12 → megadetector-5.0.14/megadetector.egg-info}/PKG-INFO +2 -2
  201. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector.egg-info/SOURCES.txt +2 -0
  202. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector.egg-info/dependency_links.txt +0 -0
  203. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector.egg-info/requires.txt +0 -0
  204. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector.egg-info/top_level.txt +0 -0
  205. {megadetector-5.0.12 → megadetector-5.0.14}/pyproject.toml +1 -1
  206. {megadetector-5.0.12 → megadetector-5.0.14}/setup.cfg +0 -0
  207. megadetector-5.0.12/megadetector/detection/process_video.py +0 -702
  208. {megadetector-5.0.12 → megadetector-5.0.14}/megadetector/classification/efficientnet/model.py +0 -0
File without changes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: megadetector
3
- Version: 5.0.12
3
+ Version: 5.0.14
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>
@@ -114,7 +114,7 @@ print('Found {} detections above threshold'.format(len(detections_above_threshol
114
114
 
115
115
  ```
116
116
  from megadetector.detection.run_detector_batch import \
117
- load_and_run_detector_batch,write_results_to_file
117
+ load_and_run_detector_batch, write_results_to_file
118
118
  from megadetector.utils import path_utils
119
119
  import os
120
120
 
@@ -62,7 +62,7 @@ print('Found {} detections above threshold'.format(len(detections_above_threshol
62
62
 
63
63
  ```
64
64
  from megadetector.detection.run_detector_batch import \
65
- load_and_run_detector_batch,write_results_to_file
65
+ load_and_run_detector_batch, write_results_to_file
66
66
  from megadetector.utils import path_utils
67
67
  import os
68
68
 
@@ -11,6 +11,7 @@
11
11
  6. [Contact](#contact)
12
12
  7. [Gratuitous camera trap picture](#gratuitous-camera-trap-picture)
13
13
 
14
+
14
15
  ## What's MegaDetector all about?
15
16
 
16
17
  [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.
@@ -25,7 +26,7 @@ Here's a &ldquo;teaser&rdquo; image of what MegaDetector output looks like:
25
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).
26
27
  * 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.
27
28
  * 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'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").
29
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>!
30
31
 
31
32
  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;.
@@ -65,12 +66,14 @@ Here are a few of the organizations that have used MegaDetector... we're only li
65
66
  * [Parc national du Mont-Tremblant](https://www.sepaq.com/pq/mot/index.dot?language_id=1)
66
67
  * [The Land Banking Group](https://thelandbankinggroup.com/)
67
68
  * [New Zealand Department of Conservation](https://www.doc.govt.nz)
69
+ * [Habitat NZ](https://habitatnz.co.nz/)
68
70
 
69
71
  * [Applied Conservation Macro Ecology Lab](http://www.acmelab.ca/), University of Victoria
70
72
  * [Banff National Park Resource Conservation](https://www.pc.gc.ca/en/pn-np/ab/banff/nature/conservation), Parks Canada
71
73
  * [Blumstein Lab](https://blumsteinlab.eeb.ucla.edu/), UCLA
72
74
  * [Borderlands Research Institute](https://bri.sulross.edu/), Sul Ross State University
73
75
  * [Capitol Reef National Park](https://www.nps.gov/care/index.htm) / Utah Valley University
76
+ * [Canyon Critters Project](https://www.zooniverse.org/projects/arw36/canyon-critters), University of Georgia
74
77
  * [Center for Biodiversity and Conservation](https://www.amnh.org/research/center-for-biodiversity-conservation), American Museum of Natural History
75
78
  * [Centre for Ecosystem Science](https://www.unsw.edu.au/research/), UNSW Sydney
76
79
  * [Cross-Cultural Ecology Lab](https://crossculturalecology.net/), Macquarie University
@@ -79,7 +82,7 @@ Here are a few of the organizations that have used MegaDetector... we're only li
79
82
  * [Department of Society & Conservation](https://www.umt.edu/environment/about/departments/socon/), W.A. Franke College of Forestry & Conservation, University of Montana
80
83
  * [Department of Wildlife Ecology and Conservation](https://wec.ifas.ufl.edu/), University of Florida
81
84
  * [Ecology and Conservation of Amazonian Vertebrates Research Group](https://www.researchgate.net/lab/Fernanda-Michalski-Lab-4), Federal University of Amapá
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)
85
+ * [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)
83
86
  * [Graeme Shannon's Research Group](https://wildliferesearch.co.uk/group-1), Bangor University
84
87
  * [Grizzly Bear Recovery Program](https://www.fws.gov/office/grizzly-bear-recovery-program), U.S. Fish & Wildlife Service
85
88
  * [Hamaarag](https://hamaarag.org.il/), The Steinhardt Museum of Natural History, Tel Aviv University
@@ -138,49 +141,59 @@ Also see:
138
141
 
139
142
  ## Repo contents
140
143
 
141
- This repo is organized into the following folders...
144
+ ### Repo history
145
+
146
+ 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). If you're interested in MD's history, see the [downloading the model](https://github.com/agentmorris/MegaDetector/blob/main/megadetector.md#downloading-the-model) section in the MegaDetector User Guide to learn about the history of MegaDetector releases, and the [can you share the training data?](https://github.com/agentmorris/MegaDetector/blob/main/megadetector.md#can-you-share-the-training-data) section to learn about the training data used in each of those releases.
142
147
 
143
- 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.
148
+ ### What the code in this repo does
144
149
 
145
- The core functionality provided is:
150
+ The core functionality provided in this repo is:
146
151
 
147
- - Training and running [MegaDetector](megadetector.md).
148
- - Training and running some [species classifiers](classification) that are used in conjunction with MegaDetector.
149
- - Tools to [convert](data_management) frequently-used camera trap metadata formats into a common format.
150
- - A [batch processing API](https://github.com/agentmorris/MegaDetector/tree/main/megadetector/api/batch_processing) that runs MegaDetector on large image collections, to accelerate population surveys.
151
- - A [real-time API](https://github.com/agentmorris/MegaDetector/tree/main/megadetector/api/synchronous) that runs MegaDetector (and some species classifiers) synchronously, primarily to support biosecurity applications.
152
+ - Tools for training and running [MegaDetector](megadetector.md).
153
+ - Tools for working with MegaDetector output, e.g. for reviewing the results of a large processing batch.
154
+ - Tools to convert among frequently-used camera trap metadata formats.
152
155
 
153
156
  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.
154
157
 
155
- 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).
158
+ ### Repo organization
156
159
 
160
+ This repo is organized into the following folders...
157
161
 
158
- ### megadetector/detection
162
+ #### megadetector/detection
159
163
 
160
164
  Code for running models, especially MegaDetector.
161
165
 
162
166
 
163
- ### megadetector/postprocessing
167
+ ##### megadetector/postprocessing
164
168
 
165
169
  Code for common operations one might do after running MegaDetector, e.g. [generating preview pages to summarize your results](https://github.com/agentmorris/MegaDetector/blob/main/megadetector/postprocessing/postprocess_batch_results.py), [separating images into different folders based on AI results](https://github.com/agentmorris/MegaDetector/blob/main/megadetector/postprocessing/separate_detections_into_folders.py), or [converting results to a different format](https://github.com/agentmorris/MegaDetector/blob/main/megadetector/postprocessing/convert_output_format.py).
166
170
 
167
171
 
168
- ### megadetector/utils
172
+ #### megadetector/utils
173
+
174
+ Small utility functions for string manipulation, filename manipulation, downloading files from URLs, etc.
169
175
 
170
- Small utility functions for string manipulation, filename manipulation, downloading files from URLs, etc. Mostly adapted from the [ai4eutils](https://github.com/microsoft/ai4eutils) repo.
171
176
 
177
+ #### megadetector/visualization
172
178
 
173
- ### megadetector/visualization
179
+ Tools for visualizing images with ground truth and/or predicted bounding boxes.
174
180
 
175
- Tools for visualizing images with ground truth and/or predicted annotations.
181
+
182
+ #### megadetector/data_management
183
+
184
+ Code for:
185
+
186
+ * Converting frequently-used metadata formats to [COCO Camera Traps](https://github.com/agentmorris/MegaDetector/blob/main/megadetector/data_management/README.md#coco-cameratraps-format) format
187
+ * Converting the output of AI models (especially YOLOv5) to the format used for AI results throughout this repo
188
+ * Creating, visualizing, and editing COCO Camera Traps .json databases
176
189
 
177
190
 
178
- ### megadetector/api
191
+ #### megadetector/api
179
192
 
180
193
  Code for hosting our models as an API, either for synchronous operation (i.e., for real-time inference) or as a batch process (for large biodiversity surveys).
181
194
 
182
195
 
183
- ### megadetector/classification
196
+ #### megadetector/classification
184
197
 
185
198
  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.
186
199
 
@@ -189,41 +202,32 @@ All that said, here's another "teaser image" of what you get at the end of train
189
202
  <img src="images/warthog_classifications.jpg" width="700"><br/>Image credit University of Minnesota, from the Snapshot Safari program.
190
203
 
191
204
 
192
- ### megadetector/taxonomy_mapping
205
+ #### megadetector/taxonomy_mapping
193
206
 
194
207
  Code to facilitate mapping data-set-specific category names (e.g. "lion", which means very different things in Idaho vs. South Africa) to a standard taxonomy.
195
208
 
196
209
 
197
- ### megadetector/data_management
198
-
199
- Code for:
200
-
201
- * Converting frequently-used metadata formats to [COCO Camera Traps](https://github.com/agentmorris/MegaDetector/blob/main/megadetector/data_management/README.md#coco-cameratraps-format) format
202
- * Converting the output of AI models (especially YOLOv5) to the format used for AI results throughout this repo
203
- * Creating, visualizing, and editing COCO Camera Traps .json databases
204
-
205
-
206
- ### envs
210
+ #### envs
207
211
 
208
212
  Environment files... specifically .yml files for mamba/conda environments (these are what we recommend in our [MegaDetector User Guide](megadetector.md)), and a requirements.txt for the pip-inclined.
209
213
 
210
214
 
211
- ### images
215
+ #### images
212
216
 
213
217
  Media used in documentation.
214
218
 
215
219
 
216
- ### archive
220
+ #### archive
217
221
 
218
222
  Old code that we didn't <i>quite</i> want to delete, but is basically obsolete.
219
223
 
220
224
 
221
- ### sandbox
225
+ #### sandbox
222
226
 
223
227
  Random things that don't fit in any other directory, but aren't quite deprecated. Mostly postprocessing scripts that were built for a single use case but could potentially be useful in the future.
224
228
 
225
229
 
226
- ### test_images
230
+ #### test_images
227
231
 
228
232
  A handful of images from [LILA](https://lila.science) that facilitate testing and debugging.
229
233
 
@@ -105,7 +105,7 @@ def request_detections():
105
105
  model_version = post_body.get('model_version', '')
106
106
  if model_version != '':
107
107
  model_version = str(model_version) # in case user used an int
108
- if model_version not in api_config.MD_VERSIONS_TO_REL_PATH: # TODO use AppConfig to store model version info
108
+ if model_version not in api_config.MD_VERSIONS_TO_REL_PATH:
109
109
  return make_error(400, f'model_version {model_version} is not supported.')
110
110
 
111
111
  # check request_name has only allowed characters
@@ -47,7 +47,6 @@ MAX_BATCH_ACCOUNT_ACTIVE_JOBS = 300
47
47
  DETECTION_CONF_THRESHOLD = 0.1
48
48
 
49
49
  # relative to the `megadetector_copies` folder in the container `models`
50
- # TODO add MD versions info to AppConfig
51
50
  MD_VERSIONS_TO_REL_PATH = {
52
51
  '4.1': 'megadetector_v4_1/md_v4.1.0.pb',
53
52
  '3': 'megadetector_v3/megadetector_v3_tf19.pb',
@@ -67,9 +67,6 @@ class JobStatusTable:
67
67
  assert 'request_status' in status and 'message' in status
68
68
  assert status['request_status'] in JobStatusTable.allowed_statuses
69
69
 
70
- # TODO do not read the entry first to get the call_params when the Cosmos SDK add a
71
- # patching functionality:
72
- # https://feedback.azure.com/forums/263030-azure-cosmos-db/suggestions/6693091-be-able-to-do-partial-updates-on-document
73
70
  item_old = self.read_job_status(job_id)
74
71
  if item_old is None:
75
72
  raise ValueError
@@ -19,7 +19,6 @@ log = logging.getLogger(os.environ['FLASK_APP'])
19
19
  #%% helper classes and functions
20
20
 
21
21
  def make_error(error_code: int, error_message: str) -> Tuple[dict, int]:
22
- # TODO log exception when we have more telemetry
23
22
  log.error(f'Error {error_code} - {error_message}')
24
23
  return {'error': error_message}, error_code
25
24
 
@@ -28,8 +27,6 @@ def check_data_container_sas(input_container_sas: str) -> Optional[Tuple[int, st
28
27
  """
29
28
  Returns a tuple (error_code, msg) if not a usable SAS URL, else returns None
30
29
  """
31
- # TODO check that the expiry date of input_container_sas is at least a month
32
- # into the future
33
30
  permissions = sas_blob_utils.get_permissions_from_uri(input_container_sas)
34
31
  data = sas_blob_utils.get_all_query_parts(input_container_sas)
35
32
 
@@ -38,7 +35,6 @@ def check_data_container_sas(input_container_sas: str) -> Optional[Tuple[int, st
38
35
  if 'read' not in permissions or 'list' not in permissions:
39
36
  if 'si' in data:
40
37
  # if no permission specified explicitly but has an access policy, assumes okay
41
- # TODO - check based on access policy as well
42
38
  return None
43
39
 
44
40
  return 400, msg
@@ -72,7 +72,6 @@ def main():
72
72
 
73
73
  print(deployment_id)
74
74
 
75
- # TODO: check project ID ?
76
75
  sql = ''' SELECT emammal_project_taxa_id FROM wild_id.emammal_project_taxa
77
76
  where species in ("No Animal", "Unknown Animal", "Homo sapiens", "Vehicle") '''
78
77
 
@@ -147,8 +147,6 @@ def detect_sync():
147
147
 
148
148
  try:
149
149
  # Write images to temporary files
150
- #
151
- # TODO: read from memory rather than using intermediate files
152
150
  os.makedirs(temp_direc,exist_ok=True)
153
151
  for name, file in request.files.items():
154
152
  if file.content_type in config.IMAGE_CONTENT_TYPES:
@@ -166,7 +164,6 @@ def detect_sync():
166
164
 
167
165
  while True:
168
166
 
169
- # TODO: convert to a blocking read and eliminate the sleep() statement in this loop
170
167
  result = db.get(redis_id)
171
168
 
172
169
  if result:
@@ -90,9 +90,6 @@ def round_filters(filters, global_params):
90
90
  multiplier = global_params.width_coefficient
91
91
  if not multiplier:
92
92
  return filters
93
- # TODO: modify the params names.
94
- # maybe the names (width_divisor,min_width)
95
- # are more suitable than (depth_divisor,min_depth).
96
93
  divisor = global_params.depth_divisor
97
94
  min_depth = global_params.min_depth
98
95
  filters *= multiplier
@@ -295,8 +295,9 @@ class SequenceOptions:
295
295
  Options parameterizing the grouping of images into sequences by time.
296
296
  """
297
297
 
298
- #: Images separated by <= this duration will be grouped into the same sequence.
299
- episode_interval_seconds = 60.0
298
+ def __init__(self):
299
+ #: Images separated by <= this duration will be grouped into the same sequence.
300
+ self.episode_interval_seconds = 60.0
300
301
 
301
302
 
302
303
  #%% Functions
@@ -305,16 +306,24 @@ def create_sequences(image_info,options=None):
305
306
  """
306
307
  Synthesizes episodes/sequences/bursts for the images in [image_info].
307
308
 
308
- Modifies [image_info], populating the 'seq_id', 'seq_num_frames', and 'frame_num' fields
309
- for each image.
309
+ Modifies [image_info] in place, populating the 'seq_id', 'seq_num_frames', and 'frame_num'
310
+ fields for each image.
310
311
 
311
312
  Args:
312
- image_info (dict): a list of dicts in CCT format, i.e. with fields 'file_name' (str),
313
- 'datetime' (datetime), and 'location' (str).
313
+ image_info (str, dict, or list): a dict in CCT format, a CCT .json file, or just the 'images' component
314
+ of a CCT dataset (a list of dicts with fields 'file_name' (str), 'datetime' (datetime), and
315
+ 'location' (str)).
314
316
  """
315
317
 
316
318
  if options is None:
317
319
  options = SequenceOptions()
320
+
321
+ if isinstance(image_info,str):
322
+ with open(image_info,'r') as f:
323
+ image_info = json.load(f)
324
+
325
+ if isinstance(image_info,dict):
326
+ image_info = image_info['images']
318
327
 
319
328
  # Find all unique locations
320
329
  locations = set()
@@ -95,7 +95,18 @@ def get_labelme_dict_for_image_from_coco_record(im,annotations,categories,info=N
95
95
  def coco_to_labelme(coco_data,image_base,overwrite=False,bypass_image_size_check=False,verbose=False):
96
96
  """
97
97
  For all the images in [coco_data] (a dict or a filename), write a .json file in
98
- labelme format alongside the corresponding relative path within image_base.
98
+ labelme format alongside the corresponding relative path within image_base.
99
+
100
+ Args:
101
+ coco_data (dict or str): path to a COCO-formatted .json file, or an already-loaded
102
+ COCO-formatted dict
103
+ image_base (str): path where images live (filenames in [coco_data] should be relative to
104
+ [image_base]); this is also where labelme files will be written
105
+ overwrite (bool, optional): overwrite existing .json files
106
+ bypass_image_size_check (bool, optional): if you're sure that the COCO data already has
107
+ correct 'width' and 'height' fields, this bypasses the somewhat-slow loading of
108
+ each image to fetch image sizes
109
+ verbose (bool, optional): enable additional debug output
99
110
  """
100
111
 
101
112
  # Load COCO data if necessary
@@ -37,30 +37,34 @@ class IntegrityCheckOptions:
37
37
  Options for integrity_check_json_db()
38
38
  """
39
39
 
40
- #: Image path; the filenames in the .json file should be relative to this folder
41
- baseDir = ''
42
-
43
- #: Should we validate the image sizes?
44
- bCheckImageSizes = False
45
-
46
- #: Should we check that all the images in the .json file exist on disk?
47
- bCheckImageExistence = False
48
-
49
- #: Should we search [baseDir] for images that are not used in the .json file?
50
- bFindUnusedImages = False
51
-
52
- #: Should we require that all images in the .json file have a 'location' field?
53
- bRequireLocation = True
54
-
55
- #: For debugging, limit the number of images we'll process
56
- iMaxNumImages = -1
57
-
58
- #: Number of threads to use for parallelization, set to <= 1 to disable parallelization
59
- nThreads = 10
60
-
61
- #: Enable additional debug output
62
- verbose = True
63
-
40
+ def __init__(self):
41
+
42
+ #: Image path; the filenames in the .json file should be relative to this folder
43
+ self.baseDir = ''
44
+
45
+ #: Should we validate the image sizes?
46
+ self.bCheckImageSizes = False
47
+
48
+ #: Should we check that all the images in the .json file exist on disk?
49
+ self.bCheckImageExistence = False
50
+
51
+ #: Should we search [baseDir] for images that are not used in the .json file?
52
+ self.bFindUnusedImages = False
53
+
54
+ #: Should we require that all images in the .json file have a 'location' field?
55
+ self.bRequireLocation = True
56
+
57
+ #: For debugging, limit the number of images we'll process
58
+ self.iMaxNumImages = -1
59
+
60
+ #: Number of threads to use for parallelization, set to <= 1 to disable parallelization
61
+ self.nThreads = 10
62
+
63
+ #: Enable additional debug output
64
+ self.verbose = True
65
+
66
+ #: Allow integer-valued image and annotation IDs (COCO uses this, CCT files use strings)
67
+ self.allowIntIDs = False
64
68
 
65
69
  # This is used in a medium-hacky way to share modified options across threads
66
70
  defaultOptions = IntegrityCheckOptions()
@@ -231,7 +235,12 @@ def integrity_check_json_db(jsonFile, options=None):
231
235
  imagePathsInJson.add(image['file_name'])
232
236
 
233
237
  assert isinstance(image['file_name'],str), 'Illegal image filename type'
234
- assert isinstance(image['id'],str), 'Illegal image ID type'
238
+
239
+ if options.allowIntIDs:
240
+ assert isinstance(image['id'],str) or isinstance(image['id'],int), \
241
+ 'Illegal image ID type'
242
+ else:
243
+ assert isinstance(image['id'],str), 'Illegal image ID type'
235
244
 
236
245
  imageId = image['id']
237
246
 
@@ -329,9 +338,16 @@ def integrity_check_json_db(jsonFile, options=None):
329
338
  assert 'id' in ann
330
339
  assert 'category_id' in ann
331
340
 
332
- assert isinstance(ann['id'],str), 'Illegal annotation ID type'
341
+ if options.allowIntIDs:
342
+ assert isinstance(ann['id'],str) or isinstance(ann['id'],int), \
343
+ 'Illegal annotation ID type'
344
+ assert isinstance(ann['image_id'],str) or isinstance(ann['image_id'],int), \
345
+ 'Illegal annotation image ID type'
346
+ else:
347
+ assert isinstance(ann['id'],str), 'Illegal annotation ID type'
348
+ assert isinstance(ann['image_id'],str), 'Illegal annotation image ID type'
349
+
333
350
  assert isinstance(ann['category_id'],int), 'Illegal annotation category ID type'
334
- assert isinstance(ann['image_id'],str), 'Illegal annotation image ID type'
335
351
 
336
352
  if 'bbox' in ann:
337
353
  nBoxes += 1