diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 0631213715..5f02211de5 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -52,9 +52,9 @@ body: - type: textarea attributes: label: Environment - description: Many issues are often related to dependency versions and hardware. Please provide the output of `yolo checks` or `ultralytics.checks()` command to help us diagnose the problem. + description: Many issues are often related to dependency versions and hardware. Please provide the output of `yolo checks` (CLI) or `ultralytics.utils.checks.collect_system_info()` (Python) command to help us diagnose the problem. placeholder: | - Paste output of `yolo checks` or `ultralytics.checks()` command, i.e.: + Paste output of `yolo checks` (CLI) or `ultralytics.utils.checks.collect_system_info()` (Python) command, i.e.: ``` Ultralytics 8.3.2 ๐Ÿš€ Python-3.11.2 torch-2.4.1 CPU (Apple M3) Setup complete โœ… (8 CPUs, 16.0 GB RAM, 266.5/460.4 GB disk) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 38f30bb1b6..4fa6440926 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -134,12 +134,12 @@ jobs: - name: Build Image if: github.event_name == 'push' || github.event.inputs[matrix.dockerfile] == 'true' - uses: nick-invision/retry@v3 + uses: ultralytics/actions/retry@main with: timeout_minutes: 120 - retry_wait_seconds: 60 - max_attempts: 3 # retry twice - command: | + retry_delay_seconds: 60 + retries: 2 + run: | docker build \ --platform ${{ matrix.platforms }} \ -f docker/${{ matrix.dockerfile }} \ @@ -172,7 +172,7 @@ jobs: fi if [[ "${{ matrix.tags }}" == "latest-python" ]]; then t=ultralytics/ultralytics:latest-jupyter - v=ultralytics/ultralytics:${{ steps.get_version.outputs.version_tag }}-jupyter + v=ultralytics/ultralytics:${{ steps.get_version.outputs.version }}-jupyter docker build -f docker/Dockerfile-jupyter -t $t -t $v . docker push $t if [[ "${{ steps.check_tag.outputs.new_release }}" == "true" ]]; then diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index 4dd8aa38b0..1a0b3ca15c 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -29,12 +29,12 @@ jobs: sudo mv lychee /usr/local/bin - name: Test Markdown and HTML links with retry - uses: nick-invision/retry@v3 + uses: ultralytics/actions/retry@main with: - timeout_minutes: 5 - retry_wait_seconds: 60 - max_attempts: 3 - command: | + timeout_minutes: 60 + retry_delay_seconds: 300 + retries: 2 + run: | lychee \ --scheme https \ --timeout 60 \ @@ -59,12 +59,12 @@ jobs: - name: Test Markdown, HTML, YAML, Python and Notebook links with retry if: github.event_name == 'workflow_dispatch' - uses: nick-invision/retry@v3 + uses: ultralytics/actions/retry@main with: - timeout_minutes: 5 - retry_wait_seconds: 60 - max_attempts: 3 - command: | + timeout_minutes: 60 + retry_delay_seconds: 300 + retries: 2 + run: | lychee \ --scheme https \ --timeout 60 \ diff --git a/.gitignore b/.gitignore index 4e0f0845b2..0d4b744d3f 100644 --- a/.gitignore +++ b/.gitignore @@ -163,6 +163,7 @@ weights/ *_openvino_model/ *_paddle_model/ *_ncnn_model/ +*_imx_model/ pnnx* # Autogenerated files for tests diff --git a/README.md b/README.md index 01277aff54..52ef10fcb8 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@
Ultralytics CI - Ultralytics Downloads + Ultralytics Downloads Ultralytics YOLO Citation Ultralytics Discord Ultralytics Forums @@ -55,7 +55,7 @@ See below for a quickstart install and usage examples, and see our [Docs](https: Pip install the ultralytics package including all [requirements](https://github.com/ultralytics/ultralytics/blob/main/pyproject.toml) in a [**Python>=3.8**](https://www.python.org/) environment with [**PyTorch>=1.8**](https://pytorch.org/get-started/locally/). -[![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) [![Ultralytics Downloads](https://static.pepy.tech/badge/ultralytics)](https://pepy.tech/project/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/) +[![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) [![Ultralytics Downloads](https://static.pepy.tech/badge/ultralytics)](https://www.pepy.tech/projects/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/) ```bash pip install ultralytics diff --git a/README.zh-CN.md b/README.zh-CN.md index caf5e6b470..418652edd5 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -8,7 +8,7 @@
Ultralytics CI - Ultralytics Downloads + Ultralytics Downloads Ultralytics YOLO Citation Ultralytics Discord Ultralytics Forums @@ -55,7 +55,7 @@ ๅœจ [**Python>=3.8**](https://www.python.org/) ็Žฏๅขƒไธญไฝฟ็”จ [**PyTorch>=1.8**](https://pytorch.org/get-started/locally/) ้€š่ฟ‡ pip ๅฎ‰่ฃ…ๅŒ…ๅซๆ‰€ๆœ‰[ไพ่ต–้กน](https://github.com/ultralytics/ultralytics/blob/main/pyproject.toml) ็š„ ultralytics ๅŒ…ใ€‚ -[![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) [![Ultralytics Downloads](https://static.pepy.tech/badge/ultralytics)](https://pepy.tech/project/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/) +[![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) [![Ultralytics Downloads](https://static.pepy.tech/badge/ultralytics)](https://www.pepy.tech/projects/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/) ```bash pip install ultralytics diff --git a/docker/Dockerfile-jupyter b/docker/Dockerfile-jupyter index e42639b9b7..0a58bb35fd 100644 --- a/docker/Dockerfile-jupyter +++ b/docker/Dockerfile-jupyter @@ -17,7 +17,7 @@ RUN mkdir /data/weights && /usr/local/bin/yolo settings weights_dir="/data/weigh RUN mkdir /data/runs && /usr/local/bin/yolo settings runs_dir="/data/runs" # Start JupyterLab with tutorial notebook -ENTRYPOINT ["/usr/local/bin/jupyter", "lab", "--allow-root", "/ultralytics/examples/tutorial.ipynb"] +ENTRYPOINT ["/usr/local/bin/jupyter", "lab", "--allow-root", "--ip=*", "/ultralytics/examples/tutorial.ipynb"] # Usage Examples ------------------------------------------------------------------------------------------------------- diff --git a/docs/README.md b/docs/README.md index a3d3edb40e..802352b581 100644 --- a/docs/README.md +++ b/docs/README.md @@ -15,7 +15,7 @@ ## ๐Ÿ› ๏ธ Installation [![PyPI - Version](https://img.shields.io/pypi/v/ultralytics?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics/) -[![Downloads](https://static.pepy.tech/badge/ultralytics)](https://pepy.tech/project/ultralytics) +[![Downloads](https://static.pepy.tech/badge/ultralytics)](https://www.pepy.tech/projects/ultralytics) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics/) To install the ultralytics package in developer mode, ensure you have Git and Python 3 installed on your system. Then, follow these steps: diff --git a/docs/en/guides/analytics.md b/docs/en/guides/analytics.md index dec9b4cce8..cd7fc40dcf 100644 --- a/docs/en/guides/analytics.md +++ b/docs/en/guides/analytics.md @@ -45,126 +45,15 @@ This guide provides a comprehensive overview of three fundamental types of [data # generate the pie chart yolo solutions analytics analytics_type="pie" show=True - ``` - - === "Python" - - ```python - import cv2 - - from ultralytics import solutions - - cap = cv2.VideoCapture("Path/to/video/file.mp4") - assert cap.isOpened(), "Error reading video file" - - w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS)) - - out = cv2.VideoWriter( - "ultralytics_analytics.avi", - cv2.VideoWriter_fourcc(*"MJPG"), - fps, - (1920, 1080), # This is fixed - ) - analytics = solutions.Analytics( - analytics_type="line", - show=True, - ) + # generate the bar plots + yolo solutions analytics analytics_type="bar" show=True - frame_count = 0 - while cap.isOpened(): - success, im0 = cap.read() - if success: - frame_count += 1 - im0 = analytics.process_data(im0, frame_count) # update analytics graph every frame - out.write(im0) # write the video file - else: - break - - cap.release() - out.release() - cv2.destroyAllWindows() + # generate the area plots + yolo solutions analytics analytics_type="area" show=True ``` - === "Pie Chart" - - ```python - import cv2 - - from ultralytics import solutions - - cap = cv2.VideoCapture("Path/to/video/file.mp4") - assert cap.isOpened(), "Error reading video file" - - w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS)) - - out = cv2.VideoWriter( - "ultralytics_analytics.avi", - cv2.VideoWriter_fourcc(*"MJPG"), - fps, - (1920, 1080), # This is fixed - ) - - analytics = solutions.Analytics( - analytics_type="pie", - show=True, - ) - - frame_count = 0 - while cap.isOpened(): - success, im0 = cap.read() - if success: - frame_count += 1 - im0 = analytics.process_data(im0, frame_count) # update analytics graph every frame - out.write(im0) # write the video file - else: - break - - cap.release() - out.release() - cv2.destroyAllWindows() - ``` - - === "Bar Plot" - - ```python - import cv2 - - from ultralytics import solutions - - cap = cv2.VideoCapture("Path/to/video/file.mp4") - assert cap.isOpened(), "Error reading video file" - - w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS)) - - out = cv2.VideoWriter( - "ultralytics_analytics.avi", - cv2.VideoWriter_fourcc(*"MJPG"), - fps, - (1920, 1080), # This is fixed - ) - - analytics = solutions.Analytics( - analytics_type="bar", - show=True, - ) - - frame_count = 0 - while cap.isOpened(): - success, im0 = cap.read() - if success: - frame_count += 1 - im0 = analytics.process_data(im0, frame_count) # update analytics graph every frame - out.write(im0) # write the video file - else: - break - - cap.release() - out.release() - cv2.destroyAllWindows() - ``` - - === "Area chart" + === "Python" ```python import cv2 @@ -173,9 +62,9 @@ This guide provides a comprehensive overview of three fundamental types of [data cap = cv2.VideoCapture("Path/to/video/file.mp4") assert cap.isOpened(), "Error reading video file" - w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS)) + # Video writer out = cv2.VideoWriter( "ultralytics_analytics.avi", cv2.VideoWriter_fourcc(*"MJPG"), @@ -183,11 +72,15 @@ This guide provides a comprehensive overview of three fundamental types of [data (1920, 1080), # This is fixed ) + # Init analytics analytics = solutions.Analytics( - analytics_type="area", - show=True, + show=True, # Display the output + analytics_type="line", # Pass the analytics type, could be "pie", "bar" or "area". + model="yolo11n.pt", # Path to the YOLO11 model file + # classes=[0, 2], # If you want to count specific classes i.e person and car with COCO pretrained model. ) + # Process video frame_count = 0 while cap.isOpened(): success, im0 = cap.read() diff --git a/docs/en/guides/distance-calculation.md b/docs/en/guides/distance-calculation.md index 009899ae3c..c9775124d4 100644 --- a/docs/en/guides/distance-calculation.md +++ b/docs/en/guides/distance-calculation.md @@ -55,6 +55,7 @@ Measuring the gap between two objects is known as distance calculation within a # Init distance-calculation obj distance = solutions.DistanceCalculation(model="yolo11n.pt", show=True) + # Process video while cap.isOpened(): success, im0 = cap.read() if not success: diff --git a/docs/en/guides/heatmaps.md b/docs/en/guides/heatmaps.md index 66c26eaa01..038929ccfd 100644 --- a/docs/en/guides/heatmaps.md +++ b/docs/en/guides/heatmaps.md @@ -47,119 +47,12 @@ A heatmap generated with [Ultralytics YOLO11](https://github.com/ultralytics/ult # Pass a custom colormap yolo solutions heatmap colormap=cv2.COLORMAP_INFERNO - ``` - - === "Python" - - ```python - import cv2 - - from ultralytics import solutions - - cap = cv2.VideoCapture("Path/to/video/file.mp4") - assert cap.isOpened(), "Error reading video file" - w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS)) - - # Video writer - video_writer = cv2.VideoWriter("heatmap_output.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h)) - - # Init heatmap - heatmap = solutions.Heatmap( - show=True, - model="yolo11n.pt", - colormap=cv2.COLORMAP_PARULA, - ) - - while cap.isOpened(): - success, im0 = cap.read() - if not success: - print("Video frame is empty or video processing has been successfully completed.") - break - im0 = heatmap.generate_heatmap(im0) - video_writer.write(im0) - - cap.release() - video_writer.release() - cv2.destroyAllWindows() - ``` - - === "Line Counting" - - ```python - import cv2 - - from ultralytics import solutions - - cap = cv2.VideoCapture("Path/to/video/file.mp4") - assert cap.isOpened(), "Error reading video file" - w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS)) - - # Video writer - video_writer = cv2.VideoWriter("heatmap_output.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h)) - # line for object counting - line_points = [(20, 400), (1080, 404)] - - # Init heatmap - heatmap = solutions.Heatmap( - show=True, - model="yolo11n.pt", - colormap=cv2.COLORMAP_PARULA, - region=line_points, - ) - - while cap.isOpened(): - success, im0 = cap.read() - if not success: - print("Video frame is empty or video processing has been successfully completed.") - break - im0 = heatmap.generate_heatmap(im0) - video_writer.write(im0) - - cap.release() - video_writer.release() - cv2.destroyAllWindows() + # Heatmaps + object counting + yolo solutions heatmap region=[(20, 400), (1080, 404), (1080, 360), (20, 360)] ``` - === "Polygon Counting" - - ```python - import cv2 - - from ultralytics import solutions - - cap = cv2.VideoCapture("Path/to/video/file.mp4") - assert cap.isOpened(), "Error reading video file" - w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS)) - - # Video writer - video_writer = cv2.VideoWriter("heatmap_output.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h)) - - # Define polygon points - region_points = [(20, 400), (1080, 404), (1080, 360), (20, 360), (20, 400)] - - # Init heatmap - heatmap = solutions.Heatmap( - show=True, - model="yolo11n.pt", - colormap=cv2.COLORMAP_PARULA, - region=region_points, - ) - - while cap.isOpened(): - success, im0 = cap.read() - if not success: - print("Video frame is empty or video processing has been successfully completed.") - break - im0 = heatmap.generate_heatmap(im0) - video_writer.write(im0) - - cap.release() - video_writer.release() - cv2.destroyAllWindows() - ``` - - === "Region Counting" + === "Python" ```python import cv2 @@ -173,51 +66,24 @@ A heatmap generated with [Ultralytics YOLO11](https://github.com/ultralytics/ult # Video writer video_writer = cv2.VideoWriter("heatmap_output.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h)) - # Define region points - region_points = [(20, 400), (1080, 404), (1080, 360), (20, 360)] - - # Init heatmap - heatmap = solutions.Heatmap( - show=True, - model="yolo11n.pt", - colormap=cv2.COLORMAP_PARULA, - region=region_points, - ) - - while cap.isOpened(): - success, im0 = cap.read() - if not success: - print("Video frame is empty or video processing has been successfully completed.") - break - im0 = heatmap.generate_heatmap(im0) - video_writer.write(im0) - - cap.release() - video_writer.release() - cv2.destroyAllWindows() - ``` - - === "Specific Classes" - - ```python - import cv2 - - from ultralytics import solutions - - cap = cv2.VideoCapture("Path/to/video/file.mp4") - assert cap.isOpened(), "Error reading video file" - w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS)) - - # Video writer - video_writer = cv2.VideoWriter("heatmap_output.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h)) + # In case you want to apply object counting + heatmaps, you can pass region points. + # region_points = [(20, 400), (1080, 404)] # Define line points + # region_points = [(20, 400), (1080, 404), (1080, 360), (20, 360)] # Define region points + # region_points = [(20, 400), (1080, 404), (1080, 360), (20, 360), (20, 400)] # Define polygon points # Init heatmap heatmap = solutions.Heatmap( - show=True, - model="yolo11n.pt", - classes=[0, 2], + show=True, # Display the output + model="yolo11n.pt", # Path to the YOLO11 model file + colormap=cv2.COLORMAP_PARULA, # Colormap of heatmap + # region=region_points, # If you want to do object counting with heatmaps, you can pass region_points + # classes=[0, 2], # If you want to generate heatmap for specific classes i.e person and car. + # show_in=True, # Display in counts + # show_out=True, # Display out counts + # line_width=2, # Adjust the line width for bounding boxes and text display ) + # Process video while cap.isOpened(): success, im0 = cap.read() if not success: diff --git a/docs/en/guides/object-counting.md b/docs/en/guides/object-counting.md index 144555793d..ba21ffac2b 100644 --- a/docs/en/guides/object-counting.md +++ b/docs/en/guides/object-counting.md @@ -19,7 +19,7 @@ Object counting with [Ultralytics YOLO11](https://github.com/ultralytics/ultraly allowfullscreen>
- Watch: Object Counting using Ultralytics YOLO11 + Watch: Object Counting using Ultralytics YOLOv8