megadetector 5.0.7__py3-none-any.whl → 5.0.8__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 (48) hide show
  1. api/batch_processing/data_preparation/manage_local_batch.py +28 -14
  2. api/batch_processing/postprocessing/combine_api_outputs.py +2 -2
  3. api/batch_processing/postprocessing/compare_batch_results.py +1 -1
  4. api/batch_processing/postprocessing/convert_output_format.py +24 -6
  5. api/batch_processing/postprocessing/load_api_results.py +1 -3
  6. api/batch_processing/postprocessing/md_to_labelme.py +118 -51
  7. api/batch_processing/postprocessing/merge_detections.py +30 -5
  8. api/batch_processing/postprocessing/postprocess_batch_results.py +24 -12
  9. api/batch_processing/postprocessing/remap_detection_categories.py +163 -0
  10. api/batch_processing/postprocessing/render_detection_confusion_matrix.py +15 -12
  11. api/batch_processing/postprocessing/repeat_detection_elimination/repeat_detections_core.py +2 -2
  12. data_management/cct_json_utils.py +7 -2
  13. data_management/coco_to_labelme.py +263 -0
  14. data_management/coco_to_yolo.py +7 -4
  15. data_management/databases/integrity_check_json_db.py +68 -59
  16. data_management/databases/subset_json_db.py +1 -1
  17. data_management/get_image_sizes.py +44 -26
  18. data_management/importers/animl_results_to_md_results.py +1 -3
  19. data_management/importers/noaa_seals_2019.py +1 -1
  20. data_management/labelme_to_coco.py +252 -143
  21. data_management/labelme_to_yolo.py +95 -52
  22. data_management/lila/create_lila_blank_set.py +106 -23
  23. data_management/lila/download_lila_subset.py +133 -65
  24. data_management/lila/generate_lila_per_image_labels.py +1 -1
  25. data_management/lila/lila_common.py +8 -38
  26. data_management/read_exif.py +65 -16
  27. data_management/remap_coco_categories.py +84 -0
  28. data_management/resize_coco_dataset.py +3 -22
  29. data_management/wi_download_csv_to_coco.py +239 -0
  30. data_management/yolo_to_coco.py +283 -83
  31. detection/run_detector_batch.py +12 -3
  32. detection/run_inference_with_yolov5_val.py +10 -3
  33. detection/run_tiled_inference.py +2 -2
  34. detection/tf_detector.py +2 -1
  35. detection/video_utils.py +1 -1
  36. md_utils/ct_utils.py +22 -3
  37. md_utils/md_tests.py +11 -2
  38. md_utils/path_utils.py +206 -32
  39. md_utils/url_utils.py +66 -1
  40. md_utils/write_html_image_list.py +12 -3
  41. md_visualization/visualization_utils.py +363 -72
  42. md_visualization/visualize_db.py +33 -10
  43. {megadetector-5.0.7.dist-info → megadetector-5.0.8.dist-info}/METADATA +10 -12
  44. {megadetector-5.0.7.dist-info → megadetector-5.0.8.dist-info}/RECORD +47 -44
  45. {megadetector-5.0.7.dist-info → megadetector-5.0.8.dist-info}/WHEEL +1 -1
  46. md_visualization/visualize_megadb.py +0 -183
  47. {megadetector-5.0.7.dist-info → megadetector-5.0.8.dist-info}/LICENSE +0 -0
  48. {megadetector-5.0.7.dist-info → megadetector-5.0.8.dist-info}/top_level.txt +0 -0
@@ -16,18 +16,21 @@ import math
16
16
  import os
17
17
  import sys
18
18
  import time
19
+
20
+ import pandas as pd
21
+ import numpy as np
22
+
23
+ import humanfriendly
24
+
19
25
  from itertools import compress
20
26
  from multiprocessing.pool import ThreadPool
21
27
  from multiprocessing.pool import Pool
22
-
23
- import pandas as pd
24
28
  from tqdm import tqdm
25
- import humanfriendly
26
29
 
27
30
  from md_utils.write_html_image_list import write_html_image_list
31
+ from data_management.cct_json_utils import IndexedJsonDb
28
32
 
29
33
  import md_visualization.visualization_utils as vis_utils
30
- from data_management.cct_json_utils import IndexedJsonDb
31
34
 
32
35
 
33
36
  #%% Settings
@@ -40,7 +43,7 @@ class DbVizOptions:
40
43
  # Target size for rendering; set either dimension to -1 to preserve aspect ratio
41
44
  #
42
45
  # If viz_size is None or (-1,-1), the original image size is used.
43
- viz_size = (675, -1)
46
+ viz_size = (800, -1)
44
47
 
45
48
  # The most relevant option one might want to set here is:
46
49
  #
@@ -90,6 +93,11 @@ class DbVizOptions:
90
93
  # Should we show absolute (vs. relative) paths for each image?
91
94
  show_full_paths = False
92
95
 
96
+ # Set to False to skip existing images
97
+ force_rendering = True
98
+
99
+ verbose = False
100
+
93
101
 
94
102
  #%% Helper functions
95
103
 
@@ -272,7 +280,7 @@ def visualize_db(db_path, output_dir, image_base_dir, options=None):
272
280
  categoryName = label_map[categoryID]
273
281
  if options.add_search_links:
274
282
  categoryName = categoryName.replace('"','')
275
- categoryName = '<a href="https://www.bing.com/images/search?q={}">{}</a>'.format(
283
+ categoryName = '<a href="https://www.google.com/search?tbm=isch&q={}">{}</a>'.format(
276
284
  categoryName,categoryName)
277
285
  imageCategories.add(categoryName)
278
286
 
@@ -317,14 +325,22 @@ def visualize_db(db_path, output_dir, image_base_dir, options=None):
317
325
  if options.include_filename_links:
318
326
  filename_text = '<a href="{}">{}</a>'.format(img_path,filename_text)
319
327
 
328
+ flagString = ''
329
+
330
+ def isnan(x):
331
+ return (isinstance(x,float) and np.isnan(x))
332
+
333
+ if ('flags' in img) and (not isnan(img['flags'])):
334
+ flagString = ', flags: {}'.format(str(img['flags']))
335
+
320
336
  # We're adding html for an image before we render it, so it's possible this image will
321
337
  # fail to render. For applications where this script is being used to debua a database
322
338
  # (the common case?), this is useful behavior, for other applications, this is annoying.
323
339
  image_dict = \
324
340
  {
325
341
  'filename': '{}/{}'.format('rendered_images', file_name),
326
- 'title': '{}<br/>{}, num boxes: {}, {}class labels: {}{}'.format(
327
- filename_text, img_id, len(bboxes), frameString, imageClasses, labelLevelString),
342
+ 'title': '{}<br/>{}, num boxes: {}, {}class labels: {}{}{}'.format(
343
+ filename_text, img_id, len(bboxes), frameString, imageClasses, labelLevelString, flagString),
328
344
  'textStyle': 'font-family:verdana,arial,calibri;font-size:80%;' + \
329
345
  'text-align:left;margin-top:20;margin-bottom:5'
330
346
  }
@@ -341,7 +357,13 @@ def visualize_db(db_path, output_dir, image_base_dir, options=None):
341
357
  bboxes = rendering_info['bboxes']
342
358
  bboxClasses = rendering_info['boxClasses']
343
359
  output_file_name = rendering_info['output_file_name']
360
+ output_full_path = os.path.join(output_dir, 'rendered_images', output_file_name)
344
361
 
362
+ if (os.path.isfile(output_full_path)) and (not options.force_rendering):
363
+ if options.verbose:
364
+ print('Skipping existing image {}'.format(output_full_path))
365
+ return True
366
+
345
367
  if not img_path.startswith('http'):
346
368
  if not os.path.exists(img_path):
347
369
  print('Image {} cannot be found'.format(img_path))
@@ -356,7 +378,7 @@ def visualize_db(db_path, output_dir, image_base_dir, options=None):
356
378
  image = vis_utils.resize_image(original_image, options.viz_size[0],
357
379
  options.viz_size[1])
358
380
  except Exception as e:
359
- print('Image {} failed to open. Error: {}'.format(img_path, e))
381
+ print('Image {} failed to open, error: {}'.format(img_path, e))
360
382
  return False
361
383
 
362
384
  vis_utils.render_db_bounding_boxes(boxes=bboxes, classes=bboxClasses,
@@ -365,7 +387,8 @@ def visualize_db(db_path, output_dir, image_base_dir, options=None):
365
387
  thickness=options.box_thickness,
366
388
  expansion=options.box_expansion)
367
389
 
368
- image.save(os.path.join(output_dir, 'rendered_images', output_file_name))
390
+ image.save(output_full_path)
391
+
369
392
  return True
370
393
 
371
394
  # ...def render_image_info
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: megadetector
3
- Version: 5.0.7
3
+ Version: 5.0.8
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>
@@ -60,7 +60,7 @@ If you want to learn more about what MegaDetector is all about, head over to the
60
60
 
61
61
  ### If you are an ecologist...
62
62
 
63
- 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. We recommend starting with our "[Getting started with MegaDetector](https://github.com/agentmorris/MegaDetector/blob/main/collaborations.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. That journey will <i>not</i> involve this package.
63
+ 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. We recommend starting with our "[Getting started with MegaDetector](https://github.com/agentmorris/MegaDetector/blob/main/collaborations.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. That journey will <i>not</i> involve this Python package.
64
64
 
65
65
  ### If you are a computer-vision-y type...
66
66
 
@@ -95,15 +95,13 @@ temporary_filename = url_utils.download_url(image_url)
95
95
 
96
96
  image = vis_utils.load_image(temporary_filename)
97
97
 
98
- # This will automatically download MDv5a to the system temp folder;
99
- # you can also specify a filename explicitly, or set the $MDV5A
100
- # environment variable to point to the model file.
98
+ # This will automatically download MDv5a; you can also specify a filename.
101
99
  model = run_detector.load_detector('MDV5A')
102
100
 
103
101
  result = model.generate_detections_one_image(image)
104
102
 
105
103
  detections_above_threshold = [d for d in result['detections'] if d['conf'] > 0.2]
106
- print('Found {} detection above threshold'.format(len(detections_above_threshold)))
104
+ print('Found {} detections above threshold'.format(len(detections_above_threshold)))
107
105
  ```
108
106
 
109
107
  #### Run MegaDetector on a folder of images
@@ -120,14 +118,14 @@ output_file = os.path.expanduser('~/megadetector_output_test.json')
120
118
  # Recursively find images
121
119
  image_file_names = path_utils.find_images(image_folder,recursive=True)
122
120
 
123
- # This will automatically download MDv5a to the system temp folder;
124
- # you can also specify a filename explicitly, or set the $MDV5A
125
- # environment variable to point to the model file.
121
+ # This will automatically download MDv5a; you can also specify a filename.
126
122
  results = load_and_run_detector_batch('MDV5A', image_file_names)
127
123
 
128
- # Write results as relative filenames, this is what Timelapse
129
- # and other downstream tools expect.
130
- write_results_to_file(results,output_file,relative_path_base=image_folder)
124
+ # Write results to a format that Timelapse and other downstream tools like.
125
+ write_results_to_file(results,
126
+ output_file,
127
+ relative_path_base=image_folder,
128
+ detector_file=detector_filename)
131
129
  ```
132
130
 
133
131
  ## Contact
@@ -8,7 +8,7 @@ api/batch_processing/api_core/server_utils.py,sha256=oFusP1E29op5DN1nEaR-jQZgREx
8
8
  api/batch_processing/api_core/batch_service/score.py,sha256=ZuPQV7O1u9QNPhWVSYxQqvYgXo9p15e-XhnUyuz0vLE,17347
9
9
  api/batch_processing/api_core_support/aggregate_results_manually.py,sha256=8yDXbw12G8Y6SOv09tY-0hPXMNG_iRPv6mzxBiccsaU,2275
10
10
  api/batch_processing/api_support/summarize_daily_activity.py,sha256=SmRGAMWTKXf9bDXUPsTySMiIg8K1LDkAC8KVBVH_mPg,5383
11
- api/batch_processing/data_preparation/manage_local_batch.py,sha256=Nb9MxJyAJC2e4twWkoGfI-crSSgB9g8Ue28cbbeE5QA,88618
11
+ api/batch_processing/data_preparation/manage_local_batch.py,sha256=z1smCyfw1Pet1AuXALPhGhpt53ClM4qW1OypMre31ac,89186
12
12
  api/batch_processing/data_preparation/manage_video_batch.py,sha256=fobPIMmfvdqa1OzxsurEYCFVnUTHGrtrGBiCq3xnYHs,9668
13
13
  api/batch_processing/integration/digiKam/setup.py,sha256=7P1X3JYrBDXmLUeLRrzxNfDkL5lo-pY8nXsp9Cz8rOI,203
14
14
  api/batch_processing/integration/digiKam/xmp_integration.py,sha256=AbGPTe9RjjOkKdiZDSElai61QyfeiLQQqJR2fiJpymA,17775
@@ -17,21 +17,22 @@ api/batch_processing/integration/eMammal/test_scripts/push_annotations_to_emamma
17
17
  api/batch_processing/integration/eMammal/test_scripts/select_images_for_testing.py,sha256=OYMu97p8vprSv03QcnS6aSxPBocn9sgaozfUqq_JpyM,1369
18
18
  api/batch_processing/postprocessing/add_max_conf.py,sha256=y4Xr_OHRxcop3vsLWQJ56eYIemm2HHKqVfvKJonTcQA,1530
19
19
  api/batch_processing/postprocessing/categorize_detections_by_size.py,sha256=b_O2OM44zIXewR4RjzeS2ue-32k5jE6KgjiPn8JRxAA,4877
20
- api/batch_processing/postprocessing/combine_api_outputs.py,sha256=WsOV4EsK9JUCMka1_-u-vinmWc6Ko8B0PD5fmwoXHh0,8233
21
- api/batch_processing/postprocessing/compare_batch_results.py,sha256=65Kq6mChsPElQfjhWgLDmnO9b6igatQvXiasB2YVHno,34652
22
- api/batch_processing/postprocessing/convert_output_format.py,sha256=aLboVVZdlGUNYOZhme0w8LtYrd04i15oK0apOgZaYWk,12947
23
- api/batch_processing/postprocessing/load_api_results.py,sha256=1BwpXUUQiGJeOUDfQTiA9thNd5jbSbOU3siTO1_Dw5s,6997
20
+ api/batch_processing/postprocessing/combine_api_outputs.py,sha256=7NR_QbozC6xLTwXpUrw7c1WIL2guAHiHIg4hj1XTbeU,8237
21
+ api/batch_processing/postprocessing/compare_batch_results.py,sha256=8oJGwQ3ykNSBjrQNleuEhl2j_z74YynwnW19r0dmBG0,34652
22
+ api/batch_processing/postprocessing/convert_output_format.py,sha256=b4hEQOaXSyH6GZQfHr_PLSM85r5aPrriwUOdgH1RkOo,13600
23
+ api/batch_processing/postprocessing/load_api_results.py,sha256=aqmsWpqzDIcmompRwzF4oFkV7QPAazFyIGwEWRVd8Ng,6895
24
24
  api/batch_processing/postprocessing/md_to_coco.py,sha256=dRAkCGWtcNy_vsSTkX1h_0DZAsW6zNO7F-8XSkR8wAo,10139
25
- api/batch_processing/postprocessing/md_to_labelme.py,sha256=lfheIrXqzjq6lInmlYgYq354PrVvH2SPNXKr8e3S_DQ,7075
26
- api/batch_processing/postprocessing/merge_detections.py,sha256=B4QnqW9nvcEJpXzAK20TVB0t6L8c7PR5OjPy8FX-5Z8,15930
27
- api/batch_processing/postprocessing/postprocess_batch_results.py,sha256=l_uyOTTINq9GBZlHsAnPteEvA-rWmKZH-eWVcqbMPUM,73653
28
- api/batch_processing/postprocessing/render_detection_confusion_matrix.py,sha256=h-a7tWNBSe3VRUg-Z4aX-ySUzrF8NfiEYWA1lHbZrmo,25040
25
+ api/batch_processing/postprocessing/md_to_labelme.py,sha256=0evnkCFC7TucHgFJ1i12rp_C1pEflxFD44Jp98AbGrw,9779
26
+ api/batch_processing/postprocessing/merge_detections.py,sha256=O9fjLTZz7PJN19L19BYHVMGr20-gB9M3sIaBFY1_w_8,17192
27
+ api/batch_processing/postprocessing/postprocess_batch_results.py,sha256=4lDpYqpA_wcwMWVP5xKpQH6_JfkBFV8N93j_CjkvPh8,74165
28
+ api/batch_processing/postprocessing/remap_detection_categories.py,sha256=hcX2-Thk59X0df6H6x1rH1v15IwJrm3NQJK94yOt95w,6042
29
+ api/batch_processing/postprocessing/render_detection_confusion_matrix.py,sha256=kIFBgu_JDagm8FhEd3GislSMoBHAz2Fq4ySeYHPKTd0,25047
29
30
  api/batch_processing/postprocessing/separate_detections_into_folders.py,sha256=l5NKxDDxROc2EXt8EslrswXAZkQXgWTy5FSqCqa09Ug,28720
30
31
  api/batch_processing/postprocessing/subset_json_detector_output.py,sha256=EROwcj4K-abAwzyZjPCQocuayIVma85lV-D6WvvRMuc,26368
31
32
  api/batch_processing/postprocessing/top_folders_to_bottom.py,sha256=etJK9DmHppMe3WqGXypuilW-n-7hOjOO9w_k1khlaVU,5476
32
33
  api/batch_processing/postprocessing/repeat_detection_elimination/find_repeat_detections.py,sha256=fYqPZhaL-6cbpKHz96O3Ch65Y8xux2LQ2-ZlMGhOlM0,9053
33
34
  api/batch_processing/postprocessing/repeat_detection_elimination/remove_repeat_detections.py,sha256=YdMvM814TX0ZRTnP7BfowE62PoMoCOYcJOFl69DlKhQ,2189
34
- api/batch_processing/postprocessing/repeat_detection_elimination/repeat_detections_core.py,sha256=D-q20g9kLXCNB8IMyeLYxdMSvipzmgu2buEh--HJrC0,62882
35
+ api/batch_processing/postprocessing/repeat_detection_elimination/repeat_detections_core.py,sha256=79F6sLwGWOSBNZ5GbZMeuZEH3kfRsjYUTl4ouLhwnA8,62880
35
36
  api/synchronous/api_core/animal_detection_api/api_backend.py,sha256=PJXV0RFb6FoPBmdRug5W_5nbFwY2C_8CvDpFHjDs9w4,4934
36
37
  api/synchronous/api_core/animal_detection_api/api_frontend.py,sha256=_FGLf5C2tXQABFEGaA2Kzq05hj_D60BaIfWLCI-Os_4,10690
37
38
  api/synchronous/api_core/animal_detection_api/config.py,sha256=yEf7JZwRJCtHEV80kYvnNnUFJNds_AYLhomffwfFQi0,1017
@@ -82,30 +83,33 @@ classification/efficientnet/__init__.py,sha256=e-jfknjzCc5a0CSW-TaZ2vi0SPU1OMIsa
82
83
  classification/efficientnet/model.py,sha256=qJHWV9-rYKa4E_TIee5N_OjRhqDdM-icPpoMap3Q5HM,17040
83
84
  classification/efficientnet/utils.py,sha256=TF5S2cn2lvlCO2dFhdFPdzjbBBs-SyZGZmEx_dsJMbo,24846
84
85
  data_management/cct_json_to_filename_json.py,sha256=AxYeOzZHkHF1UxHCUBtofXNKVdUK-5xTfZp3_iE7hFc,2416
85
- data_management/cct_json_utils.py,sha256=JX5pJh5QLyKDhcXheUYgbRSd99uB9Ui-EfsRZ_Fhw_I,12570
86
+ data_management/cct_json_utils.py,sha256=tZD2SftV4Vw9dlZQRnOumVoOYIsIkWU_iOAiim8fRMs,12767
86
87
  data_management/cct_to_csv.py,sha256=urIL8IUByhKZ4FLLa9TKlzT6mu8upLzAPN1WNnDZdIY,3859
87
88
  data_management/cct_to_md.py,sha256=0QtqUdUkrema2BSNTeJqHYkDuwOLc7tOQwq1KxTbtPE,4485
88
89
  data_management/cct_to_wi.py,sha256=nJKUhLXcZXKE5tAR9UxbqCjeikfaABfB746wpv-1BmI,8336
89
- data_management/coco_to_yolo.py,sha256=8c-9cCjelKTwMOL6gQc9oAWum7UPxIr0FP_tiK8NyLc,25880
90
+ data_management/coco_to_labelme.py,sha256=YmztZdYHGenPj6lRe-jB1R5J4jG0kX7Ni9SIAGZTK7s,8077
91
+ data_management/coco_to_yolo.py,sha256=IgW51lxyr_j9Y4ZlzIsW8NsgtWgvIkDeNKICVeYDx3s,26042
90
92
  data_management/generate_crops_from_cct.py,sha256=m6HJ8bB4N50HYV4SXAUV43k1XJl71QZmmWZ4L-9T45Y,4283
91
- data_management/get_image_sizes.py,sha256=yUCI5zQmA9G_GDaQiApwoafmO37cUi97dw-Ekh5leOE,4220
92
- data_management/labelme_to_coco.py,sha256=9RpOp-IV5miJag4KInLijR7koH8eZSztKdAmArhoMx4,14204
93
- data_management/labelme_to_yolo.py,sha256=XjhrmoGxyo1N-N8kueGzmy_m6FWR4SO8sNHFppoH-GQ,8480
93
+ data_management/get_image_sizes.py,sha256=34o5LTwanc0XfC7XqKnBJiX8mPiEq_JiiqqVMHglQqI,4961
94
+ data_management/labelme_to_coco.py,sha256=yoGr7o-qwogTbvLLJQ6NjCmaYqY6-kHyn2C2860phkQ,18344
95
+ data_management/labelme_to_yolo.py,sha256=7oHS-wV9jXqq1c03agsKnc9-YWSN_BeDjJ4pbX_lDW0,10041
94
96
  data_management/ocr_tools.py,sha256=8cVJMQvzvv_6HXV8zMR4nJH72-L_f3Dy9IjIb3E32Js,29920
95
- data_management/read_exif.py,sha256=HGCp5gvD8MHQ0xGGTX2_PD5JHFTdMtqjZ8ql2pt5Fn0,19036
97
+ data_management/read_exif.py,sha256=9zdMkn4L_Do-4R4yenZw9ffFgb1TEBZuXhiCewVnP1A,21446
98
+ data_management/remap_coco_categories.py,sha256=pQSJKHxYY2p3HwDB1JXLchvNIyPDbg7TXBLZdBzAw_g,3002
96
99
  data_management/remove_exif.py,sha256=_WDrKfRwK0UWCkj4SiLutGCd7-WRaKYoTgLfBWPDhGU,1555
97
- data_management/resize_coco_dataset.py,sha256=pG1yVktPSp6Vc3DThrJO7lmo67_KvOdqEtFpwM6QjOA,7398
100
+ data_management/resize_coco_dataset.py,sha256=3PSrV5T0FzUiHnZFdX7F9jKXLEqZSsNJN0jk-Yf9qh0,6100
101
+ data_management/wi_download_csv_to_coco.py,sha256=cQs7b3j-6QcSTcVKocUK0Nl0sV9jepy3Bqi9wM1dzok,7704
98
102
  data_management/yolo_output_to_md_output.py,sha256=vxUdn4bqg0S67ozvxtnlX77X6S7nCvyZbKAyvCh_Suc,16313
99
- data_management/yolo_to_coco.py,sha256=Xb9UVO-HHYrkJyxbASWJDZrZCyW3JwBPI_WN5SQHys4,8078
103
+ data_management/yolo_to_coco.py,sha256=E0Z0O6O2vyNDks9cC2INJjezstwujjdkz4QZ3PuPMf8,15196
100
104
  data_management/annotations/annotation_constants.py,sha256=P2CZCbAE0ImLLfaNRb1SMlP3q1fULWAIjgrYOrF9L0g,1566
101
105
  data_management/databases/add_width_and_height_to_db.py,sha256=71mOEK3xo9gbxK1TVZzBA9nNi-1ElmBZbIPKrUm9XG0,619
102
106
  data_management/databases/combine_coco_camera_traps_files.py,sha256=cwu_REQXdHWfVLtCvTvFEIvM7z8GwHVoawVuHcWv2aw,6888
103
- data_management/databases/integrity_check_json_db.py,sha256=aQe36eEnhxHFpm9XGmFXCf4jsTvfXuBWMfKdIKKN4tU,14535
107
+ data_management/databases/integrity_check_json_db.py,sha256=mZxwc42uL_e4VqmuzRwh0lxvDN7WrwtKsDVPObp9hWc,14887
104
108
  data_management/databases/remove_corrupted_images_from_db.py,sha256=Dod8UQDFveAUJlrH9Svcp_HezdILRHp74TbAl3YGf84,6138
105
- data_management/databases/subset_json_db.py,sha256=UeVn3jlcpEw-K9E-QyRwxdzl7zaV80iv_u4v6kHUd_E,2749
109
+ data_management/databases/subset_json_db.py,sha256=7oHGuiyoPyv8JBh5IrgP4Qez8xs86z94UAPss2_FlfQ,2749
106
110
  data_management/importers/add_nacti_sizes.py,sha256=qsBHPyJ7MPzl0vgJX5iErZxWkTJ6QRcyLJ8GM2YBu2U,1172
107
111
  data_management/importers/add_timestamps_to_icct.py,sha256=8XhQAIt_qw63qTMPobCKGl4O9RQZvZmhbmiSetOyNvA,2459
108
- data_management/importers/animl_results_to_md_results.py,sha256=tzYaPpiUte5A1VHulAbYO9-hzUIpE1xI5lJp6hS_JoI,4899
112
+ data_management/importers/animl_results_to_md_results.py,sha256=Q43z0TQ5JTRVNbbCrb4E6lZB0kvWbngZMPrRmr43rp0,4884
109
113
  data_management/importers/auckland_doc_test_to_json.py,sha256=9Fg-n_Kj2jK5iZVaPrioNkhlLNxGnrU5GS_44lsadKo,12910
110
114
  data_management/importers/auckland_doc_to_json.py,sha256=qSjBcR7FTd5_J2LO6WOoIFxSnE2IiIIqRkhbydULV7s,5952
111
115
  data_management/importers/awc_to_json.py,sha256=jLXmwGaq81wgH7HcpbAJoNMQP2CqkdfI1mvShdTGeqw,5307
@@ -124,7 +128,7 @@ data_management/importers/jb_csv_to_json.py,sha256=u3IZwDboObYlxtUSa35G8P3t_L48m
124
128
  data_management/importers/mcgill_to_json.py,sha256=ZxsNW9qFi6Kyu8SJ0BB5uK7AMuBW92QOOKXHPbIgPwY,6718
125
129
  data_management/importers/missouri_to_json.py,sha256=y9lbLaD8bGM4m9iqGHIicyZOByeJGfZOF51RikHMSFU,14840
126
130
  data_management/importers/nacti_fieldname_adjustments.py,sha256=57PyfOft2Ws-1AcG4_9mzOcB3uW4IFxaZ3z0LsItUUU,2045
127
- data_management/importers/noaa_seals_2019.py,sha256=wYcjhARv4IUJgawXcAnwIAOGZq5GORG8ElE_7JZSVCk,5145
131
+ data_management/importers/noaa_seals_2019.py,sha256=2_XJl-jxSiN1IOzGmRvsUR-bI4Pclo_jO4qSW2ytqks,5147
128
132
  data_management/importers/pc_to_json.py,sha256=9Nin7R47aaE5bjXjvq7A2trv2vFdJVYzhLHwLFji5Tg,10718
129
133
  data_management/importers/plot_wni_giraffes.py,sha256=V_kAzbYjtXEBUCdSwSGsEEemLN9aVyZuKhoSZQEvkCI,3787
130
134
  data_management/importers/prepare-noaa-fish-data-for-lila.py,sha256=WIkuR4ozEeHwzQPs54jIDIbAgKf1I4taZNgpHHzh-Rc,12774
@@ -149,42 +153,41 @@ data_management/importers/snapshotserengeti/make_full_SS_json.py,sha256=khE3W0pO
149
153
  data_management/importers/snapshotserengeti/make_per_season_SS_json.py,sha256=sAwvcR2siwblgY3LfTsbH4mXOXvJZCA246QIsQWuQBA,4316
150
154
  data_management/lila/add_locations_to_island_camera_traps.py,sha256=nsIJXyw2IhOwwM9A0SCn108Fg297fRUdADXGUAN8Y34,2561
151
155
  data_management/lila/add_locations_to_nacti.py,sha256=KVMWwSJx-gYI_J6J8y-AqsWnOTgidtebotJjYPfsj00,5017
152
- data_management/lila/create_lila_blank_set.py,sha256=ScGlqalOySsmZEvYtEn4pGNxGOj0qHyxGs-F5URTmk8,16359
156
+ data_management/lila/create_lila_blank_set.py,sha256=09b2tvMPG9jThyJoLQ3tHiaoQJ_kBEJ4Yn2dACh_McY,19764
153
157
  data_management/lila/create_lila_test_set.py,sha256=WxM-LuhtNiee3CLeVPxUEWsfbybgZd7oluZu6epl69A,4825
154
158
  data_management/lila/create_links_to_md_results_files.py,sha256=f0pXY2Lyj9DtRlgFpmLqNBs2qWd--B8N6UAt8E26tcM,3916
155
- data_management/lila/download_lila_subset.py,sha256=nJjzKuMOYJa2lBJcXOEZloWjbFlQW_USke49DJdNruM,5283
156
- data_management/lila/generate_lila_per_image_labels.py,sha256=b0FDiYbs5BI8wdk221ysr-p1PsprfRFwMIgv65BYS6Y,17351
159
+ data_management/lila/download_lila_subset.py,sha256=yDTv_TApQWCi3XzGe8-i4VLku2-gSayd4vRUP-W2kMI,7531
160
+ data_management/lila/generate_lila_per_image_labels.py,sha256=pZ6WJJmIRvFrypbjE4LP2-jdwGhEiBYdA2FlL7HK5eA,17352
157
161
  data_management/lila/get_lila_annotation_counts.py,sha256=QVSKCmeLzliFZimjzi8AClS0Gz94pDMYckjw2cOm-7E,5490
158
162
  data_management/lila/get_lila_image_counts.py,sha256=r5p2wPL5vuKKO8DWia3Tll-EZZWFNUvax6ljaYtrKsk,3625
159
- data_management/lila/lila_common.py,sha256=vzazQR3UzvRxbxdBvRBcCbQ9pw0DUD3iWjUscV-nUvo,8785
163
+ data_management/lila/lila_common.py,sha256=lR_kW6qz5bqOFiu_Io5Ax4CLbyOH4Rikev6cJXQHob8,7691
160
164
  data_management/lila/test_lila_metadata_urls.py,sha256=jDInoM5WD_EoahR_b5yTjrj6pkiitvj_Kz_1U0uSDzE,3966
161
165
  detection/process_video.py,sha256=wuMoV-DJde_QlTiNAxsRjlDttiLl2e2BiJuyTQBINIE,26825
162
166
  detection/pytorch_detector.py,sha256=WG6Q4KueBoA8lCZCdR2PrgbQAHs3HCO6MF01Ful4tfc,11992
163
167
  detection/run_detector.py,sha256=XmQ4s-B7IlkxJye56y6uvx2vx6Ml3IBTo3Wx0SalO1Q,26036
164
- detection/run_detector_batch.py,sha256=dgPwvEAOTutpuEKE6TCopjj5w9J1Eb9jOvT3lyEmoNc,46937
165
- detection/run_inference_with_yolov5_val.py,sha256=tjHovM8I2YWvDsBcWV0h6hJaAjckTEN7foJ_X6IetIo,33755
166
- detection/run_tiled_inference.py,sha256=mL1WxA4bWEf2TaT3xK-hXjA4_5ABBwfXx9zVbmhaWB4,33930
167
- detection/tf_detector.py,sha256=xOO8kzd-Um2X_sAZyop524LM53nipv5pNx8YueGTJrc,6760
168
- detection/video_utils.py,sha256=70dx6_D9zQhAHatzHA0Bo3LreOJe98A859O243dFIvs,19425
168
+ detection/run_detector_batch.py,sha256=NC_tqgnshlmPijyM61WE1kyfA6SLfNNPQfAYqjhlxz0,47426
169
+ detection/run_inference_with_yolov5_val.py,sha256=ny1aM94U-sjgJWb-cY1y9HG8r7Qx-RJsi9zCWYH_z1w,33975
170
+ detection/run_tiled_inference.py,sha256=SMK6aaeOYZu5Yr3wezW3Pf0Q2TXyf6tHC-19p7854Rc,33931
171
+ detection/tf_detector.py,sha256=p3P5ippLo79jdneXilqEuywUbOjUN79VqksL7ayPWy4,6769
172
+ detection/video_utils.py,sha256=Rp5H7yl2vPgYKctztPGJFNSsrI3m021oh_uuT8SBmvI,19501
169
173
  detection/detector_training/copy_checkpoints.py,sha256=t2c3Q4Pf82tAp_OjSG-veIjRPrX0tJYi-bSQmGL2m4c,1091
170
174
  detection/detector_training/model_main_tf2.py,sha256=YwNsZ7hkIFaEuwKU0rHG_VyqiR_0E01BbdlD0Yx4Smo,4936
171
175
  md_utils/azure_utils.py,sha256=SVoQNSknYlBcpZeGrH2v3Qgm5kXxBrqM5Sx2L_Lax-I,6243
172
- md_utils/ct_utils.py,sha256=CbuSL-XqI5jU9ShxEgnvIKqQF_BzbDPSTULPBmEVAnU,12908
176
+ md_utils/ct_utils.py,sha256=NkxEH5S2qCBcQlqVMgdY07jYU6sOUXPbjDv0GWapca0,13311
173
177
  md_utils/directory_listing.py,sha256=dgxMczSOEH352YXdWRuNo_ujsonRrPJXFeuS7ocpe9k,9615
174
- md_utils/md_tests.py,sha256=FWqv74nBmN5772cSgRxnFZX8zZ3tikwMFr_rhvdV24Y,33316
175
- md_utils/path_utils.py,sha256=g_ASvwJCeN6eGtypuwrSfCxNM7Gx15oeC6TXwJ6yYJc,16573
178
+ md_utils/md_tests.py,sha256=7NQ_c-a4LfDceeHKU3gVr7e94fh7R1pZMLev-925fx8,33520
179
+ md_utils/path_utils.py,sha256=Hsk-Rtx3Y_LRR4rAPNtAP9GBgfWmRkt7tVkLnOhgAFg,23176
176
180
  md_utils/process_utils.py,sha256=YkD38KLgceuqvMvDXIcVyzY51npUuUT3tOAjjF5Mvf8,4316
177
181
  md_utils/sas_blob_utils.py,sha256=GpjHn33N2b-XeBAtU3xhGbTIYcBs4YrXHtbQDmlGFvY,16955
178
182
  md_utils/split_locations_into_train_val.py,sha256=psiWoXkYYLLOfjVHUyOhaa3fh9mmlm7HGFthklWbMaA,9241
179
183
  md_utils/string_utils.py,sha256=Edwa07IWu7-QTNoMmvQYNnYgpwxxNh9VhXQ8AXMX3Qg,1600
180
- md_utils/url_utils.py,sha256=2Ee459ZRQ4Ms-52WRhyiEBICHACKmigrRnYRi6JtCdQ,4593
181
- md_utils/write_html_image_list.py,sha256=VLbeJnrRPm-D-_KFDVAnrU3alrXUr6eOr4WOv4-ugwk,7036
184
+ md_utils/url_utils.py,sha256=4PLqoRLVVN-W_ovcGEEicQ4zb7-Nc5u8sTCtm3qR8CM,6824
185
+ md_utils/write_html_image_list.py,sha256=U4JantMnHe7_aEL5oLOFyz2XvbK34M5ZZ4QVbiA5H98,7532
182
186
  md_visualization/plot_utils.py,sha256=eppaGgI0k73jhvOCruNrNO-VLH3EEFpFP2la_rZo57E,10712
183
187
  md_visualization/render_images_with_thumbnails.py,sha256=XJcL5qxu5pe2LQ4MqnD-O6dM_cPxGGNoqk5U_rZzFUQ,10391
184
- md_visualization/visualization_utils.py,sha256=2OJKG_L70XYCCdhLGmQ5-HD9nCaHisqIJoRGIYb0L1g,35297
185
- md_visualization/visualize_db.py,sha256=x6Y--RazaPvUayEch_Dr10NV0P0C7l0ZB29-vjW5WjI,18931
188
+ md_visualization/visualization_utils.py,sha256=AZyetIxwnAa5eLPPkMvArVCX2ORf6UFJ3Uw39D5mXsY,46496
189
+ md_visualization/visualize_db.py,sha256=fleCCGRBoKkdfBjgt277_EjbidnGI4RcunZosVN5_Ms,19616
186
190
  md_visualization/visualize_detector_output.py,sha256=aeg8DbwfddW5CDe84V2dt07eWMyxr4QdFcwTYbC_Lnk,15814
187
- md_visualization/visualize_megadb.py,sha256=ZHFMgQv-zjXwvyT6gEfLe2BzodvBNfQYEh0b6P_59TE,6188
188
191
  taxonomy_mapping/map_lila_taxonomy_to_wi_taxonomy.py,sha256=kFDp6r25LhYVkyrm-35TgBc2vgXXh6SmoARqO4aE9PU,16517
189
192
  taxonomy_mapping/map_new_lila_datasets.py,sha256=rJlj-HuP9wNN2RvIlcWfqnW5N7cyiGLWglbe3FsFG0Q,4324
190
193
  taxonomy_mapping/prepare_lila_taxonomy_release.py,sha256=Ser_lwpbYR75fMMcE49uT90t7o02dRZ7wY0GUyhzK9c,4357
@@ -195,8 +198,8 @@ taxonomy_mapping/species_lookup.py,sha256=oRqaUbiH_xULH7z5mkrtaFhacxlyM8KT-V-c4F
195
198
  taxonomy_mapping/taxonomy_csv_checker.py,sha256=xmV2SBOfQEuZBMGmXyUzbuNxvd_oXKysXkxU6-IhKJg,4874
196
199
  taxonomy_mapping/taxonomy_graph.py,sha256=ZDm2enGanBlm8KXWvCndqmeerOp9LREaetSl-Lxy07s,12361
197
200
  taxonomy_mapping/validate_lila_category_mappings.py,sha256=CApYVWIZ8TTJ3vvQTgfjIvWDGHpPo-Zn9jqJFaw3DNw,2314
198
- megadetector-5.0.7.dist-info/LICENSE,sha256=RMa3qq-7Cyk7DdtqRj_bP1oInGFgjyHn9-PZ3PcrqIs,1100
199
- megadetector-5.0.7.dist-info/METADATA,sha256=xgK96jYJkxj6kXvCzY3y8HlYb0-Oa44nmfETb2Ba7xI,7513
200
- megadetector-5.0.7.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
201
- megadetector-5.0.7.dist-info/top_level.txt,sha256=-mFGpqnmviVz0Vyr2GxZ_kTo_PBPNoK6h4JtqIMjZGQ,88
202
- megadetector-5.0.7.dist-info/RECORD,,
201
+ megadetector-5.0.8.dist-info/LICENSE,sha256=RMa3qq-7Cyk7DdtqRj_bP1oInGFgjyHn9-PZ3PcrqIs,1100
202
+ megadetector-5.0.8.dist-info/METADATA,sha256=tqdjGFYteHST4x9vGmougFqF76DH8J0Hr-wcyaAEaXg,7383
203
+ megadetector-5.0.8.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
204
+ megadetector-5.0.8.dist-info/top_level.txt,sha256=-mFGpqnmviVz0Vyr2GxZ_kTo_PBPNoK6h4JtqIMjZGQ,88
205
+ megadetector-5.0.8.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: bdist_wheel (0.43.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,183 +0,0 @@
1
- ########
2
- #
3
- # visualize_megadb.py
4
- #
5
- # Create visual previews of images/sequences in MegaDB.
6
- #
7
- ########
8
-
9
- #%% Imports
10
-
11
- import argparse
12
- import json
13
- import os
14
- import sys
15
- from random import shuffle
16
- from multiprocessing.pool import ThreadPool
17
- from functools import partial
18
- import io
19
-
20
- from tqdm import tqdm
21
-
22
- from data_management.megadb.megadb_utils import MegadbUtils
23
- from md_utils.write_html_image_list import write_html_image_list
24
- from md_visualization import visualization_utils as vis_utils
25
-
26
-
27
- #%% Support functions
28
-
29
- def render_image_info(rendering, args):
30
-
31
- storage_client = rendering['storage_client']
32
- image_obj = io.BytesIO()
33
-
34
- try:
35
- storage_client.download_blob(rendering['blob_path']).readinto(image_obj)
36
- except Exception as e:
37
- print(f'Image not found in blob storage: {rendering["blob_path"]}')
38
- print(e)
39
- return
40
-
41
- # resize is for displaying them more quickly
42
- image = vis_utils.resize_image(
43
- vis_utils.open_image(image_obj), args.output_image_width)
44
- vis_utils.render_megadb_bounding_boxes(rendering['bbox'], image)
45
-
46
- annotated_img_name = rendering['annotated_img_name']
47
- annotated_img_path = os.path.join(
48
- args.output_dir, 'rendered_images', annotated_img_name)
49
- image.save(annotated_img_path)
50
-
51
-
52
- def visualize_sequences(datasets_table, sequences, args):
53
-
54
- num_images = 0
55
-
56
- images_html = []
57
- rendering_info = []
58
-
59
- for seq in sequences:
60
- if 'images' not in seq:
61
- continue
62
-
63
- # dataset and seq_id are required fields
64
- dataset_name = seq['dataset']
65
- seq_id = seq['seq_id']
66
-
67
- # sort the images in the sequence
68
-
69
- images_in_seq = sorted(seq['images'], key=lambda x: x['frame_num']) if len(seq['images']) > 1 else seq['images']
70
-
71
- for im in images_in_seq:
72
- if args.trim_to_images_bboxes_labeled and 'bbox' not in im:
73
- continue
74
-
75
- num_images += 1
76
-
77
- blob_path = MegadbUtils.get_full_path(
78
- datasets_table, dataset_name, im['file'])
79
- frame_num = im.get('frame_num', -1)
80
-
81
- # if no class label on the image, show class label on the sequence
82
- im_class = im.get('class', None)
83
- if im_class is None:
84
- im_class = seq.get('class', [])
85
-
86
- rendering = {}
87
- rendering['storage_client'] = MegadbUtils.get_storage_client(
88
- datasets_table, dataset_name)
89
- rendering['blob_path'] = blob_path
90
- rendering['bbox'] = im.get('bbox', [])
91
-
92
- annotated_img_name = 'anno_' + blob_path.replace('/', args.pathsep_replacement).replace('\\', args.pathsep_replacement)
93
- rendering['annotated_img_name'] = annotated_img_name
94
-
95
- rendering_info.append(rendering)
96
-
97
- images_html.append({
98
- 'filename': 'rendered_images/{}'.format(annotated_img_name),
99
- 'title': 'Seq ID: {}. Frame number: {}<br/> Image file: {}<br/> number of boxes: {}, image class labels: {}'.format(seq_id, frame_num, blob_path, len(rendering['bbox']), im_class),
100
- 'textStyle': 'font-family:verdana,arial,calibri;font-size:80%;text-align:left;margin-top:20;margin-bottom:5'
101
- })
102
-
103
- if num_images >= args.num_to_visualize:
104
- print('num_images visualized is {}'.format(num_images))
105
- break
106
-
107
- # pool = ThreadPool()
108
- render_image_info_partial = partial(render_image_info, args=args)
109
- # print('len of rendering_info', len(rendering_info))
110
- # tqdm(pool.imap_unordered(render_image_info_partial, rendering_info), total=len(rendering_info))
111
-
112
- for rendering in tqdm(rendering_info):
113
- render_image_info_partial(rendering)
114
-
115
- print('Making HTML...')
116
-
117
- html_path = os.path.join(args.output_dir, 'index.html')
118
- # options = write_html_image_list()
119
- # options['headerHtml']
120
- write_html_image_list(
121
- filename=html_path,
122
- images=images_html
123
- )
124
-
125
-
126
- #%% Command-line driver
127
-
128
- def main():
129
-
130
- parser = argparse.ArgumentParser()
131
- parser.add_argument(
132
- 'megadb_entries', type=str,
133
- help='Path to a json list of MegaDB entries')
134
- parser.add_argument(
135
- 'output_dir', action='store', type=str,
136
- help='Output directory for html and rendered images')
137
- parser.add_argument(
138
- '--trim_to_images_bboxes_labeled', action='store_true',
139
- help='Only include images that have been sent for bbox labeling (but '
140
- 'may be actually empty). Turn this on if QAing annotations.')
141
- parser.add_argument(
142
- '--num_to_visualize', action='store', type=int, default=200,
143
- help='Number of images to visualize (all comformant images in a '
144
- 'sequence are shown, so may be a few more than specified). '
145
- 'Sequences are shuffled. Default: 200. Use -1 to visualize all.')
146
- parser.add_argument(
147
- '--pathsep_replacement', action='store', type=str, default='~',
148
- help='Replace path separators in relative filenames with another '
149
- 'character (default ~)')
150
- parser.add_argument(
151
- '-w', '--output_image_width', type=int, default=700,
152
- help='an integer indicating the desired width in pixels of the output '
153
- 'annotated images. Use -1 to not resize.')
154
-
155
- if len(sys.argv[1:]) == 0:
156
- parser.print_help()
157
- parser.exit()
158
-
159
- args = parser.parse_args()
160
-
161
- assert 'COSMOS_ENDPOINT' in os.environ and 'COSMOS_KEY' in os.environ
162
-
163
- os.makedirs(args.output_dir, exist_ok=True)
164
- os.makedirs(os.path.join(args.output_dir, 'rendered_images'))
165
-
166
- print('Connecting to MegaDB to get the datasets table...')
167
- megadb_utils = MegadbUtils()
168
- datasets_table = megadb_utils.get_datasets_table()
169
-
170
- print('Loading the MegaDB entries...')
171
- with open(args.megadb_entries) as f:
172
- sequences = json.load(f)
173
- print('Total number of sequences: {}'.format(len(sequences)))
174
-
175
- # print('Checking that the MegaDB entries conform to the schema...')
176
- # sequences_schema_check.sequences_schema_check(sequences)
177
-
178
- shuffle(sequences)
179
- visualize_sequences(datasets_table, sequences, args)
180
-
181
-
182
- if __name__ == '__main__':
183
- main()