megadetector 5.0.27__py3-none-any.whl → 5.0.29__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 (176) hide show
  1. megadetector/api/batch_processing/api_core/batch_service/score.py +4 -5
  2. megadetector/api/batch_processing/api_core_support/aggregate_results_manually.py +1 -1
  3. megadetector/api/batch_processing/api_support/summarize_daily_activity.py +1 -1
  4. megadetector/api/batch_processing/integration/digiKam/xmp_integration.py +2 -2
  5. megadetector/api/batch_processing/integration/eMammal/test_scripts/push_annotations_to_emammal.py +1 -1
  6. megadetector/api/batch_processing/integration/eMammal/test_scripts/select_images_for_testing.py +1 -1
  7. megadetector/api/synchronous/api_core/tests/load_test.py +2 -3
  8. megadetector/classification/aggregate_classifier_probs.py +3 -3
  9. megadetector/classification/analyze_failed_images.py +5 -5
  10. megadetector/classification/cache_batchapi_outputs.py +5 -5
  11. megadetector/classification/create_classification_dataset.py +11 -12
  12. megadetector/classification/crop_detections.py +10 -10
  13. megadetector/classification/csv_to_json.py +8 -8
  14. megadetector/classification/detect_and_crop.py +13 -15
  15. megadetector/classification/evaluate_model.py +7 -7
  16. megadetector/classification/identify_mislabeled_candidates.py +6 -6
  17. megadetector/classification/json_to_azcopy_list.py +1 -1
  18. megadetector/classification/json_validator.py +29 -32
  19. megadetector/classification/map_classification_categories.py +9 -9
  20. megadetector/classification/merge_classification_detection_output.py +12 -9
  21. megadetector/classification/prepare_classification_script.py +19 -19
  22. megadetector/classification/prepare_classification_script_mc.py +23 -23
  23. megadetector/classification/run_classifier.py +4 -4
  24. megadetector/classification/save_mislabeled.py +6 -6
  25. megadetector/classification/train_classifier.py +1 -1
  26. megadetector/classification/train_classifier_tf.py +9 -9
  27. megadetector/classification/train_utils.py +10 -10
  28. megadetector/data_management/annotations/annotation_constants.py +1 -1
  29. megadetector/data_management/camtrap_dp_to_coco.py +45 -45
  30. megadetector/data_management/cct_json_utils.py +101 -101
  31. megadetector/data_management/cct_to_md.py +49 -49
  32. megadetector/data_management/cct_to_wi.py +33 -33
  33. megadetector/data_management/coco_to_labelme.py +75 -75
  34. megadetector/data_management/coco_to_yolo.py +189 -189
  35. megadetector/data_management/databases/add_width_and_height_to_db.py +3 -2
  36. megadetector/data_management/databases/combine_coco_camera_traps_files.py +38 -38
  37. megadetector/data_management/databases/integrity_check_json_db.py +202 -188
  38. megadetector/data_management/databases/subset_json_db.py +33 -33
  39. megadetector/data_management/generate_crops_from_cct.py +38 -38
  40. megadetector/data_management/get_image_sizes.py +54 -49
  41. megadetector/data_management/labelme_to_coco.py +130 -124
  42. megadetector/data_management/labelme_to_yolo.py +78 -72
  43. megadetector/data_management/lila/create_lila_blank_set.py +81 -83
  44. megadetector/data_management/lila/create_lila_test_set.py +32 -31
  45. megadetector/data_management/lila/create_links_to_md_results_files.py +18 -18
  46. megadetector/data_management/lila/download_lila_subset.py +21 -24
  47. megadetector/data_management/lila/generate_lila_per_image_labels.py +91 -91
  48. megadetector/data_management/lila/get_lila_annotation_counts.py +30 -30
  49. megadetector/data_management/lila/get_lila_image_counts.py +22 -22
  50. megadetector/data_management/lila/lila_common.py +70 -70
  51. megadetector/data_management/lila/test_lila_metadata_urls.py +13 -14
  52. megadetector/data_management/mewc_to_md.py +339 -340
  53. megadetector/data_management/ocr_tools.py +258 -252
  54. megadetector/data_management/read_exif.py +232 -223
  55. megadetector/data_management/remap_coco_categories.py +26 -26
  56. megadetector/data_management/remove_exif.py +31 -20
  57. megadetector/data_management/rename_images.py +187 -187
  58. megadetector/data_management/resize_coco_dataset.py +41 -41
  59. megadetector/data_management/speciesnet_to_md.py +41 -41
  60. megadetector/data_management/wi_download_csv_to_coco.py +55 -55
  61. megadetector/data_management/yolo_output_to_md_output.py +117 -120
  62. megadetector/data_management/yolo_to_coco.py +195 -188
  63. megadetector/detection/change_detection.py +831 -0
  64. megadetector/detection/process_video.py +341 -338
  65. megadetector/detection/pytorch_detector.py +308 -266
  66. megadetector/detection/run_detector.py +186 -166
  67. megadetector/detection/run_detector_batch.py +366 -364
  68. megadetector/detection/run_inference_with_yolov5_val.py +328 -325
  69. megadetector/detection/run_tiled_inference.py +312 -253
  70. megadetector/detection/tf_detector.py +24 -24
  71. megadetector/detection/video_utils.py +291 -283
  72. megadetector/postprocessing/add_max_conf.py +15 -11
  73. megadetector/postprocessing/categorize_detections_by_size.py +44 -44
  74. megadetector/postprocessing/classification_postprocessing.py +808 -311
  75. megadetector/postprocessing/combine_batch_outputs.py +20 -21
  76. megadetector/postprocessing/compare_batch_results.py +528 -517
  77. megadetector/postprocessing/convert_output_format.py +97 -97
  78. megadetector/postprocessing/create_crop_folder.py +220 -147
  79. megadetector/postprocessing/detector_calibration.py +173 -168
  80. megadetector/postprocessing/generate_csv_report.py +508 -0
  81. megadetector/postprocessing/load_api_results.py +25 -22
  82. megadetector/postprocessing/md_to_coco.py +129 -98
  83. megadetector/postprocessing/md_to_labelme.py +89 -83
  84. megadetector/postprocessing/md_to_wi.py +40 -40
  85. megadetector/postprocessing/merge_detections.py +87 -114
  86. megadetector/postprocessing/postprocess_batch_results.py +319 -302
  87. megadetector/postprocessing/remap_detection_categories.py +36 -36
  88. megadetector/postprocessing/render_detection_confusion_matrix.py +205 -199
  89. megadetector/postprocessing/repeat_detection_elimination/find_repeat_detections.py +57 -57
  90. megadetector/postprocessing/repeat_detection_elimination/remove_repeat_detections.py +27 -28
  91. megadetector/postprocessing/repeat_detection_elimination/repeat_detections_core.py +702 -677
  92. megadetector/postprocessing/separate_detections_into_folders.py +226 -211
  93. megadetector/postprocessing/subset_json_detector_output.py +265 -262
  94. megadetector/postprocessing/top_folders_to_bottom.py +45 -45
  95. megadetector/postprocessing/validate_batch_results.py +70 -70
  96. megadetector/taxonomy_mapping/map_lila_taxonomy_to_wi_taxonomy.py +52 -52
  97. megadetector/taxonomy_mapping/map_new_lila_datasets.py +15 -15
  98. megadetector/taxonomy_mapping/prepare_lila_taxonomy_release.py +14 -14
  99. megadetector/taxonomy_mapping/preview_lila_taxonomy.py +66 -69
  100. megadetector/taxonomy_mapping/retrieve_sample_image.py +16 -16
  101. megadetector/taxonomy_mapping/simple_image_download.py +8 -8
  102. megadetector/taxonomy_mapping/species_lookup.py +33 -33
  103. megadetector/taxonomy_mapping/taxonomy_csv_checker.py +14 -14
  104. megadetector/taxonomy_mapping/taxonomy_graph.py +11 -11
  105. megadetector/taxonomy_mapping/validate_lila_category_mappings.py +13 -13
  106. megadetector/utils/azure_utils.py +22 -22
  107. megadetector/utils/ct_utils.py +1019 -200
  108. megadetector/utils/directory_listing.py +21 -77
  109. megadetector/utils/gpu_test.py +22 -22
  110. megadetector/utils/md_tests.py +541 -518
  111. megadetector/utils/path_utils.py +1511 -406
  112. megadetector/utils/process_utils.py +41 -41
  113. megadetector/utils/sas_blob_utils.py +53 -49
  114. megadetector/utils/split_locations_into_train_val.py +73 -60
  115. megadetector/utils/string_utils.py +147 -26
  116. megadetector/utils/url_utils.py +463 -173
  117. megadetector/utils/wi_utils.py +2629 -2868
  118. megadetector/utils/write_html_image_list.py +137 -137
  119. megadetector/visualization/plot_utils.py +21 -21
  120. megadetector/visualization/render_images_with_thumbnails.py +37 -73
  121. megadetector/visualization/visualization_utils.py +424 -404
  122. megadetector/visualization/visualize_db.py +197 -190
  123. megadetector/visualization/visualize_detector_output.py +126 -98
  124. {megadetector-5.0.27.dist-info → megadetector-5.0.29.dist-info}/METADATA +6 -3
  125. megadetector-5.0.29.dist-info/RECORD +163 -0
  126. {megadetector-5.0.27.dist-info → megadetector-5.0.29.dist-info}/WHEEL +1 -1
  127. megadetector/data_management/importers/add_nacti_sizes.py +0 -52
  128. megadetector/data_management/importers/add_timestamps_to_icct.py +0 -79
  129. megadetector/data_management/importers/animl_results_to_md_results.py +0 -158
  130. megadetector/data_management/importers/auckland_doc_test_to_json.py +0 -373
  131. megadetector/data_management/importers/auckland_doc_to_json.py +0 -201
  132. megadetector/data_management/importers/awc_to_json.py +0 -191
  133. megadetector/data_management/importers/bellevue_to_json.py +0 -272
  134. megadetector/data_management/importers/cacophony-thermal-importer.py +0 -793
  135. megadetector/data_management/importers/carrizo_shrubfree_2018.py +0 -269
  136. megadetector/data_management/importers/carrizo_trail_cam_2017.py +0 -289
  137. megadetector/data_management/importers/cct_field_adjustments.py +0 -58
  138. megadetector/data_management/importers/channel_islands_to_cct.py +0 -913
  139. megadetector/data_management/importers/eMammal/copy_and_unzip_emammal.py +0 -180
  140. megadetector/data_management/importers/eMammal/eMammal_helpers.py +0 -249
  141. megadetector/data_management/importers/eMammal/make_eMammal_json.py +0 -223
  142. megadetector/data_management/importers/ena24_to_json.py +0 -276
  143. megadetector/data_management/importers/filenames_to_json.py +0 -386
  144. megadetector/data_management/importers/helena_to_cct.py +0 -283
  145. megadetector/data_management/importers/idaho-camera-traps.py +0 -1407
  146. megadetector/data_management/importers/idfg_iwildcam_lila_prep.py +0 -294
  147. megadetector/data_management/importers/import_desert_lion_conservation_camera_traps.py +0 -387
  148. megadetector/data_management/importers/jb_csv_to_json.py +0 -150
  149. megadetector/data_management/importers/mcgill_to_json.py +0 -250
  150. megadetector/data_management/importers/missouri_to_json.py +0 -490
  151. megadetector/data_management/importers/nacti_fieldname_adjustments.py +0 -79
  152. megadetector/data_management/importers/noaa_seals_2019.py +0 -181
  153. megadetector/data_management/importers/osu-small-animals-to-json.py +0 -364
  154. megadetector/data_management/importers/pc_to_json.py +0 -365
  155. megadetector/data_management/importers/plot_wni_giraffes.py +0 -123
  156. megadetector/data_management/importers/prepare_zsl_imerit.py +0 -131
  157. megadetector/data_management/importers/raic_csv_to_md_results.py +0 -416
  158. megadetector/data_management/importers/rspb_to_json.py +0 -356
  159. megadetector/data_management/importers/save_the_elephants_survey_A.py +0 -320
  160. megadetector/data_management/importers/save_the_elephants_survey_B.py +0 -329
  161. megadetector/data_management/importers/snapshot_safari_importer.py +0 -758
  162. megadetector/data_management/importers/snapshot_serengeti_lila.py +0 -1067
  163. megadetector/data_management/importers/snapshotserengeti/make_full_SS_json.py +0 -150
  164. megadetector/data_management/importers/snapshotserengeti/make_per_season_SS_json.py +0 -153
  165. megadetector/data_management/importers/sulross_get_exif.py +0 -65
  166. megadetector/data_management/importers/timelapse_csv_set_to_json.py +0 -490
  167. megadetector/data_management/importers/ubc_to_json.py +0 -399
  168. megadetector/data_management/importers/umn_to_json.py +0 -507
  169. megadetector/data_management/importers/wellington_to_json.py +0 -263
  170. megadetector/data_management/importers/wi_to_json.py +0 -442
  171. megadetector/data_management/importers/zamba_results_to_md_results.py +0 -180
  172. megadetector/data_management/lila/add_locations_to_island_camera_traps.py +0 -101
  173. megadetector/data_management/lila/add_locations_to_nacti.py +0 -151
  174. megadetector-5.0.27.dist-info/RECORD +0 -208
  175. {megadetector-5.0.27.dist-info → megadetector-5.0.29.dist-info}/licenses/LICENSE +0 -0
  176. {megadetector-5.0.27.dist-info → megadetector-5.0.29.dist-info}/top_level.txt +0 -0
@@ -2,7 +2,7 @@
2
2
 
3
3
  directory_listing.py
4
4
 
5
- Script for creating Apache-style HTML directory listings for a local directory
5
+ Script for creating Apache-style HTML directory listings for a local directory
6
6
  and all its subdirectories.
7
7
 
8
8
  Also includes a preview of a jpg file (the first in an alphabetical list),
@@ -15,7 +15,6 @@ if present.
15
15
  import os
16
16
  import sys
17
17
  import argparse
18
- import re
19
18
 
20
19
  from megadetector.utils.path_utils import is_image_file
21
20
 
@@ -24,7 +23,7 @@ from megadetector.utils.path_utils import is_image_file
24
23
 
25
24
  def create_plain_index(root, dirs, files, dirname=None):
26
25
  """
27
- Creates the fairly plain HTML folder index including a preview of a single image file,
26
+ Creates the fairly plain HTML folder index including a preview of a single image file,
28
27
  if any is present.
29
28
 
30
29
  Args:
@@ -32,10 +31,10 @@ def create_plain_index(root, dirs, files, dirname=None):
32
31
  [files] are relative to this root folder
33
32
  dirs (list): list of strings, the directories in [root]
34
33
  files (list): list of strings, the files in [root]
35
- dirname (str, optional): name to print in the html,
34
+ dirname (str, optional): name to print in the html,
36
35
  which may be different than [root]
37
36
 
38
- Returns:
37
+ Returns:
39
38
  str: HTML source of the directory listing
40
39
  """
41
40
 
@@ -67,7 +66,8 @@ def create_plain_index(root, dirs, files, dirname=None):
67
66
  # jpg_file_sizes = [os.path.getsize(f) for f in jpg_files]
68
67
  # largest_file_index = max(range(len(jpg_files)), key=lambda x: jpg_file_sizes[x])
69
68
 
70
- html += "<a href='{0}'><img style='height:200px; float:right;' src='{0}' alt='Preview image'></a>\n".format(jpg_files[0])
69
+ html += "<a href='{0}'><img style='height:200px; float:right;' src='{0}' alt='Preview image'></a>\n".\
70
+ format(jpg_files[0])
71
71
  else:
72
72
  html += "\n"
73
73
  # html += "<p style='width:15em; float:right; margin:0;'>[No preview available]</p>\n"
@@ -107,8 +107,10 @@ def create_plain_index(root, dirs, files, dirname=None):
107
107
  # ...def create_plain_index(...)
108
108
 
109
109
 
110
- def traverse_and_create_index(dir, sas_url=None, overwrite_files=False,
111
- template_fun=create_plain_index, basepath=None):
110
+ def traverse_and_create_index(dir,
111
+ overwrite_files=False,
112
+ template_fun=create_plain_index,
113
+ basepath=None):
112
114
  """
113
115
  Recursively traverses the local directory [dir] and generates a index
114
116
  file for each folder using [template_fun] to generate the HTML output.
@@ -116,13 +118,9 @@ def traverse_and_create_index(dir, sas_url=None, overwrite_files=False,
116
118
 
117
119
  Args:
118
120
  dir (str): directory to process
119
- sas_url (str, optional): write-capable SAS URL that points to the same place as
120
- [dir], used for the very esoteric scenario where [dir] is really a mounted
121
- blob container, and we want to set the content-type on each file so the resulting
122
- index can be viewed in a browser
123
121
  overwrite_files (bool, optional): whether to over-write existing index file
124
- template_fun (func, optional): function taking three arguments (string,
125
- list of string, list of string) representing the current root, the list of folders,
122
+ template_fun (func, optional): function taking three arguments (string,
123
+ list of string, list of string) representing the current root, the list of folders,
126
124
  and the list of files. Should return the HTML source of the index file.
127
125
  basepath (str, optional): if not None, the name used for each subfolder in [dir]
128
126
  in the output files will be relative to [basepath]
@@ -133,40 +131,6 @@ def traverse_and_create_index(dir, sas_url=None, overwrite_files=False,
133
131
  # Make sure we remove the trailing /
134
132
  dir = os.path.normpath(dir)
135
133
 
136
- # If we want to set the content type in blob storage using a SAS URL
137
- if sas_url:
138
-
139
- from azure.storage.blob import BlobServiceClient, ContentSettings
140
-
141
- # Example: sas_url = 'https://accname.blob.core.windows.net/bname/path/to/folder?st=...&se=...&sp=...&...'
142
- if '?' in sas_url:
143
- # 'https://accname.blob.core.windows.net/bname/path/to/folder' and 'st=...&se=...&sp=...&...'
144
- base_url, sas_token = sas_url.split('?', 1)
145
- else:
146
- # 'https://accname.blob.core.windows.net/bname/path/to/folder' and None
147
- base_url, sas_token = sas_url, None
148
- # Remove https:// from base url
149
- # 'accname.blob.core.windows.net/bname/path/to/folder'
150
- base_url = base_url.split("//", 1)[1]
151
- # Everything up to the first dot is account name
152
- # 'accname'
153
- account_name = base_url.split(".", 1)[0]
154
- # get everything after the first /
155
- # 'bname/path/to/folder'
156
- query_string = base_url.split("/", 1)[1]
157
- # Get container name and subfolder
158
- if '/' in query_string:
159
- # 'bname', 'path/to/folder'
160
- container_name, container_folder = query_string.split("/", 1)
161
- else:
162
- container_name, container_folder = query_string, ''
163
-
164
- # Prepare the storage access
165
- target_settings = ContentSettings(content_type='text/html')
166
- blob_service = BlobServiceClient(
167
- account_url=f'{account_name}.blob.core.windows.net',
168
- credential=sas_token)
169
-
170
134
  # Traverse directory and all sub directories, excluding hidden files
171
135
  for root, dirs, files in os.walk(dir):
172
136
 
@@ -193,40 +157,20 @@ def traverse_and_create_index(dir, sas_url=None, overwrite_files=False,
193
157
  with open(output_file, 'wt') as fi:
194
158
  fi.write(html)
195
159
 
196
- # Set content type in blob storage
197
- if sas_url:
198
- import azure.common
199
- if container_folder:
200
- output_blob_path = container_folder + '/' + output_file[len(dir) + 1:]
201
- else:
202
- output_blob_path = output_file[len(dir) + 1:]
203
- try:
204
- blob_client = blob_service.get_blob_client(container_name, output_blob_path)
205
- blob_client.set_http_headers(content_settings=target_settings)
206
- except azure.common.AzureMissingResourceHttpError:
207
- print('ERROR: It seems the SAS URL is incorrect or does not allow setting properties.')
208
- return
209
-
210
160
  # ...def traverse_and_create_index(...)
211
161
 
212
162
 
213
163
  #%% Command-line driver
214
164
 
215
- def main():
216
-
165
+ def main(): # noqa
166
+
217
167
  parser = argparse.ArgumentParser()
218
-
219
- parser.add_argument("directory", type=str,
168
+
169
+ parser.add_argument("directory", type=str,
220
170
  help='Path to directory which should be traversed.')
221
- parser.add_argument("--basepath", type=str,
222
- help='Folder names will be printed relative to basepath, if specified',
171
+ parser.add_argument("--basepath", type=str,
172
+ help='Folder names will be printed relative to basepath, if specified',
223
173
  default=None)
224
- parser.add_argument("--sas_url", type=str,
225
- help='Blobfuse does not set the content-type property ' + \
226
- 'properly and hence index.html won\'t be accessible in the browser. If you want to set the ' + \
227
- 'content-type in the corresponding blob storage, provide the SAS URL that corresponds to the ' + \
228
- 'directory, e.g. if *directory* is /mountpoint/path/to/folder, then *--sas_url* looks like ' + \
229
- '"https://accname.blob.core.windows.net/bname/path/to/folder?st=...&se=...&sp=...&..."')
230
174
  parser.add_argument("--enable_overwrite", action='store_true', default=False,
231
175
  help='If set, the script will overwrite existing index.html files.')
232
176
 
@@ -237,10 +181,10 @@ def main():
237
181
  args = parser.parse_args()
238
182
 
239
183
  assert os.path.isdir(args.directory), "{} is not a valid directory".format(args.directory)
240
- assert re.match(r'https?://[^\.]+\.blob\.core\.windows\.net/.+', args.sas_url), "--sas_url does not " + \
241
- "match the format https://accname.blob.core.windows.net/bname/path/to/folder?..."
242
184
 
243
- traverse_and_create_index(args.directory, overwrite_files=args.enable_overwrite, sas_url=args.sas_url, basepath=args.basepath)
185
+ traverse_and_create_index(args.directory,
186
+ overwrite_files=args.enable_overwrite,
187
+ basepath=args.basepath)
244
188
 
245
189
  if __name__ == '__main__':
246
190
  main()
@@ -17,18 +17,18 @@ try:
17
17
  except Exception:
18
18
  pass
19
19
 
20
-
20
+
21
21
  #%% Torch/TF test functions
22
22
 
23
23
  def torch_test():
24
24
  """
25
25
  Print diagnostic information about Torch/CUDA status, including Torch/CUDA versions
26
26
  and all available CUDA device names.
27
-
27
+
28
28
  Returns:
29
29
  int: The number of CUDA devices reported by PyTorch.
30
30
  """
31
-
31
+
32
32
  try:
33
33
  import torch
34
34
  except Exception as e: #noqa
@@ -43,11 +43,11 @@ def torch_test():
43
43
  print('CuDNN version (according to PyTorch): {}'.format(torch.backends.cudnn.version()))
44
44
 
45
45
  device_ids = list(range(torch.cuda.device_count()))
46
-
47
- if len(device_ids) > 0:
46
+
47
+ if len(device_ids) > 0:
48
48
  cuda_str = 'Found {} CUDA devices:'.format(len(device_ids))
49
49
  print(cuda_str)
50
-
50
+
51
51
  for device_id in device_ids:
52
52
  device_name = 'unknown'
53
53
  try:
@@ -57,33 +57,33 @@ def torch_test():
57
57
  print('{}: {}'.format(device_id,device_name))
58
58
  else:
59
59
  print('No GPUs reported by PyTorch')
60
-
60
+
61
61
  try:
62
62
  if torch.backends.mps.is_built and torch.backends.mps.is_available():
63
63
  print('PyTorch reports that Metal Performance Shaders are available')
64
64
  except Exception:
65
- pass
65
+ pass
66
66
  return len(device_ids)
67
67
 
68
68
 
69
69
  def tf_test():
70
70
  """
71
71
  Print diagnostic information about TF/CUDA status.
72
-
72
+
73
73
  Returns:
74
- int: The number of CUDA devices reported by PyTorch.
74
+ int: The number of CUDA devices reported by PyTorch.
75
75
  """
76
-
76
+
77
77
  try:
78
78
  import tensorflow as tf
79
79
  except Exception as e: #noqa
80
80
  print('TensorFlow unavailable, not running TF tests. TF import error was:\n{}'.format(
81
81
  str(e)))
82
82
  return
83
-
83
+
84
84
  from tensorflow.python.platform import build_info as build
85
85
  print(f"TF version: {tf.__version__}")
86
-
86
+
87
87
  if 'cuda_version' not in build.build_info:
88
88
  print('TF does not appear to be built with CUDA')
89
89
  else:
@@ -98,28 +98,28 @@ def tf_test():
98
98
  print("Linked TensorRT version: {}".format(trt.trt_utils._pywrap_py_utils.get_linked_tensorrt_version()))
99
99
  except Exception:
100
100
  print('Could not probe TensorRT version')
101
-
101
+
102
102
  gpus = tf.config.list_physical_devices('GPU')
103
103
  if gpus is None:
104
104
  gpus = []
105
-
105
+
106
106
  if len(gpus) > 0:
107
107
  print('TensorFlow found the following GPUs:')
108
108
  for gpu in gpus:
109
109
  print(gpu.name)
110
-
110
+
111
111
  else:
112
112
  print('No GPUs reported by TensorFlow')
113
-
113
+
114
114
  return len(gpus)
115
-
115
+
116
116
 
117
117
  #%% Command-line driver
118
-
119
- if __name__ == '__main__':
120
-
118
+
119
+ if __name__ == '__main__':
120
+
121
121
  print('*** Running Torch tests ***\n')
122
122
  torch_test()
123
-
123
+
124
124
  print('\n*** Running TF tests ***\n')
125
125
  tf_test()