From fa826db45f964877545a762990ef1ca90446956e Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Wed, 20 Sep 2023 23:05:49 +0200 Subject: [PATCH] `ultralytics 8.0.184` https://yolovision.ultralytics.com #YV23 (#5004) --- .github/ISSUE_TEMPLATE/bug-report.yml | 24 +++++++++++----------- .github/workflows/docker.yaml | 2 +- README.md | 4 ++-- README.zh-CN.md | 4 ++-- docker/Dockerfile-arm64 | 3 +++ docker/Dockerfile-cpu | 3 +++ docs/modes/train.md | 4 ++-- docs/usage/cfg.md | 4 ++-- ultralytics/utils/checks.py | 29 +++++++++++++-------------- 9 files changed, 41 insertions(+), 36 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index e0c85ee393..ff1c83f15a 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -52,19 +52,19 @@ body: label: Environment description: Please specify the software and hardware you used to produce the bug. placeholder: | - Paste output of `yolo checks` or `ultralytics.checks()` commands: - ``` - Ultralytics YOLOv8.0.181 🚀 Python-3.11.2 torch-2.0.1 CPU (Apple M2) - Setup complete ✅ (8 CPUs, 16.0 GB RAM, 266.5/460.4 GB disk) + Paste output of `yolo checks` or `ultralytics.checks()` command, i.e.: + ``` + Ultralytics YOLOv8.0.181 🚀 Python-3.11.2 torch-2.0.1 CPU (Apple M2) + Setup complete ✅ (8 CPUs, 16.0 GB RAM, 266.5/460.4 GB disk) - OS macOS-13.5.2 - Environment Jupyter - Python 3.11.2 - Install git - RAM 16.00 GB - CPU Apple M2 - CUDA None - ``` + OS macOS-13.5.2 + Environment Jupyter + Python 3.11.2 + Install git + RAM 16.00 GB + CPU Apple M2 + CUDA None + ``` validations: required: false diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 529564ca6a..2875c4589f 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -121,7 +121,7 @@ jobs: - name: Run Benchmarks # WARNING: Dockerfile (GPU) error on TF.js export 'module 'numpy' has no attribute 'object'. if: (github.event_name == 'push' || github.event.inputs[matrix.dockerfile] == 'true') && matrix.platforms == 'linux/amd64' && matrix.dockerfile != 'Dockerfile' && matrix.dockerfile != 'Dockerfile-conda' # arm64 images not supported on GitHub CI runners - run: docker run ultralytics/ultralytics:${{ matrix.tags }} yolo benchmark model=yolov8n.pt imgsz=160 verbose=0.26 + run: docker run ultralytics/ultralytics:${{ matrix.tags }} yolo benchmark model=yolov8n.pt imgsz=160 verbose=0.318 - name: Push Docker Image with Ultralytics version tag if: (github.event_name == 'push' || (github.event.inputs[matrix.dockerfile] == 'true' && github.event.inputs.push == 'true')) && steps.check_tag.outputs.exists == 'false' && matrix.dockerfile != 'Dockerfile-conda' diff --git a/README.md b/README.md index 83e6d35e2a..befcee6e14 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

- - + +

[English](README.md) | [įŽ€äŊ“中文](README.zh-CN.md) diff --git a/README.zh-CN.md b/README.zh-CN.md index a11868afaa..b807fd6744 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 aa65f60f29..052d83e55f 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 e94a71a715..1bccdafdc7 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 4bf6e4a642..3506a7f714 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 0dc872c9ca..7eb8668c5b 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 1327b7a79b..911f6a30f2 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: