megadetector 5.0.22__py3-none-any.whl → 5.0.24__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/api/synchronous/api_core/animal_detection_api/api_backend.py +2 -3
- megadetector/classification/merge_classification_detection_output.py +2 -2
- megadetector/data_management/coco_to_labelme.py +2 -1
- megadetector/data_management/databases/integrity_check_json_db.py +15 -14
- megadetector/data_management/databases/subset_json_db.py +49 -21
- megadetector/data_management/mewc_to_md.py +340 -0
- megadetector/data_management/wi_to_md.py +41 -0
- megadetector/data_management/yolo_output_to_md_output.py +15 -8
- megadetector/detection/process_video.py +24 -7
- megadetector/detection/pytorch_detector.py +841 -160
- megadetector/detection/run_detector.py +340 -146
- megadetector/detection/run_detector_batch.py +306 -70
- megadetector/detection/run_inference_with_yolov5_val.py +61 -4
- megadetector/detection/tf_detector.py +6 -1
- megadetector/postprocessing/{combine_api_outputs.py → combine_batch_outputs.py} +10 -13
- megadetector/postprocessing/compare_batch_results.py +68 -6
- megadetector/postprocessing/md_to_labelme.py +7 -7
- megadetector/postprocessing/md_to_wi.py +40 -0
- megadetector/postprocessing/merge_detections.py +1 -1
- megadetector/postprocessing/postprocess_batch_results.py +10 -3
- megadetector/postprocessing/separate_detections_into_folders.py +32 -4
- megadetector/postprocessing/validate_batch_results.py +9 -4
- megadetector/utils/ct_utils.py +172 -57
- megadetector/utils/gpu_test.py +107 -0
- megadetector/utils/md_tests.py +363 -108
- megadetector/utils/path_utils.py +9 -2
- megadetector/utils/wi_utils.py +1794 -0
- megadetector/visualization/visualization_utils.py +82 -16
- megadetector/visualization/visualize_db.py +25 -7
- megadetector/visualization/visualize_detector_output.py +60 -13
- {megadetector-5.0.22.dist-info → megadetector-5.0.24.dist-info}/LICENSE +0 -0
- {megadetector-5.0.22.dist-info → megadetector-5.0.24.dist-info}/METADATA +129 -143
- {megadetector-5.0.22.dist-info → megadetector-5.0.24.dist-info}/RECORD +35 -33
- {megadetector-5.0.22.dist-info → megadetector-5.0.24.dist-info}/top_level.txt +0 -0
- megadetector/detection/detector_training/__init__.py +0 -0
- megadetector/detection/detector_training/model_main_tf2.py +0 -114
- megadetector/utils/torch_test.py +0 -32
- {megadetector-5.0.22.dist-info → megadetector-5.0.24.dist-info}/WHEEL +0 -0
|
@@ -1,143 +1,129 @@
|
|
|
1
|
-
Metadata-Version: 2.2
|
|
2
|
-
Name: megadetector
|
|
3
|
-
Version: 5.0.
|
|
4
|
-
Summary: MegaDetector is an AI model that helps conservation folks spend less time doing boring things with camera trap images.
|
|
5
|
-
Author-email: Your friendly neighborhood MegaDetector team <cameratraps@lila.science>
|
|
6
|
-
Maintainer-email: Your friendly neighborhood MegaDetector team <cameratraps@lila.science>
|
|
7
|
-
License: MIT License
|
|
8
|
-
|
|
9
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
-
in the Software without restriction, including without limitation the rights
|
|
12
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
-
furnished to do so, subject to the following conditions:
|
|
15
|
-
|
|
16
|
-
The above copyright notice and this permission notice shall be included in all
|
|
17
|
-
copies or substantial portions of the Software.
|
|
18
|
-
|
|
19
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
-
SOFTWARE.
|
|
26
|
-
|
|
27
|
-
Project-URL: Homepage, https://github.com/agentmorris/MegaDetector
|
|
28
|
-
Project-URL: Documentation, https://megadetector.readthedocs.io
|
|
29
|
-
Project-URL: Bug Reports, https://github.com/agentmorris/MegaDetector/issues
|
|
30
|
-
Project-URL: Source, https://github.com/agentmorris/MegaDetector
|
|
31
|
-
Keywords: camera traps,conservation,wildlife,ai,megadetector
|
|
32
|
-
Classifier:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
Requires-Dist: Pillow>=9.5
|
|
39
|
-
Requires-Dist: tqdm>=4.64.0
|
|
40
|
-
Requires-Dist: jsonpickle>=3.0.2
|
|
41
|
-
Requires-Dist: humanfriendly>=10.0
|
|
42
|
-
Requires-Dist:
|
|
43
|
-
Requires-Dist:
|
|
44
|
-
Requires-Dist:
|
|
45
|
-
Requires-Dist:
|
|
46
|
-
Requires-Dist:
|
|
47
|
-
Requires-Dist:
|
|
48
|
-
Requires-Dist:
|
|
49
|
-
Requires-Dist:
|
|
50
|
-
Requires-Dist:
|
|
51
|
-
Requires-Dist: ultralytics-yolov5==0.1.1
|
|
52
|
-
Requires-Dist:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
##
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
# Write results to a format that Timelapse and other downstream tools like.
|
|
131
|
-
write_results_to_file(results,
|
|
132
|
-
output_file,
|
|
133
|
-
relative_path_base=image_folder,
|
|
134
|
-
detector_file=detector_filename)
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
## Contact
|
|
138
|
-
|
|
139
|
-
Contact <a href="cameratraps@lila.science">cameratraps@lila.science</a> with questions.
|
|
140
|
-
|
|
141
|
-
## Gratuitous animal picture
|
|
142
|
-
|
|
143
|
-
<img src="https://github.com/agentmorris/MegaDetector/raw/main/images/orinoquia-thumb-web_detections.jpg"><br/>Image credit University of Minnesota, from the [Orinoquía Camera Traps](http://lila.science/datasets/orinoquia-camera-traps/) data set.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: megadetector
|
|
3
|
+
Version: 5.0.24
|
|
4
|
+
Summary: MegaDetector is an AI model that helps conservation folks spend less time doing boring things with camera trap images.
|
|
5
|
+
Author-email: Your friendly neighborhood MegaDetector team <cameratraps@lila.science>
|
|
6
|
+
Maintainer-email: Your friendly neighborhood MegaDetector team <cameratraps@lila.science>
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
26
|
+
|
|
27
|
+
Project-URL: Homepage, https://github.com/agentmorris/MegaDetector
|
|
28
|
+
Project-URL: Documentation, https://megadetector.readthedocs.io
|
|
29
|
+
Project-URL: Bug Reports, https://github.com/agentmorris/MegaDetector/issues
|
|
30
|
+
Project-URL: Source, https://github.com/agentmorris/MegaDetector
|
|
31
|
+
Keywords: camera traps,conservation,wildlife,ai,megadetector
|
|
32
|
+
Classifier: Programming Language :: Python :: 3
|
|
33
|
+
Requires-Python: <=3.13,>=3.9
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
License-File: LICENSE
|
|
36
|
+
Requires-Dist: mkl==2024.0; sys_platform != "darwin"
|
|
37
|
+
Requires-Dist: numpy<2.0,>=1.26.4
|
|
38
|
+
Requires-Dist: Pillow>=9.5
|
|
39
|
+
Requires-Dist: tqdm>=4.64.0
|
|
40
|
+
Requires-Dist: jsonpickle>=3.0.2
|
|
41
|
+
Requires-Dist: humanfriendly>=10.0
|
|
42
|
+
Requires-Dist: matplotlib>=3.8.0
|
|
43
|
+
Requires-Dist: opencv-python>=4.8.0
|
|
44
|
+
Requires-Dist: requests>=2.31.0
|
|
45
|
+
Requires-Dist: pyqtree>=1.0.0
|
|
46
|
+
Requires-Dist: scikit-learn>=1.3.1
|
|
47
|
+
Requires-Dist: pandas>=2.1.1
|
|
48
|
+
Requires-Dist: python-dateutil
|
|
49
|
+
Requires-Dist: send2trash
|
|
50
|
+
Requires-Dist: dill
|
|
51
|
+
Requires-Dist: ultralytics-yolov5==0.1.1
|
|
52
|
+
Requires-Dist: yolov9pip==0.0.4
|
|
53
|
+
Requires-Dist: python-dateutil
|
|
54
|
+
|
|
55
|
+
# MegaDetector
|
|
56
|
+
|
|
57
|
+
This package is a pip-installable version of the support/inference code for [MegaDetector](https://github.com/agentmorris/MegaDetector/?tab=readme-ov-file#megadetector), an object detection model that helps conservation biologists spend less time doing boring things with camera trap images. Complete documentation for this Python package is available at [megadetector.readthedocs.io](https://megadetector.readthedocs.io).
|
|
58
|
+
|
|
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
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
Install with:
|
|
64
|
+
|
|
65
|
+
`pip install megadetector`
|
|
66
|
+
|
|
67
|
+
MegaDetector model weights aren't downloaded at the time you install the package, but they will be (optionally) automatically downloaded the first time you run the model.
|
|
68
|
+
|
|
69
|
+
## Package reference
|
|
70
|
+
|
|
71
|
+
See [megadetector.readthedocs.io](https://megadetector.readthedocs.io).
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## Examples of things you can do with this package
|
|
75
|
+
|
|
76
|
+
### Run MegaDetector on one image and count the number of detections
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
from megadetector.utils import url_utils
|
|
80
|
+
from megadetector.visualization import visualization_utils as vis_utils
|
|
81
|
+
from megadetector.detection import run_detector
|
|
82
|
+
|
|
83
|
+
# This is the image at the bottom of this page, it has one animal in it
|
|
84
|
+
image_url = 'https://github.com/agentmorris/MegaDetector/raw/main/images/orinoquia-thumb-web.jpg'
|
|
85
|
+
temporary_filename = url_utils.download_url(image_url)
|
|
86
|
+
|
|
87
|
+
image = vis_utils.load_image(temporary_filename)
|
|
88
|
+
|
|
89
|
+
# This will automatically download MDv5a; you can also specify a filename.
|
|
90
|
+
model = run_detector.load_detector('MDV5A')
|
|
91
|
+
|
|
92
|
+
result = model.generate_detections_one_image(image)
|
|
93
|
+
|
|
94
|
+
detections_above_threshold = [d for d in result['detections'] if d['conf'] > 0.2]
|
|
95
|
+
print('Found {} detections above threshold'.format(len(detections_above_threshold)))
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Run MegaDetector on a folder of images
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
from megadetector.detection.run_detector_batch import \
|
|
102
|
+
load_and_run_detector_batch, write_results_to_file
|
|
103
|
+
from megadetector.utils import path_utils
|
|
104
|
+
import os
|
|
105
|
+
|
|
106
|
+
# Pick a folder to run MD on recursively, and an output file
|
|
107
|
+
image_folder = os.path.expanduser('~/megadetector_test_images')
|
|
108
|
+
output_file = os.path.expanduser('~/megadetector_output_test.json')
|
|
109
|
+
|
|
110
|
+
# Recursively find images
|
|
111
|
+
image_file_names = path_utils.find_images(image_folder,recursive=True)
|
|
112
|
+
|
|
113
|
+
# This will automatically download MDv5a; you can also specify a filename.
|
|
114
|
+
results = load_and_run_detector_batch('MDV5A', image_file_names)
|
|
115
|
+
|
|
116
|
+
# Write results to a format that Timelapse and other downstream tools like.
|
|
117
|
+
write_results_to_file(results,
|
|
118
|
+
output_file,
|
|
119
|
+
relative_path_base=image_folder,
|
|
120
|
+
detector_file=detector_filename)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Contact
|
|
124
|
+
|
|
125
|
+
Contact <a href="cameratraps@lila.science">cameratraps@lila.science</a> with questions.
|
|
126
|
+
|
|
127
|
+
## Gratuitous animal picture
|
|
128
|
+
|
|
129
|
+
<img src="https://github.com/agentmorris/MegaDetector/raw/main/images/orinoquia-thumb-web_detections.jpg"><br/>Image credit University of Minnesota, from the [Orinoquía Camera Traps](http://lila.science/datasets/orinoquia-camera-traps/) data set.
|
|
@@ -22,7 +22,7 @@ megadetector/api/batch_processing/integration/eMammal/test_scripts/push_annotati
|
|
|
22
22
|
megadetector/api/batch_processing/integration/eMammal/test_scripts/select_images_for_testing.py,sha256=OYMu97p8vprSv03QcnS6aSxPBocn9sgaozfUqq_JpyM,1369
|
|
23
23
|
megadetector/api/synchronous/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
24
|
megadetector/api/synchronous/api_core/animal_detection_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
|
-
megadetector/api/synchronous/api_core/animal_detection_api/api_backend.py,sha256=
|
|
25
|
+
megadetector/api/synchronous/api_core/animal_detection_api/api_backend.py,sha256=g4HvPJ1bynLPzL79yta0GtWunxb8RjCADF56_YbYCsA,4955
|
|
26
26
|
megadetector/api/synchronous/api_core/animal_detection_api/api_frontend.py,sha256=f16J7OBN87Tv0vVIIpXlyyVDeT6qYXDe5Kpr5XGqhdQ,10233
|
|
27
27
|
megadetector/api/synchronous/api_core/animal_detection_api/config.py,sha256=05fVcLx0KK3wWFi62Mr-m_soewVn81qqeObUh-a2mrA,982
|
|
28
28
|
megadetector/api/synchronous/api_core/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -40,7 +40,7 @@ megadetector/classification/identify_mislabeled_candidates.py,sha256=zOWHmWeaiOp
|
|
|
40
40
|
megadetector/classification/json_to_azcopy_list.py,sha256=146gUlCOMw5oaiZzNR2z0q1-gn6q56hkxIfY4lMiPVE,1670
|
|
41
41
|
megadetector/classification/json_validator.py,sha256=uLHWs9X1r_Hi5Gq7zqpQYl6mDc_7M2KAnbmU5Hu_EXs,26553
|
|
42
42
|
megadetector/classification/map_classification_categories.py,sha256=2vAfbVnVtyq38SuHpdo3H_kjt8ZGc6FUOyl50VxHjMM,10679
|
|
43
|
-
megadetector/classification/merge_classification_detection_output.py,sha256=
|
|
43
|
+
megadetector/classification/merge_classification_detection_output.py,sha256=rDYj6vEQT78nP3bsbrnyAGgHTJ3yxQFYIVQtpdWJxDw,20015
|
|
44
44
|
megadetector/classification/prepare_classification_script.py,sha256=zE8j3wi8YJBkEnuqkIb-SK8xoEnAu-XtlkSiO8-zpdQ,6510
|
|
45
45
|
megadetector/classification/prepare_classification_script_mc.py,sha256=zQV6Vlr0cQxPrFLNk33RlPKAFPA4VuhlHsz-FtAIWv4,7190
|
|
46
46
|
megadetector/classification/run_classifier.py,sha256=8PtkQzCUceOyoYxMfriJzA9ZLz_-YAd3OEr2865i3SM,9339
|
|
@@ -56,12 +56,13 @@ megadetector/data_management/camtrap_dp_to_coco.py,sha256=WC5u5nK5BwXpV26_pGy6Cp
|
|
|
56
56
|
megadetector/data_management/cct_json_utils.py,sha256=d1jDmL5wioypt4Ny6BRBNg6iUBaqpq2E2xf162n6zGo,19520
|
|
57
57
|
megadetector/data_management/cct_to_md.py,sha256=Q6ika31wwHLdRcdH_0QFs2o5elu44rhF4UEJ-u3edpk,5441
|
|
58
58
|
megadetector/data_management/cct_to_wi.py,sha256=hnFErIlBDmhZtBv21kDW14MSdHlUjwtCGn2vnG-cN34,9771
|
|
59
|
-
megadetector/data_management/coco_to_labelme.py,sha256=
|
|
59
|
+
megadetector/data_management/coco_to_labelme.py,sha256=bDDuVzTcHdeDXt08hHC5ClqDfloexmp0LO2TH-6ltfg,9049
|
|
60
60
|
megadetector/data_management/coco_to_yolo.py,sha256=rTDOh3XdoOoo7HCSH7obT3xpQgiSykf71ba8uOXfnxc,28121
|
|
61
61
|
megadetector/data_management/generate_crops_from_cct.py,sha256=Esq2Vlvp1AQvD8bmtC15OvoTZTHASBfcIVIuisxXT08,4383
|
|
62
62
|
megadetector/data_management/get_image_sizes.py,sha256=2b6arj4gvoN-9f61lC3t1zAFFwYFxfb2iL83Tstoiik,6602
|
|
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
|
+
megadetector/data_management/mewc_to_md.py,sha256=FQ57B0nJ6V0ZxmfvkWUNQ2fY9JZoHNwQ5W0aLwiY-Ds,13398
|
|
65
66
|
megadetector/data_management/ocr_tools.py,sha256=T9ClY3B-blnK3-UF1vpVdageknYsykm_6FAfqn0kliU,32529
|
|
66
67
|
megadetector/data_management/read_exif.py,sha256=TIPf1OHFhuDq7M2H9MxcEEvN17G0dpJTriRTtiqIvxA,30474
|
|
67
68
|
megadetector/data_management/remap_coco_categories.py,sha256=xXWv0QhTjkUfc9RKtAZanK77HMSq_21mFg_34KFD6hw,2903
|
|
@@ -69,15 +70,16 @@ megadetector/data_management/remove_exif.py,sha256=vIWnJfw1i9JgyQKUDGEzzqkHro4nd
|
|
|
69
70
|
megadetector/data_management/rename_images.py,sha256=ikIj_b5DY1rgaAn9n_IbwsnugAolczFNivh4xzfLPy8,6915
|
|
70
71
|
megadetector/data_management/resize_coco_dataset.py,sha256=AaiV7efIcNnqsXsnQckmHq2G__7ZQHBV_jN6rhZfMjo,6810
|
|
71
72
|
megadetector/data_management/wi_download_csv_to_coco.py,sha256=ilnJZhNZK-FGUR-AfUSWjIDUk9Gytgxw7IOK_N8WKLE,8350
|
|
72
|
-
megadetector/data_management/
|
|
73
|
+
megadetector/data_management/wi_to_md.py,sha256=SGZOyiYvCHud2eeatqjvvpHfDLVwTyC6S5QA-D28qII,1398
|
|
74
|
+
megadetector/data_management/yolo_output_to_md_output.py,sha256=0ewFhTxdv8H5jaTv4kTpoxdzmOYFHbizvja41VCA_Ls,18307
|
|
73
75
|
megadetector/data_management/yolo_to_coco.py,sha256=TzAagQ2ATbB_tn1oZxrHCWsrFGO_OhfZmi-3X45WdDU,26180
|
|
74
76
|
megadetector/data_management/annotations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
75
77
|
megadetector/data_management/annotations/annotation_constants.py,sha256=1597MpAr_HdidIHoDFj4RgUO3K5e2Xm2bGafGeonR2k,953
|
|
76
78
|
megadetector/data_management/databases/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
77
79
|
megadetector/data_management/databases/add_width_and_height_to_db.py,sha256=X7A_iniGwlkhZ0jUNm564GT_mH2_RJGLD0aGP9cBhY0,749
|
|
78
80
|
megadetector/data_management/databases/combine_coco_camera_traps_files.py,sha256=oeELrMgxhsJ6aNBxPQyu4CmsdtYnzS5GKZEV8U-XUdk,6693
|
|
79
|
-
megadetector/data_management/databases/integrity_check_json_db.py,sha256=
|
|
80
|
-
megadetector/data_management/databases/subset_json_db.py,sha256=
|
|
81
|
+
megadetector/data_management/databases/integrity_check_json_db.py,sha256=WoW8MFiRjAjiHWfUdhGeRskIWgXvHrpmBPPI9px7nlk,17713
|
|
82
|
+
megadetector/data_management/databases/subset_json_db.py,sha256=0tKB_twdEsXxj9w2KOfQmXv4Hhbvbq3Aes2UMQG9yYU,4272
|
|
81
83
|
megadetector/data_management/importers/add_nacti_sizes.py,sha256=jjGTpd36g5w7nLIeOatXRwu1Uti2GiGgP3-61QSg8oA,1156
|
|
82
84
|
megadetector/data_management/importers/add_timestamps_to_icct.py,sha256=5l1TkWq3X4Mxed7zlZ07U1RQcjbzBnwcoftNiaruigM,2364
|
|
83
85
|
megadetector/data_management/importers/animl_results_to_md_results.py,sha256=duvQkfFzONYHdTsJrhHyufpamK55r41IjkjFuPY7WmE,4698
|
|
@@ -136,35 +138,34 @@ megadetector/data_management/lila/get_lila_image_counts.py,sha256=UxXS5RDnSA_Wbx
|
|
|
136
138
|
megadetector/data_management/lila/lila_common.py,sha256=74ecaGItH4AtCYeY1WSejLIcylhJPCJ1y97gYYL34PM,11080
|
|
137
139
|
megadetector/data_management/lila/test_lila_metadata_urls.py,sha256=qKyZAb17Va9rfLdNwiOBER02yhUwquOSR9VURtxzugY,4784
|
|
138
140
|
megadetector/detection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
139
|
-
megadetector/detection/process_video.py,sha256=
|
|
140
|
-
megadetector/detection/pytorch_detector.py,sha256=
|
|
141
|
-
megadetector/detection/run_detector.py,sha256=
|
|
142
|
-
megadetector/detection/run_detector_batch.py,sha256=
|
|
143
|
-
megadetector/detection/run_inference_with_yolov5_val.py,sha256=
|
|
141
|
+
megadetector/detection/process_video.py,sha256=SGCp98nYI-1LZnTwrTOFhiGs1PpFjrebsI078D2KC-Q,54470
|
|
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
|
|
145
|
+
megadetector/detection/run_inference_with_yolov5_val.py,sha256=Ofu9B4yOmWso-S6JYalK0f_CvsG5tr2gkW_-rDskMD0,55291
|
|
144
146
|
megadetector/detection/run_tiled_inference.py,sha256=vw0713eNuMiEOjHfweQl58zPHNxPOMdFWZ8bTDLhlMY,37883
|
|
145
|
-
megadetector/detection/tf_detector.py,sha256=
|
|
147
|
+
megadetector/detection/tf_detector.py,sha256=t9O6J7r1wHOkKbrwchducdJrAHSw38DDA7rF7_0urn0,8522
|
|
146
148
|
megadetector/detection/video_utils.py,sha256=XqaaF8YQX-goSzHEoHasmkuNF7DrbFDil0Xd9KjHb5Q,43821
|
|
147
|
-
megadetector/detection/detector_training/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
148
|
-
megadetector/detection/detector_training/model_main_tf2.py,sha256=YwNsZ7hkIFaEuwKU0rHG_VyqiR_0E01BbdlD0Yx4Smo,4936
|
|
149
149
|
megadetector/postprocessing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
150
150
|
megadetector/postprocessing/add_max_conf.py,sha256=qTE1_0RwGAy6jLDkHrIo2pS84yNbUV11s4IZuAYGdIU,1514
|
|
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
|
-
megadetector/postprocessing/
|
|
154
|
-
megadetector/postprocessing/compare_batch_results.py,sha256=
|
|
153
|
+
megadetector/postprocessing/combine_batch_outputs.py,sha256=va6v1ZZzbQlq16S3gEqHKI5RbBuwRQ6ZoLAdDbIWYOQ,8416
|
|
154
|
+
megadetector/postprocessing/compare_batch_results.py,sha256=O6J32C5O3gPTe9P6ZU-1E4ECsARIP7v621Cipl-pELw,77737
|
|
155
155
|
megadetector/postprocessing/convert_output_format.py,sha256=HwThfK76UPEAGa3KQbJ_tMKIrUvJ3JhKoQVWJt9dPBk,15447
|
|
156
156
|
megadetector/postprocessing/detector_calibration.py,sha256=rzAsiUJhw8Y4RxSK1SMnsdjI3MYkFA9NP5vJ7CNsX0I,21820
|
|
157
157
|
megadetector/postprocessing/load_api_results.py,sha256=FqcaiPMuqTojZOV3Jn14pJESpuwjWGbZtcvJuVXUaDM,6861
|
|
158
158
|
megadetector/postprocessing/md_to_coco.py,sha256=wleD9Fq2zvQ5ubwfV3KUsDmgpiLnBXh5XvjjYk7YIH8,15971
|
|
159
|
-
megadetector/postprocessing/md_to_labelme.py,sha256=
|
|
160
|
-
megadetector/postprocessing/
|
|
161
|
-
megadetector/postprocessing/
|
|
159
|
+
megadetector/postprocessing/md_to_labelme.py,sha256=DDCsQpxZXQxWjPlsg1DM5yE33Fc_c8KatuDgt66Q8rQ,11696
|
|
160
|
+
megadetector/postprocessing/md_to_wi.py,sha256=Yq-WdbWPcwkGkF5Iw7c6Ua6Ky723jYwJWY8Kl_KfgRE,1271
|
|
161
|
+
megadetector/postprocessing/merge_detections.py,sha256=GfoDtDUdOyv9M4p8tTzUuaEPsgnmHu1pgnPsvSUfOq0,17778
|
|
162
|
+
megadetector/postprocessing/postprocess_batch_results.py,sha256=baJioCU6sB4iAtLV_mMMecqKZlgb-ycYQx-NLsS2gw0,80175
|
|
162
163
|
megadetector/postprocessing/remap_detection_categories.py,sha256=d9IYTa0i_KbbrarJc_mczABmdwypscl5-KpK8Hx_z8o,6640
|
|
163
164
|
megadetector/postprocessing/render_detection_confusion_matrix.py,sha256=_wsk4W0PbNiqmFuHy-EA0Z07B1tQLMsdCTPatnHAdZw,27382
|
|
164
|
-
megadetector/postprocessing/separate_detections_into_folders.py,sha256=
|
|
165
|
+
megadetector/postprocessing/separate_detections_into_folders.py,sha256=8ISxkZJ3KCCONdbi2NrJsHoAP34t_Z_qwUEeZ_SfElQ,32893
|
|
165
166
|
megadetector/postprocessing/subset_json_detector_output.py,sha256=PDgb6cnsFm9d4E7_sMVIguLIU7s79uFQa2CRCxAO0F4,27064
|
|
166
167
|
megadetector/postprocessing/top_folders_to_bottom.py,sha256=Dqk-KZXiRlIYlmLZmk6aUapmaaLJUKOf8wK1kxt9W6A,6283
|
|
167
|
-
megadetector/postprocessing/validate_batch_results.py,sha256=
|
|
168
|
+
megadetector/postprocessing/validate_batch_results.py,sha256=sEPxRPGD7AuDWveJAAfly4MR8Xr-xT5NRM88FxYJx_Q,11420
|
|
168
169
|
megadetector/postprocessing/repeat_detection_elimination/find_repeat_detections.py,sha256=e4Y9CyMyd-bLN3il8tu76vI0nVYHZlhZr6vcL0J4zQ0,9832
|
|
169
170
|
megadetector/postprocessing/repeat_detection_elimination/remove_repeat_detections.py,sha256=tARPxuY0OyQgpKU2XqiQPko3f-hHnWuISB8ZlZgXwxI,2819
|
|
170
171
|
megadetector/postprocessing/repeat_detection_elimination/repeat_detections_core.py,sha256=vEmWLSSv0_rxDwhjz_S9YaKZ_LM2tADTz2JYb_zUCnc,67923
|
|
@@ -181,25 +182,26 @@ megadetector/taxonomy_mapping/taxonomy_graph.py,sha256=ayrTFseVaIMbtMXhnjWCkZdxI
|
|
|
181
182
|
megadetector/taxonomy_mapping/validate_lila_category_mappings.py,sha256=1qyZr23bvZSVUYLQnO1XAtIZ4jdpARA5dxt8euKVyOA,2527
|
|
182
183
|
megadetector/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
183
184
|
megadetector/utils/azure_utils.py,sha256=0BdnkG2hW-X0yFpsJqmBhOd2wysz_LvhuyImPJMVPJs,6271
|
|
184
|
-
megadetector/utils/ct_utils.py,sha256=
|
|
185
|
+
megadetector/utils/ct_utils.py,sha256=se4sy5f_vpcZiY6b1NCGidhVY31nkI2re2wotlahX9Q,24848
|
|
185
186
|
megadetector/utils/directory_listing.py,sha256=r4rg2xA4O9ZVxVtzPZzXIXa0DOEukAJMTTNcNSiQcuM,9668
|
|
186
|
-
megadetector/utils/
|
|
187
|
-
megadetector/utils/
|
|
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
|
|
188
190
|
megadetector/utils/process_utils.py,sha256=K7-ZW_bJbMgeDBLDhYHMV84urM8H7L6IddQS5z3UgBw,5824
|
|
189
191
|
megadetector/utils/sas_blob_utils.py,sha256=k76EcMmJc_otrEHcfV2fxAC6fNhxU88FxM3ddSYrsKU,16917
|
|
190
192
|
megadetector/utils/split_locations_into_train_val.py,sha256=jvaDu1xKB51L3Xq2nXQo0XtXRjNRf8RglBApl1g6gHo,10101
|
|
191
193
|
megadetector/utils/string_utils.py,sha256=ZQapJodzvTDyQhjZgMoMl3-9bqnKAUlORpws8Db9AkA,2050
|
|
192
|
-
megadetector/utils/torch_test.py,sha256=aEYE-1vGt5PujD0bHAVRTJiLrKFlGWpS8zeYhqEYZLY,853
|
|
193
194
|
megadetector/utils/url_utils.py,sha256=yybWwJ-vl2A6Fci66i-xt_dl3Uqh72Ylnb8XOT2Grog,14835
|
|
195
|
+
megadetector/utils/wi_utils.py,sha256=qOW2Oz8NM09l6Ow_CMgatmwdPd1gdMx_saUDQlNekpY,71622
|
|
194
196
|
megadetector/utils/write_html_image_list.py,sha256=MhVAAv6th9Q2fldtE8hp_hHWFgJ_pcKJEk3YiK6dWY4,9415
|
|
195
197
|
megadetector/visualization/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
196
198
|
megadetector/visualization/plot_utils.py,sha256=lOfU3uPrcuHZagV_1SN8erT8PujIepocgw6KZ17Ej6c,10671
|
|
197
199
|
megadetector/visualization/render_images_with_thumbnails.py,sha256=kgJYW8BsqRO4C7T3sqItdBuSkZ64I1vOtIWAsVG4XBI,10589
|
|
198
|
-
megadetector/visualization/visualization_utils.py,sha256=
|
|
199
|
-
megadetector/visualization/visualize_db.py,sha256=
|
|
200
|
-
megadetector/visualization/visualize_detector_output.py,sha256=
|
|
201
|
-
megadetector-5.0.
|
|
202
|
-
megadetector-5.0.
|
|
203
|
-
megadetector-5.0.
|
|
204
|
-
megadetector-5.0.
|
|
205
|
-
megadetector-5.0.
|
|
200
|
+
megadetector/visualization/visualization_utils.py,sha256=io156_DC_0icNbFDrYxAE6wFQ1lsQXI12nV675tsxCE,75353
|
|
201
|
+
megadetector/visualization/visualize_db.py,sha256=hnJEIBRWf7_HjTEiUmzS59_8kK0usb8mczZMDv1N4r8,25279
|
|
202
|
+
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,,
|
|
File without changes
|
|
File without changes
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
# Lint as: python3
|
|
2
|
-
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
|
|
3
|
-
#
|
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
# you may not use this file except in compliance with the License.
|
|
6
|
-
# You may obtain a copy of the License at
|
|
7
|
-
#
|
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
# See the License for the specific language governing permissions and
|
|
14
|
-
# limitations under the License.
|
|
15
|
-
# ==============================================================================
|
|
16
|
-
|
|
17
|
-
r"""Creates and runs TF2 object detection models.
|
|
18
|
-
For local training/evaluation run:
|
|
19
|
-
PIPELINE_CONFIG_PATH=path/to/pipeline.config
|
|
20
|
-
MODEL_DIR=/tmp/model_outputs
|
|
21
|
-
NUM_TRAIN_STEPS=10000
|
|
22
|
-
SAMPLE_1_OF_N_EVAL_EXAMPLES=1
|
|
23
|
-
python model_main_tf2.py -- \
|
|
24
|
-
--model_dir=$MODEL_DIR --num_train_steps=$NUM_TRAIN_STEPS \
|
|
25
|
-
--sample_1_of_n_eval_examples=$SAMPLE_1_OF_N_EVAL_EXAMPLES \
|
|
26
|
-
--pipeline_config_path=$PIPELINE_CONFIG_PATH \
|
|
27
|
-
--alsologtostderr
|
|
28
|
-
"""
|
|
29
|
-
from absl import flags
|
|
30
|
-
import tensorflow.compat.v2 as tf
|
|
31
|
-
from object_detection import model_lib_v2
|
|
32
|
-
|
|
33
|
-
flags.DEFINE_string('pipeline_config_path', None, 'Path to pipeline config '
|
|
34
|
-
'file.')
|
|
35
|
-
flags.DEFINE_integer('num_train_steps', None, 'Number of train steps.')
|
|
36
|
-
flags.DEFINE_bool('eval_on_train_data', False, 'Enable evaluating on train '
|
|
37
|
-
'data (only supported in distributed training).')
|
|
38
|
-
flags.DEFINE_integer('sample_1_of_n_eval_examples', None, 'Will sample one of '
|
|
39
|
-
'every n eval input examples, where n is provided.')
|
|
40
|
-
flags.DEFINE_integer('sample_1_of_n_eval_on_train_examples', 5, 'Will sample '
|
|
41
|
-
'one of every n train input examples for evaluation, '
|
|
42
|
-
'where n is provided. This is only used if '
|
|
43
|
-
'`eval_training_data` is True.')
|
|
44
|
-
flags.DEFINE_string(
|
|
45
|
-
'model_dir', None, 'Path to output model directory '
|
|
46
|
-
'where event and checkpoint files will be written.')
|
|
47
|
-
flags.DEFINE_string(
|
|
48
|
-
'checkpoint_dir', None, 'Path to directory holding a checkpoint. If '
|
|
49
|
-
'`checkpoint_dir` is provided, this binary operates in eval-only mode, '
|
|
50
|
-
'writing resulting metrics to `model_dir`.')
|
|
51
|
-
|
|
52
|
-
flags.DEFINE_integer('eval_timeout', 3600, 'Number of seconds to wait for an'
|
|
53
|
-
'evaluation checkpoint before exiting.')
|
|
54
|
-
|
|
55
|
-
flags.DEFINE_bool('use_tpu', False, 'Whether the job is executing on a TPU.')
|
|
56
|
-
flags.DEFINE_string(
|
|
57
|
-
'tpu_name',
|
|
58
|
-
default=None,
|
|
59
|
-
help='Name of the Cloud TPU for Cluster Resolvers.')
|
|
60
|
-
flags.DEFINE_integer(
|
|
61
|
-
'num_workers', 1, 'When num_workers > 1, training uses '
|
|
62
|
-
'MultiWorkerMirroredStrategy. When num_workers = 1 it uses '
|
|
63
|
-
'MirroredStrategy.')
|
|
64
|
-
flags.DEFINE_integer(
|
|
65
|
-
'checkpoint_every_n', 1000, 'Integer defining how often we checkpoint.')
|
|
66
|
-
flags.DEFINE_boolean('record_summaries', True,
|
|
67
|
-
('Whether or not to record summaries defined by the model'
|
|
68
|
-
' or the training pipeline. This does not impact the'
|
|
69
|
-
' summaries of the loss values which are always'
|
|
70
|
-
' recorded.'))
|
|
71
|
-
|
|
72
|
-
FLAGS = flags.FLAGS
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
def main(unused_argv):
|
|
76
|
-
flags.mark_flag_as_required('model_dir')
|
|
77
|
-
flags.mark_flag_as_required('pipeline_config_path')
|
|
78
|
-
tf.config.set_soft_device_placement(True)
|
|
79
|
-
|
|
80
|
-
if FLAGS.checkpoint_dir:
|
|
81
|
-
model_lib_v2.eval_continuously(
|
|
82
|
-
pipeline_config_path=FLAGS.pipeline_config_path,
|
|
83
|
-
model_dir=FLAGS.model_dir,
|
|
84
|
-
train_steps=FLAGS.num_train_steps,
|
|
85
|
-
sample_1_of_n_eval_examples=FLAGS.sample_1_of_n_eval_examples,
|
|
86
|
-
sample_1_of_n_eval_on_train_examples=(
|
|
87
|
-
FLAGS.sample_1_of_n_eval_on_train_examples),
|
|
88
|
-
checkpoint_dir=FLAGS.checkpoint_dir,
|
|
89
|
-
wait_interval=300, timeout=FLAGS.eval_timeout)
|
|
90
|
-
else:
|
|
91
|
-
if FLAGS.use_tpu:
|
|
92
|
-
# TPU is automatically inferred if tpu_name is None and
|
|
93
|
-
# we are running under cloud ai-platform.
|
|
94
|
-
resolver = tf.distribute.cluster_resolver.TPUClusterResolver(
|
|
95
|
-
FLAGS.tpu_name)
|
|
96
|
-
tf.config.experimental_connect_to_cluster(resolver)
|
|
97
|
-
tf.tpu.experimental.initialize_tpu_system(resolver)
|
|
98
|
-
strategy = tf.distribute.experimental.TPUStrategy(resolver)
|
|
99
|
-
elif FLAGS.num_workers > 1:
|
|
100
|
-
strategy = tf.distribute.experimental.MultiWorkerMirroredStrategy()
|
|
101
|
-
else:
|
|
102
|
-
strategy = tf.compat.v2.distribute.MirroredStrategy()
|
|
103
|
-
|
|
104
|
-
with strategy.scope():
|
|
105
|
-
model_lib_v2.train_loop(
|
|
106
|
-
pipeline_config_path=FLAGS.pipeline_config_path,
|
|
107
|
-
model_dir=FLAGS.model_dir,
|
|
108
|
-
train_steps=FLAGS.num_train_steps,
|
|
109
|
-
use_tpu=FLAGS.use_tpu,
|
|
110
|
-
checkpoint_every_n=FLAGS.checkpoint_every_n,
|
|
111
|
-
record_summaries=FLAGS.record_summaries)
|
|
112
|
-
|
|
113
|
-
if __name__ == '__main__':
|
|
114
|
-
tf.compat.v1.app.run()
|
megadetector/utils/torch_test.py
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
|
|
3
|
-
torch_test.py
|
|
4
|
-
|
|
5
|
-
Simple script to verify CUDA availability, used to verify a CUDA/PyTorch
|
|
6
|
-
environment.
|
|
7
|
-
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
def torch_test():
|
|
11
|
-
"""
|
|
12
|
-
Print diagnostic information about Torch/CUDA status, including Torch/CUDA versions
|
|
13
|
-
and all available CUDA device names.
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
import torch
|
|
17
|
-
|
|
18
|
-
print('Torch version: {}'.format(str(torch.__version__)))
|
|
19
|
-
print('CUDA available: {}'.format(torch.cuda.is_available()))
|
|
20
|
-
|
|
21
|
-
device_ids = list(range(torch.cuda.device_count()))
|
|
22
|
-
print('Found {} CUDA devices:'.format(len(device_ids)))
|
|
23
|
-
for device_id in device_ids:
|
|
24
|
-
device_name = 'unknown'
|
|
25
|
-
try:
|
|
26
|
-
device_name = torch.cuda.get_device_name(device=device_id)
|
|
27
|
-
except Exception as e:
|
|
28
|
-
pass
|
|
29
|
-
print('{}: {}'.format(device_id,device_name))
|
|
30
|
-
|
|
31
|
-
if __name__ == '__main__':
|
|
32
|
-
torch_test()
|
|
File without changes
|