megadetector 5.0.10__py3-none-any.whl → 5.0.12__py3-none-any.whl

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 (226) hide show
  1. {api → megadetector/api}/batch_processing/api_core/batch_service/score.py +2 -2
  2. {api → megadetector/api}/synchronous/api_core/animal_detection_api/api_backend.py +1 -1
  3. {api → megadetector/api}/synchronous/api_core/animal_detection_api/api_frontend.py +1 -1
  4. {classification → megadetector/classification}/analyze_failed_images.py +3 -3
  5. {classification → megadetector/classification}/cache_batchapi_outputs.py +1 -1
  6. {classification → megadetector/classification}/create_classification_dataset.py +1 -1
  7. {classification → megadetector/classification}/crop_detections.py +1 -1
  8. {classification → megadetector/classification}/detect_and_crop.py +5 -5
  9. {classification → megadetector/classification}/evaluate_model.py +1 -1
  10. {classification → megadetector/classification}/json_to_azcopy_list.py +2 -2
  11. {classification → megadetector/classification}/json_validator.py +13 -9
  12. {classification → megadetector/classification}/map_classification_categories.py +1 -1
  13. {classification → megadetector/classification}/merge_classification_detection_output.py +1 -1
  14. {classification → megadetector/classification}/run_classifier.py +2 -1
  15. {classification → megadetector/classification}/train_classifier.py +8 -6
  16. {classification → megadetector/classification}/train_classifier_tf.py +10 -9
  17. {classification → megadetector/classification}/train_utils.py +3 -2
  18. {data_management → megadetector/data_management}/camtrap_dp_to_coco.py +4 -3
  19. {data_management → megadetector/data_management}/cct_json_utils.py +2 -2
  20. {data_management → megadetector/data_management}/cct_to_md.py +1 -1
  21. {data_management → megadetector/data_management}/coco_to_labelme.py +1 -1
  22. {data_management → megadetector/data_management}/coco_to_yolo.py +1 -1
  23. {data_management → megadetector/data_management}/databases/integrity_check_json_db.py +2 -2
  24. {data_management → megadetector/data_management}/get_image_sizes.py +4 -3
  25. {data_management → megadetector/data_management}/importers/auckland_doc_test_to_json.py +6 -5
  26. {data_management → megadetector/data_management}/importers/auckland_doc_to_json.py +4 -3
  27. {data_management → megadetector/data_management}/importers/awc_to_json.py +6 -4
  28. {data_management → megadetector/data_management}/importers/bellevue_to_json.py +3 -3
  29. {data_management → megadetector/data_management}/importers/cacophony-thermal-importer.py +4 -4
  30. {data_management → megadetector/data_management}/importers/carrizo_shrubfree_2018.py +5 -4
  31. {data_management → megadetector/data_management}/importers/carrizo_trail_cam_2017.py +8 -6
  32. {data_management → megadetector/data_management}/importers/cct_field_adjustments.py +2 -1
  33. {data_management → megadetector/data_management}/importers/channel_islands_to_cct.py +2 -2
  34. {data_management → megadetector/data_management}/importers/ena24_to_json.py +6 -5
  35. {data_management → megadetector/data_management}/importers/filenames_to_json.py +2 -1
  36. {data_management → megadetector/data_management}/importers/helena_to_cct.py +7 -6
  37. {data_management → megadetector/data_management}/importers/idaho-camera-traps.py +6 -6
  38. {data_management → megadetector/data_management}/importers/idfg_iwildcam_lila_prep.py +4 -4
  39. {data_management → megadetector/data_management}/importers/jb_csv_to_json.py +1 -1
  40. {data_management → megadetector/data_management}/importers/missouri_to_json.py +4 -3
  41. {data_management → megadetector/data_management}/importers/noaa_seals_2019.py +2 -2
  42. {data_management → megadetector/data_management}/importers/pc_to_json.py +5 -5
  43. {data_management → megadetector/data_management}/importers/prepare-noaa-fish-data-for-lila.py +3 -3
  44. {data_management → megadetector/data_management}/importers/prepare_zsl_imerit.py +3 -3
  45. {data_management → megadetector/data_management}/importers/rspb_to_json.py +2 -2
  46. {data_management → megadetector/data_management}/importers/save_the_elephants_survey_A.py +4 -4
  47. {data_management → megadetector/data_management}/importers/save_the_elephants_survey_B.py +6 -9
  48. {data_management → megadetector/data_management}/importers/snapshot_safari_importer.py +4 -4
  49. {data_management → megadetector/data_management}/importers/snapshot_safari_importer_reprise.py +2 -2
  50. {data_management → megadetector/data_management}/importers/snapshot_serengeti_lila.py +4 -4
  51. {data_management → megadetector/data_management}/importers/timelapse_csv_set_to_json.py +3 -3
  52. {data_management → megadetector/data_management}/importers/ubc_to_json.py +3 -3
  53. {data_management → megadetector/data_management}/importers/umn_to_json.py +2 -2
  54. {data_management → megadetector/data_management}/importers/wellington_to_json.py +3 -3
  55. {data_management → megadetector/data_management}/importers/wi_to_json.py +3 -2
  56. {data_management → megadetector/data_management}/labelme_to_coco.py +6 -7
  57. {data_management → megadetector/data_management}/labelme_to_yolo.py +2 -2
  58. {data_management → megadetector/data_management}/lila/add_locations_to_island_camera_traps.py +4 -4
  59. {data_management → megadetector/data_management}/lila/create_lila_blank_set.py +10 -9
  60. {data_management → megadetector/data_management}/lila/create_lila_test_set.py +3 -2
  61. {data_management → megadetector/data_management}/lila/create_links_to_md_results_files.py +1 -1
  62. {data_management → megadetector/data_management}/lila/download_lila_subset.py +5 -4
  63. {data_management → megadetector/data_management}/lila/generate_lila_per_image_labels.py +6 -5
  64. {data_management → megadetector/data_management}/lila/get_lila_annotation_counts.py +2 -2
  65. {data_management → megadetector/data_management}/lila/get_lila_image_counts.py +2 -1
  66. {data_management → megadetector/data_management}/lila/lila_common.py +5 -5
  67. {data_management → megadetector/data_management}/lila/test_lila_metadata_urls.py +2 -2
  68. {data_management → megadetector/data_management}/ocr_tools.py +6 -6
  69. {data_management → megadetector/data_management}/read_exif.py +2 -2
  70. {data_management → megadetector/data_management}/remap_coco_categories.py +1 -1
  71. {data_management → megadetector/data_management}/remove_exif.py +1 -1
  72. {data_management → megadetector/data_management}/resize_coco_dataset.py +4 -4
  73. {data_management → megadetector/data_management}/wi_download_csv_to_coco.py +3 -3
  74. {data_management → megadetector/data_management}/yolo_output_to_md_output.py +5 -5
  75. {data_management → megadetector/data_management}/yolo_to_coco.py +9 -9
  76. {detection → megadetector/detection}/process_video.py +9 -10
  77. {detection → megadetector/detection}/pytorch_detector.py +12 -8
  78. {detection → megadetector/detection}/run_detector.py +6 -6
  79. {detection → megadetector/detection}/run_detector_batch.py +12 -12
  80. {detection → megadetector/detection}/run_inference_with_yolov5_val.py +12 -12
  81. {detection → megadetector/detection}/run_tiled_inference.py +8 -9
  82. {detection → megadetector/detection}/tf_detector.py +3 -2
  83. {detection → megadetector/detection}/video_utils.py +2 -2
  84. {api/batch_processing → megadetector}/postprocessing/add_max_conf.py +1 -1
  85. {api/batch_processing → megadetector}/postprocessing/categorize_detections_by_size.py +1 -1
  86. {api/batch_processing → megadetector}/postprocessing/combine_api_outputs.py +1 -1
  87. {api/batch_processing → megadetector}/postprocessing/compare_batch_results.py +5 -5
  88. {api/batch_processing → megadetector}/postprocessing/convert_output_format.py +4 -5
  89. {api/batch_processing → megadetector}/postprocessing/load_api_results.py +1 -1
  90. {api/batch_processing → megadetector}/postprocessing/md_to_coco.py +3 -3
  91. {api/batch_processing → megadetector}/postprocessing/md_to_labelme.py +3 -3
  92. {api/batch_processing → megadetector}/postprocessing/merge_detections.py +1 -1
  93. {api/batch_processing → megadetector}/postprocessing/postprocess_batch_results.py +19 -21
  94. {api/batch_processing → megadetector}/postprocessing/remap_detection_categories.py +1 -1
  95. {api/batch_processing → megadetector}/postprocessing/render_detection_confusion_matrix.py +5 -6
  96. {api/batch_processing → megadetector}/postprocessing/repeat_detection_elimination/find_repeat_detections.py +3 -3
  97. {api/batch_processing → megadetector}/postprocessing/repeat_detection_elimination/remove_repeat_detections.py +3 -2
  98. {api/batch_processing → megadetector}/postprocessing/repeat_detection_elimination/repeat_detections_core.py +11 -11
  99. {api/batch_processing → megadetector}/postprocessing/separate_detections_into_folders.py +3 -4
  100. {api/batch_processing → megadetector}/postprocessing/subset_json_detector_output.py +2 -2
  101. {api/batch_processing → megadetector}/postprocessing/top_folders_to_bottom.py +1 -1
  102. {taxonomy_mapping → megadetector/taxonomy_mapping}/map_lila_taxonomy_to_wi_taxonomy.py +2 -2
  103. {taxonomy_mapping → megadetector/taxonomy_mapping}/map_new_lila_datasets.py +2 -6
  104. {taxonomy_mapping → megadetector/taxonomy_mapping}/preview_lila_taxonomy.py +6 -7
  105. {taxonomy_mapping → megadetector/taxonomy_mapping}/retrieve_sample_image.py +1 -1
  106. {taxonomy_mapping → megadetector/taxonomy_mapping}/simple_image_download.py +2 -1
  107. {taxonomy_mapping → megadetector/taxonomy_mapping}/species_lookup.py +1 -1
  108. {taxonomy_mapping → megadetector/taxonomy_mapping}/taxonomy_csv_checker.py +1 -1
  109. {taxonomy_mapping → megadetector/taxonomy_mapping}/validate_lila_category_mappings.py +1 -1
  110. {md_utils → megadetector/utils}/azure_utils.py +7 -3
  111. {md_utils → megadetector/utils}/directory_listing.py +1 -1
  112. {md_utils → megadetector/utils}/md_tests.py +29 -29
  113. {md_utils → megadetector/utils}/split_locations_into_train_val.py +1 -1
  114. {md_utils → megadetector/utils}/write_html_image_list.py +1 -1
  115. {md_visualization → megadetector/visualization}/render_images_with_thumbnails.py +3 -3
  116. {md_visualization → megadetector/visualization}/visualization_utils.py +6 -7
  117. {md_visualization → megadetector/visualization}/visualize_db.py +3 -4
  118. {md_visualization → megadetector/visualization}/visualize_detector_output.py +9 -10
  119. {megadetector-5.0.10.dist-info → megadetector-5.0.12.dist-info}/LICENSE +0 -0
  120. {megadetector-5.0.10.dist-info → megadetector-5.0.12.dist-info}/METADATA +12 -11
  121. megadetector-5.0.12.dist-info/RECORD +199 -0
  122. megadetector-5.0.12.dist-info/top_level.txt +1 -0
  123. api/batch_processing/data_preparation/manage_local_batch.py +0 -2391
  124. api/batch_processing/data_preparation/manage_video_batch.py +0 -327
  125. api/synchronous/api_core/animal_detection_api/data_management/annotations/annotation_constants.py +0 -47
  126. api/synchronous/api_core/animal_detection_api/detection/detector_training/copy_checkpoints.py +0 -43
  127. api/synchronous/api_core/animal_detection_api/detection/process_video.py +0 -543
  128. api/synchronous/api_core/animal_detection_api/detection/pytorch_detector.py +0 -304
  129. api/synchronous/api_core/animal_detection_api/detection/run_detector.py +0 -627
  130. api/synchronous/api_core/animal_detection_api/detection/run_detector_batch.py +0 -1029
  131. api/synchronous/api_core/animal_detection_api/detection/run_inference_with_yolov5_val.py +0 -581
  132. api/synchronous/api_core/animal_detection_api/detection/run_tiled_inference.py +0 -754
  133. api/synchronous/api_core/animal_detection_api/detection/tf_detector.py +0 -165
  134. api/synchronous/api_core/animal_detection_api/detection/video_utils.py +0 -495
  135. api/synchronous/api_core/animal_detection_api/md_utils/azure_utils.py +0 -174
  136. api/synchronous/api_core/animal_detection_api/md_utils/ct_utils.py +0 -262
  137. api/synchronous/api_core/animal_detection_api/md_utils/directory_listing.py +0 -251
  138. api/synchronous/api_core/animal_detection_api/md_utils/matlab_porting_tools.py +0 -97
  139. api/synchronous/api_core/animal_detection_api/md_utils/path_utils.py +0 -416
  140. api/synchronous/api_core/animal_detection_api/md_utils/process_utils.py +0 -110
  141. api/synchronous/api_core/animal_detection_api/md_utils/sas_blob_utils.py +0 -509
  142. api/synchronous/api_core/animal_detection_api/md_utils/string_utils.py +0 -59
  143. api/synchronous/api_core/animal_detection_api/md_utils/url_utils.py +0 -144
  144. api/synchronous/api_core/animal_detection_api/md_utils/write_html_image_list.py +0 -226
  145. api/synchronous/api_core/animal_detection_api/md_visualization/visualization_utils.py +0 -841
  146. detection/detector_training/model_main_tf2.py +0 -114
  147. docs/source/conf.py +0 -43
  148. megadetector-5.0.10.dist-info/RECORD +0 -224
  149. megadetector-5.0.10.dist-info/top_level.txt +0 -8
  150. {api → megadetector/api}/__init__.py +0 -0
  151. {api → megadetector/api}/batch_processing/__init__.py +0 -0
  152. {api → megadetector/api}/batch_processing/api_core/__init__.py +0 -0
  153. {api → megadetector/api}/batch_processing/api_core/batch_service/__init__.py +0 -0
  154. {api → megadetector/api}/batch_processing/api_core/server.py +0 -0
  155. {api → megadetector/api}/batch_processing/api_core/server_api_config.py +0 -0
  156. {api → megadetector/api}/batch_processing/api_core/server_app_config.py +0 -0
  157. {api → megadetector/api}/batch_processing/api_core/server_batch_job_manager.py +0 -0
  158. {api → megadetector/api}/batch_processing/api_core/server_job_status_table.py +0 -0
  159. {api → megadetector/api}/batch_processing/api_core/server_orchestration.py +0 -0
  160. {api → megadetector/api}/batch_processing/api_core/server_utils.py +0 -0
  161. {api → megadetector/api}/batch_processing/api_core_support/__init__.py +0 -0
  162. {api → megadetector/api}/batch_processing/api_core_support/aggregate_results_manually.py +0 -0
  163. {api → megadetector/api}/batch_processing/api_support/__init__.py +0 -0
  164. {api → megadetector/api}/batch_processing/api_support/summarize_daily_activity.py +0 -0
  165. {api → megadetector/api}/batch_processing/data_preparation/__init__.py +0 -0
  166. {api → megadetector/api}/batch_processing/integration/digiKam/setup.py +0 -0
  167. {api → megadetector/api}/batch_processing/integration/digiKam/xmp_integration.py +0 -0
  168. {api → megadetector/api}/batch_processing/integration/eMammal/test_scripts/config_template.py +0 -0
  169. {api → megadetector/api}/batch_processing/integration/eMammal/test_scripts/push_annotations_to_emammal.py +0 -0
  170. {api → megadetector/api}/batch_processing/integration/eMammal/test_scripts/select_images_for_testing.py +0 -0
  171. {api/batch_processing/postprocessing → megadetector/api/synchronous}/__init__.py +0 -0
  172. {api/synchronous → megadetector/api/synchronous/api_core/animal_detection_api}/__init__.py +0 -0
  173. {api → megadetector/api}/synchronous/api_core/animal_detection_api/config.py +0 -0
  174. {api/synchronous/api_core/animal_detection_api → megadetector/api/synchronous/api_core/tests}/__init__.py +0 -0
  175. {api → megadetector/api}/synchronous/api_core/tests/load_test.py +0 -0
  176. {api/synchronous/api_core/tests → megadetector/classification}/__init__.py +0 -0
  177. {classification → megadetector/classification}/aggregate_classifier_probs.py +0 -0
  178. {classification → megadetector/classification}/csv_to_json.py +0 -0
  179. {classification → megadetector/classification}/efficientnet/__init__.py +0 -0
  180. {classification → megadetector/classification}/efficientnet/model.py +0 -0
  181. {classification → megadetector/classification}/efficientnet/utils.py +0 -0
  182. {classification → megadetector/classification}/identify_mislabeled_candidates.py +0 -0
  183. {classification → megadetector/classification}/prepare_classification_script.py +0 -0
  184. {classification → megadetector/classification}/prepare_classification_script_mc.py +0 -0
  185. {classification → megadetector/classification}/save_mislabeled.py +0 -0
  186. {classification → megadetector/data_management}/__init__.py +0 -0
  187. {data_management → megadetector/data_management/annotations}/__init__.py +0 -0
  188. {data_management → megadetector/data_management}/annotations/annotation_constants.py +0 -0
  189. {data_management → megadetector/data_management}/cct_to_wi.py +0 -0
  190. {data_management/annotations → megadetector/data_management/databases}/__init__.py +0 -0
  191. {data_management → megadetector/data_management}/databases/add_width_and_height_to_db.py +0 -0
  192. {data_management → megadetector/data_management}/databases/combine_coco_camera_traps_files.py +0 -0
  193. {data_management → megadetector/data_management}/databases/subset_json_db.py +0 -0
  194. {data_management → megadetector/data_management}/generate_crops_from_cct.py +0 -0
  195. {data_management → megadetector/data_management}/importers/add_nacti_sizes.py +0 -0
  196. {data_management → megadetector/data_management}/importers/add_timestamps_to_icct.py +0 -0
  197. {data_management → megadetector/data_management}/importers/animl_results_to_md_results.py +0 -0
  198. {data_management → megadetector/data_management}/importers/eMammal/copy_and_unzip_emammal.py +0 -0
  199. {data_management → megadetector/data_management}/importers/eMammal/eMammal_helpers.py +0 -0
  200. {data_management → megadetector/data_management}/importers/eMammal/make_eMammal_json.py +0 -0
  201. {data_management → megadetector/data_management}/importers/mcgill_to_json.py +0 -0
  202. {data_management → megadetector/data_management}/importers/nacti_fieldname_adjustments.py +0 -0
  203. {data_management → megadetector/data_management}/importers/plot_wni_giraffes.py +0 -0
  204. {data_management → megadetector/data_management}/importers/snapshotserengeti/make_full_SS_json.py +0 -0
  205. {data_management → megadetector/data_management}/importers/snapshotserengeti/make_per_season_SS_json.py +0 -0
  206. {data_management → megadetector/data_management}/importers/sulross_get_exif.py +0 -0
  207. {data_management → megadetector/data_management}/importers/zamba_results_to_md_results.py +0 -0
  208. {data_management/databases → megadetector/data_management/lila}/__init__.py +0 -0
  209. {data_management → megadetector/data_management}/lila/add_locations_to_nacti.py +0 -0
  210. {data_management/lila → megadetector/detection}/__init__.py +0 -0
  211. {detection → megadetector/detection/detector_training}/__init__.py +0 -0
  212. {api/synchronous/api_core/animal_detection_api → megadetector}/detection/detector_training/model_main_tf2.py +0 -0
  213. {detection/detector_training → megadetector/postprocessing}/__init__.py +0 -0
  214. {md_utils → megadetector/taxonomy_mapping}/__init__.py +0 -0
  215. {taxonomy_mapping → megadetector/taxonomy_mapping}/prepare_lila_taxonomy_release.py +0 -0
  216. {taxonomy_mapping → megadetector/taxonomy_mapping}/taxonomy_graph.py +0 -0
  217. {md_visualization → megadetector/utils}/__init__.py +0 -0
  218. {md_utils → megadetector/utils}/ct_utils.py +0 -0
  219. {md_utils → megadetector/utils}/path_utils.py +0 -0
  220. {md_utils → megadetector/utils}/process_utils.py +0 -0
  221. {md_utils → megadetector/utils}/sas_blob_utils.py +0 -0
  222. {md_utils → megadetector/utils}/string_utils.py +0 -0
  223. {md_utils → megadetector/utils}/url_utils.py +0 -0
  224. {taxonomy_mapping → megadetector/visualization}/__init__.py +0 -0
  225. {md_visualization → megadetector/visualization}/plot_utils.py +0 -0
  226. {megadetector-5.0.10.dist-info → megadetector-5.0.12.dist-info}/WHEEL +0 -0
@@ -55,11 +55,11 @@ import json
55
55
 
56
56
  from tqdm import tqdm
57
57
 
58
- from md_utils import path_utils
59
- from md_utils import process_utils
60
- from md_utils import string_utils
61
- from data_management import yolo_output_to_md_output
62
- from detection.run_detector import try_download_known_detector
58
+ from megadetector.utils import path_utils
59
+ from megadetector.utils import process_utils
60
+ from megadetector.utils import string_utils
61
+ from megadetector.data_management import yolo_output_to_md_output
62
+ from megadetector.detection.run_detector import try_download_known_detector
63
63
 
64
64
  default_image_size_with_augmentation = int(1280 * 1.3)
65
65
  default_image_size_with_no_augmentation = 1280
@@ -548,7 +548,7 @@ def run_inference_with_yolo_val(options):
548
548
  #%% Command-line driver
549
549
 
550
550
  import argparse
551
- from md_utils.ct_utils import args_to_object
551
+ from megadetector.utils.ct_utils import args_to_object
552
552
 
553
553
  def main():
554
554
 
@@ -811,8 +811,8 @@ if False:
811
811
  postprocessing_output_folder = os.path.join(output_folder,'yolo-val-preview')
812
812
  md_json_file = options.output_file
813
813
 
814
- from api.batch_processing.postprocessing.postprocess_batch_results import (
815
- PostProcessingOptions, process_batch_results)
814
+ from megadetector.postprocessing.postprocess_batch_results import \
815
+ PostProcessingOptions, process_batch_results
816
816
 
817
817
  with open(md_json_file,'r') as f:
818
818
  d = json.load(f)
@@ -839,7 +839,7 @@ if False:
839
839
  os.makedirs(output_base, exist_ok=True)
840
840
  print('Processing to {}'.format(output_base))
841
841
 
842
- pp_options.api_output_file = md_json_file
842
+ pp_options.md_results_file = md_json_file
843
843
  pp_options.output_dir = output_base
844
844
  ppresults = process_batch_results(pp_options)
845
845
  html_output_file = ppresults.output_html_file
@@ -853,8 +853,8 @@ if False:
853
853
 
854
854
  import itertools
855
855
 
856
- from api.batch_processing.postprocessing.compare_batch_results import (
857
- BatchComparisonOptions,PairwiseBatchComparisonOptions,compare_batch_results)
856
+ from megadetector.postprocessing.compare_batch_results import \
857
+ BatchComparisonOptions,PairwiseBatchComparisonOptions,compare_batch_results
858
858
 
859
859
  options = BatchComparisonOptions()
860
860
 
@@ -913,5 +913,5 @@ if False:
913
913
 
914
914
  results = compare_batch_results(options)
915
915
 
916
- from md_utils.path_utils import open_file
916
+ from megadetector.utils.path_utils import open_file
917
917
  open_file(results.html_output_file)
@@ -29,15 +29,14 @@ import json
29
29
 
30
30
  from tqdm import tqdm
31
31
 
32
- from detection.run_inference_with_yolov5_val import YoloInferenceOptions,run_inference_with_yolo_val
33
- from detection.run_detector_batch import load_and_run_detector_batch,write_results_to_file
34
- from detection.run_detector import try_download_known_detector
35
-
36
32
  import torch
37
33
  from torchvision import ops
38
34
 
39
- from md_utils import path_utils
40
- from md_visualization import visualization_utils as vis_utils
35
+ from megadetector.detection.run_inference_with_yolov5_val import YoloInferenceOptions,run_inference_with_yolo_val
36
+ from megadetector.detection.run_detector_batch import load_and_run_detector_batch,write_results_to_file
37
+ from megadetector.detection.run_detector import try_download_known_detector
38
+ from megadetector.utils import path_utils
39
+ from megadetector.visualization import visualization_utils as vis_utils
41
40
 
42
41
  default_patch_overlap = 0.5
43
42
  patch_jpeg_quality = 95
@@ -821,8 +820,8 @@ if False:
821
820
 
822
821
  #%% Preview tiled inference
823
822
 
824
- from api.batch_processing.postprocessing.postprocess_batch_results import (
825
- PostProcessingOptions, process_batch_results)
823
+ from megadetector.postprocessing.postprocess_batch_results import \
824
+ PostProcessingOptions, process_batch_results
826
825
 
827
826
  options = PostProcessingOptions()
828
827
  options.image_base_dir = image_folder
@@ -843,7 +842,7 @@ if False:
843
842
 
844
843
  print('Processing post-RDE to {}'.format(preview_base))
845
844
 
846
- options.api_output_file = output_file
845
+ options.md_results_file = output_file
847
846
  options.output_dir = preview_base
848
847
  ppresults = process_batch_results(options)
849
848
  html_output_file = ppresults.output_html_file
@@ -10,8 +10,9 @@ Module containing the class TFDetector, for loading and running a TensorFlow det
10
10
 
11
11
  import numpy as np
12
12
 
13
- from detection.run_detector import CONF_DIGITS, COORD_DIGITS, FAILURE_INFER
14
- from md_utils.ct_utils import truncate_float
13
+ from megadetector.detection.run_detector import \
14
+ CONF_DIGITS, COORD_DIGITS, FAILURE_INFER
15
+ from megadetector.utils.ct_utils import truncate_float
15
16
 
16
17
  import tensorflow.compat.v1 as tf
17
18
 
@@ -19,8 +19,8 @@ from multiprocessing.pool import Pool
19
19
  from tqdm import tqdm
20
20
  from functools import partial
21
21
 
22
- from md_utils import path_utils
23
- from md_visualization import visualization_utils as vis_utils
22
+ from megadetector.utils import path_utils
23
+ from megadetector.visualization import visualization_utils as vis_utils
24
24
 
25
25
  default_fourcc = 'h264'
26
26
 
@@ -15,7 +15,7 @@ to add it back to an existing .json file.
15
15
 
16
16
  import os
17
17
  import json
18
- from md_utils import ct_utils
18
+ from megadetector.utils import ct_utils
19
19
 
20
20
 
21
21
  #%% Main function
@@ -116,7 +116,7 @@ def categorize_detections_by_size(input_file,output_file=None,options=None):
116
116
  (d['category'] not in options.categories_to_separate):
117
117
  continue
118
118
 
119
- # https://github.com/agentmorris/MegaDetector/tree/master/api/batch_processing#detector-outputs
119
+ # https://github.com/agentmorris/MegaDetector/tree/main/megadetector/api/batch_processing#detector-outputs
120
120
  w = d['bbox'][2]
121
121
  h = d['bbox'][3]
122
122
  detection_size = w*h
@@ -11,7 +11,7 @@ writing the results to another .json file.
11
11
 
12
12
  File format:
13
13
 
14
- https://github.com/agentmorris/MegaDetector/tree/master/api/batch_processing#batch-processing-api-output-format
14
+ https://github.com/agentmorris/MegaDetector/tree/main/megadetector/api/batch_processing#batch-processing-api-output-format
15
15
 
16
16
  Command-line use:
17
17
 
@@ -30,9 +30,9 @@ from functools import partial
30
30
  from multiprocessing.pool import ThreadPool
31
31
  from multiprocessing.pool import Pool
32
32
 
33
- from md_visualization import visualization_utils
34
- from md_utils.write_html_image_list import write_html_image_list
35
- from md_utils import path_utils
33
+ from megadetector.visualization import visualization_utils
34
+ from megadetector.utils.write_html_image_list import write_html_image_list
35
+ from megadetector.utils import path_utils
36
36
 
37
37
 
38
38
  #%% Constants and support classes
@@ -833,7 +833,7 @@ if False:
833
833
 
834
834
  results = n_way_comparison(filenames,options,detection_thresholds,rendering_thresholds=rendering_thresholds)
835
835
 
836
- from md_utils.path_utils import open_file
836
+ from megadetector.utils.path_utils import open_file
837
837
  open_file(results.html_output_file)
838
838
 
839
839
 
@@ -859,7 +859,7 @@ if False:
859
859
 
860
860
  results = n_way_comparison(filenames,options,detection_thresholds,rendering_thresholds=None)
861
861
 
862
- from md_utils.path_utils import open_file
862
+ from megadetector.utils.path_utils import open_file
863
863
  open_file(results.html_output_file)
864
864
 
865
865
 
@@ -21,10 +21,9 @@ import os
21
21
 
22
22
  from tqdm import tqdm
23
23
 
24
- from api.batch_processing.postprocessing.load_api_results import load_api_results_csv
25
- from data_management.annotations import annotation_constants
26
-
27
- from md_utils import ct_utils
24
+ from megadetector.postprocessing.load_api_results import load_api_results_csv
25
+ from megadetector.data_management.annotations import annotation_constants
26
+ from megadetector.utils import ct_utils
28
27
 
29
28
  CONF_DIGITS = 3
30
29
 
@@ -242,7 +241,7 @@ def convert_csv_to_json(input_path,output_path=None,overwrite=True):
242
241
 
243
242
  # Format spec:
244
243
  #
245
- # https://github.com/agentmorris/MegaDetector/tree/master/api/batch_processing
244
+ # https://github.com/agentmorris/MegaDetector/tree/main/megadetector/api/batch_processing
246
245
 
247
246
  print('Loading csv results...')
248
247
  df = load_api_results_csv(input_path)
@@ -22,7 +22,7 @@ from typing import Dict, Mapping, Optional, Tuple
22
22
 
23
23
  import pandas as pd
24
24
 
25
- from md_utils import ct_utils
25
+ from megadetector.utils import ct_utils
26
26
 
27
27
 
28
28
  #%% Functions for loading .json results into a Pandas DataFrame, and writing back to .json
@@ -17,7 +17,7 @@ import uuid
17
17
 
18
18
  from tqdm import tqdm
19
19
 
20
- from md_visualization import visualization_utils as vis_utils
20
+ from megadetector.visualization import visualization_utils as vis_utils
21
21
 
22
22
  default_confidence_threshold = 0.15
23
23
 
@@ -231,7 +231,7 @@ if False:
231
231
 
232
232
  #%% Preview the resulting file
233
233
 
234
- from md_visualization import visualize_db
234
+ from megadetector.visualization import visualize_db
235
235
  options = visualize_db.DbVizOptions()
236
236
  options.parallelize_rendering = True
237
237
  options.viz_size = (900, -1)
@@ -241,7 +241,7 @@ if False:
241
241
  os.path.expanduser('~/tmp/md_to_coco_preview'),
242
242
  image_folder,options)
243
243
 
244
- from md_utils import path_utils # noqa
244
+ from megadetector.utils import path_utils # noqa
245
245
  path_utils.open_file(html_file)
246
246
 
247
247
 
@@ -24,9 +24,9 @@ from multiprocessing.pool import Pool
24
24
  from multiprocessing.pool import ThreadPool
25
25
  from functools import partial
26
26
 
27
- from md_visualization.visualization_utils import open_image
28
- from md_utils.ct_utils import truncate_float
29
- from detection.run_detector import DEFAULT_DETECTOR_LABEL_MAP
27
+ from megadetector.visualization.visualization_utils import open_image
28
+ from megadetector.utils.ct_utils import truncate_float
29
+ from megadetector.detection.run_detector import DEFAULT_DETECTOR_LABEL_MAP
30
30
 
31
31
  output_precision = 3
32
32
  default_confidence_threshold = 0.15
@@ -22,7 +22,7 @@ import os
22
22
 
23
23
  from tqdm import tqdm
24
24
 
25
- from md_utils.ct_utils import get_iou
25
+ from megadetector.utils.ct_utils import get_iou
26
26
 
27
27
 
28
28
  #%% Structs
@@ -13,7 +13,7 @@ Given a .json or .csv file containing MD results, do one or more of the followin
13
13
 
14
14
  Ground truth, if available, must be in COCO Camera Traps format:
15
15
 
16
- https://github.com/agentmorris/MegaDetector/blob/main/data_management/README.md#coco-camera-traps-format
16
+ https://github.com/agentmorris/MegaDetector/blob/main/megadetector/data_management/README.md#coco-camera-traps-format
17
17
 
18
18
  """
19
19
 
@@ -44,16 +44,14 @@ import pandas as pd
44
44
  from sklearn.metrics import precision_recall_curve, confusion_matrix, average_precision_score
45
45
  from tqdm import tqdm
46
46
 
47
- import md_visualization.visualization_utils as vis_utils
48
- import md_visualization.plot_utils as plot_utils
49
-
50
- from md_utils.write_html_image_list import write_html_image_list
51
- from md_utils import path_utils
52
- from data_management.cct_json_utils import (CameraTrapJsonUtils, IndexedJsonDb)
53
- from api.batch_processing.postprocessing.load_api_results import load_api_results
54
- from md_utils.ct_utils import args_to_object, sets_overlap
55
-
56
- from detection.run_detector import get_typical_confidence_threshold_from_results
47
+ from megadetector.visualization import visualization_utils as vis_utils
48
+ from megadetector.visualization import plot_utils
49
+ from megadetector.utils.write_html_image_list import write_html_image_list
50
+ from megadetector.utils import path_utils
51
+ from megadetector.utils.ct_utils import args_to_object, sets_overlap
52
+ from megadetector.data_management.cct_json_utils import (CameraTrapJsonUtils, IndexedJsonDb)
53
+ from megadetector.postprocessing.load_api_results import load_api_results
54
+ from megadetector.detection.run_detector import get_typical_confidence_threshold_from_results
57
55
 
58
56
  warnings.filterwarnings('ignore', '(Possibly )?corrupt EXIF data', UserWarning)
59
57
 
@@ -394,7 +392,7 @@ def _render_bounding_boxes(
394
392
  Renders detection bounding boxes on a single image.
395
393
 
396
394
  This is an internal function; if you want tools for rendering boxes on images, see
397
- md_visualization.visualization_utils.
395
+ visualization.visualization_utils.
398
396
 
399
397
  The source image is:
400
398
 
@@ -896,7 +894,7 @@ def process_batch_results(options):
896
894
 
897
895
  Ground truth, if available, must be in COCO Camera Traps format:
898
896
 
899
- https://github.com/agentmorris/MegaDetector/blob/main/data_management/README.md#coco-camera-traps-format
897
+ https://github.com/agentmorris/MegaDetector/blob/main/megadetector/data_management/README.md#coco-camera-traps-format
900
898
 
901
899
  Args:
902
900
  options (PostProcessingOptions): everything we need to render a preview/analysis for
@@ -951,7 +949,7 @@ def process_batch_results(options):
951
949
  # If the caller hasn't supplied results, load them
952
950
  if options.api_detection_results is None:
953
951
  detections_df, other_fields = load_api_results(
954
- options.api_output_file, force_forward_slashes=True,
952
+ options.md_results_file, force_forward_slashes=True,
955
953
  filename_replacements=options.api_output_filename_replacements)
956
954
  ppresults.api_detection_results = detections_df
957
955
  ppresults.api_other_fields = other_fields
@@ -1026,11 +1024,11 @@ def process_batch_results(options):
1026
1024
  job_name_string = options.job_name_string
1027
1025
  else:
1028
1026
  # This is rare; it only happens during debugging when the caller
1029
- # is supplying already-loaded API results.
1030
- if options.api_output_file is None:
1027
+ # is supplying already-loaded MD results.
1028
+ if options.md_results_file is None:
1031
1029
  job_name_string = 'unknown'
1032
1030
  else:
1033
- job_name_string = os.path.basename(options.api_output_file)
1031
+ job_name_string = os.path.basename(options.md_results_file)
1034
1032
 
1035
1033
  if options.model_version_string is not None:
1036
1034
  model_version_string = options.model_version_string
@@ -1800,13 +1798,13 @@ if False:
1800
1798
  options = PostProcessingOptions()
1801
1799
  options.image_base_dir = base_dir
1802
1800
  options.output_dir = os.path.join(base_dir, 'preview')
1803
- options.api_output_file = os.path.join(base_dir, 'results.json')
1801
+ options.md_results_file = os.path.join(base_dir, 'results.json')
1804
1802
  options.confidence_threshold = {'person':0.5,'animal':0.5,'vehicle':0.01}
1805
1803
  options.include_almost_detections = True
1806
1804
  options.almost_detection_confidence_threshold = 0.001
1807
1805
 
1808
1806
  ppresults = process_batch_results(options)
1809
- # from md_utils.path_utils import open_file; open_file(ppresults.output_html_file)
1807
+ # from megadetector.utils.path_utils import open_file; open_file(ppresults.output_html_file)
1810
1808
 
1811
1809
 
1812
1810
  #%% Command-line driver
@@ -1817,8 +1815,8 @@ def main():
1817
1815
 
1818
1816
  parser = argparse.ArgumentParser()
1819
1817
  parser.add_argument(
1820
- 'api_output_file',
1821
- help='path to .json file produced by the batch inference API')
1818
+ 'md_results_file',
1819
+ help='path to .json file containing MegaDetector results')
1822
1820
  parser.add_argument(
1823
1821
  'output_dir',
1824
1822
  help='base directory for output')
@@ -16,7 +16,7 @@ import os
16
16
 
17
17
  from tqdm import tqdm
18
18
 
19
- from md_utils.ct_utils import invert_dictionary
19
+ from megadetector.utils.ct_utils import invert_dictionary
20
20
 
21
21
 
22
22
  #%% Main function
@@ -20,12 +20,11 @@ from tqdm import tqdm
20
20
  from collections import defaultdict
21
21
  from functools import partial
22
22
 
23
- from md_utils.path_utils import find_images
24
- from md_utils.path_utils import flatten_path
25
- from md_visualization import visualization_utils as vis_utils
26
- from md_utils.write_html_image_list import write_html_image_list
27
-
28
- import md_visualization.plot_utils as plot_utils
23
+ from megadetector.utils.path_utils import find_images
24
+ from megadetector.utils.path_utils import flatten_path
25
+ from megadetector.utils.write_html_image_list import write_html_image_list
26
+ from megadetector.visualization import visualization_utils as vis_utils
27
+ from megadetector.visualization import plot_utils
29
28
 
30
29
  from multiprocessing.pool import ThreadPool
31
30
  from multiprocessing.pool import Pool
@@ -4,7 +4,7 @@ find_repeat_detections.py
4
4
 
5
5
  If you want to use this script, we recommend that you read the RDE user's guide:
6
6
 
7
- https://github.com/agentmorris/MegaDetector/tree/master/api/batch_processing/postprocessing/repeat_detection_elimination
7
+ https://github.com/agentmorris/MegaDetector/tree/main/megadetector/postprocessing/repeat_detection_elimination
8
8
 
9
9
  Really, don't try to run this script without reading the user's guide, you'll think
10
10
  it's more magical than it is.
@@ -28,8 +28,8 @@ import argparse
28
28
  import os
29
29
  import sys
30
30
 
31
- from md_utils import ct_utils
32
- from api.batch_processing.postprocessing.repeat_detection_elimination import repeat_detections_core
31
+ from megadetector.utils import ct_utils
32
+ from megadetector.postprocessing.repeat_detection_elimination import repeat_detections_core
33
33
 
34
34
 
35
35
  #%% Interactive driver
@@ -7,7 +7,7 @@ to create a final filtered output file.
7
7
 
8
8
  If you want to use this script, we recommend that you read the RDE user's guide:
9
9
 
10
- https://github.com/agentmorris/MegaDetector/tree/master/api/batch_processing/postprocessing/repeat_detection_elimination
10
+ https://github.com/agentmorris/MegaDetector/tree/main/megadetector/postprocessing/repeat_detection_elimination
11
11
 
12
12
  """
13
13
 
@@ -15,7 +15,8 @@ https://github.com/agentmorris/MegaDetector/tree/master/api/batch_processing/pos
15
15
 
16
16
  import argparse
17
17
  import os
18
- from api.batch_processing.postprocessing.repeat_detection_elimination import repeat_detections_core
18
+
19
+ from megadetector.postprocessing.repeat_detection_elimination import repeat_detections_core
19
20
 
20
21
 
21
22
  #%% Main function
@@ -7,7 +7,7 @@ Core utilities shared by find_repeat_detections and remove_repeat_detections.
7
7
  Nothing in this file (in fact nothing in this subpackage) will make sense until you read
8
8
  the RDE user's guide:
9
9
 
10
- https://github.com/agentmorris/MegaDetector/tree/master/api/batch_processing/postprocessing/repeat_detection_elimination
10
+ https://github.com/agentmorris/MegaDetector/tree/main/megadetector/postprocessing/repeat_detection_elimination
11
11
 
12
12
  """
13
13
 
@@ -35,16 +35,16 @@ from multiprocessing.pool import ThreadPool
35
35
  from multiprocessing.pool import Pool
36
36
  from functools import partial
37
37
 
38
- from md_utils import path_utils
39
- from md_utils import ct_utils
40
- from api.batch_processing.postprocessing.load_api_results import load_api_results, write_api_results
41
- from api.batch_processing.postprocessing.postprocess_batch_results import is_sas_url
42
- from api.batch_processing.postprocessing.postprocess_batch_results import relative_sas_url
43
- from md_visualization.visualization_utils import open_image, render_detection_bounding_boxes
44
- from md_visualization import render_images_with_thumbnails
45
- from md_visualization import visualization_utils as vis_utils
46
- from md_utils.path_utils import flatten_path
47
- from md_utils.ct_utils import invert_dictionary
38
+ from megadetector.utils import path_utils
39
+ from megadetector.utils import ct_utils
40
+ from megadetector.postprocessing.load_api_results import load_api_results, write_api_results
41
+ from megadetector.postprocessing.postprocess_batch_results import is_sas_url
42
+ from megadetector.postprocessing.postprocess_batch_results import relative_sas_url
43
+ from megadetector.visualization.visualization_utils import open_image, render_detection_bounding_boxes
44
+ from megadetector.visualization import render_images_with_thumbnails
45
+ from megadetector.visualization import visualization_utils as vis_utils
46
+ from megadetector.utils.path_utils import flatten_path
47
+ from megadetector.utils.ct_utils import invert_dictionary
48
48
 
49
49
  # "PIL cannot read EXIF metainfo for the images"
50
50
  warnings.filterwarnings('ignore', '(Possibly )?corrupt EXIF data', UserWarning)
@@ -85,10 +85,9 @@ from multiprocessing.pool import ThreadPool
85
85
  from functools import partial
86
86
  from tqdm import tqdm
87
87
 
88
- from md_utils.ct_utils import args_to_object, is_float
89
- from detection.run_detector import get_typical_confidence_threshold_from_results
90
-
91
- import md_visualization.visualization_utils as vis_utils
88
+ from megadetector.utils.ct_utils import args_to_object, is_float
89
+ from megadetector.detection.run_detector import get_typical_confidence_threshold_from_results
90
+ from megadetector.visualization import visualization_utils as vis_utils
92
91
 
93
92
  friendly_folder_names = {'animal':'animals','person':'people','vehicle':'vehicles'}
94
93
 
@@ -62,8 +62,8 @@ import re
62
62
 
63
63
  from tqdm import tqdm
64
64
 
65
- from md_utils.ct_utils import args_to_object, get_max_conf, invert_dictionary
66
- from md_utils.path_utils import top_level_folder
65
+ from megadetector.utils.ct_utils import args_to_object, get_max_conf, invert_dictionary
66
+ from megadetector.utils.path_utils import top_level_folder
67
67
 
68
68
 
69
69
  #%% Helper classes
@@ -35,7 +35,7 @@ from tqdm import tqdm
35
35
  from functools import partial
36
36
  from multiprocessing.pool import ThreadPool
37
37
 
38
- from md_utils.path_utils import path_is_abs
38
+ from megadetector.utils.path_utils import path_is_abs
39
39
 
40
40
 
41
41
  #%% Classes
@@ -15,8 +15,8 @@ import os
15
15
 
16
16
  from tqdm import tqdm
17
17
 
18
- from data_management.lila.lila_common import read_lila_taxonomy_mapping, \
19
- read_wildlife_insights_taxonomy_mapping
18
+ from megadetector.data_management.lila.lila_common import \
19
+ read_lila_taxonomy_mapping, read_wildlife_insights_taxonomy_mapping
20
20
 
21
21
 
22
22
  #%% Prevent execution during infrastructural imports
@@ -24,12 +24,8 @@ datasets_to_map = [
24
24
 
25
25
  #%% Initialize taxonomic lookup
26
26
 
27
- from taxonomy_mapping.species_lookup import (
28
- initialize_taxonomy_lookup,
29
- get_preferred_taxonomic_match)
30
-
31
- # from taxonomy_mapping.species_lookup import (
32
- # get_taxonomic_info, print_taxonomy_matche)
27
+ from megadetector.taxonomy_mapping.species_lookup import \
28
+ initialize_taxonomy_lookup, get_preferred_taxonomic_match
33
29
 
34
30
  initialize_taxonomy_lookup(force_init=False)
35
31
 
@@ -63,9 +63,8 @@ df = pd.read_csv(lila_taxonomy_file)
63
63
 
64
64
  #%% Prepare taxonomy lookup
65
65
 
66
- from taxonomy_mapping.species_lookup import (
67
- initialize_taxonomy_lookup,
68
- get_preferred_taxonomic_match)
66
+ from megadetector.taxonomy_mapping.species_lookup import \
67
+ initialize_taxonomy_lookup, get_preferred_taxonomic_match
69
68
 
70
69
  # from taxonomy_mapping.species_lookup import (
71
70
  # get_taxonomic_info, print_taxonomy_matche)
@@ -390,7 +389,7 @@ remapped_queries = {'papio':'papio+baboon',
390
389
  'mirafra':'genus+mirafra'}
391
390
 
392
391
  import os
393
- from taxonomy_mapping import retrieve_sample_image
392
+ from megadetector.taxonomy_mapping import retrieve_sample_image
394
393
 
395
394
  scientific_name_to_paths = {}
396
395
  image_base = os.path.join(preview_base,'images')
@@ -442,7 +441,7 @@ for i_row,row in df.iterrows():
442
441
 
443
442
  #%% Rename .jpeg to .jpg
444
443
 
445
- from md_utils import path_utils
444
+ from megadetector.utils import path_utils
446
445
  all_images = path_utils.recursive_file_list(image_base,False)
447
446
 
448
447
  for fn in tqdm(all_images):
@@ -506,7 +505,7 @@ for images in scientific_name_to_preferred_images.values():
506
505
  print('Using a total of {} images'.format(len(used_images)))
507
506
  used_images_set = set(used_images)
508
507
 
509
- from md_utils import path_utils
508
+ from megadetector.utils import path_utils
510
509
  all_images = path_utils.recursive_file_list(image_base,False)
511
510
 
512
511
  unused_images = []
@@ -587,5 +586,5 @@ with open(html_output_file, 'w', encoding='utf-8') as f:
587
586
 
588
587
  #%% Open HTML preview
589
588
 
590
- from md_utils.path_utils import open_file
589
+ from megadetector.utils.path_utils import open_file
591
590
  open_file(html_output_file)
@@ -22,7 +22,7 @@ method = 'simple_image_download' # 'google_images_download'
22
22
 
23
23
  if method == 'simple_image_download':
24
24
 
25
- from taxonomy_mapping import simple_image_download
25
+ from megadetector.taxonomy_mapping import simple_image_download
26
26
  google_image_downloader = simple_image_download.Downloader()
27
27
  google_image_downloader.directory = output_folder
28
28
 
@@ -16,9 +16,10 @@ import os
16
16
  import urllib
17
17
  import requests
18
18
  import magic
19
- from urllib.parse import quote
20
19
  import random
21
20
 
21
+ from urllib.parse import quote
22
+
22
23
 
23
24
  #%% Constants
24
25
 
@@ -26,7 +26,7 @@ from typing import Any, Dict, List, Mapping, Sequence, Set
26
26
  import pandas as pd
27
27
  import numpy as np
28
28
 
29
- from md_utils import url_utils
29
+ from megadetector.utils import url_utils
30
30
 
31
31
  taxonomy_download_dir = os.path.expanduser('~/taxonomy')
32
32
 
@@ -27,7 +27,7 @@ import pandas as pd
27
27
 
28
28
  from typing import Optional
29
29
 
30
- from taxonomy_mapping.taxonomy_graph import TaxonNode, dag_to_tree
30
+ from megadetector.taxonomy_mapping.taxonomy_graph import TaxonNode, dag_to_tree
31
31
 
32
32
 
33
33
  #%% Taxonomy checking
@@ -11,7 +11,7 @@ Confirm that all category names on LILA have mappings in the taxonomy file.
11
11
  import json
12
12
  import os
13
13
 
14
- from data_management.lila.lila_common import read_lila_taxonomy_mapping
14
+ from megadetector.data_management.lila.lila_common import read_lila_taxonomy_mapping
15
15
 
16
16
 
17
17
  #%% Prevent execution during infrastructural imports