megadetector 5.0.21__tar.gz → 5.0.22__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 (213) hide show
  1. {megadetector-5.0.21 → megadetector-5.0.22}/LICENSE +0 -0
  2. {megadetector-5.0.21/megadetector.egg-info → megadetector-5.0.22}/PKG-INFO +143 -142
  3. {megadetector-5.0.21 → megadetector-5.0.22}/README-package.md +0 -0
  4. {megadetector-5.0.21 → megadetector-5.0.22}/README.md +1 -1
  5. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/__init__.py +0 -0
  6. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/__init__.py +0 -0
  7. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/api_core/__init__.py +0 -0
  8. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/api_core/batch_service/__init__.py +0 -0
  9. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/api_core/batch_service/score.py +0 -0
  10. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/api_core/server.py +0 -0
  11. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/api_core/server_api_config.py +0 -0
  12. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/api_core/server_app_config.py +0 -0
  13. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/api_core/server_batch_job_manager.py +0 -0
  14. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/api_core/server_job_status_table.py +0 -0
  15. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/api_core/server_orchestration.py +0 -0
  16. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/api_core/server_utils.py +0 -0
  17. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/api_core_support/__init__.py +0 -0
  18. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/api_core_support/aggregate_results_manually.py +0 -0
  19. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/api_support/__init__.py +0 -0
  20. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/api_support/summarize_daily_activity.py +0 -0
  21. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/data_preparation/__init__.py +0 -0
  22. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/integration/digiKam/setup.py +0 -0
  23. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/integration/digiKam/xmp_integration.py +0 -0
  24. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/integration/eMammal/test_scripts/config_template.py +0 -0
  25. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/integration/eMammal/test_scripts/push_annotations_to_emammal.py +0 -0
  26. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/batch_processing/integration/eMammal/test_scripts/select_images_for_testing.py +0 -0
  27. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/synchronous/__init__.py +0 -0
  28. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/synchronous/api_core/animal_detection_api/__init__.py +0 -0
  29. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/synchronous/api_core/animal_detection_api/api_backend.py +0 -0
  30. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/synchronous/api_core/animal_detection_api/api_frontend.py +0 -0
  31. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/synchronous/api_core/animal_detection_api/config.py +0 -0
  32. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/synchronous/api_core/tests/__init__.py +0 -0
  33. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/api/synchronous/api_core/tests/load_test.py +0 -0
  34. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/__init__.py +0 -0
  35. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/aggregate_classifier_probs.py +0 -0
  36. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/analyze_failed_images.py +0 -0
  37. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/cache_batchapi_outputs.py +0 -0
  38. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/create_classification_dataset.py +0 -0
  39. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/crop_detections.py +0 -0
  40. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/csv_to_json.py +0 -0
  41. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/detect_and_crop.py +0 -0
  42. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/efficientnet/__init__.py +0 -0
  43. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/efficientnet/model.py +0 -0
  44. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/efficientnet/utils.py +0 -0
  45. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/evaluate_model.py +0 -0
  46. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/identify_mislabeled_candidates.py +0 -0
  47. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/json_to_azcopy_list.py +0 -0
  48. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/json_validator.py +0 -0
  49. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/map_classification_categories.py +0 -0
  50. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/merge_classification_detection_output.py +0 -0
  51. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/prepare_classification_script.py +0 -0
  52. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/prepare_classification_script_mc.py +0 -0
  53. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/run_classifier.py +0 -0
  54. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/save_mislabeled.py +0 -0
  55. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/train_classifier.py +0 -0
  56. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/train_classifier_tf.py +0 -0
  57. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/classification/train_utils.py +0 -0
  58. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/__init__.py +0 -0
  59. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/annotations/__init__.py +0 -0
  60. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/annotations/annotation_constants.py +0 -0
  61. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/camtrap_dp_to_coco.py +0 -0
  62. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/cct_json_utils.py +143 -7
  63. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/cct_to_md.py +12 -5
  64. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/cct_to_wi.py +0 -0
  65. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/coco_to_labelme.py +0 -0
  66. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/coco_to_yolo.py +0 -0
  67. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/databases/__init__.py +0 -0
  68. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/databases/add_width_and_height_to_db.py +0 -0
  69. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/databases/combine_coco_camera_traps_files.py +0 -0
  70. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/databases/integrity_check_json_db.py +83 -77
  71. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/databases/subset_json_db.py +0 -0
  72. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/generate_crops_from_cct.py +0 -0
  73. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/get_image_sizes.py +0 -0
  74. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/add_nacti_sizes.py +0 -0
  75. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/add_timestamps_to_icct.py +0 -0
  76. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/animl_results_to_md_results.py +0 -0
  77. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/auckland_doc_test_to_json.py +0 -0
  78. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/auckland_doc_to_json.py +0 -0
  79. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/awc_to_json.py +0 -0
  80. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/bellevue_to_json.py +0 -0
  81. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/cacophony-thermal-importer.py +0 -0
  82. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/carrizo_shrubfree_2018.py +0 -0
  83. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/carrizo_trail_cam_2017.py +0 -0
  84. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/cct_field_adjustments.py +0 -0
  85. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/channel_islands_to_cct.py +0 -0
  86. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/eMammal/copy_and_unzip_emammal.py +0 -0
  87. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/eMammal/eMammal_helpers.py +0 -0
  88. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/eMammal/make_eMammal_json.py +0 -0
  89. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/ena24_to_json.py +0 -0
  90. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/filenames_to_json.py +0 -0
  91. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/helena_to_cct.py +0 -0
  92. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/idaho-camera-traps.py +0 -0
  93. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/idfg_iwildcam_lila_prep.py +0 -0
  94. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/import_desert_lion_conservation_camera_traps.py +0 -0
  95. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/jb_csv_to_json.py +0 -0
  96. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/mcgill_to_json.py +0 -0
  97. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/missouri_to_json.py +0 -0
  98. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/nacti_fieldname_adjustments.py +0 -0
  99. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/noaa_seals_2019.py +0 -0
  100. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/osu-small-animals-to-json.py +0 -0
  101. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/pc_to_json.py +0 -0
  102. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/plot_wni_giraffes.py +0 -0
  103. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/prepare_zsl_imerit.py +0 -0
  104. megadetector-5.0.22/megadetector/data_management/importers/raic_csv_to_md_results.py +416 -0
  105. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/rspb_to_json.py +0 -0
  106. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/save_the_elephants_survey_A.py +0 -0
  107. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/save_the_elephants_survey_B.py +0 -0
  108. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/snapshot_safari_importer.py +0 -0
  109. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/snapshot_serengeti_lila.py +0 -0
  110. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/snapshotserengeti/make_full_SS_json.py +0 -0
  111. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/snapshotserengeti/make_per_season_SS_json.py +0 -0
  112. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/sulross_get_exif.py +0 -0
  113. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/timelapse_csv_set_to_json.py +0 -0
  114. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/ubc_to_json.py +0 -0
  115. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/umn_to_json.py +0 -0
  116. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/wellington_to_json.py +0 -0
  117. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/wi_to_json.py +0 -0
  118. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/importers/zamba_results_to_md_results.py +1 -2
  119. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/labelme_to_coco.py +0 -0
  120. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/labelme_to_yolo.py +0 -0
  121. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/lila/__init__.py +0 -0
  122. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/lila/add_locations_to_island_camera_traps.py +0 -0
  123. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/lila/add_locations_to_nacti.py +0 -0
  124. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/lila/create_lila_blank_set.py +0 -0
  125. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/lila/create_lila_test_set.py +25 -11
  126. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/lila/create_links_to_md_results_files.py +0 -0
  127. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/lila/download_lila_subset.py +9 -2
  128. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/lila/generate_lila_per_image_labels.py +3 -2
  129. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/lila/get_lila_annotation_counts.py +0 -0
  130. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/lila/get_lila_image_counts.py +0 -0
  131. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/lila/lila_common.py +0 -0
  132. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/lila/test_lila_metadata_urls.py +5 -1
  133. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/ocr_tools.py +0 -0
  134. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/read_exif.py +10 -14
  135. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/remap_coco_categories.py +0 -0
  136. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/remove_exif.py +0 -0
  137. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/rename_images.py +1 -1
  138. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/resize_coco_dataset.py +0 -0
  139. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/wi_download_csv_to_coco.py +0 -0
  140. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/yolo_output_to_md_output.py +0 -0
  141. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/data_management/yolo_to_coco.py +0 -0
  142. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/detection/__init__.py +0 -0
  143. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/detection/detector_training/__init__.py +0 -0
  144. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/detection/detector_training/model_main_tf2.py +0 -0
  145. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/detection/process_video.py +14 -3
  146. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/detection/pytorch_detector.py +15 -3
  147. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/detection/run_detector.py +4 -3
  148. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/detection/run_detector_batch.py +0 -0
  149. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/detection/run_inference_with_yolov5_val.py +121 -13
  150. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/detection/run_tiled_inference.py +0 -0
  151. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/detection/tf_detector.py +0 -0
  152. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/detection/video_utils.py +21 -10
  153. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/postprocessing/__init__.py +0 -0
  154. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/postprocessing/add_max_conf.py +0 -0
  155. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/postprocessing/categorize_detections_by_size.py +0 -0
  156. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/postprocessing/classification_postprocessing.py +1 -1
  157. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/postprocessing/combine_api_outputs.py +0 -0
  158. megadetector-5.0.22/megadetector/postprocessing/compare_batch_results.py +1755 -0
  159. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/postprocessing/convert_output_format.py +0 -0
  160. megadetector-5.0.22/megadetector/postprocessing/detector_calibration.py +565 -0
  161. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/postprocessing/load_api_results.py +0 -0
  162. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/postprocessing/md_to_coco.py +85 -20
  163. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/postprocessing/md_to_labelme.py +0 -0
  164. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/postprocessing/merge_detections.py +0 -0
  165. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/postprocessing/postprocess_batch_results.py +0 -1
  166. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/postprocessing/remap_detection_categories.py +0 -0
  167. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/postprocessing/render_detection_confusion_matrix.py +0 -0
  168. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/postprocessing/repeat_detection_elimination/find_repeat_detections.py +0 -0
  169. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/postprocessing/repeat_detection_elimination/remove_repeat_detections.py +0 -0
  170. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/postprocessing/repeat_detection_elimination/repeat_detections_core.py +0 -0
  171. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/postprocessing/separate_detections_into_folders.py +0 -0
  172. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/postprocessing/subset_json_detector_output.py +0 -0
  173. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/postprocessing/top_folders_to_bottom.py +0 -0
  174. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/postprocessing/validate_batch_results.py +65 -15
  175. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/taxonomy_mapping/__init__.py +0 -0
  176. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/taxonomy_mapping/map_lila_taxonomy_to_wi_taxonomy.py +0 -0
  177. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/taxonomy_mapping/map_new_lila_datasets.py +15 -12
  178. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/taxonomy_mapping/prepare_lila_taxonomy_release.py +1 -1
  179. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/taxonomy_mapping/preview_lila_taxonomy.py +3 -1
  180. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/taxonomy_mapping/retrieve_sample_image.py +0 -0
  181. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/taxonomy_mapping/simple_image_download.py +0 -0
  182. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/taxonomy_mapping/species_lookup.py +0 -0
  183. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/taxonomy_mapping/taxonomy_csv_checker.py +0 -0
  184. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/taxonomy_mapping/taxonomy_graph.py +0 -0
  185. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/taxonomy_mapping/validate_lila_category_mappings.py +0 -0
  186. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/utils/__init__.py +0 -0
  187. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/utils/azure_utils.py +0 -0
  188. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/utils/ct_utils.py +64 -2
  189. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/utils/directory_listing.py +0 -0
  190. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/utils/md_tests.py +1 -1
  191. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/utils/path_utils.py +14 -7
  192. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/utils/process_utils.py +9 -3
  193. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/utils/sas_blob_utils.py +0 -0
  194. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/utils/split_locations_into_train_val.py +0 -0
  195. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/utils/string_utils.py +0 -0
  196. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/utils/torch_test.py +0 -0
  197. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/utils/url_utils.py +0 -0
  198. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/utils/write_html_image_list.py +5 -1
  199. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/visualization/__init__.py +0 -0
  200. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/visualization/plot_utils.py +0 -0
  201. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/visualization/render_images_with_thumbnails.py +0 -0
  202. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/visualization/visualization_utils.py +211 -87
  203. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/visualization/visualize_db.py +0 -0
  204. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector/visualization/visualize_detector_output.py +0 -0
  205. {megadetector-5.0.21 → megadetector-5.0.22/megadetector.egg-info}/PKG-INFO +143 -142
  206. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector.egg-info/SOURCES.txt +1 -0
  207. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector.egg-info/dependency_links.txt +0 -0
  208. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector.egg-info/requires.txt +1 -0
  209. {megadetector-5.0.21 → megadetector-5.0.22}/megadetector.egg-info/top_level.txt +0 -0
  210. {megadetector-5.0.21 → megadetector-5.0.22}/pyproject.toml +10 -2
  211. {megadetector-5.0.21 → megadetector-5.0.22}/setup.cfg +4 -4
  212. megadetector-5.0.21/megadetector/postprocessing/compare_batch_results.py +0 -966
  213. megadetector-5.0.21/megadetector/postprocessing/detector_calibration.py +0 -367
File without changes
@@ -1,142 +1,143 @@
1
- Metadata-Version: 2.1
2
- Name: megadetector
3
- Version: 5.0.21
4
- Summary: MegaDetector is an AI model that helps conservation folks spend less time doing boring things with camera trap images.
5
- Author-email: Your friendly neighborhood MegaDetector team <cameratraps@lila.science>
6
- Maintainer-email: Your friendly neighborhood MegaDetector team <cameratraps@lila.science>
7
- License: MIT License
8
-
9
- Permission is hereby granted, free of charge, to any person obtaining a copy
10
- of this software and associated documentation files (the "Software"), to deal
11
- in the Software without restriction, including without limitation the rights
12
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
- copies of the Software, and to permit persons to whom the Software is
14
- furnished to do so, subject to the following conditions:
15
-
16
- The above copyright notice and this permission notice shall be included in all
17
- copies or substantial portions of the Software.
18
-
19
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
- SOFTWARE.
26
-
27
- Project-URL: Homepage, https://github.com/agentmorris/MegaDetector
28
- Project-URL: Documentation, https://megadetector.readthedocs.io
29
- Project-URL: Bug Reports, https://github.com/agentmorris/MegaDetector/issues
30
- Project-URL: Source, https://github.com/agentmorris/MegaDetector
31
- Keywords: camera traps,conservation,wildlife,ai,megadetector
32
- Classifier: Development Status :: 3 - Alpha
33
- Classifier: License :: OSI Approved :: MIT License
34
- Classifier: Programming Language :: Python :: 3
35
- Requires-Python: <3.12,>=3.9
36
- Description-Content-Type: text/markdown
37
- License-File: LICENSE
38
- Requires-Dist: Pillow>=9.5
39
- Requires-Dist: tqdm>=4.64.0
40
- Requires-Dist: jsonpickle>=3.0.2
41
- Requires-Dist: humanfriendly>=10.0
42
- Requires-Dist: numpy<1.24,>=1.22
43
- Requires-Dist: matplotlib>=3.8.0
44
- Requires-Dist: opencv-python>=4.8.0
45
- Requires-Dist: requests>=2.31.0
46
- Requires-Dist: pyqtree>=1.0.0
47
- Requires-Dist: seaborn>=0.12.2
48
- Requires-Dist: scikit-learn>=1.3.1
49
- Requires-Dist: pandas>=2.1.1
50
- Requires-Dist: PyYAML>=6.0.1
51
- Requires-Dist: ultralytics-yolov5==0.1.1
52
-
53
- # MegaDetector
54
-
55
- This package is a pip-installable version of the support/inference code for [MegaDetector](https://github.com/agentmorris/MegaDetector/?tab=readme-ov-file#megadetector), an object detection model that helps conservation biologists spend less time doing boring things with camera trap images. Complete documentation for this Python package is available at [megadetector.readthedocs.io](https://megadetector.readthedocs.io).
56
-
57
- 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).
58
-
59
-
60
- ## Reasons you might not be looking for this package
61
-
62
- ### If you are an ecologist...
63
-
64
- 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.
65
-
66
- ### If you are a computer-vision-y type...
67
-
68
- 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.
69
-
70
- ## Reasons you might want to use this package
71
-
72
- 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.
73
-
74
- ## If I haven't talked you out of using this package...
75
-
76
- To install:
77
-
78
- `pip install megadetector`
79
-
80
- MegaDetector model weights aren't downloaded at pip-install time, but they will be (optionally) automatically downloaded the first time you run the model.
81
-
82
- ## Package reference
83
-
84
- See [megadetector.readthedocs.io](https://megadetector.readthedocs.io).
85
-
86
-
87
- ## Examples of things you can do with this package
88
-
89
- ### Run MegaDetector on one image and count the number of detections
90
-
91
- ```
92
- from megadetector.utils import url_utils
93
- from megadetector.visualization import visualization_utils as vis_utils
94
- from megadetector.detection import run_detector
95
-
96
- # This is the image at the bottom of this page, it has one animal in it
97
- image_url = 'https://github.com/agentmorris/MegaDetector/raw/main/images/orinoquia-thumb-web.jpg'
98
- temporary_filename = url_utils.download_url(image_url)
99
-
100
- image = vis_utils.load_image(temporary_filename)
101
-
102
- # This will automatically download MDv5a; you can also specify a filename.
103
- model = run_detector.load_detector('MDV5A')
104
-
105
- result = model.generate_detections_one_image(image)
106
-
107
- detections_above_threshold = [d for d in result['detections'] if d['conf'] > 0.2]
108
- print('Found {} detections above threshold'.format(len(detections_above_threshold)))
109
- ```
110
-
111
- ### Run MegaDetector on a folder of images
112
-
113
- ```
114
- from megadetector.detection.run_detector_batch import \
115
- load_and_run_detector_batch, write_results_to_file
116
- from megadetector.utils import path_utils
117
- import os
118
-
119
- # Pick a folder to run MD on recursively, and an output file
120
- image_folder = os.path.expanduser('~/megadetector_test_images')
121
- output_file = os.path.expanduser('~/megadetector_output_test.json')
122
-
123
- # Recursively find images
124
- image_file_names = path_utils.find_images(image_folder,recursive=True)
125
-
126
- # This will automatically download MDv5a; you can also specify a filename.
127
- results = load_and_run_detector_batch('MDV5A', image_file_names)
128
-
129
- # Write results to a format that Timelapse and other downstream tools like.
130
- write_results_to_file(results,
131
- output_file,
132
- relative_path_base=image_folder,
133
- detector_file=detector_filename)
134
- ```
135
-
136
- ## Contact
137
-
138
- Contact <a href="cameratraps@lila.science">cameratraps@lila.science</a> with questions.
139
-
140
- ## Gratuitous animal picture
141
-
142
- <img src="https://github.com/agentmorris/MegaDetector/raw/main/images/orinoquia-thumb-web_detections.jpg"><br/>Image credit University of Minnesota, from the [Orinoquía Camera Traps](http://lila.science/datasets/orinoquia-camera-traps/) data set.
1
+ Metadata-Version: 2.2
2
+ Name: megadetector
3
+ Version: 5.0.22
4
+ Summary: MegaDetector is an AI model that helps conservation folks spend less time doing boring things with camera trap images.
5
+ Author-email: Your friendly neighborhood MegaDetector team <cameratraps@lila.science>
6
+ Maintainer-email: Your friendly neighborhood MegaDetector team <cameratraps@lila.science>
7
+ License: MIT License
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ Project-URL: Homepage, https://github.com/agentmorris/MegaDetector
28
+ Project-URL: Documentation, https://megadetector.readthedocs.io
29
+ Project-URL: Bug Reports, https://github.com/agentmorris/MegaDetector/issues
30
+ Project-URL: Source, https://github.com/agentmorris/MegaDetector
31
+ Keywords: camera traps,conservation,wildlife,ai,megadetector
32
+ Classifier: Development Status :: 3 - Alpha
33
+ Classifier: License :: OSI Approved :: MIT License
34
+ Classifier: Programming Language :: Python :: 3
35
+ Requires-Python: <3.12,>=3.9
36
+ Description-Content-Type: text/markdown
37
+ License-File: LICENSE
38
+ Requires-Dist: Pillow>=9.5
39
+ Requires-Dist: tqdm>=4.64.0
40
+ Requires-Dist: jsonpickle>=3.0.2
41
+ Requires-Dist: humanfriendly>=10.0
42
+ Requires-Dist: numpy<1.24,>=1.22
43
+ Requires-Dist: matplotlib>=3.8.0
44
+ Requires-Dist: opencv-python>=4.8.0
45
+ Requires-Dist: requests>=2.31.0
46
+ Requires-Dist: pyqtree>=1.0.0
47
+ Requires-Dist: seaborn>=0.12.2
48
+ Requires-Dist: scikit-learn>=1.3.1
49
+ Requires-Dist: pandas>=2.1.1
50
+ Requires-Dist: PyYAML>=6.0.1
51
+ Requires-Dist: ultralytics-yolov5==0.1.1
52
+ Requires-Dist: python-dateutil
53
+
54
+ # MegaDetector
55
+
56
+ This package is a pip-installable version of the support/inference code for [MegaDetector](https://github.com/agentmorris/MegaDetector/?tab=readme-ov-file#megadetector), an object detection model that helps conservation biologists spend less time doing boring things with camera trap images. Complete documentation for this Python package is available at [megadetector.readthedocs.io](https://megadetector.readthedocs.io).
57
+
58
+ 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
+ ## 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...
76
+
77
+ To install:
78
+
79
+ `pip install megadetector`
80
+
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.
82
+
83
+ ## Package reference
84
+
85
+ See [megadetector.readthedocs.io](https://megadetector.readthedocs.io).
86
+
87
+
88
+ ## Examples of things you can do with this package
89
+
90
+ ### Run MegaDetector on one image and count the number of detections
91
+
92
+ ```
93
+ from megadetector.utils import url_utils
94
+ from megadetector.visualization import visualization_utils as vis_utils
95
+ from megadetector.detection import run_detector
96
+
97
+ # This is the image at the bottom of this page, it has one animal in it
98
+ image_url = 'https://github.com/agentmorris/MegaDetector/raw/main/images/orinoquia-thumb-web.jpg'
99
+ temporary_filename = url_utils.download_url(image_url)
100
+
101
+ image = vis_utils.load_image(temporary_filename)
102
+
103
+ # This will automatically download MDv5a; you can also specify a filename.
104
+ model = run_detector.load_detector('MDV5A')
105
+
106
+ result = model.generate_detections_one_image(image)
107
+
108
+ detections_above_threshold = [d for d in result['detections'] if d['conf'] > 0.2]
109
+ print('Found {} detections above threshold'.format(len(detections_above_threshold)))
110
+ ```
111
+
112
+ ### Run MegaDetector on a folder of images
113
+
114
+ ```
115
+ from megadetector.detection.run_detector_batch import \
116
+ load_and_run_detector_batch, write_results_to_file
117
+ from megadetector.utils import path_utils
118
+ import os
119
+
120
+ # Pick a folder to run MD on recursively, and an output file
121
+ image_folder = os.path.expanduser('~/megadetector_test_images')
122
+ output_file = os.path.expanduser('~/megadetector_output_test.json')
123
+
124
+ # Recursively find images
125
+ image_file_names = path_utils.find_images(image_folder,recursive=True)
126
+
127
+ # This will automatically download MDv5a; you can also specify a filename.
128
+ results = load_and_run_detector_batch('MDV5A', image_file_names)
129
+
130
+ # Write results to a format that Timelapse and other downstream tools like.
131
+ write_results_to_file(results,
132
+ output_file,
133
+ relative_path_base=image_folder,
134
+ detector_file=detector_filename)
135
+ ```
136
+
137
+ ## Contact
138
+
139
+ Contact <a href="cameratraps@lila.science">cameratraps@lila.science</a> with questions.
140
+
141
+ ## Gratuitous animal picture
142
+
143
+ <img src="https://github.com/agentmorris/MegaDetector/raw/main/images/orinoquia-thumb-web_detections.jpg"><br/>Image credit University of Minnesota, from the [Orinoquía Camera Traps](http://lila.science/datasets/orinoquia-camera-traps/) data set.
@@ -107,7 +107,7 @@ Here are a few of the organizations that have used MegaDetector... we're only li
107
107
  * [Wildlife Coexistence Lab](https://wildlife.forestry.ubc.ca/), University of British Columbia
108
108
  * [Wildlife Research](https://www.dfw.state.or.us/wildlife/research/index.asp), Oregon Department of Fish and Wildlife
109
109
  * [Wildlife Division](https://www.michigan.gov/dnr/about/contact/wildlife), Michigan Department of Natural Resources
110
-
110
+ * [Kohl Wildlife Lab](https://kohlwildlifelab.com/), University of Georgia
111
111
  * Department of Ecology, TU Berlin
112
112
  * Ghost Cat Analytics
113
113
  * Protected Areas Unit, Canadian Wildlife Service
@@ -12,6 +12,8 @@ https://github.com/agentmorris/MegaDetector/blob/main/megadetector/data_manageme
12
12
 
13
13
  import json
14
14
  import os
15
+ import datetime
16
+ import dateutil
15
17
 
16
18
  from tqdm import tqdm
17
19
  from collections import defaultdict, OrderedDict
@@ -302,6 +304,106 @@ class SequenceOptions:
302
304
 
303
305
  #%% Functions
304
306
 
307
+ def write_object_with_serialized_datetimes(d,json_fn):
308
+ """
309
+ Writes the object [d] to the .json file [json_fn] with a standard approach
310
+ to serializing Python datetime objects.
311
+
312
+ Args:
313
+ d (obj): the object to write, typically a dict
314
+ json_fn (str): the output filename
315
+ """
316
+
317
+ # This writes datetimes as:
318
+ #
319
+ # 2022-12-31T09:52:50
320
+ def json_serialize_datetime(obj):
321
+ if isinstance(obj, (datetime.datetime, datetime.date)):
322
+ return obj.isoformat()
323
+ raise TypeError('Object {} (type {}) not serializable'.format(
324
+ str(obj),type(obj)))
325
+
326
+ with open(json_fn,'w') as f:
327
+ json.dump(d,f,indent=1,default=json_serialize_datetime)
328
+
329
+
330
+ def parse_datetimes_from_cct_image_list(images,conversion_failure_behavior='error'):
331
+ """
332
+ Given the "images" field from a COCO camera traps dictionary, converts all
333
+ string-formatted datetime fields to Python datetimes, making reasonable assumptions
334
+ about datetime representations. Modifies [images] in place.
335
+
336
+ Args:
337
+ images (list): a list of dicts in CCT images format
338
+ conversion_failure_behavior (str, optional): determines what happens on a failed
339
+ conversion; can be "error" (raise an error), "str" (leave as a string), or
340
+ "none" (convert to None)
341
+
342
+ Returns:
343
+ images: the input list, with datetimes converted (after modifying in place)
344
+ """
345
+
346
+ assert isinstance(images,list)
347
+
348
+ for im in images:
349
+
350
+ if 'datetime' not in im:
351
+ continue
352
+ if isinstance(im['datetime'],datetime.datetime):
353
+ continue
354
+ try:
355
+ dt = dateutil.parser.parse(im['datetime'])
356
+ im['datetime'] = dt
357
+ except Exception as e:
358
+ s = 'could not parse datetime {}: {}'.format(str(im['datetime']),str(e))
359
+ if conversion_failure_behavior == 'error':
360
+ raise ValueError(s)
361
+ elif conversion_failure_behavior == 'str':
362
+ print('Warning: {}'.format(s))
363
+ pass
364
+ elif conversion_failure_behavior == 'none':
365
+ print('Warning: {}'.format(s))
366
+ im['datetime'] = None
367
+
368
+ # ...for each image
369
+
370
+ return images
371
+
372
+ # ...def parse_datetimes_from_cct_image_list(...)
373
+
374
+
375
+ def parse_datetimes_from_cct_dict(d,conversion_failure_behavior='error'):
376
+ """
377
+ Given a COCO camera traps dictionary that may just have been loaded from file,
378
+ converts all string-formatted datetime fields to Python datetimes, making
379
+ reasonable assumptions about datetime representations. Modifies [d] in place
380
+ if [d] is supplied as a dict
381
+
382
+ Args:
383
+ d (dict or str): a dict in CCT format or a filename pointing to a CCT .json file
384
+ conversion_failure_behavior (str, optional): determines what happens on a failed
385
+ conversion; can be "error" (raise an error), "str" (leave as a string), or
386
+ "none" (convert to None)
387
+
388
+ Returns:
389
+ dict: the CCT dict with converted datetimes.
390
+ """
391
+
392
+ if isinstance(d,str):
393
+ assert os.path.isfile(d), 'Could not find .json file {}'.format(d)
394
+ with open(d,'r') as f:
395
+ d = json.load(f)
396
+
397
+ images = d['images']
398
+
399
+ # Modifies in place
400
+ _ = parse_datetimes_from_cct_image_list(images)
401
+
402
+ return d
403
+
404
+ # ...def parse_datetimes_from_cct_dict(...)
405
+
406
+
305
407
  def create_sequences(image_info,options=None):
306
408
  """
307
409
  Synthesizes episodes/sequences/bursts for the images in [image_info].
@@ -310,21 +412,41 @@ def create_sequences(image_info,options=None):
310
412
  fields for each image.
311
413
 
312
414
  Args:
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)).
415
+ image_info (str, dict, or list): a dict in CCT format, a CCT .json file, or just the
416
+ 'images' component of a CCT dataset (a list of dicts with fields 'file_name' (str),
417
+ 'datetime' (datetime), and 'location' (str)).
418
+ options (SequenceOptions): options parameterizing the assembly of images into sequences;
419
+ see the SequenceOptions class for details.
420
+
421
+ Returns:
422
+ image_info: if [image_info] is passed as a list, returns the list, otherwise returns
423
+ a CCT-formatted dict.
316
424
  """
317
425
 
318
426
  if options is None:
319
427
  options = SequenceOptions()
320
428
 
321
- if isinstance(image_info,str):
429
+ to_return = None
430
+
431
+ if isinstance(image_info,list):
432
+ to_return = image_info
433
+
434
+ elif isinstance(image_info,str):
322
435
  with open(image_info,'r') as f:
323
- image_info = json.load(f)
436
+ d = json.load(f)
437
+ to_return = d
438
+ image_info = d['images']
324
439
 
325
- if isinstance(image_info,dict):
440
+ elif isinstance(image_info,dict):
441
+ to_return = image_info
326
442
  image_info = image_info['images']
443
+
444
+ else:
445
+ raise ValueError('Unrecognized type for [image_info]')
327
446
 
447
+ # Modifies the images in place
448
+ _ = parse_datetimes_from_cct_image_list(image_info)
449
+
328
450
  # Find all unique locations
329
451
  locations = set()
330
452
  for im in image_info:
@@ -401,4 +523,18 @@ def create_sequences(image_info,options=None):
401
523
 
402
524
  print('Created {} sequences from {} images'.format(len(all_sequences),len(image_info)))
403
525
 
404
- # ...create_sequences()
526
+ return to_return
527
+
528
+ # ...def create_sequences(...)
529
+
530
+
531
+ #%% Test drivers
532
+
533
+ if False:
534
+
535
+ pass
536
+
537
+ #%%
538
+
539
+ fn = r'g:\temp\test.json'
540
+ d = parse_datetimes_from_cct_dict(fn,conversion_failure_behavior='error')