ultralytics 8.2.67__py3-none-any.whl → 8.2.68__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 ultralytics might be problematic. Click here for more details.
- ultralytics/__init__.py +1 -1
- ultralytics/hub/google/__init__.py +159 -0
- {ultralytics-8.2.67.dist-info → ultralytics-8.2.68.dist-info}/METADATA +1 -1
- {ultralytics-8.2.67.dist-info → ultralytics-8.2.68.dist-info}/RECORD +8 -7
- {ultralytics-8.2.67.dist-info → ultralytics-8.2.68.dist-info}/LICENSE +0 -0
- {ultralytics-8.2.67.dist-info → ultralytics-8.2.68.dist-info}/WHEEL +0 -0
- {ultralytics-8.2.67.dist-info → ultralytics-8.2.68.dist-info}/entry_points.txt +0 -0
- {ultralytics-8.2.67.dist-info → ultralytics-8.2.68.dist-info}/top_level.txt +0 -0
ultralytics/__init__.py
CHANGED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
|
2
|
+
|
|
3
|
+
import concurrent.futures
|
|
4
|
+
import statistics
|
|
5
|
+
import time
|
|
6
|
+
from typing import List, Optional, Tuple
|
|
7
|
+
|
|
8
|
+
import requests
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class GCPRegions:
|
|
12
|
+
"""
|
|
13
|
+
A class for managing and analyzing Google Cloud Platform (GCP) regions.
|
|
14
|
+
|
|
15
|
+
This class provides functionality to initialize, categorize, and analyze GCP regions based on their
|
|
16
|
+
geographical location, tier classification, and network latency.
|
|
17
|
+
|
|
18
|
+
Attributes:
|
|
19
|
+
regions (Dict[str, Tuple[int, str, str]]): A dictionary of GCP regions with their tier, city, and country.
|
|
20
|
+
|
|
21
|
+
Methods:
|
|
22
|
+
tier1: Returns a list of tier 1 GCP regions.
|
|
23
|
+
tier2: Returns a list of tier 2 GCP regions.
|
|
24
|
+
lowest_latency: Determines the GCP region(s) with the lowest network latency.
|
|
25
|
+
|
|
26
|
+
Examples:
|
|
27
|
+
>>> from ultralytics.hub.google import GCPRegions
|
|
28
|
+
>>> regions = GCPRegions()
|
|
29
|
+
>>> lowest_latency_region = regions.lowest_latency(verbose=True, attempts=3)
|
|
30
|
+
>>> print(f"Lowest latency region: {lowest_latency_region[0][0]}")
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
def __init__(self):
|
|
34
|
+
"""Initializes the GCPRegions class with predefined Google Cloud Platform regions and their details."""
|
|
35
|
+
self.regions = {
|
|
36
|
+
"asia-east1": (1, "Taiwan", "China"),
|
|
37
|
+
"asia-east2": (2, "Hong Kong", "China"),
|
|
38
|
+
"asia-northeast1": (1, "Tokyo", "Japan"),
|
|
39
|
+
"asia-northeast2": (1, "Osaka", "Japan"),
|
|
40
|
+
"asia-northeast3": (2, "Seoul", "South Korea"),
|
|
41
|
+
"asia-south1": (2, "Mumbai", "India"),
|
|
42
|
+
"asia-south2": (2, "Delhi", "India"),
|
|
43
|
+
"asia-southeast1": (2, "Jurong West", "Singapore"),
|
|
44
|
+
"asia-southeast2": (2, "Jakarta", "Indonesia"),
|
|
45
|
+
"australia-southeast1": (2, "Sydney", "Australia"),
|
|
46
|
+
"australia-southeast2": (2, "Melbourne", "Australia"),
|
|
47
|
+
"europe-central2": (2, "Warsaw", "Poland"),
|
|
48
|
+
"europe-north1": (1, "Hamina", "Finland"),
|
|
49
|
+
"europe-southwest1": (1, "Madrid", "Spain"),
|
|
50
|
+
"europe-west1": (1, "St. Ghislain", "Belgium"),
|
|
51
|
+
"europe-west10": (2, "Berlin", "Germany"),
|
|
52
|
+
"europe-west12": (2, "Turin", "Italy"),
|
|
53
|
+
"europe-west2": (2, "London", "United Kingdom"),
|
|
54
|
+
"europe-west3": (2, "Frankfurt", "Germany"),
|
|
55
|
+
"europe-west4": (1, "Eemshaven", "Netherlands"),
|
|
56
|
+
"europe-west6": (2, "Zurich", "Switzerland"),
|
|
57
|
+
"europe-west8": (1, "Milan", "Italy"),
|
|
58
|
+
"europe-west9": (1, "Paris", "France"),
|
|
59
|
+
"me-central1": (2, "Doha", "Qatar"),
|
|
60
|
+
"me-west1": (1, "Tel Aviv", "Israel"),
|
|
61
|
+
"northamerica-northeast1": (2, "Montreal", "Canada"),
|
|
62
|
+
"northamerica-northeast2": (2, "Toronto", "Canada"),
|
|
63
|
+
"southamerica-east1": (2, "São Paulo", "Brazil"),
|
|
64
|
+
"southamerica-west1": (2, "Santiago", "Chile"),
|
|
65
|
+
"us-central1": (1, "Iowa", "United States"),
|
|
66
|
+
"us-east1": (1, "South Carolina", "United States"),
|
|
67
|
+
"us-east4": (1, "Northern Virginia", "United States"),
|
|
68
|
+
"us-east5": (1, "Columbus", "United States"),
|
|
69
|
+
"us-south1": (1, "Dallas", "United States"),
|
|
70
|
+
"us-west1": (1, "Oregon", "United States"),
|
|
71
|
+
"us-west2": (2, "Los Angeles", "United States"),
|
|
72
|
+
"us-west3": (2, "Salt Lake City", "United States"),
|
|
73
|
+
"us-west4": (2, "Las Vegas", "United States"),
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
def tier1(self) -> List[str]:
|
|
77
|
+
"""Returns a list of GCP regions classified as tier 1 based on predefined criteria."""
|
|
78
|
+
return [region for region, info in self.regions.items() if info[0] == 1]
|
|
79
|
+
|
|
80
|
+
def tier2(self) -> List[str]:
|
|
81
|
+
"""Returns a list of GCP regions classified as tier 2 based on predefined criteria."""
|
|
82
|
+
return [region for region, info in self.regions.items() if info[0] == 2]
|
|
83
|
+
|
|
84
|
+
@staticmethod
|
|
85
|
+
def _ping_region(region: str, attempts: int = 1) -> Tuple[str, float, float, float, float]:
|
|
86
|
+
"""Pings a specified GCP region and returns latency statistics: mean, min, max, and standard deviation."""
|
|
87
|
+
url = f"https://{region}-docker.pkg.dev"
|
|
88
|
+
latencies = []
|
|
89
|
+
for _ in range(attempts):
|
|
90
|
+
try:
|
|
91
|
+
start_time = time.time()
|
|
92
|
+
_ = requests.head(url, timeout=5)
|
|
93
|
+
latency = (time.time() - start_time) * 1000 # convert latency to milliseconds
|
|
94
|
+
if latency != float("inf"):
|
|
95
|
+
latencies.append(latency)
|
|
96
|
+
except requests.RequestException:
|
|
97
|
+
pass
|
|
98
|
+
if not latencies:
|
|
99
|
+
return region, float("inf"), float("inf"), float("inf"), float("inf")
|
|
100
|
+
|
|
101
|
+
std_dev = statistics.stdev(latencies) if len(latencies) > 1 else 0
|
|
102
|
+
return region, statistics.mean(latencies), std_dev, min(latencies), max(latencies)
|
|
103
|
+
|
|
104
|
+
def lowest_latency(
|
|
105
|
+
self,
|
|
106
|
+
top: int = 1,
|
|
107
|
+
verbose: bool = False,
|
|
108
|
+
tier: Optional[int] = None,
|
|
109
|
+
attempts: int = 1,
|
|
110
|
+
) -> List[Tuple[str, float, float, float, float]]:
|
|
111
|
+
"""
|
|
112
|
+
Determines the GCP regions with the lowest latency based on ping tests.
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
top (int): Number of top regions to return.
|
|
116
|
+
verbose (bool): If True, prints detailed latency information for all tested regions.
|
|
117
|
+
tier (int | None): Filter regions by tier (1 or 2). If None, all regions are tested.
|
|
118
|
+
attempts (int): Number of ping attempts per region.
|
|
119
|
+
|
|
120
|
+
Returns:
|
|
121
|
+
(List[Tuple[str, float, float, float, float]]): List of tuples containing region information and
|
|
122
|
+
latency statistics. Each tuple contains (region, mean_latency, std_dev, min_latency, max_latency).
|
|
123
|
+
|
|
124
|
+
Examples:
|
|
125
|
+
>>> regions = GCPRegions()
|
|
126
|
+
>>> results = regions.lowest_latency(top=3, verbose=True, tier=1, attempts=2)
|
|
127
|
+
>>> print(results[0][0]) # Print the name of the lowest latency region
|
|
128
|
+
"""
|
|
129
|
+
if verbose:
|
|
130
|
+
print(f"Testing GCP regions for latency (with {attempts} {'retry' if attempts == 1 else 'attempts'})...")
|
|
131
|
+
|
|
132
|
+
regions_to_test = [k for k, v in self.regions.items() if v[0] == tier] if tier else list(self.regions.keys())
|
|
133
|
+
with concurrent.futures.ThreadPoolExecutor(max_workers=50) as executor:
|
|
134
|
+
results = list(executor.map(lambda r: self._ping_region(r, attempts), regions_to_test))
|
|
135
|
+
|
|
136
|
+
sorted_results = sorted(results, key=lambda x: x[1])
|
|
137
|
+
|
|
138
|
+
if verbose:
|
|
139
|
+
print(f"{'Region':<20} {'Location':<35} {'Tier':<5} {'Latency (ms)'}")
|
|
140
|
+
for region, mean, std, min_, max_ in sorted_results:
|
|
141
|
+
tier, city, country = self.regions[region]
|
|
142
|
+
location = f"{city}, {country}"
|
|
143
|
+
if mean == float("inf"):
|
|
144
|
+
print(f"{region:<20} {location:<35} {tier:<5} {'Timeout'}")
|
|
145
|
+
else:
|
|
146
|
+
print(f"{region:<20} {location:<35} {tier:<5} {mean:.0f} ± {std:.0f} ({min_:.0f} - {max_:.0f})")
|
|
147
|
+
print(f"\nLowest latency region{'s' if top > 1 else ''}:")
|
|
148
|
+
for region, mean, std, min_, max_ in sorted_results[:top]:
|
|
149
|
+
tier, city, country = self.regions[region]
|
|
150
|
+
location = f"{city}, {country}"
|
|
151
|
+
print(f"{region} ({location}, {mean:.0f} ± {std:.0f} ms ({min_:.0f} - {max_:.0f}))")
|
|
152
|
+
|
|
153
|
+
return sorted_results[:top]
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
# Usage example
|
|
157
|
+
if __name__ == "__main__":
|
|
158
|
+
regions = GCPRegions()
|
|
159
|
+
top_3_latency_tier1 = regions.lowest_latency(top=3, verbose=True, tier=1, attempts=3)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ultralytics
|
|
3
|
-
Version: 8.2.
|
|
3
|
+
Version: 8.2.68
|
|
4
4
|
Summary: Ultralytics YOLOv8 for SOTA object detection, multi-object tracking, instance segmentation, pose estimation and image classification.
|
|
5
5
|
Author: Glenn Jocher, Ayush Chaurasia, Jing Qiu
|
|
6
6
|
Maintainer: Glenn Jocher, Ayush Chaurasia, Jing Qiu
|
|
@@ -8,7 +8,7 @@ tests/test_exports.py,sha256=Uezf3OatpPHlo5qoPw-2kqkZxuMCF9L4XF2riD4vmII,8225
|
|
|
8
8
|
tests/test_integrations.py,sha256=xglcfMPjfVh346PV8WTpk6tBxraCXEFJEQyyJMr5tyU,6064
|
|
9
9
|
tests/test_python.py,sha256=cLK8dyRf_4H_znFIm-krnOFMydwkxKlVZvHwl9vbck8,21780
|
|
10
10
|
tests/test_solutions.py,sha256=EACnPXbeJe2aVTOKfqMk5jclKKCWCVgFEzjpR6y7Sh8,3304
|
|
11
|
-
ultralytics/__init__.py,sha256=
|
|
11
|
+
ultralytics/__init__.py,sha256=kFbWHacl29mp-kVoUKfsiqYWu9a_pbJU0q7y0xeg7uE,694
|
|
12
12
|
ultralytics/assets/bus.jpg,sha256=wCAZxJecGR63Od3ZRERe9Aja1Weayrb9Ug751DS_vGM,137419
|
|
13
13
|
ultralytics/assets/zidane.jpg,sha256=Ftc4aeMmen1O0A3o6GCDO9FlfBslLpTAw0gnetx7bts,50427
|
|
14
14
|
ultralytics/cfg/__init__.py,sha256=fD3Llw12sIkJo4g667t6b051je9nEpwdBLGgbbVEzHY,32973
|
|
@@ -109,6 +109,7 @@ ultralytics/hub/__init__.py,sha256=93bqI8x8-MfDYdKkQVduuocUiQj3WGnk1nIk0li08zA,5
|
|
|
109
109
|
ultralytics/hub/auth.py,sha256=FID58NE6fh7Op_B45QOpWBw1qoBN0ponL16uvyb2dZ8,5399
|
|
110
110
|
ultralytics/hub/session.py,sha256=UF_aVwyxnbP-OzpzKXGGhi4i6KGWjjhoj5Qsn46dFpE,16257
|
|
111
111
|
ultralytics/hub/utils.py,sha256=tXfM3QbXBcf4Y6StgHI1pktT4OM7Ic9eF3xiBFHGlhY,9721
|
|
112
|
+
ultralytics/hub/google/__init__.py,sha256=0jjs294Kd1iEdRUGgoqIGUrUNzDFtSwV_M8H9_BQoGU,7512
|
|
112
113
|
ultralytics/models/__init__.py,sha256=TT9iLCL_n9Y80dcUq0Fo-p-GRZCSU2vrWXM3CoMwqqE,265
|
|
113
114
|
ultralytics/models/fastsam/__init__.py,sha256=0dt65jZ_5b7Q-mdXN8MSEkgnFRA0FIwlel_LS2RaOlU,254
|
|
114
115
|
ultralytics/models/fastsam/model.py,sha256=c7GGwaa9AXssJFwrcuytFHpPOlgSrS3n0utyf4JSL2o,1055
|
|
@@ -222,9 +223,9 @@ ultralytics/utils/callbacks/neptune.py,sha256=5Z3ua5YBTUS56FH8VQKQG1aaIo9fH8GEyz
|
|
|
222
223
|
ultralytics/utils/callbacks/raytune.py,sha256=ODVYzy-CoM4Uge0zjkh3Hnh9nF2M0vhDrSenXnvcizw,705
|
|
223
224
|
ultralytics/utils/callbacks/tensorboard.py,sha256=QEgOVhUqY9akOs5TJIwz1Rvn6l32xWLpOxlwEyWF0B8,4136
|
|
224
225
|
ultralytics/utils/callbacks/wb.py,sha256=9-fjQIdLjr3b73DTE3rHO171KvbH1VweJ-bmbv-rqTw,6747
|
|
225
|
-
ultralytics-8.2.
|
|
226
|
-
ultralytics-8.2.
|
|
227
|
-
ultralytics-8.2.
|
|
228
|
-
ultralytics-8.2.
|
|
229
|
-
ultralytics-8.2.
|
|
230
|
-
ultralytics-8.2.
|
|
226
|
+
ultralytics-8.2.68.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
|
227
|
+
ultralytics-8.2.68.dist-info/METADATA,sha256=Sbvvwn9ey5INu9Iqb5yZz8KtyC4zc56D7ItK9LW1TJ0,41337
|
|
228
|
+
ultralytics-8.2.68.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
|
|
229
|
+
ultralytics-8.2.68.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
|
|
230
|
+
ultralytics-8.2.68.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
|
|
231
|
+
ultralytics-8.2.68.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|