From ec97a7ffc4f3fb59a17e43a8aa370032be42d440 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 24 Jul 2023 16:35:02 +0200 Subject: [PATCH 1/3] Update Discord invite to https://ultralytics.com/discord (#3922) --- .github/ISSUE_TEMPLATE/config.yml | 2 +- README.md | 8 ++++---- README.zh-CN.md | 8 ++++---- docs/hub/index.md | 2 +- docs/yolov5/index.md | 2 +- examples/hub.ipynb | 2 +- examples/tutorial.ipynb | 2 +- mkdocs.yml | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 746047a84c..9018a6213f 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -7,5 +7,5 @@ contact_links: url: https://community.ultralytics.com/ about: Ask on Ultralytics Community Forum - name: 🎧 Discord - url: https://discord.gg/2wNGbc6g9X + url: https://ultralytics.com/discord about: Ask on Ultralytics Discord diff --git a/README.md b/README.md index 1d63f1733f..6a30790645 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ [Ultralytics](https://ultralytics.com) [YOLOv8](https://github.com/ultralytics/ultralytics) is a cutting-edge, state-of-the-art (SOTA) model that builds upon the success of previous YOLO versions and introduces new features and improvements to further boost performance and flexibility. YOLOv8 is designed to be fast, accurate, and easy to use, making it an excellent choice for a wide range of object detection and tracking, instance segmentation, image classification and pose estimation tasks. -We hope that the resources here will help you get the most out of YOLOv8. Please browse the YOLOv8 Docs for details, raise an issue on GitHub for support, and join our Discord community for questions and discussions! +We hope that the resources here will help you get the most out of YOLOv8. Please browse the YOLOv8 Docs for details, raise an issue on GitHub for support, and join our Discord community for questions and discussions! To request an Enterprise License please complete the form at [Ultralytics Licensing](https://ultralytics.com/license). @@ -45,7 +45,7 @@ To request an Enterprise License please complete the form at [Ultralytics Licens - + @@ -241,7 +241,7 @@ Ultralytics offers two licensing options to accommodate diverse use cases: ##
Contact
-For Ultralytics bug reports and feature requests please visit [GitHub Issues](https://github.com/ultralytics/ultralytics/issues), and join our [Discord](https://discord.gg/2wNGbc6g9X) community for questions and discussions! +For Ultralytics bug reports and feature requests please visit [GitHub Issues](https://github.com/ultralytics/ultralytics/issues), and join our [Discord](https://ultralytics.com/discord) community for questions and discussions!
@@ -263,6 +263,6 @@ For Ultralytics bug reports and feature requests please visit [GitHub Issues](ht - +
diff --git a/README.zh-CN.md b/README.zh-CN.md index ab9c063fac..e71f57e74f 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -20,7 +20,7 @@ [Ultralytics](https://ultralytics.com) [YOLOv8](https://github.com/ultralytics/ultralytics) 是一款前沿、最先进(SOTA)的模型,基于先前 YOLO 版本的成功,引入了新功能和改进,进一步提升性能和灵活性。YOLOv8 设计快速、准确且易于使用,使其成为各种物体检测与跟踪、实例分割、图像分类和姿态估计任务的绝佳选择。 -我们希望这里的资源能帮助您充分利用 YOLOv8。请浏览 YOLOv8 文档 了解详细信息,在 GitHub 上提交问题以获得支持,并加入我们的 Discord 社区进行问题和讨论! +我们希望这里的资源能帮助您充分利用 YOLOv8。请浏览 YOLOv8 文档 了解详细信息,在 GitHub 上提交问题以获得支持,并加入我们的 Discord 社区进行问题和讨论! 如需申请企业许可,请在 [Ultralytics Licensing](https://ultralytics.com/license) 处填写表格 @@ -45,7 +45,7 @@ - + @@ -240,7 +240,7 @@ Ultralytics 提供两种许可证选项以适应各种使用场景: ##
联系方式
-对于 Ultralytics 的错误报告和功能请求,请访问 [GitHub Issues](https://github.com/ultralytics/ultralytics/issues),并加入我们的 [Discord](https://discord.gg/2wNGbc6g9X) 社区进行问题和讨论! +对于 Ultralytics 的错误报告和功能请求,请访问 [GitHub Issues](https://github.com/ultralytics/ultralytics/issues),并加入我们的 [Discord](https://ultralytics.com/discord) 社区进行问题和讨论!
@@ -261,6 +261,6 @@ Ultralytics 提供两种许可证选项以适应各种使用场景: - +
diff --git a/docs/hub/index.md b/docs/hub/index.md index 26dec78666..c4276939a4 100644 --- a/docs/hub/index.md +++ b/docs/hub/index.md @@ -29,7 +29,7 @@ easily upload their data and train new models quickly. It offers a range of pre- templates to choose from, making it easy for users to get started with training their own models. Once a model is trained, it can be easily deployed and used for real-time object detection, instance segmentation and classification tasks. -We hope that the resources here will help you get the most out of HUB. Please browse the HUB Docs for details, raise an issue on GitHub for support, and join our Discord community for questions and discussions! +We hope that the resources here will help you get the most out of HUB. Please browse the HUB Docs for details, raise an issue on GitHub for support, and join our Discord community for questions and discussions! - [**Quickstart**](./quickstart.md). Start training and deploying YOLO models with HUB in seconds. - [**Datasets: Preparing and Uploading**](./datasets.md). Learn how to prepare and upload your datasets to HUB in YOLO format. diff --git a/docs/yolov5/index.md b/docs/yolov5/index.md index 1620422c8c..ccd2b4500c 100644 --- a/docs/yolov5/index.md +++ b/docs/yolov5/index.md @@ -85,6 +85,6 @@ This badge signifies that all [YOLOv5 GitHub Actions](https://github.com/ultraly - + diff --git a/examples/hub.ipynb b/examples/hub.ipynb index 252891424d..3b3b1f7106 100644 --- a/examples/hub.ipynb +++ b/examples/hub.ipynb @@ -33,7 +33,7 @@ "\n", "Welcome to the [Ultralytics](https://ultralytics.com/) HUB notebook! \n", "\n", - "This notebook allows you to train [YOLOv5](https://github.com/ultralytics/yolov5) and [YOLOv8](https://github.com/ultralytics/ultralytics) 🚀 models using [HUB](https://hub.ultralytics.com/). Please browse the YOLOv8 Docs for details, raise an issue on GitHub for support, and join our Discord community for questions and discussions!\n", + "This notebook allows you to train [YOLOv5](https://github.com/ultralytics/yolov5) and [YOLOv8](https://github.com/ultralytics/ultralytics) 🚀 models using [HUB](https://hub.ultralytics.com/). Please browse the YOLOv8 Docs for details, raise an issue on GitHub for support, and join our Discord community for questions and discussions!\n", "" ] }, diff --git a/examples/tutorial.ipynb b/examples/tutorial.ipynb index 33cd084da8..3212c065ff 100644 --- a/examples/tutorial.ipynb +++ b/examples/tutorial.ipynb @@ -36,7 +36,7 @@ "\n", "YOLOv8 models are fast, accurate, and easy to use, making them ideal for various object detection and image segmentation tasks. They can be trained on large datasets and run on diverse hardware platforms, from CPUs to GPUs.\n", "\n", - "We hope that the resources in this notebook will help you get the most out of YOLOv8. Please browse the YOLOv8 Docs for details, raise an issue on GitHub for support, and join our Discord community for questions and discussions!\n", + "We hope that the resources in this notebook will help you get the most out of YOLOv8. Please browse the YOLOv8 Docs for details, raise an issue on GitHub for support, and join our Discord community for questions and discussions!\n", "\n", "" ] diff --git a/mkdocs.yml b/mkdocs.yml index 09939920d7..143042e2b6 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -91,7 +91,7 @@ extra: - icon: fontawesome/brands/python link: https://pypi.org/project/ultralytics/ - icon: fontawesome/brands/discord - link: https://discord.gg/2wNGbc6g9X + link: https://ultralytics.com/discord extra_css: - stylesheets/style.css From 86b3c001c4aeca4cb24aa80216fbc83293e59535 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 24 Jul 2023 17:43:14 +0200 Subject: [PATCH 2/3] Cleanup NCNN export files (#3925) --- ultralytics/engine/exporter.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/ultralytics/engine/exporter.py b/ultralytics/engine/exporter.py index a35b089b3b..65784c72f2 100644 --- a/ultralytics/engine/exporter.py +++ b/ultralytics/engine/exporter.py @@ -432,16 +432,24 @@ class Exporter: Path(asset).unlink() # delete zip pnnx.chmod(0o777) # set read, write, and execute permissions for everyone - cmd = [ - str(pnnx), - str(f_ts), + use_ncnn = True + ncnn_args = [ + f'ncnnparam={f / "model.ncnn.param"}', + f'ncnnbin={f / "model.ncnn.bin"}', + f'ncnnpy={f / "model_ncnn.py"}', ] if use_ncnn else [] + + use_pnnx = False + pnnx_args = [ f'pnnxparam={f / "model.pnnx.param"}', f'pnnxbin={f / "model.pnnx.bin"}', f'pnnxpy={f / "model_pnnx.py"}', - f'pnnxonnx={f / "model.pnnx.onnx"}', - f'ncnnparam={f / "model.ncnn.param"}', - f'ncnnbin={f / "model.ncnn.bin"}', - f'ncnnpy={f / "model_ncnn.py"}', + f'pnnxonnx={f / "model.pnnx.onnx"}', ] if use_pnnx else [] + + cmd = [ + str(pnnx), + str(f_ts), + *ncnn_args, + *pnnx_args, f'fp16={int(self.args.half)}', f'device={self.device.type}', f'inputshape="{[self.args.batch, 3, *self.imgsz]}"', ] From 2ee147838a28d3743a7f0d7a3480ba4788589f0c Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 24 Jul 2023 23:56:16 +0200 Subject: [PATCH 3/3] Add tests before pushing to Docker Hub (#3924) --- .github/workflows/docker.yaml | 109 ++++++++++++++++--------------- docker/Dockerfile-python | 2 +- requirements.txt | 9 +-- setup.py | 9 +-- ultralytics/engine/exporter.py | 2 +- ultralytics/utils/benchmarks.py | 4 +- ultralytics/utils/torch_utils.py | 5 +- 7 files changed, 71 insertions(+), 69 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 5dbc195678..4a035050e3 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -8,23 +8,48 @@ on: branches: [main] workflow_dispatch: inputs: - image: + dockerfile: type: choice - description: Select Docker Image + description: Select Dockerfile options: - - Arm64 - - Jetson - - Python - - CPU - - GPU + - Dockerfile-arm64 + - Dockerfile-jetson + - Dockerfile-python + - Dockerfile-cpu + - Dockerfile + push: + type: boolean + description: Push image to Docker Hub + default: true jobs: docker: if: github.repository == 'ultralytics/ultralytics' - name: Push Docker image to Docker Hub + name: Push runs-on: ubuntu-latest + strategy: + fail-fast: false + max-parallel: 5 + matrix: + include: + - dockerfile: "Dockerfile-arm64" + tags: "latest-arm64" + platforms: "linux/arm64" + - dockerfile: "Dockerfile-jetson" + tags: "latest-jetson" + platforms: "linux/arm64" + - dockerfile: "Dockerfile-python" + tags: "latest-python" + platforms: "linux/amd64" + - dockerfile: "Dockerfile-cpu" + tags: "latest-cpu" + platforms: "linux/amd64" + - dockerfile: "Dockerfile" + tags: "latest" + platforms: "linux/amd64" steps: - name: Checkout repo + if: github.event_name == 'push' || github.event.inputs.dockerfile == matrix.dockerfile uses: actions/checkout@v3 - name: Set up QEMU @@ -39,54 +64,30 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push arm64 image - if: github.event_name == 'push' || github.event.inputs.image == 'Arm64' - uses: docker/build-push-action@v4 - continue-on-error: true - with: - context: . - platforms: linux/arm64 - file: docker/Dockerfile-arm64 - push: true - tags: ultralytics/ultralytics:latest-arm64 + - name: Build Image + run: | + docker build --platform ${{ matrix.platforms }} -f docker/${{ matrix.dockerfile }} -t ultralytics/ultralytics:${{ matrix.tags }} . - - name: Build and push Jetson image - if: github.event_name == 'push' || github.event.inputs.image == 'Jetson' - uses: docker/build-push-action@v4 - continue-on-error: true - with: - context: . - platforms: linux/arm64 - file: docker/Dockerfile-jetson - push: true - tags: ultralytics/ultralytics:latest-jetson + - name: Run Tests + if: matrix.platforms == 'linux/amd64' # arm64 images not supported on GitHub CI runners + run: | + docker run ultralytics/ultralytics:${{ matrix.tags }} /bin/bash -c "pip install pytest && pytest tests" - - name: Build and push Python image - if: github.event_name == 'push' || github.event.inputs.image == 'Python' - uses: docker/build-push-action@v4 - continue-on-error: true - with: - context: . - file: docker/Dockerfile-python - push: true - tags: ultralytics/ultralytics:latest-python + - name: Run Benchmarks + if: matrix.platforms == 'linux/amd64' # arm64 images not supported on GitHub CI runners + run: | + docker run ultralytics/ultralytics:${{ matrix.tags }} yolo benchmark model=yolov8n.pt imgsz=160 - - name: Build and push CPU image - if: github.event_name == 'push' || github.event.inputs.image == 'CPU' - uses: docker/build-push-action@v4 - continue-on-error: true - with: - context: . - file: docker/Dockerfile-cpu - push: true - tags: ultralytics/ultralytics:latest-cpu + - name: Push Image + if: github.event_name == 'push' || github.event.inputs.push == true + run: | + docker push ultralytics/ultralytics:${{ matrix.tags }} - - name: Build and push GPU image - if: github.event_name == 'push' || github.event.inputs.image == 'GPU' - uses: docker/build-push-action@v4 - continue-on-error: true + - name: Notify on failure + if: github.event_name == 'push' && (cancelled() || failure()) + uses: slackapi/slack-github-action@v1.23.0 with: - context: . - file: docker/Dockerfile - push: true - tags: ultralytics/ultralytics:latest + payload: | + {"text": " GitHub Actions error for ${{ github.workflow }} ❌\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Action:* https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n*Author:* ${{ github.actor }}\n*Event:* ${{ github.event_name }}\n"} + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_YOLO }} diff --git a/docker/Dockerfile-python b/docker/Dockerfile-python index 5ddb19b1dc..bb3b36cf0a 100644 --- a/docker/Dockerfile-python +++ b/docker/Dockerfile-python @@ -28,7 +28,7 @@ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt /u # Install pip packages RUN python3 -m pip install --upgrade pip wheel -RUN pip install --no-cache -e '.[export]' thop py-cpuinfo --extra-index-url https://download.pytorch.org/whl/cpu +RUN pip install --no-cache -e '.[export]' thop --extra-index-url https://download.pytorch.org/whl/cpu # Run exports to AutoInstall packages WORKDIR /tmp_exports diff --git a/requirements.txt b/requirements.txt index fd1956e39c..b2e4684ca8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,8 +4,8 @@ # Base ---------------------------------------- matplotlib>=3.2.2 opencv-python>=4.6.0 -Pillow>=7.1.2 -PyYAML>=5.3.1 +pillow>=7.1.2 +pyyaml>=5.3.1 requests>=2.23.0 scipy>=1.4.1 torch>=1.7.0 @@ -23,7 +23,7 @@ pandas>=1.1.4 seaborn>=0.11.0 # Export -------------------------------------- -# coremltools>=6.0 # CoreML export +# coremltools>=6.0,<=6.2 # CoreML export # onnx>=1.12.0 # ONNX export # onnxsim>=0.4.1 # ONNX simplifier # nvidia-pyindex # TensorRT export @@ -36,8 +36,9 @@ seaborn>=0.11.0 # Extras -------------------------------------- psutil # system utilization +py-cpuinfo # display CPU info # thop>=0.1.1 # FLOPs computation # ipython # interactive notebook -# albumentations>=1.0.3 +# albumentations>=1.0.3 # training augmentations # pycocotools>=2.0.6 # COCO mAP # roboflow diff --git a/setup.py b/setup.py index bec6ff9d52..c02fd27932 100644 --- a/setup.py +++ b/setup.py @@ -48,9 +48,11 @@ setup( 'mkdocs-redirects', # for 301 redirects 'mkdocs-ultralytics-plugin>=0.0.21', # for meta descriptions and images, dates and authors ], - 'export': ['coremltools>=6.0,<=6.2', 'openvino-dev>=2023.0', - 'tensorflowjs'], # automatically installs tensorflow - }, + 'export': [ + 'coremltools>=6.0,<=6.2', + 'openvino-dev>=2023.0', + 'tensorflowjs', # automatically installs tensorflow + ], }, classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', @@ -58,7 +60,6 @@ setup( 'Intended Audience :: Science/Research', 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', diff --git a/ultralytics/engine/exporter.py b/ultralytics/engine/exporter.py index 65784c72f2..10aecaf1f5 100644 --- a/ultralytics/engine/exporter.py +++ b/ultralytics/engine/exporter.py @@ -465,7 +465,7 @@ class Exporter: @try_export def export_coreml(self, prefix=colorstr('CoreML:')): """YOLOv8 CoreML export.""" - check_requirements('coremltools>=6.0') + check_requirements('coremltools>=6.0,<=6.2') import coremltools as ct # noqa LOGGER.info(f'\n{prefix} starting export with coremltools {ct.__version__}...') diff --git a/ultralytics/utils/benchmarks.py b/ultralytics/utils/benchmarks.py index 69efd6136f..eaea7176a6 100644 --- a/ultralytics/utils/benchmarks.py +++ b/ultralytics/utils/benchmarks.py @@ -122,7 +122,7 @@ def benchmark(model=Path(SETTINGS['weights_dir']) / 'yolov8n.pt', y.append([name, '✅', round(file_size(filename), 1), round(metric, 4), round(speed, 2)]) except Exception as e: if hard_fail: - assert type(e) is AssertionError, f'Benchmark hard_fail for {name}: {e}' + assert type(e) is AssertionError, f'Benchmark failure for {name}: {e}' LOGGER.warning(f'ERROR ❌️ Benchmark failure for {name}: {e}') y.append([name, emoji, round(file_size(filename), 1), None, None]) # mAP, t_inference @@ -139,7 +139,7 @@ def benchmark(model=Path(SETTINGS['weights_dir']) / 'yolov8n.pt', if hard_fail and isinstance(hard_fail, float): metrics = df[key].array # values to compare to floor floor = hard_fail # minimum metric floor to pass, i.e. = 0.29 mAP for YOLOv5n - assert all(x > floor for x in metrics if pd.notna(x)), f'HARD FAIL: one or more metric(s) < floor {floor}' + assert all(x > floor for x in metrics if pd.notna(x)), f'Benchmark failure: metric(s) < floor {floor}' return df diff --git a/ultralytics/utils/torch_utils.py b/ultralytics/utils/torch_utils.py index cd82d525e6..500b519b79 100644 --- a/ultralytics/utils/torch_utils.py +++ b/ultralytics/utils/torch_utils.py @@ -17,7 +17,7 @@ import torch.nn.functional as F import torchvision from ultralytics.utils import DEFAULT_CFG_DICT, DEFAULT_CFG_KEYS, LOGGER, RANK, __version__ -from ultralytics.utils.checks import check_requirements, check_version +from ultralytics.utils.checks import check_version try: import thop @@ -54,8 +54,7 @@ def smart_inference_mode(): def get_cpu_info(): """Return a string with system CPU information, i.e. 'Apple M2'.""" - check_requirements('py-cpuinfo') - import cpuinfo # noqa + import cpuinfo # pip install py-cpuinfo k = 'brand_raw', 'hardware_raw', 'arch_string_raw' # info keys sorted by preference (not all keys always available) info = cpuinfo.get_cpu_info() # info dict