megadetector 5.0.5__py3-none-any.whl → 5.0.7__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 (132) hide show
  1. api/batch_processing/data_preparation/manage_local_batch.py +302 -263
  2. api/batch_processing/data_preparation/manage_video_batch.py +81 -2
  3. api/batch_processing/postprocessing/add_max_conf.py +1 -0
  4. api/batch_processing/postprocessing/categorize_detections_by_size.py +50 -19
  5. api/batch_processing/postprocessing/compare_batch_results.py +110 -60
  6. api/batch_processing/postprocessing/load_api_results.py +56 -70
  7. api/batch_processing/postprocessing/md_to_coco.py +1 -1
  8. api/batch_processing/postprocessing/md_to_labelme.py +2 -1
  9. api/batch_processing/postprocessing/postprocess_batch_results.py +240 -81
  10. api/batch_processing/postprocessing/render_detection_confusion_matrix.py +625 -0
  11. api/batch_processing/postprocessing/repeat_detection_elimination/find_repeat_detections.py +71 -23
  12. api/batch_processing/postprocessing/repeat_detection_elimination/remove_repeat_detections.py +1 -1
  13. api/batch_processing/postprocessing/repeat_detection_elimination/repeat_detections_core.py +227 -75
  14. api/batch_processing/postprocessing/subset_json_detector_output.py +132 -5
  15. api/batch_processing/postprocessing/top_folders_to_bottom.py +1 -1
  16. api/synchronous/api_core/animal_detection_api/detection/run_detector_batch.py +2 -2
  17. classification/prepare_classification_script.py +191 -191
  18. data_management/coco_to_yolo.py +68 -45
  19. data_management/databases/integrity_check_json_db.py +7 -5
  20. data_management/generate_crops_from_cct.py +3 -3
  21. data_management/get_image_sizes.py +8 -6
  22. data_management/importers/add_timestamps_to_icct.py +79 -0
  23. data_management/importers/animl_results_to_md_results.py +160 -0
  24. data_management/importers/auckland_doc_test_to_json.py +4 -4
  25. data_management/importers/auckland_doc_to_json.py +1 -1
  26. data_management/importers/awc_to_json.py +5 -5
  27. data_management/importers/bellevue_to_json.py +5 -5
  28. data_management/importers/carrizo_shrubfree_2018.py +5 -5
  29. data_management/importers/carrizo_trail_cam_2017.py +5 -5
  30. data_management/importers/cct_field_adjustments.py +2 -3
  31. data_management/importers/channel_islands_to_cct.py +4 -4
  32. data_management/importers/ena24_to_json.py +5 -5
  33. data_management/importers/helena_to_cct.py +10 -10
  34. data_management/importers/idaho-camera-traps.py +12 -12
  35. data_management/importers/idfg_iwildcam_lila_prep.py +8 -8
  36. data_management/importers/jb_csv_to_json.py +4 -4
  37. data_management/importers/missouri_to_json.py +1 -1
  38. data_management/importers/noaa_seals_2019.py +1 -1
  39. data_management/importers/pc_to_json.py +5 -5
  40. data_management/importers/prepare-noaa-fish-data-for-lila.py +4 -4
  41. data_management/importers/prepare_zsl_imerit.py +5 -5
  42. data_management/importers/rspb_to_json.py +4 -4
  43. data_management/importers/save_the_elephants_survey_A.py +5 -5
  44. data_management/importers/save_the_elephants_survey_B.py +6 -6
  45. data_management/importers/snapshot_safari_importer.py +9 -9
  46. data_management/importers/snapshot_serengeti_lila.py +9 -9
  47. data_management/importers/timelapse_csv_set_to_json.py +5 -7
  48. data_management/importers/ubc_to_json.py +4 -4
  49. data_management/importers/umn_to_json.py +4 -4
  50. data_management/importers/wellington_to_json.py +1 -1
  51. data_management/importers/wi_to_json.py +2 -2
  52. data_management/importers/zamba_results_to_md_results.py +181 -0
  53. data_management/labelme_to_coco.py +35 -7
  54. data_management/labelme_to_yolo.py +229 -0
  55. data_management/lila/add_locations_to_island_camera_traps.py +1 -1
  56. data_management/lila/add_locations_to_nacti.py +147 -0
  57. data_management/lila/create_lila_blank_set.py +474 -0
  58. data_management/lila/create_lila_test_set.py +2 -1
  59. data_management/lila/create_links_to_md_results_files.py +106 -0
  60. data_management/lila/download_lila_subset.py +46 -21
  61. data_management/lila/generate_lila_per_image_labels.py +23 -14
  62. data_management/lila/get_lila_annotation_counts.py +17 -11
  63. data_management/lila/lila_common.py +14 -11
  64. data_management/lila/test_lila_metadata_urls.py +116 -0
  65. data_management/ocr_tools.py +829 -0
  66. data_management/resize_coco_dataset.py +13 -11
  67. data_management/yolo_output_to_md_output.py +84 -12
  68. data_management/yolo_to_coco.py +38 -20
  69. detection/process_video.py +36 -14
  70. detection/pytorch_detector.py +23 -8
  71. detection/run_detector.py +76 -19
  72. detection/run_detector_batch.py +178 -63
  73. detection/run_inference_with_yolov5_val.py +326 -57
  74. detection/run_tiled_inference.py +153 -43
  75. detection/video_utils.py +34 -8
  76. md_utils/ct_utils.py +172 -1
  77. md_utils/md_tests.py +372 -51
  78. md_utils/path_utils.py +167 -39
  79. md_utils/process_utils.py +26 -7
  80. md_utils/split_locations_into_train_val.py +215 -0
  81. md_utils/string_utils.py +10 -0
  82. md_utils/url_utils.py +0 -2
  83. md_utils/write_html_image_list.py +9 -26
  84. md_visualization/plot_utils.py +12 -8
  85. md_visualization/visualization_utils.py +106 -7
  86. md_visualization/visualize_db.py +16 -8
  87. md_visualization/visualize_detector_output.py +208 -97
  88. {megadetector-5.0.5.dist-info → megadetector-5.0.7.dist-info}/METADATA +3 -6
  89. {megadetector-5.0.5.dist-info → megadetector-5.0.7.dist-info}/RECORD +98 -121
  90. {megadetector-5.0.5.dist-info → megadetector-5.0.7.dist-info}/WHEEL +1 -1
  91. taxonomy_mapping/map_lila_taxonomy_to_wi_taxonomy.py +1 -1
  92. taxonomy_mapping/map_new_lila_datasets.py +43 -39
  93. taxonomy_mapping/prepare_lila_taxonomy_release.py +5 -2
  94. taxonomy_mapping/preview_lila_taxonomy.py +27 -27
  95. taxonomy_mapping/species_lookup.py +33 -13
  96. taxonomy_mapping/taxonomy_csv_checker.py +7 -5
  97. api/synchronous/api_core/yolov5/detect.py +0 -252
  98. api/synchronous/api_core/yolov5/export.py +0 -607
  99. api/synchronous/api_core/yolov5/hubconf.py +0 -146
  100. api/synchronous/api_core/yolov5/models/__init__.py +0 -0
  101. api/synchronous/api_core/yolov5/models/common.py +0 -738
  102. api/synchronous/api_core/yolov5/models/experimental.py +0 -104
  103. api/synchronous/api_core/yolov5/models/tf.py +0 -574
  104. api/synchronous/api_core/yolov5/models/yolo.py +0 -338
  105. api/synchronous/api_core/yolov5/train.py +0 -670
  106. api/synchronous/api_core/yolov5/utils/__init__.py +0 -36
  107. api/synchronous/api_core/yolov5/utils/activations.py +0 -103
  108. api/synchronous/api_core/yolov5/utils/augmentations.py +0 -284
  109. api/synchronous/api_core/yolov5/utils/autoanchor.py +0 -170
  110. api/synchronous/api_core/yolov5/utils/autobatch.py +0 -66
  111. api/synchronous/api_core/yolov5/utils/aws/__init__.py +0 -0
  112. api/synchronous/api_core/yolov5/utils/aws/resume.py +0 -40
  113. api/synchronous/api_core/yolov5/utils/benchmarks.py +0 -148
  114. api/synchronous/api_core/yolov5/utils/callbacks.py +0 -71
  115. api/synchronous/api_core/yolov5/utils/dataloaders.py +0 -1087
  116. api/synchronous/api_core/yolov5/utils/downloads.py +0 -178
  117. api/synchronous/api_core/yolov5/utils/flask_rest_api/example_request.py +0 -19
  118. api/synchronous/api_core/yolov5/utils/flask_rest_api/restapi.py +0 -46
  119. api/synchronous/api_core/yolov5/utils/general.py +0 -1018
  120. api/synchronous/api_core/yolov5/utils/loggers/__init__.py +0 -187
  121. api/synchronous/api_core/yolov5/utils/loggers/wandb/__init__.py +0 -0
  122. api/synchronous/api_core/yolov5/utils/loggers/wandb/log_dataset.py +0 -27
  123. api/synchronous/api_core/yolov5/utils/loggers/wandb/sweep.py +0 -41
  124. api/synchronous/api_core/yolov5/utils/loggers/wandb/wandb_utils.py +0 -577
  125. api/synchronous/api_core/yolov5/utils/loss.py +0 -234
  126. api/synchronous/api_core/yolov5/utils/metrics.py +0 -355
  127. api/synchronous/api_core/yolov5/utils/plots.py +0 -489
  128. api/synchronous/api_core/yolov5/utils/torch_utils.py +0 -314
  129. api/synchronous/api_core/yolov5/val.py +0 -394
  130. md_utils/matlab_porting_tools.py +0 -97
  131. {megadetector-5.0.5.dist-info → megadetector-5.0.7.dist-info}/LICENSE +0 -0
  132. {megadetector-5.0.5.dist-info → megadetector-5.0.7.dist-info}/top_level.txt +0 -0
@@ -76,56 +76,75 @@ def main():
76
76
 
77
77
  parser = argparse.ArgumentParser()
78
78
  parser.add_argument('inputFile')
79
+
79
80
  parser.add_argument('--outputFile', action='store', type=str, default=None,
80
81
  help=".json file to write filtered results to... don't use this " + \
81
82
  "if you're going to do manual review of the repeat detection images")
83
+
82
84
  parser.add_argument('--imageBase', action='store', type=str, default='',
83
85
  help='Image base dir, relevant if renderHtml is True or if " + \
84
86
  "omitFilteringFolder is not set')
87
+
85
88
  parser.add_argument('--outputBase', action='store', type=str, default='',
86
89
  help='HTML or filtering folder output dir')
87
- parser.add_argument('--filterFileToLoad', action='store', type=str, default='',
88
- help='Path to detectionIndex.json, which should be inside a ' + \
89
- 'folder of images that are manually verified to _not_ ' + \
90
- 'contain valid animals')
91
-
92
- parser.add_argument('--confidenceMax', action='store', type=float,
93
- default=defaultOptions.confidenceMax,
94
- help='Detection confidence threshold; don\'t process anything above this')
90
+
95
91
  parser.add_argument('--confidenceMin', action='store', type=float,
96
92
  default=defaultOptions.confidenceMin,
97
93
  help='Detection confidence threshold; don\'t process anything below this')
94
+
95
+ parser.add_argument('--confidenceMax', action='store', type=float,
96
+ default=defaultOptions.confidenceMax,
97
+ help='Detection confidence threshold; don\'t process anything above this')
98
+
98
99
  parser.add_argument('--iouThreshold', action='store', type=float,
99
100
  default=defaultOptions.iouThreshold,
100
101
  help='Detections with IOUs greater than this are considered ' + \
101
102
  '"the same detection"')
103
+
102
104
  parser.add_argument('--occurrenceThreshold', action='store', type=int,
103
105
  default=defaultOptions.occurrenceThreshold,
104
106
  help='More than this many near-identical detections in a group ' + \
105
107
  '(e.g. a folder) is considered suspicious')
106
- parser.add_argument('--nWorkers', action='store', type=int,
107
- default=defaultOptions.nWorkers,
108
- help='Level of parallelism for rendering and IOU computation')
108
+
109
+ parser.add_argument('--minSuspiciousDetectionSize', action='store', type=float,
110
+ default=defaultOptions.minSuspiciousDetectionSize,
111
+ help='Detections smaller than this fraction of image area are not ' + \
112
+ 'considered suspicious')
113
+
109
114
  parser.add_argument('--maxSuspiciousDetectionSize', action='store', type=float,
110
115
  default=defaultOptions.maxSuspiciousDetectionSize,
111
116
  help='Detections larger than this fraction of image area are not ' + \
112
117
  'considered suspicious')
113
118
 
114
- parser.add_argument('--renderDetectionTiles', action='store_true',
115
- dest='bRenderDetectionTiles', help='Should we render a grid showing every instance for each detection?')
116
- parser.add_argument('--renderHtml', action='store_true',
117
- dest='bRenderHtml', help='Should we render HTML output?')
119
+ parser.add_argument('--maxImagesPerFolder', action='store', type=int,
120
+ default=defaultOptions.maxImagesPerFolder,
121
+ help='Ignore folders with more than this many images in them')
122
+
123
+ parser.add_argument('--excludeClasses', action='store', nargs='+', type=int,
124
+ default=None,
125
+ help='List of integer classes we don\'t want to treat as suspicious, separated by spaces.')
126
+
127
+ parser.add_argument('--pass_detections_to_processes_method', action='store', type=str,
128
+ default=defaultOptions.pass_detections_to_processes_method,
129
+ help='Pass detections information to/from workers via "memory" (default) or "files"')
130
+
131
+ parser.add_argument('--nWorkers', action='store', type=int,
132
+ default=defaultOptions.nWorkers,
133
+ help='Level of parallelism for rendering and IOU computation')
134
+
135
+ parser.add_argument('--parallelizationUsesProcesses', action='store_false',
136
+ dest='parallelizationUsesThreads',
137
+ help='Parallelize with processes (defaults to threads)')
138
+
139
+ parser.add_argument('--filterFileToLoad', action='store', type=str, default='',
140
+ help='Path to detectionIndex.json, which should be inside a ' + \
141
+ 'folder of images that are manually verified to _not_ ' + \
142
+ 'contain valid animals')
143
+
118
144
  parser.add_argument('--omitFilteringFolder', action='store_false',
119
145
  dest='bWriteFilteringFolder',
120
146
  help='Should we create a folder of rendered detections for post-filtering?')
121
- parser.add_argument('--excludeClasses', action='store', nargs='+', type=int,
122
- default=defaultOptions.excludeClasses,
123
- help='List of classes (ints) to exclude from analysis, separated by spaces')
124
-
125
- parser.add_argument('--nDirLevelsFromLeaf', default=0, type=int,
126
- help='Number of levels from the leaf folders to use for repeat ' + \
127
- 'detection (0 == leaves)')
128
-
147
+
129
148
  parser.add_argument('--debugMaxDir', action='store', type=int, default=-1)
130
149
  parser.add_argument('--debugMaxRenderDir', action='store', type=int, default=-1)
131
150
  parser.add_argument('--debugMaxRenderDetection', action='store', type=int, default=-1)
@@ -136,6 +155,35 @@ def main():
136
155
  parser.add_argument('--forceSerialRendering', action='store_false',
137
156
  dest='bParallelizeRendering')
138
157
 
158
+ parser.add_argument('--maxOutputImageWidth', action='store', type=int,
159
+ default=defaultOptions.maxOutputImageWidth,
160
+ help='Maximum output size for thumbnail images')
161
+
162
+ parser.add_argument('--lineThickness', action='store', type=int,
163
+ default=defaultOptions.lineThickness,
164
+ help='Line thickness thumbnail images')
165
+
166
+ parser.add_argument('--boxExpansion', action='store', type=int,
167
+ default=defaultOptions.boxExpansion,
168
+ help='Box expansion for thumbnail images')
169
+
170
+ parser.add_argument('--nDirLevelsFromLeaf', type=int,
171
+ default=defaultOptions.nDirLevelsFromLeaf,
172
+ help='Number of levels from the leaf folders to use for repeat ' + \
173
+ 'detection (0 == leaves)')
174
+
175
+ parser.add_argument('--bRenderOtherDetections', action='store_true',
176
+ help='Show non-target detections in light gray on each image')
177
+
178
+ parser.add_argument('--bRenderDetectionTiles', action='store_true',
179
+ help='Should we render a grid showing every instance for each detection?')
180
+
181
+ parser.add_argument('--detectionTilesPrimaryImageWidth', type=int,
182
+ default=defaultOptions.detectionTilesPrimaryImageWidth)
183
+
184
+ parser.add_argument('--renderHtml', action='store_true',
185
+ dest='bRenderHtml', help='Should we render HTML output?')
186
+
139
187
  if len(sys.argv[1:]) == 0:
140
188
  parser.print_help()
141
189
  parser.exit()
@@ -30,7 +30,7 @@ def remove_repeat_detections(inputFile,outputFile,filteringDir):
30
30
  else:
31
31
  assert os.path.isdir(filteringDir), '{} is not a valid folder'.format(filteringDir)
32
32
  options.filterFileToLoad = \
33
- os.path.join(filteringDir,repeat_detections_core.DETECTION_INDEX_FILE_NAME)
33
+ os.path.join(filteringDir,repeat_detections_core.detection_index_file_name_base)
34
34
  repeat_detections_core.find_repeat_detections(inputFile, outputFile, options)
35
35
 
36
36