ultralytics 8.0.197__py3-none-any.whl → 8.0.198__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/cfg/__init__.py +4 -5
- ultralytics/engine/trainer.py +1 -0
- ultralytics/utils/__init__.py +2 -1
- ultralytics/utils/callbacks/mlflow.py +76 -36
- ultralytics/utils/callbacks/wb.py +2 -2
- {ultralytics-8.0.197.dist-info → ultralytics-8.0.198.dist-info}/METADATA +1 -1
- {ultralytics-8.0.197.dist-info → ultralytics-8.0.198.dist-info}/RECORD +12 -12
- {ultralytics-8.0.197.dist-info → ultralytics-8.0.198.dist-info}/LICENSE +0 -0
- {ultralytics-8.0.197.dist-info → ultralytics-8.0.198.dist-info}/WHEEL +0 -0
- {ultralytics-8.0.197.dist-info → ultralytics-8.0.198.dist-info}/entry_points.txt +0 -0
- {ultralytics-8.0.197.dist-info → ultralytics-8.0.198.dist-info}/top_level.txt +0 -0
ultralytics/__init__.py
CHANGED
ultralytics/cfg/__init__.py
CHANGED
|
@@ -7,9 +7,9 @@ from pathlib import Path
|
|
|
7
7
|
from types import SimpleNamespace
|
|
8
8
|
from typing import Dict, List, Union
|
|
9
9
|
|
|
10
|
-
from ultralytics.utils import (ASSETS, DEFAULT_CFG, DEFAULT_CFG_DICT, DEFAULT_CFG_PATH, LOGGER, RANK, ROOT,
|
|
11
|
-
SETTINGS_YAML, TESTS_RUNNING, IterableSimpleNamespace, __version__, checks,
|
|
12
|
-
deprecation_warn, yaml_load, yaml_print)
|
|
10
|
+
from ultralytics.utils import (ASSETS, DEFAULT_CFG, DEFAULT_CFG_DICT, DEFAULT_CFG_PATH, LOGGER, RANK, ROOT, RUNS_DIR,
|
|
11
|
+
SETTINGS, SETTINGS_YAML, TESTS_RUNNING, IterableSimpleNamespace, __version__, checks,
|
|
12
|
+
colorstr, deprecation_warn, yaml_load, yaml_print)
|
|
13
13
|
|
|
14
14
|
# Define valid tasks and modes
|
|
15
15
|
MODES = 'train', 'val', 'predict', 'export', 'track', 'benchmark'
|
|
@@ -153,8 +153,7 @@ def get_save_dir(args, name=None):
|
|
|
153
153
|
else:
|
|
154
154
|
from ultralytics.utils.files import increment_path
|
|
155
155
|
|
|
156
|
-
project = args.project or (ROOT /
|
|
157
|
-
'../tests/tmp/runs' if TESTS_RUNNING else Path(SETTINGS['runs_dir'])) / args.task
|
|
156
|
+
project = args.project or (ROOT.parent / 'tests/tmp/runs' if TESTS_RUNNING else RUNS_DIR) / args.task
|
|
158
157
|
name = name or args.name or f'{args.mode}'
|
|
159
158
|
save_dir = increment_path(Path(project) / name, exist_ok=args.exist_ok if RANK in (-1, 0) else True)
|
|
160
159
|
|
ultralytics/engine/trainer.py
CHANGED
|
@@ -91,6 +91,7 @@ class BaseTrainer:
|
|
|
91
91
|
|
|
92
92
|
# Dirs
|
|
93
93
|
self.save_dir = get_save_dir(self.args)
|
|
94
|
+
self.args.name = self.save_dir.name # update name for loggers
|
|
94
95
|
self.wdir = self.save_dir / 'weights' # weights dir
|
|
95
96
|
if RANK in (-1, 0):
|
|
96
97
|
self.wdir.mkdir(parents=True, exist_ok=True) # make dir
|
ultralytics/utils/__init__.py
CHANGED
|
@@ -930,7 +930,8 @@ def url2file(url):
|
|
|
930
930
|
PREFIX = colorstr('Ultralytics: ')
|
|
931
931
|
SETTINGS = SettingsManager() # initialize settings
|
|
932
932
|
DATASETS_DIR = Path(SETTINGS['datasets_dir']) # global datasets directory
|
|
933
|
-
WEIGHTS_DIR = Path(SETTINGS['weights_dir'])
|
|
933
|
+
WEIGHTS_DIR = Path(SETTINGS['weights_dir']) # global weights directory
|
|
934
|
+
RUNS_DIR = Path(SETTINGS['runs_dir']) # global runs directory
|
|
934
935
|
ENVIRONMENT = 'Colab' if is_colab() else 'Kaggle' if is_kaggle() else 'Jupyter' if is_jupyter() else \
|
|
935
936
|
'Docker' if is_docker() else platform.system()
|
|
936
937
|
TESTS_RUNNING = is_pytest_running() or is_github_actions_ci()
|
|
@@ -1,64 +1,104 @@
|
|
|
1
1
|
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
|
2
|
+
"""
|
|
3
|
+
MLflow Logging for Ultralytics YOLO.
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
This module enables MLflow logging for Ultralytics YOLO. It logs metrics, parameters, and model artifacts.
|
|
6
|
+
For setting up, a tracking URI should be specified. The logging can be customized using environment variables.
|
|
7
|
+
|
|
8
|
+
Commands:
|
|
9
|
+
1. To set a project name:
|
|
10
|
+
`export MLFLOW_EXPERIMENT_NAME=<your_experiment_name>` or use the project=<project> argument
|
|
11
|
+
|
|
12
|
+
2. To set a run name:
|
|
13
|
+
`export MLFLOW_RUN=<your_run_name>` or use the name=<name> argument
|
|
14
|
+
|
|
15
|
+
3. To start a local MLflow server:
|
|
16
|
+
mlflow server --backend-store-uri runs/mlflow
|
|
17
|
+
It will by default start a local server at http://127.0.0.1:5000.
|
|
18
|
+
To specify a different URI, set the MLFLOW_TRACKING_URI environment variable.
|
|
19
|
+
|
|
20
|
+
4. To kill all running MLflow server instances:
|
|
21
|
+
ps aux | grep 'mlflow' | grep -v 'grep' | awk '{print $2}' | xargs kill -9
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
from ultralytics.utils import LOGGER, RUNS_DIR, SETTINGS, TESTS_RUNNING, colorstr
|
|
4
25
|
|
|
5
26
|
try:
|
|
6
|
-
|
|
27
|
+
import os
|
|
28
|
+
|
|
29
|
+
assert not TESTS_RUNNING or 'test_mlflow' in os.environ.get('PYTEST_CURRENT_TEST', '') # do not log pytest
|
|
7
30
|
assert SETTINGS['mlflow'] is True # verify integration is enabled
|
|
8
31
|
import mlflow
|
|
9
32
|
|
|
10
33
|
assert hasattr(mlflow, '__version__') # verify package is not directory
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import re
|
|
34
|
+
from pathlib import Path
|
|
35
|
+
PREFIX = colorstr('MLflow: ')
|
|
14
36
|
|
|
15
37
|
except (ImportError, AssertionError):
|
|
16
38
|
mlflow = None
|
|
17
39
|
|
|
18
40
|
|
|
19
41
|
def on_pretrain_routine_end(trainer):
|
|
20
|
-
"""
|
|
21
|
-
|
|
42
|
+
"""
|
|
43
|
+
Log training parameters to MLflow at the end of the pretraining routine.
|
|
22
44
|
|
|
23
|
-
|
|
24
|
-
|
|
45
|
+
This function sets up MLflow logging based on environment variables and trainer arguments. It sets the tracking URI,
|
|
46
|
+
experiment name, and run name, then starts the MLflow run if not already active. It finally logs the parameters
|
|
47
|
+
from the trainer.
|
|
25
48
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
Args:
|
|
50
|
+
trainer (ultralytics.engine.trainer.BaseTrainer): The training object with arguments and parameters to log.
|
|
51
|
+
|
|
52
|
+
Global:
|
|
53
|
+
mlflow: The imported mlflow module to use for logging.
|
|
54
|
+
|
|
55
|
+
Environment Variables:
|
|
56
|
+
MLFLOW_TRACKING_URI: The URI for MLflow tracking. If not set, defaults to 'runs/mlflow'.
|
|
57
|
+
MLFLOW_EXPERIMENT_NAME: The name of the MLflow experiment. If not set, defaults to trainer.args.project.
|
|
58
|
+
MLFLOW_RUN: The name of the MLflow run. If not set, defaults to trainer.args.name.
|
|
59
|
+
"""
|
|
60
|
+
global mlflow
|
|
61
|
+
|
|
62
|
+
uri = os.environ.get('MLFLOW_TRACKING_URI') or str(RUNS_DIR / 'mlflow')
|
|
63
|
+
LOGGER.debug(f'{PREFIX} tracking uri: {uri}')
|
|
64
|
+
mlflow.set_tracking_uri(uri)
|
|
65
|
+
|
|
66
|
+
# Set experiment and run names
|
|
67
|
+
experiment_name = os.environ.get('MLFLOW_EXPERIMENT_NAME') or trainer.args.project or '/Shared/YOLOv8'
|
|
68
|
+
run_name = os.environ.get('MLFLOW_RUN') or trainer.args.name
|
|
69
|
+
mlflow.set_experiment(experiment_name)
|
|
70
|
+
|
|
71
|
+
mlflow.autolog()
|
|
72
|
+
try:
|
|
73
|
+
active_run = mlflow.active_run() or mlflow.start_run(run_name=run_name)
|
|
74
|
+
LOGGER.info(f'{PREFIX}logging run_id({active_run.info.run_id}) to {uri}')
|
|
75
|
+
if Path(uri).is_dir():
|
|
76
|
+
LOGGER.info(f"{PREFIX}view at http://127.0.0.1:5000 with 'mlflow server --backend-store-uri {uri}'")
|
|
77
|
+
LOGGER.info(f"{PREFIX}disable with 'yolo settings mlflow=False'")
|
|
78
|
+
mlflow.log_params(dict(trainer.args))
|
|
79
|
+
except Exception as e:
|
|
80
|
+
LOGGER.warning(f'{PREFIX}WARNING ⚠️ Failed to initialize: {e}\n'
|
|
81
|
+
f'{PREFIX}WARNING ⚠️ Not tracking this run')
|
|
45
82
|
|
|
46
83
|
|
|
47
84
|
def on_fit_epoch_end(trainer):
|
|
48
|
-
"""
|
|
85
|
+
"""Log training metrics at the end of each fit epoch to MLflow."""
|
|
49
86
|
if mlflow:
|
|
50
|
-
|
|
51
|
-
|
|
87
|
+
sanitized_metrics = {k.replace('(', '').replace(')', ''): float(v) for k, v in trainer.metrics.items()}
|
|
88
|
+
mlflow.log_metrics(metrics=sanitized_metrics, step=trainer.epoch)
|
|
52
89
|
|
|
53
90
|
|
|
54
91
|
def on_train_end(trainer):
|
|
55
|
-
"""
|
|
92
|
+
"""Log model artifacts at the end of the training."""
|
|
56
93
|
if mlflow:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
94
|
+
mlflow.log_artifact(str(trainer.best.parent)) # log save_dir/weights directory with best.pt and last.pt
|
|
95
|
+
for f in trainer.save_dir.glob('*'): # log all other files in save_dir
|
|
96
|
+
if f.suffix in {'.png', '.jpg', '.csv', '.pt', '.yaml'}:
|
|
97
|
+
mlflow.log_artifact(str(f))
|
|
98
|
+
|
|
60
99
|
mlflow.end_run()
|
|
61
|
-
LOGGER.
|
|
100
|
+
LOGGER.info(f'{PREFIX}results logged to {mlflow.get_tracking_uri()}\n'
|
|
101
|
+
f"{PREFIX}disable with 'yolo settings mlflow=False'")
|
|
62
102
|
|
|
63
103
|
|
|
64
104
|
callbacks = {
|
|
@@ -19,7 +19,7 @@ except (ImportError, AssertionError):
|
|
|
19
19
|
wb = None
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
def _custom_table(x, y, classes, title='Precision Recall Curve',
|
|
22
|
+
def _custom_table(x, y, classes, title='Precision Recall Curve', x_title='Recall', y_title='Precision'):
|
|
23
23
|
"""
|
|
24
24
|
Create and log a custom metric visualization to wandb.plot.pr_curve.
|
|
25
25
|
|
|
@@ -39,7 +39,7 @@ def _custom_table(x, y, classes, title='Precision Recall Curve', x_axis_title='R
|
|
|
39
39
|
"""
|
|
40
40
|
df = pd.DataFrame({'class': classes, 'y': y, 'x': x}).round(3)
|
|
41
41
|
fields = {'x': 'x', 'y': 'y', 'class': 'class'}
|
|
42
|
-
string_fields = {'title': title, 'x-axis-title':
|
|
42
|
+
string_fields = {'title': title, 'x-axis-title': x_title, 'y-axis-title': y_title}
|
|
43
43
|
return wb.plot_table('wandb/area-under-curve/v0',
|
|
44
44
|
wb.Table(dataframe=df),
|
|
45
45
|
fields=fields,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ultralytics
|
|
3
|
-
Version: 8.0.
|
|
3
|
+
Version: 8.0.198
|
|
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
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
ultralytics/__init__.py,sha256=
|
|
1
|
+
ultralytics/__init__.py,sha256=JWQ1ZCxAfIk063SqrqH1Ib1RgL901apefrGY9Nu_URg,463
|
|
2
2
|
ultralytics/assets/bus.jpg,sha256=wCAZxJecGR63Od3ZRERe9Aja1Weayrb9Ug751DS_vGM,137419
|
|
3
3
|
ultralytics/assets/zidane.jpg,sha256=Ftc4aeMmen1O0A3o6GCDO9FlfBslLpTAw0gnetx7bts,50427
|
|
4
|
-
ultralytics/cfg/__init__.py,sha256=
|
|
4
|
+
ultralytics/cfg/__init__.py,sha256=0rNpfVEF_zlbp7vjteMEtawvyQJ_X-CXgZI5xCyE4QQ,19672
|
|
5
5
|
ultralytics/cfg/default.yaml,sha256=PFm1fy_ZHHfR4kJ_o3eYoVOCXjQ-48znaIZeBAje7Zs,7408
|
|
6
6
|
ultralytics/cfg/datasets/Argoverse.yaml,sha256=TJhOiAm1QOsQnDkg1eEGYlaylgkvKLzBUdQ5gzyi_pY,2856
|
|
7
7
|
ultralytics/cfg/datasets/DOTAv2.yaml,sha256=SmSpmbz_wRT8HMmPqsHpjep_b-nvckTutoEwVpGaUZM,1149
|
|
@@ -54,7 +54,7 @@ ultralytics/engine/exporter.py,sha256=h8p8jOt3_QDI86qA1Neer50W3yWSxgn5nTmZB2SmO8
|
|
|
54
54
|
ultralytics/engine/model.py,sha256=KrrAcYjxAsqIpOREqty1u_twLaxSDEr5BDe6EuyFynE,19368
|
|
55
55
|
ultralytics/engine/predictor.py,sha256=onTJdx0dNaHfKIWidLbC4A4o8wMcISOVJxd6_xhe4XI,16672
|
|
56
56
|
ultralytics/engine/results.py,sha256=b98uVX6QHpQjgMxbWiGOwqDBgbfY0AtY1v5DU3-hVBM,23454
|
|
57
|
-
ultralytics/engine/trainer.py,sha256=
|
|
57
|
+
ultralytics/engine/trainer.py,sha256=xhixc-FB5RJFo0dns5GRntZArkNmNcZrdmB_UlyWkMs,32677
|
|
58
58
|
ultralytics/engine/tuner.py,sha256=Xizeaw7vSYqN-0eShxvWXkJAPGuasctPP-3SH0NLpEg,11374
|
|
59
59
|
ultralytics/engine/validator.py,sha256=4pmZ7CF5nfFnSUgPXL2YmK8lBainHeSzLvEmvQ4ImAE,14408
|
|
60
60
|
ultralytics/hub/__init__.py,sha256=iZzEg98gDEr2bfPZopHwnFIfDVDZ9a-yuAAkPKnn2hw,3685
|
|
@@ -127,7 +127,7 @@ ultralytics/trackers/utils/__init__.py,sha256=mHtJuK4hwF8cuV-VHDc7tp6u6D1gHz2Z7J
|
|
|
127
127
|
ultralytics/trackers/utils/gmc.py,sha256=T-NDsHKZWOrLcee4k1dghBVpn5RdfcSsBxcy2npmeN0,12162
|
|
128
128
|
ultralytics/trackers/utils/kalman_filter.py,sha256=PM3I6DkBlS-cDm3kc7L5XD3XSbcGajgRxiqrvUJAIBY,14850
|
|
129
129
|
ultralytics/trackers/utils/matching.py,sha256=U8tfb8tfOYs_QtHQ-rGT4ZhthUcSAYh6X_LE31olOag,4841
|
|
130
|
-
ultralytics/utils/__init__.py,sha256=
|
|
130
|
+
ultralytics/utils/__init__.py,sha256=lusjMUl40HzLQWUwVJVd7N2ugr1KIvpv2EnkBeiqPPc,33715
|
|
131
131
|
ultralytics/utils/autobatch.py,sha256=ddXzqjvb0B_g3g-pgZuPNImiW1JzY6Lktbw671cJrsA,3862
|
|
132
132
|
ultralytics/utils/benchmarks.py,sha256=ct6g9UyfHPi6a7_EuppbTrVeu_ePiCLF7Kib8RZKRgw,18217
|
|
133
133
|
ultralytics/utils/checks.py,sha256=49YjIslAPnuQ8im46TOL5ou7NYJmhed9vwHwVdzrHME,25954
|
|
@@ -151,14 +151,14 @@ ultralytics/utils/callbacks/clearml.py,sha256=TUyQAP46s4zudqDr_XOCBzTbXrzv-Asdjq
|
|
|
151
151
|
ultralytics/utils/callbacks/comet.py,sha256=58KW2zaqxFnn7Uab1fDBE5p89A1KKi2bjqTFK95sFkI,13870
|
|
152
152
|
ultralytics/utils/callbacks/dvc.py,sha256=pfywO1UqXTcXqo7WdvjPfhSKu8KmoMr0meu5LEh0rrY,4997
|
|
153
153
|
ultralytics/utils/callbacks/hub.py,sha256=ViiYhxTUxrWW9KXp0NhjXYoK8vxJoFa8gIxZRtmQT1o,3350
|
|
154
|
-
ultralytics/utils/callbacks/mlflow.py,sha256=
|
|
154
|
+
ultralytics/utils/callbacks/mlflow.py,sha256=MdZfdEQ3n9B5NqReufFueH0RR-_GIgl4G5CfEBHfh-I,4487
|
|
155
155
|
ultralytics/utils/callbacks/neptune.py,sha256=qIN0gJipB1f3Di7bw0Rb28jLYoCzJSWSqFhVgyC5Gi0,3697
|
|
156
156
|
ultralytics/utils/callbacks/raytune.py,sha256=PGZvW_haVq8Cqha3GgvL7iBMAaxfn8_3u_IIdYCNMPo,608
|
|
157
157
|
ultralytics/utils/callbacks/tensorboard.py,sha256=AL8geYjG2NBBn4U1iHbmwF1rHDsNhVBeAmXo1tSLVgM,2830
|
|
158
|
-
ultralytics/utils/callbacks/wb.py,sha256=
|
|
159
|
-
ultralytics-8.0.
|
|
160
|
-
ultralytics-8.0.
|
|
161
|
-
ultralytics-8.0.
|
|
162
|
-
ultralytics-8.0.
|
|
163
|
-
ultralytics-8.0.
|
|
164
|
-
ultralytics-8.0.
|
|
158
|
+
ultralytics/utils/callbacks/wb.py,sha256=x_j4ZH4Klp0_Ld13f0UezFluUTS5Ovfgk9hcjwqeruU,6762
|
|
159
|
+
ultralytics-8.0.198.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
|
160
|
+
ultralytics-8.0.198.dist-info/METADATA,sha256=safE0BrosJZE_r-i-HET52CQjpyF820kgNteAowBgSE,31637
|
|
161
|
+
ultralytics-8.0.198.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
162
|
+
ultralytics-8.0.198.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
|
|
163
|
+
ultralytics-8.0.198.dist-info/top_level.txt,sha256=iXnUQZuWnkCwh3InMTwthfgww_zJjOjq1Cg9CoWen_0,762
|
|
164
|
+
ultralytics-8.0.198.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|