megadetector 5.0.13__py3-none-any.whl → 5.0.15__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.
- megadetector/data_management/read_exif.py +11 -5
- megadetector/detection/process_video.py +230 -70
- megadetector/detection/pytorch_detector.py +16 -11
- megadetector/detection/run_detector.py +17 -5
- megadetector/detection/run_detector_batch.py +186 -67
- megadetector/detection/tf_detector.py +11 -3
- megadetector/detection/video_utils.py +177 -43
- megadetector/postprocessing/convert_output_format.py +12 -5
- megadetector/utils/md_tests.py +279 -108
- megadetector/utils/path_utils.py +38 -6
- megadetector/utils/process_utils.py +8 -2
- megadetector/visualization/visualization_utils.py +7 -2
- megadetector/visualization/visualize_detector_output.py +0 -1
- {megadetector-5.0.13.dist-info → megadetector-5.0.15.dist-info}/METADATA +1 -1
- {megadetector-5.0.13.dist-info → megadetector-5.0.15.dist-info}/RECORD +18 -18
- {megadetector-5.0.13.dist-info → megadetector-5.0.15.dist-info}/LICENSE +0 -0
- {megadetector-5.0.13.dist-info → megadetector-5.0.15.dist-info}/WHEEL +0 -0
- {megadetector-5.0.13.dist-info → megadetector-5.0.15.dist-info}/top_level.txt +0 -0
megadetector/utils/path_utils.py
CHANGED
|
@@ -733,9 +733,13 @@ def _get_file_size(filename,verbose=False):
|
|
|
733
733
|
return (filename,size)
|
|
734
734
|
|
|
735
735
|
|
|
736
|
-
def parallel_get_file_sizes(filenames,
|
|
737
|
-
|
|
738
|
-
|
|
736
|
+
def parallel_get_file_sizes(filenames,
|
|
737
|
+
max_workers=16,
|
|
738
|
+
use_threads=True,
|
|
739
|
+
verbose=False,
|
|
740
|
+
recursive=True,
|
|
741
|
+
convert_slashes=True,
|
|
742
|
+
return_relative_paths=False):
|
|
739
743
|
"""
|
|
740
744
|
Returns a dictionary mapping every file in [filenames] to the corresponding file size,
|
|
741
745
|
or None for errors. If [filenames] is a folder, will enumerate the folder (optionally recursively).
|
|
@@ -748,6 +752,9 @@ def parallel_get_file_sizes(filenames, max_workers=16,
|
|
|
748
752
|
parallel copying; ignored if max_workers <= 1
|
|
749
753
|
verbose (bool, optional): enable additionald debug output
|
|
750
754
|
recursive (bool, optional): enumerate recursively, only relevant if [filenames] is a folder.
|
|
755
|
+
convert_slashes (bool, optional): convert backslashes to forward slashes
|
|
756
|
+
return_relative_paths (bool, optional): return relative paths; only relevant if [filenames]
|
|
757
|
+
is a folder.
|
|
751
758
|
|
|
752
759
|
Returns:
|
|
753
760
|
dict: dictionary mapping filenames to file sizes in bytes
|
|
@@ -755,20 +762,45 @@ def parallel_get_file_sizes(filenames, max_workers=16,
|
|
|
755
762
|
|
|
756
763
|
n_workers = min(max_workers,len(filenames))
|
|
757
764
|
|
|
765
|
+
folder_name = None
|
|
766
|
+
|
|
767
|
+
if verbose:
|
|
768
|
+
print('Enumerating files')
|
|
769
|
+
|
|
758
770
|
if isinstance(filenames,str) and os.path.isdir(filenames):
|
|
771
|
+
|
|
772
|
+
folder_name = filenames
|
|
773
|
+
|
|
774
|
+
# Enumerate absolute paths here, we'll convert to relative later if requested
|
|
759
775
|
filenames = recursive_file_list(filenames,recursive=recursive,return_relative_paths=False)
|
|
776
|
+
|
|
777
|
+
if verbose:
|
|
778
|
+
print('Creating worker pool')
|
|
760
779
|
|
|
761
780
|
if use_threads:
|
|
781
|
+
pool_string = 'thread'
|
|
762
782
|
pool = ThreadPool(n_workers)
|
|
763
783
|
else:
|
|
784
|
+
pool_string = 'process'
|
|
764
785
|
pool = Pool(n_workers)
|
|
765
786
|
|
|
766
|
-
|
|
787
|
+
if verbose:
|
|
788
|
+
print('Created a {} pool of {} workers'.format(
|
|
789
|
+
pool_string,n_workers))
|
|
790
|
+
|
|
791
|
+
# This returns (filename,size) tuples
|
|
792
|
+
get_size_results = list(tqdm(pool.imap(
|
|
767
793
|
partial(_get_file_size,verbose=verbose),filenames), total=len(filenames)))
|
|
768
794
|
|
|
769
795
|
to_return = {}
|
|
770
|
-
for r in
|
|
771
|
-
|
|
796
|
+
for r in get_size_results:
|
|
797
|
+
fn = r[0]
|
|
798
|
+
if return_relative_paths and (folder_name is not None):
|
|
799
|
+
fn = os.path.relpath(fn,folder_name)
|
|
800
|
+
if convert_slashes:
|
|
801
|
+
fn = fn.replace('\\','/')
|
|
802
|
+
size = r[1]
|
|
803
|
+
to_return[fn] = size
|
|
772
804
|
|
|
773
805
|
return to_return
|
|
774
806
|
|
|
@@ -60,7 +60,8 @@ def execute(cmd,encoding=None,errors=None,env=None,verbose=False):
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
def execute_and_print(cmd,print_output=True,encoding=None,errors=None,
|
|
63
|
-
env=None,verbose=False,catch_exceptions=True
|
|
63
|
+
env=None,verbose=False,catch_exceptions=True,
|
|
64
|
+
echo_command=False):
|
|
64
65
|
"""
|
|
65
66
|
Run [cmd] (a single string) in a shell, capturing and printing output. Returns
|
|
66
67
|
a dictionary with fields "status" and "output".
|
|
@@ -77,12 +78,17 @@ def execute_and_print(cmd,print_output=True,encoding=None,errors=None,
|
|
|
77
78
|
errors (str, optional): error handling, see Popen() documentation
|
|
78
79
|
env (dict, optional): environment variables, see Popen() documentation
|
|
79
80
|
verbose (bool, optional): enable additional debug console output
|
|
80
|
-
|
|
81
|
+
catch_exceptions (bool, optional): catch exceptions and include in the output, otherwise raise
|
|
82
|
+
echo_command (bool, optional): print the command before executing
|
|
83
|
+
|
|
81
84
|
Returns:
|
|
82
85
|
dict: a dictionary with fields "status" (the process return code) and "output"
|
|
83
86
|
(the content of stdout)
|
|
84
87
|
"""
|
|
85
88
|
|
|
89
|
+
if echo_command:
|
|
90
|
+
print('Running command:\n{}\n'.format(cmd))
|
|
91
|
+
|
|
86
92
|
to_return = {'status':'unknown','output':''}
|
|
87
93
|
output = []
|
|
88
94
|
try:
|
|
@@ -1457,7 +1457,8 @@ def parallel_check_image_integrity(filenames,
|
|
|
1457
1457
|
modes=None,
|
|
1458
1458
|
max_workers=16,
|
|
1459
1459
|
use_threads=True,
|
|
1460
|
-
recursive=True
|
|
1460
|
+
recursive=True,
|
|
1461
|
+
verbose=False):
|
|
1461
1462
|
"""
|
|
1462
1463
|
Check whether we can successfully load a list of images via OpenCV and/or PIL.
|
|
1463
1464
|
|
|
@@ -1470,6 +1471,7 @@ def parallel_check_image_integrity(filenames,
|
|
|
1470
1471
|
parallelization
|
|
1471
1472
|
recursive (bool, optional): if [filenames] is a folder, whether to search recursively for images.
|
|
1472
1473
|
Ignored if [filenames] is a list.
|
|
1474
|
+
verbose (bool, optional): enable additional debug output
|
|
1473
1475
|
|
|
1474
1476
|
Returns:
|
|
1475
1477
|
list: a list of dicts, each with a key called 'file' (the value of [filename]), one key for
|
|
@@ -1480,9 +1482,12 @@ def parallel_check_image_integrity(filenames,
|
|
|
1480
1482
|
n_workers = min(max_workers,len(filenames))
|
|
1481
1483
|
|
|
1482
1484
|
if isinstance(filenames,str) and os.path.isdir(filenames):
|
|
1485
|
+
if verbose:
|
|
1486
|
+
print('Enumerating images in {}'.format(filenames))
|
|
1483
1487
|
filenames = find_images(filenames,recursive=recursive,return_relative_paths=False)
|
|
1484
1488
|
|
|
1485
|
-
|
|
1489
|
+
if verbose:
|
|
1490
|
+
print('Checking image integrity for {} filenames'.format(len(filenames)))
|
|
1486
1491
|
|
|
1487
1492
|
if n_workers <= 1:
|
|
1488
1493
|
|
|
@@ -174,7 +174,6 @@ def visualize_detector_output(detector_output_path,
|
|
|
174
174
|
f'Confidence threshold {confidence_threshold} is invalid, must be in (0, 1).')
|
|
175
175
|
|
|
176
176
|
if 'detection_categories' in detector_output:
|
|
177
|
-
print('Using custom label mapping')
|
|
178
177
|
detector_label_map = detector_output['detection_categories']
|
|
179
178
|
else:
|
|
180
179
|
detector_label_map = DEFAULT_DETECTOR_LABEL_MAP
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: megadetector
|
|
3
|
-
Version: 5.0.
|
|
3
|
+
Version: 5.0.15
|
|
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>
|
|
@@ -63,7 +63,7 @@ megadetector/data_management/get_image_sizes.py,sha256=2b6arj4gvoN-9f61lC3t1zAFF
|
|
|
63
63
|
megadetector/data_management/labelme_to_coco.py,sha256=8RUXALXbLpmS7UYUet4BAe9JVSDW7ojwDDpxYs072ZI,21231
|
|
64
64
|
megadetector/data_management/labelme_to_yolo.py,sha256=dRePSOwU_jiCr0EakDQCz1Ct-ZHDxDglUk4HbM1LfWc,10034
|
|
65
65
|
megadetector/data_management/ocr_tools.py,sha256=T9ClY3B-blnK3-UF1vpVdageknYsykm_6FAfqn0kliU,32529
|
|
66
|
-
megadetector/data_management/read_exif.py,sha256
|
|
66
|
+
megadetector/data_management/read_exif.py,sha256=-q0NqJ3VZSBovD_d6de-s3UR2NuKF6gSw2etfvVuRO4,27866
|
|
67
67
|
megadetector/data_management/remap_coco_categories.py,sha256=xXWv0QhTjkUfc9RKtAZanK77HMSq_21mFg_34KFD6hw,2903
|
|
68
68
|
megadetector/data_management/remove_exif.py,sha256=9YwMUliszhVzkkUcotpRKA-a3h5WdQF1taQ594Bgm60,1666
|
|
69
69
|
megadetector/data_management/rename_images.py,sha256=AG3YIxXEYdGmK4G-rv0_XZIylPqOZpS6gfEkydF6oDg,6918
|
|
@@ -135,14 +135,14 @@ megadetector/data_management/lila/get_lila_image_counts.py,sha256=UxXS5RDnSA_Wbx
|
|
|
135
135
|
megadetector/data_management/lila/lila_common.py,sha256=IEnGoyRgcqbek1qJ1gFE83p1Pg_5kaMS-nQI25lRWIs,10132
|
|
136
136
|
megadetector/data_management/lila/test_lila_metadata_urls.py,sha256=2zKNjgqC3kxdFfyvQC3KTlpc9lf2iMzecHQBf--r_Tk,4438
|
|
137
137
|
megadetector/detection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
138
|
-
megadetector/detection/process_video.py,sha256=
|
|
139
|
-
megadetector/detection/pytorch_detector.py,sha256=
|
|
140
|
-
megadetector/detection/run_detector.py,sha256=
|
|
141
|
-
megadetector/detection/run_detector_batch.py,sha256=
|
|
138
|
+
megadetector/detection/process_video.py,sha256=xV24TWlQ0ImN21DCPkLs7y3oUOP7cjmyrFD0PFzzhsY,42713
|
|
139
|
+
megadetector/detection/pytorch_detector.py,sha256=p70kAX5pqU4SO4GjYJmzbTPV4tKUp5WRapOs7vgSKes,13885
|
|
140
|
+
megadetector/detection/run_detector.py,sha256=biXbeS8aNDlidilxjzhZ-p4_wr2ID-rpsRklbNEd7ME,30094
|
|
141
|
+
megadetector/detection/run_detector_batch.py,sha256=nplmaxOcEe_vnS3VrUd49uZoCQNRmJQmbSMpi8uhh8k,57064
|
|
142
142
|
megadetector/detection/run_inference_with_yolov5_val.py,sha256=u9i1ndwl_k0DsiAWYQcYrrrB9D9Wt56_k6iGTAetUaM,46786
|
|
143
143
|
megadetector/detection/run_tiled_inference.py,sha256=vw0713eNuMiEOjHfweQl58zPHNxPOMdFWZ8bTDLhlMY,37883
|
|
144
|
-
megadetector/detection/tf_detector.py,sha256=-
|
|
145
|
-
megadetector/detection/video_utils.py,sha256=
|
|
144
|
+
megadetector/detection/tf_detector.py,sha256=-vcBuYRRLKumUj6imcDYgCgClGji0a21uMjoUAtY3yw,8104
|
|
145
|
+
megadetector/detection/video_utils.py,sha256=DNEW10EgWN5ZiJg9uRpxxfJLuBX9Ts2l0eJ66F9kmmw,32474
|
|
146
146
|
megadetector/detection/detector_training/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
147
147
|
megadetector/detection/detector_training/model_main_tf2.py,sha256=YwNsZ7hkIFaEuwKU0rHG_VyqiR_0E01BbdlD0Yx4Smo,4936
|
|
148
148
|
megadetector/postprocessing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -151,7 +151,7 @@ megadetector/postprocessing/categorize_detections_by_size.py,sha256=YdapcvjA6Dz2
|
|
|
151
151
|
megadetector/postprocessing/classification_postprocessing.py,sha256=8uvlA0Gc8nakM5IE5Pud7WZfmF5kEhcYvxgQXcI9kl0,30429
|
|
152
152
|
megadetector/postprocessing/combine_api_outputs.py,sha256=xCJHEKca8YW-mupEr0yNNwwSBeL9NvcV1w3VtEzN4lk,8535
|
|
153
153
|
megadetector/postprocessing/compare_batch_results.py,sha256=7O5c6-JsIDpuIGobks_R9j8MPuiZQRnEtNnJQsJqICM,38918
|
|
154
|
-
megadetector/postprocessing/convert_output_format.py,sha256=
|
|
154
|
+
megadetector/postprocessing/convert_output_format.py,sha256=HwThfK76UPEAGa3KQbJ_tMKIrUvJ3JhKoQVWJt9dPBk,15447
|
|
155
155
|
megadetector/postprocessing/load_api_results.py,sha256=FqcaiPMuqTojZOV3Jn14pJESpuwjWGbZtcvJuVXUaDM,6861
|
|
156
156
|
megadetector/postprocessing/md_to_coco.py,sha256=t8zHN3QmwxuvcQKxLd_yMSjwncxy7YEoq2EGr0kwBDs,11049
|
|
157
157
|
megadetector/postprocessing/md_to_labelme.py,sha256=hejMKVxaz_xdtsGDPTQkeWuis7gzT-VOrL2Qf8ym1x0,11703
|
|
@@ -180,9 +180,9 @@ megadetector/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
|
180
180
|
megadetector/utils/azure_utils.py,sha256=0BdnkG2hW-X0yFpsJqmBhOd2wysz_LvhuyImPJMVPJs,6271
|
|
181
181
|
megadetector/utils/ct_utils.py,sha256=RTMc0UszYuW9QpMo-qetaWder1mFWIzkMLL2UM6PYdY,17960
|
|
182
182
|
megadetector/utils/directory_listing.py,sha256=r4rg2xA4O9ZVxVtzPZzXIXa0DOEukAJMTTNcNSiQcuM,9668
|
|
183
|
-
megadetector/utils/md_tests.py,sha256=
|
|
184
|
-
megadetector/utils/path_utils.py,sha256=
|
|
185
|
-
megadetector/utils/process_utils.py,sha256=
|
|
183
|
+
megadetector/utils/md_tests.py,sha256=mtjxQ_dQYBgo8OOVta5JrPhuDMT1ZNh0S-OQXRocBEM,51236
|
|
184
|
+
megadetector/utils/path_utils.py,sha256=Uj_aNvA_P0buq-3ebQLZz-6to8mNO5JyBhD7n1-pUoU,37149
|
|
185
|
+
megadetector/utils/process_utils.py,sha256=2SdFVxqob-YUW2BTjUEavNuRH3jA4V05fbKMtrVSd3c,5635
|
|
186
186
|
megadetector/utils/sas_blob_utils.py,sha256=k76EcMmJc_otrEHcfV2fxAC6fNhxU88FxM3ddSYrsKU,16917
|
|
187
187
|
megadetector/utils/split_locations_into_train_val.py,sha256=jvaDu1xKB51L3Xq2nXQo0XtXRjNRf8RglBApl1g6gHo,10101
|
|
188
188
|
megadetector/utils/string_utils.py,sha256=ZQapJodzvTDyQhjZgMoMl3-9bqnKAUlORpws8Db9AkA,2050
|
|
@@ -191,11 +191,11 @@ megadetector/utils/write_html_image_list.py,sha256=apzoWkgZWG-ybCT4k92PlS4-guN_s
|
|
|
191
191
|
megadetector/visualization/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
192
192
|
megadetector/visualization/plot_utils.py,sha256=lOfU3uPrcuHZagV_1SN8erT8PujIepocgw6KZ17Ej6c,10671
|
|
193
193
|
megadetector/visualization/render_images_with_thumbnails.py,sha256=kgJYW8BsqRO4C7T3sqItdBuSkZ64I1vOtIWAsVG4XBI,10589
|
|
194
|
-
megadetector/visualization/visualization_utils.py,sha256=
|
|
194
|
+
megadetector/visualization/visualization_utils.py,sha256=jWiXlLpmWh_CH2vApZURclOC7fdip1aKWQ66wuNabyA,62369
|
|
195
195
|
megadetector/visualization/visualize_db.py,sha256=3FhOtn3GHvNsomwSpsSEzYe58lF9B4Ob3MEi_xplrdo,21256
|
|
196
|
-
megadetector/visualization/visualize_detector_output.py,sha256=
|
|
197
|
-
megadetector-5.0.
|
|
198
|
-
megadetector-5.0.
|
|
199
|
-
megadetector-5.0.
|
|
200
|
-
megadetector-5.0.
|
|
201
|
-
megadetector-5.0.
|
|
196
|
+
megadetector/visualization/visualize_detector_output.py,sha256=LY8QgDWpWlXVLZJUskvT29CdkNvIlEsFTk4DC_lS6pk,17052
|
|
197
|
+
megadetector-5.0.15.dist-info/LICENSE,sha256=RMa3qq-7Cyk7DdtqRj_bP1oInGFgjyHn9-PZ3PcrqIs,1100
|
|
198
|
+
megadetector-5.0.15.dist-info/METADATA,sha256=E3ZvrTIEHvAVmogrd9wXYmYgvHBo9YsFmIb6-I9uEb0,7893
|
|
199
|
+
megadetector-5.0.15.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
200
|
+
megadetector-5.0.15.dist-info/top_level.txt,sha256=wf9DXa8EwiOSZ4G5IPjakSxBPxTDjhYYnqWRfR-zS4M,13
|
|
201
|
+
megadetector-5.0.15.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|