ultralytics 8.0.115__py3-none-any.whl → 8.0.116__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 +3 -2
- ultralytics/vit/rtdetr/model.py +9 -0
- ultralytics/vit/sam/model.py +9 -0
- ultralytics/yolo/data/utils.py +1 -1
- ultralytics/yolo/nas/__init__.py +7 -0
- ultralytics/yolo/nas/model.py +125 -0
- ultralytics/yolo/nas/predict.py +35 -0
- ultralytics/yolo/nas/val.py +25 -0
- ultralytics/yolo/utils/__init__.py +6 -5
- ultralytics/yolo/utils/benchmarks.py +14 -5
- ultralytics/yolo/utils/callbacks/dvc.py +3 -8
- ultralytics/yolo/utils/checks.py +23 -20
- ultralytics/yolo/utils/torch_utils.py +2 -0
- {ultralytics-8.0.115.dist-info → ultralytics-8.0.116.dist-info}/METADATA +5 -3
- {ultralytics-8.0.115.dist-info → ultralytics-8.0.116.dist-info}/RECORD +19 -15
- {ultralytics-8.0.115.dist-info → ultralytics-8.0.116.dist-info}/LICENSE +0 -0
- {ultralytics-8.0.115.dist-info → ultralytics-8.0.116.dist-info}/WHEEL +0 -0
- {ultralytics-8.0.115.dist-info → ultralytics-8.0.116.dist-info}/entry_points.txt +0 -0
- {ultralytics-8.0.115.dist-info → ultralytics-8.0.116.dist-info}/top_level.txt +0 -0
ultralytics/__init__.py
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
|
2
2
|
|
|
3
|
-
__version__ = '8.0.
|
|
3
|
+
__version__ = '8.0.116'
|
|
4
4
|
|
|
5
5
|
from ultralytics.hub import start
|
|
6
6
|
from ultralytics.vit.rtdetr import RTDETR
|
|
7
7
|
from ultralytics.vit.sam import SAM
|
|
8
8
|
from ultralytics.yolo.engine.model import YOLO
|
|
9
|
+
from ultralytics.yolo.nas import NAS
|
|
9
10
|
from ultralytics.yolo.utils.checks import check_yolo as checks
|
|
10
11
|
|
|
11
|
-
__all__ = '__version__', 'YOLO', 'SAM', 'RTDETR', 'checks', 'start' # allow simpler import
|
|
12
|
+
__all__ = '__version__', 'YOLO', 'NAS', 'SAM', 'RTDETR', 'checks', 'start' # allow simpler import
|
ultralytics/vit/rtdetr/model.py
CHANGED
|
@@ -110,3 +110,12 @@ class RTDETR:
|
|
|
110
110
|
if args.batch == DEFAULT_CFG.batch:
|
|
111
111
|
args.batch = 1 # default to 1 if not modified
|
|
112
112
|
return Exporter(overrides=args)(model=self.model)
|
|
113
|
+
|
|
114
|
+
def __call__(self, source=None, stream=False, **kwargs):
|
|
115
|
+
"""Calls the 'predict' function with given arguments to perform object detection."""
|
|
116
|
+
return self.predict(source, stream, **kwargs)
|
|
117
|
+
|
|
118
|
+
def __getattr__(self, attr):
|
|
119
|
+
"""Raises error if object has no requested attribute."""
|
|
120
|
+
name = self.__class__.__name__
|
|
121
|
+
raise AttributeError(f"'{name}' object has no attribute '{attr}'. See valid attributes below.\n{self.__doc__}")
|
ultralytics/vit/sam/model.py
CHANGED
|
@@ -35,6 +35,15 @@ class SAM:
|
|
|
35
35
|
"""Run validation given dataset."""
|
|
36
36
|
raise NotImplementedError("SAM models don't support validation")
|
|
37
37
|
|
|
38
|
+
def __call__(self, source=None, stream=False, **kwargs):
|
|
39
|
+
"""Calls the 'predict' function with given arguments to perform object detection."""
|
|
40
|
+
return self.predict(source, stream, **kwargs)
|
|
41
|
+
|
|
42
|
+
def __getattr__(self, attr):
|
|
43
|
+
"""Raises error if object has no requested attribute."""
|
|
44
|
+
name = self.__class__.__name__
|
|
45
|
+
raise AttributeError(f"'{name}' object has no attribute '{attr}'. See valid attributes below.\n{self.__doc__}")
|
|
46
|
+
|
|
38
47
|
def info(self, detailed=False, verbose=True):
|
|
39
48
|
"""
|
|
40
49
|
Logs model info.
|
ultralytics/yolo/data/utils.py
CHANGED
|
@@ -138,7 +138,7 @@ def polygon2mask(imgsz, polygons, color=1, downsample_ratio=1):
|
|
|
138
138
|
"""
|
|
139
139
|
Args:
|
|
140
140
|
imgsz (tuple): The image size.
|
|
141
|
-
polygons (np.ndarray): [N, M], N is the number of polygons, M is the number of points(Be divided by 2).
|
|
141
|
+
polygons (list[np.ndarray]): [N, M], N is the number of polygons, M is the number of points(Be divided by 2).
|
|
142
142
|
color (int): color
|
|
143
143
|
downsample_ratio (int): downsample ratio
|
|
144
144
|
"""
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
|
2
|
+
"""
|
|
3
|
+
# NAS model interface
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
import torch
|
|
9
|
+
|
|
10
|
+
from ultralytics.yolo.cfg import get_cfg
|
|
11
|
+
from ultralytics.yolo.engine.exporter import Exporter
|
|
12
|
+
from ultralytics.yolo.utils import DEFAULT_CFG, DEFAULT_CFG_DICT, LOGGER, ROOT, is_git_dir
|
|
13
|
+
from ultralytics.yolo.utils.checks import check_imgsz
|
|
14
|
+
|
|
15
|
+
from ...yolo.utils.torch_utils import model_info, smart_inference_mode
|
|
16
|
+
from .predict import NASPredictor
|
|
17
|
+
from .val import NASValidator
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class NAS:
|
|
21
|
+
|
|
22
|
+
def __init__(self, model='yolo_nas_s.pt') -> None:
|
|
23
|
+
# Load or create new NAS model
|
|
24
|
+
import super_gradients
|
|
25
|
+
|
|
26
|
+
self.predictor = None
|
|
27
|
+
suffix = Path(model).suffix
|
|
28
|
+
if suffix == '.pt':
|
|
29
|
+
self._load(model)
|
|
30
|
+
elif suffix == '':
|
|
31
|
+
self.model = super_gradients.training.models.get(model, pretrained_weights='coco')
|
|
32
|
+
self.task = 'detect'
|
|
33
|
+
self.model.args = DEFAULT_CFG_DICT # attach args to model
|
|
34
|
+
|
|
35
|
+
# Standardize model
|
|
36
|
+
self.model.fuse = lambda verbose: self.model
|
|
37
|
+
self.model.stride = torch.tensor([32])
|
|
38
|
+
self.model.names = dict(enumerate(self.model._class_names))
|
|
39
|
+
self.model.is_fused = lambda: False # for info()
|
|
40
|
+
self.model.yaml = {} # for info()
|
|
41
|
+
self.info()
|
|
42
|
+
|
|
43
|
+
@smart_inference_mode()
|
|
44
|
+
def _load(self, weights: str):
|
|
45
|
+
self.model = torch.load(weights)
|
|
46
|
+
|
|
47
|
+
@smart_inference_mode()
|
|
48
|
+
def predict(self, source=None, stream=False, **kwargs):
|
|
49
|
+
"""
|
|
50
|
+
Perform prediction using the YOLO model.
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
source (str | int | PIL | np.ndarray): The source of the image to make predictions on.
|
|
54
|
+
Accepts all source types accepted by the YOLO model.
|
|
55
|
+
stream (bool): Whether to stream the predictions or not. Defaults to False.
|
|
56
|
+
**kwargs : Additional keyword arguments passed to the predictor.
|
|
57
|
+
Check the 'configuration' section in the documentation for all available options.
|
|
58
|
+
|
|
59
|
+
Returns:
|
|
60
|
+
(List[ultralytics.yolo.engine.results.Results]): The prediction results.
|
|
61
|
+
"""
|
|
62
|
+
if source is None:
|
|
63
|
+
source = ROOT / 'assets' if is_git_dir() else 'https://ultralytics.com/images/bus.jpg'
|
|
64
|
+
LOGGER.warning(f"WARNING ⚠️ 'source' is missing. Using 'source={source}'.")
|
|
65
|
+
overrides = dict(conf=0.25, task='detect', mode='predict')
|
|
66
|
+
overrides.update(kwargs) # prefer kwargs
|
|
67
|
+
if not self.predictor:
|
|
68
|
+
self.predictor = NASPredictor(overrides=overrides)
|
|
69
|
+
self.predictor.setup_model(model=self.model)
|
|
70
|
+
else: # only update args if predictor is already setup
|
|
71
|
+
self.predictor.args = get_cfg(self.predictor.args, overrides)
|
|
72
|
+
return self.predictor(source, stream=stream)
|
|
73
|
+
|
|
74
|
+
def train(self, **kwargs):
|
|
75
|
+
"""Function trains models but raises an error as NAS models do not support training."""
|
|
76
|
+
raise NotImplementedError("NAS models don't support training")
|
|
77
|
+
|
|
78
|
+
def val(self, **kwargs):
|
|
79
|
+
"""Run validation given dataset."""
|
|
80
|
+
overrides = dict(task='detect', mode='val')
|
|
81
|
+
overrides.update(kwargs) # prefer kwargs
|
|
82
|
+
args = get_cfg(cfg=DEFAULT_CFG, overrides=overrides)
|
|
83
|
+
args.imgsz = check_imgsz(args.imgsz, max_dim=1)
|
|
84
|
+
validator = NASValidator(args=args)
|
|
85
|
+
validator(model=self.model)
|
|
86
|
+
self.metrics = validator.metrics
|
|
87
|
+
return validator.metrics
|
|
88
|
+
|
|
89
|
+
@smart_inference_mode()
|
|
90
|
+
def export(self, **kwargs):
|
|
91
|
+
"""
|
|
92
|
+
Export model.
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
**kwargs : Any other args accepted by the predictors. To see all args check 'configuration' section in docs
|
|
96
|
+
"""
|
|
97
|
+
overrides = dict(task='detect')
|
|
98
|
+
overrides.update(kwargs)
|
|
99
|
+
overrides['mode'] = 'export'
|
|
100
|
+
args = get_cfg(cfg=DEFAULT_CFG, overrides=overrides)
|
|
101
|
+
args.task = self.task
|
|
102
|
+
if args.imgsz == DEFAULT_CFG.imgsz:
|
|
103
|
+
args.imgsz = self.model.args['imgsz'] # use trained imgsz unless custom value is passed
|
|
104
|
+
if args.batch == DEFAULT_CFG.batch:
|
|
105
|
+
args.batch = 1 # default to 1 if not modified
|
|
106
|
+
return Exporter(overrides=args)(model=self.model)
|
|
107
|
+
|
|
108
|
+
def info(self, detailed=False, verbose=True):
|
|
109
|
+
"""
|
|
110
|
+
Logs model info.
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
detailed (bool): Show detailed information about model.
|
|
114
|
+
verbose (bool): Controls verbosity.
|
|
115
|
+
"""
|
|
116
|
+
return model_info(self.model, detailed=detailed, verbose=verbose, imgsz=640)
|
|
117
|
+
|
|
118
|
+
def __call__(self, source=None, stream=False, **kwargs):
|
|
119
|
+
"""Calls the 'predict' function with given arguments to perform object detection."""
|
|
120
|
+
return self.predict(source, stream, **kwargs)
|
|
121
|
+
|
|
122
|
+
def __getattr__(self, attr):
|
|
123
|
+
"""Raises error if object has no requested attribute."""
|
|
124
|
+
name = self.__class__.__name__
|
|
125
|
+
raise AttributeError(f"'{name}' object has no attribute '{attr}'. See valid attributes below.\n{self.__doc__}")
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
|
2
|
+
|
|
3
|
+
import torch
|
|
4
|
+
|
|
5
|
+
from ultralytics.yolo.engine.predictor import BasePredictor
|
|
6
|
+
from ultralytics.yolo.engine.results import Results
|
|
7
|
+
from ultralytics.yolo.utils import ops
|
|
8
|
+
from ultralytics.yolo.utils.ops import xyxy2xywh
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class NASPredictor(BasePredictor):
|
|
12
|
+
|
|
13
|
+
def postprocess(self, preds_in, img, orig_imgs):
|
|
14
|
+
"""Postprocesses predictions and returns a list of Results objects."""
|
|
15
|
+
|
|
16
|
+
# Cat boxes and class scores
|
|
17
|
+
boxes = xyxy2xywh(preds_in[0][0])
|
|
18
|
+
preds = torch.cat((boxes, preds_in[0][1]), -1).permute(0, 2, 1)
|
|
19
|
+
|
|
20
|
+
preds = ops.non_max_suppression(preds,
|
|
21
|
+
self.args.conf,
|
|
22
|
+
self.args.iou,
|
|
23
|
+
agnostic=self.args.agnostic_nms,
|
|
24
|
+
max_det=self.args.max_det,
|
|
25
|
+
classes=self.args.classes)
|
|
26
|
+
|
|
27
|
+
results = []
|
|
28
|
+
for i, pred in enumerate(preds):
|
|
29
|
+
orig_img = orig_imgs[i] if isinstance(orig_imgs, list) else orig_imgs
|
|
30
|
+
if not isinstance(orig_imgs, torch.Tensor):
|
|
31
|
+
pred[:, :4] = ops.scale_boxes(img.shape[2:], pred[:, :4], orig_img.shape)
|
|
32
|
+
path = self.batch[0]
|
|
33
|
+
img_path = path[i] if isinstance(path, list) else path
|
|
34
|
+
results.append(Results(orig_img=orig_img, path=img_path, names=self.model.names, boxes=pred))
|
|
35
|
+
return results
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
|
2
|
+
|
|
3
|
+
import torch
|
|
4
|
+
|
|
5
|
+
from ultralytics.yolo.utils import ops
|
|
6
|
+
from ultralytics.yolo.utils.ops import xyxy2xywh
|
|
7
|
+
from ultralytics.yolo.v8.detect import DetectionValidator
|
|
8
|
+
|
|
9
|
+
__all__ = ['NASValidator']
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class NASValidator(DetectionValidator):
|
|
13
|
+
|
|
14
|
+
def postprocess(self, preds_in):
|
|
15
|
+
"""Apply Non-maximum suppression to prediction outputs."""
|
|
16
|
+
boxes = xyxy2xywh(preds_in[0][0])
|
|
17
|
+
preds = torch.cat((boxes, preds_in[0][1]), -1).permute(0, 2, 1)
|
|
18
|
+
return ops.non_max_suppression(preds,
|
|
19
|
+
self.args.conf,
|
|
20
|
+
self.args.iou,
|
|
21
|
+
labels=self.lb,
|
|
22
|
+
multi_label=False,
|
|
23
|
+
agnostic=self.args.single_cls,
|
|
24
|
+
max_det=self.args.max_det,
|
|
25
|
+
max_time_img=0.5)
|
|
@@ -224,6 +224,11 @@ def set_logging(name=LOGGING_NAME, verbose=True):
|
|
|
224
224
|
'propagate': False}}})
|
|
225
225
|
|
|
226
226
|
|
|
227
|
+
def emojis(string=''):
|
|
228
|
+
"""Return platform-dependent emoji-safe version of string."""
|
|
229
|
+
return string.encode().decode('ascii', 'ignore') if WINDOWS else string
|
|
230
|
+
|
|
231
|
+
|
|
227
232
|
class EmojiFilter(logging.Filter):
|
|
228
233
|
"""
|
|
229
234
|
A custom logging filter class for removing emojis in log messages.
|
|
@@ -533,6 +538,7 @@ def get_user_config_dir(sub_dir='Ultralytics'):
|
|
|
533
538
|
# GCP and AWS lambda fix, only /tmp is writeable
|
|
534
539
|
if not is_dir_writeable(str(path.parent)):
|
|
535
540
|
path = Path('/tmp') / sub_dir
|
|
541
|
+
LOGGER.warning(f"WARNING ⚠️ user config directory is not writeable, defaulting to '{path}'.")
|
|
536
542
|
|
|
537
543
|
# Create the subdirectory if it does not exist
|
|
538
544
|
path.mkdir(parents=True, exist_ok=True)
|
|
@@ -544,11 +550,6 @@ USER_CONFIG_DIR = Path(os.getenv('YOLO_CONFIG_DIR', get_user_config_dir())) # U
|
|
|
544
550
|
SETTINGS_YAML = USER_CONFIG_DIR / 'settings.yaml'
|
|
545
551
|
|
|
546
552
|
|
|
547
|
-
def emojis(string=''):
|
|
548
|
-
"""Return platform-dependent emoji-safe version of string."""
|
|
549
|
-
return string.encode().decode('ascii', 'ignore') if WINDOWS else string
|
|
550
|
-
|
|
551
|
-
|
|
552
553
|
def colorstr(*input):
|
|
553
554
|
"""Colors a string https://en.wikipedia.org/wiki/ANSI_escape_code, i.e. colorstr('blue', 'hello world')."""
|
|
554
555
|
*args, string = input if len(input) > 1 else ('blue', 'bold', input[0]) # color arguments, string
|
|
@@ -90,7 +90,7 @@ def benchmark(model=Path(SETTINGS['weights_dir']) / 'yolov8n.pt',
|
|
|
90
90
|
filename = model.ckpt_path or model.cfg
|
|
91
91
|
export = model # PyTorch format
|
|
92
92
|
else:
|
|
93
|
-
filename = model.export(imgsz=imgsz, format=format, half=half, int8=int8, device=device)
|
|
93
|
+
filename = model.export(imgsz=imgsz, format=format, half=half, int8=int8, device=device, verbose=False)
|
|
94
94
|
export = YOLO(filename, task=model.task)
|
|
95
95
|
assert suffix in str(filename), 'export failed'
|
|
96
96
|
emoji = '❎' # indicates export succeeded
|
|
@@ -196,8 +196,17 @@ class ProfileModels:
|
|
|
196
196
|
model.fuse() # to report correct params and GFLOPs in model.info()
|
|
197
197
|
model_info = model.info()
|
|
198
198
|
if self.trt and self.device.type != 'cpu' and not engine_file.is_file():
|
|
199
|
-
engine_file = model.export(format='engine',
|
|
200
|
-
|
|
199
|
+
engine_file = model.export(format='engine',
|
|
200
|
+
half=True,
|
|
201
|
+
imgsz=self.imgsz,
|
|
202
|
+
device=self.device,
|
|
203
|
+
verbose=False)
|
|
204
|
+
onnx_file = model.export(format='onnx',
|
|
205
|
+
half=True,
|
|
206
|
+
imgsz=self.imgsz,
|
|
207
|
+
simplify=True,
|
|
208
|
+
device=self.device,
|
|
209
|
+
verbose=False)
|
|
201
210
|
elif file.suffix == '.onnx':
|
|
202
211
|
model_info = self.get_onnx_model_info(file)
|
|
203
212
|
onnx_file = file
|
|
@@ -254,7 +263,7 @@ class ProfileModels:
|
|
|
254
263
|
for _ in range(3):
|
|
255
264
|
start_time = time.time()
|
|
256
265
|
for _ in range(self.num_warmup_runs):
|
|
257
|
-
model(input_data, verbose=False)
|
|
266
|
+
model(input_data, imgsz=self.imgsz, verbose=False)
|
|
258
267
|
elapsed = time.time() - start_time
|
|
259
268
|
|
|
260
269
|
# Compute number of runs as higher of min_time or num_timed_runs
|
|
@@ -263,7 +272,7 @@ class ProfileModels:
|
|
|
263
272
|
# Timed runs
|
|
264
273
|
run_times = []
|
|
265
274
|
for _ in tqdm(range(num_runs), desc=engine_file):
|
|
266
|
-
results = model(input_data, verbose=False)
|
|
275
|
+
results = model(input_data, imgsz=self.imgsz, verbose=False)
|
|
267
276
|
run_times.append(results[0].speed['inference']) # Convert to milliseconds
|
|
268
277
|
|
|
269
278
|
run_times = self.iterative_sigma_clipping(np.array(run_times), sigma=2, max_iters=3) # sigma clipping
|
|
@@ -4,7 +4,7 @@ import os
|
|
|
4
4
|
import pkg_resources as pkg
|
|
5
5
|
|
|
6
6
|
from ultralytics.yolo.utils import LOGGER, TESTS_RUNNING
|
|
7
|
-
from ultralytics.yolo.utils.torch_utils import
|
|
7
|
+
from ultralytics.yolo.utils.torch_utils import model_info_for_loggers
|
|
8
8
|
|
|
9
9
|
try:
|
|
10
10
|
from importlib.metadata import version
|
|
@@ -42,7 +42,7 @@ def _log_images(image_path, prefix=''):
|
|
|
42
42
|
def _log_plots(plots, prefix=''):
|
|
43
43
|
for name, params in plots.items():
|
|
44
44
|
timestamp = params['timestamp']
|
|
45
|
-
if _processed_plots.get(name
|
|
45
|
+
if _processed_plots.get(name) != timestamp:
|
|
46
46
|
_log_images(name, prefix)
|
|
47
47
|
_processed_plots[name] = timestamp
|
|
48
48
|
|
|
@@ -100,12 +100,7 @@ def on_fit_epoch_end(trainer):
|
|
|
100
100
|
live.log_metric(metric, value)
|
|
101
101
|
|
|
102
102
|
if trainer.epoch == 0:
|
|
103
|
-
|
|
104
|
-
'model/parameters': get_num_params(trainer.model),
|
|
105
|
-
'model/GFLOPs': round(get_flops(trainer.model), 3),
|
|
106
|
-
'model/speed(ms)': round(trainer.validator.speed['inference'], 3)}
|
|
107
|
-
|
|
108
|
-
for metric, value in model_info.items():
|
|
103
|
+
for metric, value in model_info_for_loggers(trainer).items():
|
|
109
104
|
live.log_metric(metric, value, plot=False)
|
|
110
105
|
|
|
111
106
|
_log_plots(trainer.plots, 'train')
|
ultralytics/yolo/utils/checks.py
CHANGED
|
@@ -19,9 +19,9 @@ import requests
|
|
|
19
19
|
import torch
|
|
20
20
|
from matplotlib import font_manager
|
|
21
21
|
|
|
22
|
-
from ultralytics.yolo.utils import (AUTOINSTALL, LOGGER, ONLINE, ROOT, USER_CONFIG_DIR, TryExcept, clean_url,
|
|
23
|
-
downloads, emojis, is_colab, is_docker, is_kaggle, is_online,
|
|
24
|
-
url2file)
|
|
22
|
+
from ultralytics.yolo.utils import (AUTOINSTALL, LOGGER, ONLINE, RANK, ROOT, USER_CONFIG_DIR, TryExcept, clean_url,
|
|
23
|
+
colorstr, downloads, emojis, is_colab, is_docker, is_kaggle, is_online,
|
|
24
|
+
is_pip_package, url2file)
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
def is_ascii(s) -> bool:
|
|
@@ -164,23 +164,26 @@ def check_font(font='Arial.ttf'):
|
|
|
164
164
|
Returns:
|
|
165
165
|
file (Path): Resolved font file path.
|
|
166
166
|
"""
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
167
|
+
from ultralytics.yolo.utils.torch_utils import torch_distributed_zero_first
|
|
168
|
+
|
|
169
|
+
with torch_distributed_zero_first(RANK):
|
|
170
|
+
name = Path(font).name
|
|
171
|
+
|
|
172
|
+
# Check USER_CONFIG_DIR
|
|
173
|
+
file = USER_CONFIG_DIR / name
|
|
174
|
+
if file.exists():
|
|
175
|
+
return file
|
|
176
|
+
|
|
177
|
+
# Check system fonts
|
|
178
|
+
matches = [s for s in font_manager.findSystemFonts() if font in s]
|
|
179
|
+
if any(matches):
|
|
180
|
+
return matches[0]
|
|
181
|
+
|
|
182
|
+
# Download to USER_CONFIG_DIR if missing
|
|
183
|
+
url = f'https://ultralytics.com/assets/{name}'
|
|
184
|
+
if downloads.is_url(url):
|
|
185
|
+
downloads.safe_download(url=url, file=file)
|
|
186
|
+
return file
|
|
184
187
|
|
|
185
188
|
|
|
186
189
|
def check_python(minimum: str = '3.7.0') -> bool:
|
|
@@ -64,6 +64,8 @@ def select_device(device='', batch=0, newline=False, verbose=True):
|
|
|
64
64
|
if cpu or mps:
|
|
65
65
|
os.environ['CUDA_VISIBLE_DEVICES'] = '-1' # force torch.cuda.is_available() = False
|
|
66
66
|
elif device: # non-cpu device requested
|
|
67
|
+
if device == 'cuda':
|
|
68
|
+
device = '0'
|
|
67
69
|
visible = os.environ.get('CUDA_VISIBLE_DEVICES', None)
|
|
68
70
|
os.environ['CUDA_VISIBLE_DEVICES'] = device # set environment variable - must be before assert is_available()
|
|
69
71
|
if not (torch.cuda.is_available() and torch.cuda.device_count() >= len(device.replace(',', ''))):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ultralytics
|
|
3
|
-
Version: 8.0.
|
|
3
|
+
Version: 8.0.116
|
|
4
4
|
Summary: Ultralytics YOLOv8 for SOTA object detection, multi-object tracking, instance segmentation, pose estimation and image classification.
|
|
5
5
|
Home-page: https://github.com/ultralytics/ultralytics
|
|
6
6
|
Author: Ultralytics
|
|
@@ -161,9 +161,11 @@ path = model.export(format="onnx") # export the model to ONNX format
|
|
|
161
161
|
|
|
162
162
|
## <div align="center">Models</div>
|
|
163
163
|
|
|
164
|
-
|
|
164
|
+
YOLOv8 [Detect](https://docs.ultralytics.com/tasks/detect), [Segment](https://docs.ultralytics.com/tasks/segment) and [Pose](https://docs.ultralytics.com/tasks/pose) models pretrained on the [COCO](https://docs.ultralytics.com/datasets/detect/coco) dataset are available here, as well as YOLOv8 [Classify](https://docs.ultralytics.com/modes/classify) models pretrained on the [ImageNet](https://docs.ultralytics.com/datasets/classify/imagenet) dataset. [Track](https://docs.ultralytics.com/modes/track) mode is available for all Detect, Segment and Pose models.
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
<img width="1024" src="https://raw.githubusercontent.com/ultralytics/assets/tasks/im/banner-tasks.png">
|
|
167
|
+
|
|
168
|
+
All [Models](https://github.com/ultralytics/ultralytics/tree/main/ultralytics/models) download automatically from the latest Ultralytics [release](https://github.com/ultralytics/assets/releases) on first use.
|
|
167
169
|
|
|
168
170
|
<details open><summary>Detection</summary>
|
|
169
171
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
ultralytics/__init__.py,sha256=
|
|
1
|
+
ultralytics/__init__.py,sha256=kGXynKiWGuj7CVtgwKm1YG31e0E0Ppqx104S-9rSBgk,427
|
|
2
2
|
ultralytics/assets/bus.jpg,sha256=wCAZxJecGR63Od3ZRERe9Aja1Weayrb9Ug751DS_vGM,137419
|
|
3
3
|
ultralytics/assets/zidane.jpg,sha256=Ftc4aeMmen1O0A3o6GCDO9FlfBslLpTAw0gnetx7bts,50427
|
|
4
4
|
ultralytics/datasets/Argoverse.yaml,sha256=Q6hKRtI52JOYt4qmjkeo192mmgSkuCdOnfiUTxtBy5A,2751
|
|
@@ -59,14 +59,14 @@ ultralytics/tracker/utils/kalman_filter.py,sha256=gMc4gDKo_dkMiL-Zkt-U7mTxjK_z4A
|
|
|
59
59
|
ultralytics/tracker/utils/matching.py,sha256=O_wJb-6ZuucIl2TuLsVe7QmqqxUNP8aoCjaWxnhk_Xg,8699
|
|
60
60
|
ultralytics/vit/__init__.py,sha256=_lrglMOLuopqBVEAwGFnM8Huc6SJAHcysuGc0dmA8l0,149
|
|
61
61
|
ultralytics/vit/rtdetr/__init__.py,sha256=1Zpc6ZcizFO0EMhP8X4m3DG27vDBX4aM4RX0rMSeo6E,197
|
|
62
|
-
ultralytics/vit/rtdetr/model.py,sha256=
|
|
62
|
+
ultralytics/vit/rtdetr/model.py,sha256=CVtRbvCTQLFmG5d2CCFfVdnWrv9ClL8vaw4_BPtDrBs,5077
|
|
63
63
|
ultralytics/vit/rtdetr/predict.py,sha256=zYV0c5lWr79h_J8kBhcFPB5wcDOyGdgR1qr_Z_l6Rj4,1902
|
|
64
64
|
ultralytics/vit/rtdetr/val.py,sha256=6ERi9xIFOEkoEvWuy9DuOc5u1OaI2jm2Jag9l9zesvw,4790
|
|
65
65
|
ultralytics/vit/sam/__init__.py,sha256=qAi91Krwqwsu2jruHiJgLabEkWo9yeZ5gDIHIKzX-PE,130
|
|
66
66
|
ultralytics/vit/sam/amg.py,sha256=tzpbVPiyIwENW0xgtdy08kVGgn69zOk4VGjHmEFTCeE,13304
|
|
67
67
|
ultralytics/vit/sam/autosize.py,sha256=3lym72tdiJFvbyIOMzxUzumqx82PY3lYEB3ctWNgM4s,3878
|
|
68
68
|
ultralytics/vit/sam/build.py,sha256=Cp0LhlNcjLl-2OA_06eaeYlA3lK3N0KqUfhmZJ7A8Hw,3781
|
|
69
|
-
ultralytics/vit/sam/model.py,sha256=
|
|
69
|
+
ultralytics/vit/sam/model.py,sha256=kS-zpGw8wXKkU0yWCH-uGvmMFWB_AnEAa6NMVdsUDEA,2274
|
|
70
70
|
ultralytics/vit/sam/predict.py,sha256=RcC3uLs3RiqWeW7UxdyjK6LcmqysFqRRfz3f-pV_mPQ,2139
|
|
71
71
|
ultralytics/vit/sam/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
72
72
|
ultralytics/vit/sam/modules/decoders.py,sha256=MJhFLPA7broz2oiYI5tUi3ROWgPxNshhKFXKUP4CEPc,6351
|
|
@@ -86,7 +86,7 @@ ultralytics/yolo/data/build.py,sha256=9eVmHXp79QpTLVB-sbaZSM6Qaet9YbiiiTW4TviAGE
|
|
|
86
86
|
ultralytics/yolo/data/converter.py,sha256=D-O9eOcO1qg7ultRv2xLAQR39JjVIUkR--g05zquQDA,9190
|
|
87
87
|
ultralytics/yolo/data/dataset.py,sha256=jmbIpgMaWhQtLfWC4hP8LBaBG2wpFGpxXDg0478FF58,13372
|
|
88
88
|
ultralytics/yolo/data/dataset_wrappers.py,sha256=a5uwWLhWDRCG5VFto6I3zknxaElxnrcOHiuTAKmmmYg,1776
|
|
89
|
-
ultralytics/yolo/data/utils.py,sha256=
|
|
89
|
+
ultralytics/yolo/data/utils.py,sha256=nqo_SJNnlBANLEOzvmJGFxz_Ai0OvAQe-CEmMCgDUBo,24056
|
|
90
90
|
ultralytics/yolo/data/dataloaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
91
91
|
ultralytics/yolo/data/dataloaders/stream_loaders.py,sha256=0bg7lPloNLml7zO9Qe-fz4Cw7VbbSZjrEUbBe-lfpzc,14905
|
|
92
92
|
ultralytics/yolo/data/dataloaders/v5augmentations.py,sha256=t39RSuHCDCX4MV9EkIoJWaPOjkYlNbbpi-30fg725rw,17646
|
|
@@ -98,10 +98,14 @@ ultralytics/yolo/engine/predictor.py,sha256=j1F6f6AHs-LNBta4IG45VyLXEs78UaYpjoIE
|
|
|
98
98
|
ultralytics/yolo/engine/results.py,sha256=KNiXW_xkSN8qJJl7gqQKCz_6zjU0nyBHKqD3yoIf-2E,24287
|
|
99
99
|
ultralytics/yolo/engine/trainer.py,sha256=Xie6mlF-jCESk-3tMLMf1nY8bI8_-9Owgg2EAQPfMLI,31199
|
|
100
100
|
ultralytics/yolo/engine/validator.py,sha256=ZbOde8CClZQgTFXJ68v4DP_etR1prJYrwMayyKUcfTk,11715
|
|
101
|
-
ultralytics/yolo/
|
|
101
|
+
ultralytics/yolo/nas/__init__.py,sha256=O7qvgqJqoLB1NXwjTNHMJHJRhDwNHS2P_oyUV_b1qq8,179
|
|
102
|
+
ultralytics/yolo/nas/model.py,sha256=LU0NaoZjcJEDvKQetavJ7YmVzn-kGO-IJDDw8vKz-S4,4977
|
|
103
|
+
ultralytics/yolo/nas/predict.py,sha256=WbO9fxO2o_WA3nM7KkgHDgr2eJWdYsT725BcJ6_Qtrs,1465
|
|
104
|
+
ultralytics/yolo/nas/val.py,sha256=D9jIFcafuD768X5l9Q56hrXIz-Jl45uEReIsPyrlNgs,953
|
|
105
|
+
ultralytics/yolo/utils/__init__.py,sha256=OJ0x67npaXsLYD5TzKmlMZ-n74Jq0hG43fHglT8SMkE,27955
|
|
102
106
|
ultralytics/yolo/utils/autobatch.py,sha256=-8eEMRN9KyX9nslL5XAC2gMTFAH5YFA33q6nnQDj1qU,3846
|
|
103
|
-
ultralytics/yolo/utils/benchmarks.py,sha256=
|
|
104
|
-
ultralytics/yolo/utils/checks.py,sha256=
|
|
107
|
+
ultralytics/yolo/utils/benchmarks.py,sha256=lFdnVqrXlI2n8JC-B1UgW2zip-Tsii7HjrJrCQmDV-g,15888
|
|
108
|
+
ultralytics/yolo/utils/checks.py,sha256=3kLYaCCuZpGNKaX9RYDEHfiPgKD-Sc3Ep5kmR-LBQFI,17568
|
|
105
109
|
ultralytics/yolo/utils/dist.py,sha256=qavAVcOeyLV0z31Spo1G9batXljnYzp1NN8YWFoBTxk,2596
|
|
106
110
|
ultralytics/yolo/utils/downloads.py,sha256=w_Pnw_0_s6rNno54J1-qIm8Zy_I0jr7B9fSdD-TwX8g,12114
|
|
107
111
|
ultralytics/yolo/utils/errors.py,sha256=u8NUGZbWVrr4O3ez6UXnabNb_zRwJUPJqDOUSpmX3-k,317
|
|
@@ -113,13 +117,13 @@ ultralytics/yolo/utils/ops.py,sha256=ne7GC7hOuAS3Lnk7eDx5w8LOMtbb_l7nJcb0wpBVJRQ
|
|
|
113
117
|
ultralytics/yolo/utils/patches.py,sha256=lxG_qZlTxiCcKWrVFtvSVA8WULRa483fOJ4ffYyGQ50,1241
|
|
114
118
|
ultralytics/yolo/utils/plotting.py,sha256=ScX-_AasukwuQpOT8q18YMSKMwJBDKFM8q1o8oY8MqE,24431
|
|
115
119
|
ultralytics/yolo/utils/tal.py,sha256=BFovrLm0m5_Pv-hFzYMAD3oonS1MvDqdy51f_Cx6Aq8,13645
|
|
116
|
-
ultralytics/yolo/utils/torch_utils.py,sha256=
|
|
120
|
+
ultralytics/yolo/utils/torch_utils.py,sha256=mpAdku7PNYFLOFcijSWA3poZ6ShIShOlEHlqvBDzJp4,22231
|
|
117
121
|
ultralytics/yolo/utils/tuner.py,sha256=yq3nYsnug2LC-iJJwLlXrQwJJT2VanujFFKnY-06CBQ,2300
|
|
118
122
|
ultralytics/yolo/utils/callbacks/__init__.py,sha256=nhrnMPpPDb5fgqw42w8e7fC5TjEPC-jp04dpQtaQtkU,214
|
|
119
123
|
ultralytics/yolo/utils/callbacks/base.py,sha256=VpiMIW9qiyncMq9cLRmm5WGr38On0LVTK2XNDmliEbE,5593
|
|
120
124
|
ultralytics/yolo/utils/callbacks/clearml.py,sha256=VYtuNTlB8M5rIFQupm53uhDEXe8qZrrOjXXHTI0bIUw,5902
|
|
121
125
|
ultralytics/yolo/utils/callbacks/comet.py,sha256=_Dm-Qbeyi36nSSETsoiObG52gceLw6RE2TodEYW7sUY,12978
|
|
122
|
-
ultralytics/yolo/utils/callbacks/dvc.py,sha256=
|
|
126
|
+
ultralytics/yolo/utils/callbacks/dvc.py,sha256=7xNhDoTQqapOULEVrwxluZGOdKZVK74EPLFu4Rm47Tw,4301
|
|
123
127
|
ultralytics/yolo/utils/callbacks/hub.py,sha256=Z-F48IcG2PtlJo3mnzp31YdXrS8nyMn6004-Ke6NLyM,3310
|
|
124
128
|
ultralytics/yolo/utils/callbacks/mlflow.py,sha256=fCp4zNefamIzqZpOkoG2UqKVkeuIX41_em2Uw33iasY,2493
|
|
125
129
|
ultralytics/yolo/utils/callbacks/neptune.py,sha256=lBvXuXkgHfiDkdeRAM7TbK7xQBSAKxYQQAwHt7SMNi8,3679
|
|
@@ -143,9 +147,9 @@ ultralytics/yolo/v8/segment/__init__.py,sha256=TOdf3ju-D5hSi-PYMpETFmv-wyhIRKGuj
|
|
|
143
147
|
ultralytics/yolo/v8/segment/predict.py,sha256=QSwXjC7sq7l7kT0W1UrwGZrUXNqkveRGRIsRnlQlWYM,2839
|
|
144
148
|
ultralytics/yolo/v8/segment/train.py,sha256=Ag0uHlJp297dljtECqZ5VVfnWj7m86oD1Dy1_s4vIEs,2499
|
|
145
149
|
ultralytics/yolo/v8/segment/val.py,sha256=R3D_itui1lU0iXC1aqmZvmwGX77oJt--bQ7MhTErsBY,12906
|
|
146
|
-
ultralytics-8.0.
|
|
147
|
-
ultralytics-8.0.
|
|
148
|
-
ultralytics-8.0.
|
|
149
|
-
ultralytics-8.0.
|
|
150
|
-
ultralytics-8.0.
|
|
151
|
-
ultralytics-8.0.
|
|
150
|
+
ultralytics-8.0.116.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
|
151
|
+
ultralytics-8.0.116.dist-info/METADATA,sha256=fhzEqGcUjDMa-o-bqGrtVJHMhLse8F6-KqsHmd5r9Ug,27157
|
|
152
|
+
ultralytics-8.0.116.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
|
153
|
+
ultralytics-8.0.116.dist-info/entry_points.txt,sha256=Ck1F6qKNokeHozQD5pmaFgXHL6dKyC2qCdyXao2e6Yg,103
|
|
154
|
+
ultralytics-8.0.116.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
|
|
155
|
+
ultralytics-8.0.116.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|