[English](README.md) | [įŽäŊä¸æ](README.zh-CN.md)
diff --git a/README.zh-CN.md b/README.zh-CN.md
index a11868af..b807fd67 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -1,7 +1,7 @@
-
-
+
+
[English](README.md) | [įŽäŊä¸æ](README.zh-CN.md)
diff --git a/docker/Dockerfile-arm64 b/docker/Dockerfile-arm64
index aa65f60f..052d83e5 100644
--- a/docker/Dockerfile-arm64
+++ b/docker/Dockerfile-arm64
@@ -26,6 +26,9 @@ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt /u
RUN python3 -m pip install --upgrade pip wheel
RUN pip install --no-cache -e . thop
+# Creates a symbolic link to make 'python' point to 'python3'
+RUN ln -sf /usr/bin/python3 /usr/bin/python
+
# Usage Examples -------------------------------------------------------------------------------------------------------
diff --git a/docker/Dockerfile-cpu b/docker/Dockerfile-cpu
index e94a71a7..1bccdafd 100644
--- a/docker/Dockerfile-cpu
+++ b/docker/Dockerfile-cpu
@@ -37,6 +37,9 @@ RUN yolo export model=tmp/yolov8n.pt format=ncnn imgsz=32
# Remove exported models
RUN rm -rf tmp
+# Creates a symbolic link to make 'python' point to 'python3'
+RUN ln -sf /usr/bin/python3 /usr/bin/python
+
# Usage Examples -------------------------------------------------------------------------------------------------------
diff --git a/docs/modes/train.md b/docs/modes/train.md
index 4bf6e4a6..3506a7f7 100644
--- a/docs/modes/train.md
+++ b/docs/modes/train.md
@@ -189,7 +189,7 @@ Training settings for YOLO models refer to the various hyperparameters and confi
| `project` | `None` | project name |
| `name` | `None` | experiment name |
| `exist_ok` | `False` | whether to overwrite existing experiment |
-| `pretrained` | `True` | (bool \| str) whether to use a pretrained model (bool) or a model to load weights from (str) |
+| `pretrained` | `True` | (bool or str) whether to use a pretrained model (bool) or a model to load weights from (str) |
| `optimizer` | `'auto'` | optimizer to use, choices=[SGD, Adam, Adamax, AdamW, NAdam, RAdam, RMSProp, auto] |
| `verbose` | `False` | whether to print verbose output |
| `seed` | `0` | random seed for reproducibility |
@@ -202,7 +202,7 @@ Training settings for YOLO models refer to the various hyperparameters and confi
| `amp` | `True` | Automatic Mixed Precision (AMP) training, choices=[True, False] |
| `fraction` | `1.0` | dataset fraction to train on (default is 1.0, all images in train set) |
| `profile` | `False` | profile ONNX and TensorRT speeds during training for loggers |
-| `freeze` | `None` | (int \| list, optional) freeze first n layers, or freeze list of layer indices during training |
+| `freeze` | `None` | (int or list, optional) freeze first n layers, or freeze list of layer indices during training |
| `lr0` | `0.01` | initial learning rate (i.e. SGD=1E-2, Adam=1E-3) |
| `lrf` | `0.01` | final learning rate (lr0 * lrf) |
| `momentum` | `0.937` | SGD momentum/Adam beta1 |
diff --git a/docs/usage/cfg.md b/docs/usage/cfg.md
index 0dc872c9..7eb8668c 100644
--- a/docs/usage/cfg.md
+++ b/docs/usage/cfg.md
@@ -88,7 +88,7 @@ The training settings for YOLO models encompass various hyperparameters and conf
| `project` | `None` | project name |
| `name` | `None` | experiment name |
| `exist_ok` | `False` | whether to overwrite existing experiment |
-| `pretrained` | `True` | (bool \| str) whether to use a pretrained model (bool) or a model to load weights from (str) |
+| `pretrained` | `True` | (bool or str) whether to use a pretrained model (bool) or a model to load weights from (str) |
| `optimizer` | `'auto'` | optimizer to use, choices=[SGD, Adam, Adamax, AdamW, NAdam, RAdam, RMSProp, auto] |
| `verbose` | `False` | whether to print verbose output |
| `seed` | `0` | random seed for reproducibility |
@@ -101,7 +101,7 @@ The training settings for YOLO models encompass various hyperparameters and conf
| `amp` | `True` | Automatic Mixed Precision (AMP) training, choices=[True, False] |
| `fraction` | `1.0` | dataset fraction to train on (default is 1.0, all images in train set) |
| `profile` | `False` | profile ONNX and TensorRT speeds during training for loggers |
-| `freeze` | `None` | (int \| list, optional) freeze first n layers, or freeze list of layer indices during training |
+| `freeze` | `None` | (int or list, optional) freeze first n layers, or freeze list of layer indices during training |
| `lr0` | `0.01` | initial learning rate (i.e. SGD=1E-2, Adam=1E-3) |
| `lrf` | `0.01` | final learning rate (lr0 * lrf) |
| `momentum` | `0.937` | SGD momentum/Adam beta1 |
diff --git a/ultralytics/utils/checks.py b/ultralytics/utils/checks.py
index 1327b7a7..911f6a30 100644
--- a/ultralytics/utils/checks.py
+++ b/ultralytics/utils/checks.py
@@ -49,20 +49,25 @@ def parse_requirements(file_path=ROOT.parent / 'requirements.txt'):
return requirements
-def parse_version(v='0.0.0') -> tuple:
+def parse_version(version='0.0.0') -> tuple:
"""
- Convert a version string to a tuple of integers, also returning any extra non-numeric string attached to the version.
+ Convert a version string to a tuple of integers, ignoring any extra non-numeric string attached to the version.
+ This function replaces deprecated 'pkg_resources.parse_version(v)'
Args:
- v (str): Version string, i.e. '2.0.1+cpu'
+ version (str): Version string, i.e. '2.0.1+cpu'
Returns:
(tuple): Tuple of integers representing the numeric part of the version and the extra string, i.e. (2, 0, 1)
"""
- correct = [True if x == '.' else x.isdigit() for x in v] # first non-number index
- if False in correct:
- v = v[:correct.index(False)]
- return tuple(map(int, v.split('.'))) # '2.0.1+cpu' -> (2, 0, 1)
+ try:
+ correct = [True if x == '.' else x.isdigit() for x in version] # first non-number index
+ v = version[:correct.index(False)] if False in correct else version
+ return tuple(map(int, v.split('.'))) # '2.0.1+cpu' -> (2, 0, 1)
+ except Exception as e:
+ LOGGER.warning(f'WARNING â ī¸ failure for parse_version({version}), reverting to deprecated pkg_resources: {e}')
+ import pkg_resources
+ return pkg_resources.parse_version(version).release
def is_ascii(s) -> bool:
@@ -161,22 +166,16 @@ def check_version(current: str = '0.0.0',
# check if current version is between 20.04 (inclusive) and 22.04 (exclusive)
check_version(current='21.10', required='>20.04,<22.04')
"""
- if not required:
+ if not (current and required): # if any inputs missing
+ LOGGER.warning(f'WARNING â ī¸ invalid check_version({current}, {required}) requested, please check values.')
return True # in case required is '' or None
- # import pkg_resources as pkg
- # current = pkg.parse_version(current)
current = parse_version(current) # '1.2.3' -> (1, 2, 3)
-
constraints = re.findall(r'([<>!=]{1,2}\s*\d+\.\d+)', required) or [f'>={required}']
-
result = True
for constraint in constraints:
op, v = re.match(r'([<>!=]{1,2})\s*(\d+\.\d+)', constraint).groups()
-
- # v = pkg.parse_version(v)
v = parse_version(v) # '1.2.3' -> (1, 2, 3)
-
if op == '==' and current != v:
result = False
elif op == '!=' and current == v: