megadetector 5.0.24__py3-none-any.whl → 5.0.25__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.

@@ -353,13 +353,14 @@ def resize_image(image, target_width=-1, target_height=-1, output_file=None,
353
353
  def crop_image(detections, image, confidence_threshold=0.15, expansion=0):
354
354
  """
355
355
  Crops detections above [confidence_threshold] from the PIL image [image],
356
- returning a list of PIL Images.
356
+ returning a list of PIL Images, preserving the order of [detections].
357
357
 
358
358
  Args:
359
359
  detections (list): a list of dictionaries with keys 'conf' and 'bbox';
360
360
  boxes are length-four arrays formatted as [x,y,w,h], normalized,
361
361
  upper-left origin (this is the standard MD detection format)
362
- image (Image): the PIL Image object from which we should crop detections
362
+ image (Image or str): the PIL Image object from which we should crop detections,
363
+ or an image filename
363
364
  confidence_threshold (float, optional): only crop detections above this threshold
364
365
  expansion (int, optional): a number of pixels to include on each side of a cropped
365
366
  detection
@@ -370,6 +371,9 @@ def crop_image(detections, image, confidence_threshold=0.15, expansion=0):
370
371
 
371
372
  ret_images = []
372
373
 
374
+ if isinstance(image,str):
375
+ image = load_image(image)
376
+
373
377
  for detection in detections:
374
378
 
375
379
  score = float(detection['conf'])
@@ -406,6 +410,8 @@ def crop_image(detections, image, confidence_threshold=0.15, expansion=0):
406
410
 
407
411
  return ret_images
408
412
 
413
+ # ...def crop_image(...)
414
+
409
415
 
410
416
  def blur_detections(image,detections,blur_radius=40):
411
417
  """
@@ -440,7 +446,12 @@ def blur_detections(image,detections,blur_radius=40):
440
446
  # Crop the region, blur it, and paste it back
441
447
  region = image.crop((left, top, right, bottom))
442
448
  blurred_region = region.filter(ImageFilter.GaussianBlur(radius=blur_radius))
443
- image.paste(blurred_region, (left, top))
449
+ image.paste(blurred_region, (left, top))
450
+
451
+ # ...for each detection
452
+
453
+ # ...def blur_detections(...)
454
+
444
455
 
445
456
  def render_detection_bounding_boxes(detections,
446
457
  image,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: megadetector
3
- Version: 5.0.24
3
+ Version: 5.0.25
4
4
  Summary: MegaDetector is an AI model that helps conservation folks spend less time doing boring things with camera trap images.
5
5
  Author-email: Your friendly neighborhood MegaDetector team <cameratraps@lila.science>
6
6
  Maintainer-email: Your friendly neighborhood MegaDetector team <cameratraps@lila.science>
@@ -58,6 +58,8 @@ This package is a pip-installable version of the support/inference code for [Meg
58
58
 
59
59
  If you aren't looking for the Python package specifically, and you just want to learn more about what MegaDetector is all about, head over to the [MegaDetector repo](https://github.com/agentmorris/MegaDetector/?tab=readme-ov-file#megadetector).
60
60
 
61
+ If you don't want to run MegaDetector, and you just want to use the utilities in this package - postprocessing, manipulating large volumes of camera trap images, etc. - you may want to check out the [megadetector-utils](https://pypi.org/project/megadetector-utils/) package, which is identical to this one, but excludes all of the PyTorch/YOLO dependencies, and is thus approximately one zillion times smaller.
62
+
61
63
  ## Installation
62
64
 
63
65
  Install with:
@@ -69,8 +69,8 @@ megadetector/data_management/remap_coco_categories.py,sha256=xXWv0QhTjkUfc9RKtAZ
69
69
  megadetector/data_management/remove_exif.py,sha256=vIWnJfw1i9JgyQKUDGEzzqkHro4ndykIPFWhtkm6RAU,2502
70
70
  megadetector/data_management/rename_images.py,sha256=ikIj_b5DY1rgaAn9n_IbwsnugAolczFNivh4xzfLPy8,6915
71
71
  megadetector/data_management/resize_coco_dataset.py,sha256=AaiV7efIcNnqsXsnQckmHq2G__7ZQHBV_jN6rhZfMjo,6810
72
+ megadetector/data_management/speciesnet_to_md.py,sha256=VKi51sZyal08qBNNHX-63PjV0_B9JSg2hyPc0Dn5crs,1422
72
73
  megadetector/data_management/wi_download_csv_to_coco.py,sha256=ilnJZhNZK-FGUR-AfUSWjIDUk9Gytgxw7IOK_N8WKLE,8350
73
- megadetector/data_management/wi_to_md.py,sha256=SGZOyiYvCHud2eeatqjvvpHfDLVwTyC6S5QA-D28qII,1398
74
74
  megadetector/data_management/yolo_output_to_md_output.py,sha256=0ewFhTxdv8H5jaTv4kTpoxdzmOYFHbizvja41VCA_Ls,18307
75
75
  megadetector/data_management/yolo_to_coco.py,sha256=TzAagQ2ATbB_tn1oZxrHCWsrFGO_OhfZmi-3X45WdDU,26180
76
76
  megadetector/data_management/annotations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -126,8 +126,8 @@ megadetector/data_management/importers/eMammal/make_eMammal_json.py,sha256=6C_-6
126
126
  megadetector/data_management/importers/snapshotserengeti/make_full_SS_json.py,sha256=khE3W0pO3Uq-UCfrLW_rpzWqjLll2JoBc360XeAuUGc,4126
127
127
  megadetector/data_management/importers/snapshotserengeti/make_per_season_SS_json.py,sha256=sAwvcR2siwblgY3LfTsbH4mXOXvJZCA246QIsQWuQBA,4316
128
128
  megadetector/data_management/lila/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
129
- megadetector/data_management/lila/add_locations_to_island_camera_traps.py,sha256=OQ-wn2YX0V96aw1EJxUAMYRnkv9G-dvHBU8ULQF-Tus,2583
130
- megadetector/data_management/lila/add_locations_to_nacti.py,sha256=S4ty7lARf2O13_GWTX1pFYyixPCNecqUj6jpO3hOV2w,4849
129
+ megadetector/data_management/lila/add_locations_to_island_camera_traps.py,sha256=0vLRoxVT4gbEWEDEM9_qDyKm7DW_J7lVEbJDih0U7cY,2930
130
+ megadetector/data_management/lila/add_locations_to_nacti.py,sha256=PJWuzVKswjEviehlNqACmNWFefhwTh9qeTubTtoq6eo,5394
131
131
  megadetector/data_management/lila/create_lila_blank_set.py,sha256=SBwpM0-pycW37TESXaJlc2oo_qIxYJoOzHhmmnBHWWI,19826
132
132
  megadetector/data_management/lila/create_lila_test_set.py,sha256=nnjaxbK-5uIP7hUT8rqlnWepKXauGEQsRS5-H8rOVrA,5184
133
133
  megadetector/data_management/lila/create_links_to_md_results_files.py,sha256=MvaPBAgdwoxaNrRaKZ8mGaOCky1BYXlrT08tPG9BrpM,3803
@@ -140,8 +140,8 @@ megadetector/data_management/lila/test_lila_metadata_urls.py,sha256=qKyZAb17Va9r
140
140
  megadetector/detection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
141
141
  megadetector/detection/process_video.py,sha256=SGCp98nYI-1LZnTwrTOFhiGs1PpFjrebsI078D2KC-Q,54470
142
142
  megadetector/detection/pytorch_detector.py,sha256=fpeAcWvSUsH4agQp1nq-yD-vtOkbz8b6M2ohvD_AzEs,45331
143
- megadetector/detection/run_detector.py,sha256=LSmbm-8PfYsyPTgFjtwGRYwjqCFkk2x_qi7y3AI_wxk,39211
144
- megadetector/detection/run_detector_batch.py,sha256=PXzyaJkDTOuGN9adfZVsSLjaD6-XnJWStNkZrsEKziI,72968
143
+ megadetector/detection/run_detector.py,sha256=7Q6db9HzMLrsYtarR73_JEL9ESNCLtW28JP7cVrtTtw,39242
144
+ megadetector/detection/run_detector_batch.py,sha256=2HrzCtQO1abILB_GnqhYiafdzIxW0X339m-ctY1cs_o,73052
145
145
  megadetector/detection/run_inference_with_yolov5_val.py,sha256=Ofu9B4yOmWso-S6JYalK0f_CvsG5tr2gkW_-rDskMD0,55291
146
146
  megadetector/detection/run_tiled_inference.py,sha256=vw0713eNuMiEOjHfweQl58zPHNxPOMdFWZ8bTDLhlMY,37883
147
147
  megadetector/detection/tf_detector.py,sha256=t9O6J7r1wHOkKbrwchducdJrAHSw38DDA7rF7_0urn0,8522
@@ -151,15 +151,16 @@ megadetector/postprocessing/add_max_conf.py,sha256=qTE1_0RwGAy6jLDkHrIo2pS84yNbU
151
151
  megadetector/postprocessing/categorize_detections_by_size.py,sha256=YdapcvjA6Dz2dPa2AFf1Dwyl7C-OmmP4G4OjhTOuaF4,5797
152
152
  megadetector/postprocessing/classification_postprocessing.py,sha256=SJah7xrVN06W_jmKdEF_-ykcaKE6fDTGHFhOz4rYi8g,30430
153
153
  megadetector/postprocessing/combine_batch_outputs.py,sha256=va6v1ZZzbQlq16S3gEqHKI5RbBuwRQ6ZoLAdDbIWYOQ,8416
154
- megadetector/postprocessing/compare_batch_results.py,sha256=O6J32C5O3gPTe9P6ZU-1E4ECsARIP7v621Cipl-pELw,77737
154
+ megadetector/postprocessing/compare_batch_results.py,sha256=dtRbutrJQNb0e9VO5bOQXMpPTj-rYJqrqrE3AaM6-NU,85613
155
155
  megadetector/postprocessing/convert_output_format.py,sha256=HwThfK76UPEAGa3KQbJ_tMKIrUvJ3JhKoQVWJt9dPBk,15447
156
+ megadetector/postprocessing/create_crop_folder.py,sha256=uMabZiLdvPLZf6L3gFr3VNCNQpBKkyoaCHfp2w1jAW4,13131
156
157
  megadetector/postprocessing/detector_calibration.py,sha256=rzAsiUJhw8Y4RxSK1SMnsdjI3MYkFA9NP5vJ7CNsX0I,21820
157
158
  megadetector/postprocessing/load_api_results.py,sha256=FqcaiPMuqTojZOV3Jn14pJESpuwjWGbZtcvJuVXUaDM,6861
158
159
  megadetector/postprocessing/md_to_coco.py,sha256=wleD9Fq2zvQ5ubwfV3KUsDmgpiLnBXh5XvjjYk7YIH8,15971
159
160
  megadetector/postprocessing/md_to_labelme.py,sha256=DDCsQpxZXQxWjPlsg1DM5yE33Fc_c8KatuDgt66Q8rQ,11696
160
161
  megadetector/postprocessing/md_to_wi.py,sha256=Yq-WdbWPcwkGkF5Iw7c6Ua6Ky723jYwJWY8Kl_KfgRE,1271
161
162
  megadetector/postprocessing/merge_detections.py,sha256=GfoDtDUdOyv9M4p8tTzUuaEPsgnmHu1pgnPsvSUfOq0,17778
162
- megadetector/postprocessing/postprocess_batch_results.py,sha256=baJioCU6sB4iAtLV_mMMecqKZlgb-ycYQx-NLsS2gw0,80175
163
+ megadetector/postprocessing/postprocess_batch_results.py,sha256=oJufA8ABqtz0MqniTa5t9in9vlreD2jexxal4MVMaD0,80183
163
164
  megadetector/postprocessing/remap_detection_categories.py,sha256=d9IYTa0i_KbbrarJc_mczABmdwypscl5-KpK8Hx_z8o,6640
164
165
  megadetector/postprocessing/render_detection_confusion_matrix.py,sha256=_wsk4W0PbNiqmFuHy-EA0Z07B1tQLMsdCTPatnHAdZw,27382
165
166
  megadetector/postprocessing/separate_detections_into_folders.py,sha256=8ISxkZJ3KCCONdbi2NrJsHoAP34t_Z_qwUEeZ_SfElQ,32893
@@ -182,26 +183,26 @@ megadetector/taxonomy_mapping/taxonomy_graph.py,sha256=ayrTFseVaIMbtMXhnjWCkZdxI
182
183
  megadetector/taxonomy_mapping/validate_lila_category_mappings.py,sha256=1qyZr23bvZSVUYLQnO1XAtIZ4jdpARA5dxt8euKVyOA,2527
183
184
  megadetector/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
184
185
  megadetector/utils/azure_utils.py,sha256=0BdnkG2hW-X0yFpsJqmBhOd2wysz_LvhuyImPJMVPJs,6271
185
- megadetector/utils/ct_utils.py,sha256=se4sy5f_vpcZiY6b1NCGidhVY31nkI2re2wotlahX9Q,24848
186
- megadetector/utils/directory_listing.py,sha256=r4rg2xA4O9ZVxVtzPZzXIXa0DOEukAJMTTNcNSiQcuM,9668
187
- megadetector/utils/gpu_test.py,sha256=AgBVs-RA04s8o5_T9I-6-DLCOLYjVn8u1cmcEbe1yOk,3229
188
- megadetector/utils/md_tests.py,sha256=LWcFC82DB53ColP5mJHzK_hLL4Xi8CF2TR2m2Tw-AYU,72118
189
- megadetector/utils/path_utils.py,sha256=kr6cWC0v-JcprDtoi8hA8WocZ6xfVHjAcF3S34kBr8g,41184
186
+ megadetector/utils/ct_utils.py,sha256=v76mXQnrO_9CVu5WhHeaqY_6DIVQ7zpgQZn8TDe6obQ,27251
187
+ megadetector/utils/directory_listing.py,sha256=1uHpK0Uq5j50ZbaVcJEoz99Vq1IBRYQxypUPklOyBvc,9688
188
+ megadetector/utils/gpu_test.py,sha256=1NxvyJrD4mq_uuCysT0q9pSJyR-gpdQogB6O8TP4E2Q,3665
189
+ megadetector/utils/md_tests.py,sha256=O4yNL2_lc10VjR0xXljeiQ6BRu58HyP8_r04xXbfbXs,74981
190
+ megadetector/utils/path_utils.py,sha256=trnJM5i2_7cHXMqxZc1mFUHAQuV-TxTYih1ph2ZCwas,42121
190
191
  megadetector/utils/process_utils.py,sha256=K7-ZW_bJbMgeDBLDhYHMV84urM8H7L6IddQS5z3UgBw,5824
191
192
  megadetector/utils/sas_blob_utils.py,sha256=k76EcMmJc_otrEHcfV2fxAC6fNhxU88FxM3ddSYrsKU,16917
192
193
  megadetector/utils/split_locations_into_train_val.py,sha256=jvaDu1xKB51L3Xq2nXQo0XtXRjNRf8RglBApl1g6gHo,10101
193
194
  megadetector/utils/string_utils.py,sha256=ZQapJodzvTDyQhjZgMoMl3-9bqnKAUlORpws8Db9AkA,2050
194
195
  megadetector/utils/url_utils.py,sha256=yybWwJ-vl2A6Fci66i-xt_dl3Uqh72Ylnb8XOT2Grog,14835
195
- megadetector/utils/wi_utils.py,sha256=qOW2Oz8NM09l6Ow_CMgatmwdPd1gdMx_saUDQlNekpY,71622
196
+ megadetector/utils/wi_utils.py,sha256=AhsWQQNl0V14ZkFCpT2dlxbm5quJGvEf3HPYXHt1ub8,108614
196
197
  megadetector/utils/write_html_image_list.py,sha256=MhVAAv6th9Q2fldtE8hp_hHWFgJ_pcKJEk3YiK6dWY4,9415
197
198
  megadetector/visualization/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
198
199
  megadetector/visualization/plot_utils.py,sha256=lOfU3uPrcuHZagV_1SN8erT8PujIepocgw6KZ17Ej6c,10671
199
200
  megadetector/visualization/render_images_with_thumbnails.py,sha256=kgJYW8BsqRO4C7T3sqItdBuSkZ64I1vOtIWAsVG4XBI,10589
200
- megadetector/visualization/visualization_utils.py,sha256=io156_DC_0icNbFDrYxAE6wFQ1lsQXI12nV675tsxCE,75353
201
+ megadetector/visualization/visualization_utils.py,sha256=_BH-dcCnBdrJnSoDDQfZGeuJcKoQTbglay5D2gr0Ayo,75592
201
202
  megadetector/visualization/visualize_db.py,sha256=hnJEIBRWf7_HjTEiUmzS59_8kK0usb8mczZMDv1N4r8,25279
202
203
  megadetector/visualization/visualize_detector_output.py,sha256=HARxyrXa2_vb6xhEEiourF-Kw4arDv0kxfyMLeKa874,19242
203
- megadetector-5.0.24.dist-info/LICENSE,sha256=RMa3qq-7Cyk7DdtqRj_bP1oInGFgjyHn9-PZ3PcrqIs,1100
204
- megadetector-5.0.24.dist-info/METADATA,sha256=FJ_IDN-d14tzO_PGurannavVh0ReSELtBQIAEQIBQEI,5889
205
- megadetector-5.0.24.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
206
- megadetector-5.0.24.dist-info/top_level.txt,sha256=wf9DXa8EwiOSZ4G5IPjakSxBPxTDjhYYnqWRfR-zS4M,13
207
- megadetector-5.0.24.dist-info/RECORD,,
204
+ megadetector-5.0.25.dist-info/LICENSE,sha256=RMa3qq-7Cyk7DdtqRj_bP1oInGFgjyHn9-PZ3PcrqIs,1100
205
+ megadetector-5.0.25.dist-info/METADATA,sha256=Fu7l8rkeG7oRLN6_CLgxz1cK2exEwCBBFgCI6i8suWc,6301
206
+ megadetector-5.0.25.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
207
+ megadetector-5.0.25.dist-info/top_level.txt,sha256=wf9DXa8EwiOSZ4G5IPjakSxBPxTDjhYYnqWRfR-zS4M,13
208
+ megadetector-5.0.25.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (75.8.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5