Merge branch 'main' into action-recog2

action-recog2
fatih c. akyon 2 months ago committed by GitHub
commit 06f6df2d7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 9
      docs/en/guides/heatmaps.md
  2. 2
      docs/en/models/index.md
  3. 82
      docs/overrides/javascript/extra.js
  4. 6
      docs/overrides/stylesheets/style.css
  5. 14
      ultralytics/solutions/heatmap.py

@ -34,11 +34,6 @@ A heatmap generated with [Ultralytics YOLO11](https://github.com/ultralytics/ult
| ![Ultralytics YOLO11 Transportation Heatmap](https://github.com/ultralytics/docs/releases/download/0/ultralytics-yolov8-transportation-heatmap.avif) | ![Ultralytics YOLO11 Retail Heatmap](https://github.com/ultralytics/docs/releases/download/0/ultralytics-yolov8-retail-heatmap.avif) |
| Ultralytics YOLO11 Transportation Heatmap | Ultralytics YOLO11 Retail Heatmap |
!!! tip "Heatmap Configuration"
- `heatmap_alpha`: Ensure this value is within the range (0.0 - 1.0).
- `decay_factor`: Used for removing heatmap after an object is no longer in the frame, its value should also be in the range (0.0 - 1.0).
!!! example "Heatmaps using Ultralytics YOLO11 Example"
=== "Heatmap"
@ -274,10 +269,7 @@ A heatmap generated with [Ultralytics YOLO11](https://github.com/ultralytics/ult
| Name | Type | Default | Description |
| ------------------ | ---------------- | ------------------ | ----------------------------------------------------------------- |
| `names` | `list` | `None` | Dictionary of class names. |
| `imw` | `int` | `0` | Image width. |
| `imh` | `int` | `0` | Image height. |
| `colormap` | `int` | `cv2.COLORMAP_JET` | Colormap to use for the heatmap. |
| `heatmap_alpha` | `float` | `0.5` | Alpha blending value for heatmap overlay. |
| `view_img` | `bool` | `False` | Whether to display the image with the heatmap overlay. |
| `view_in_counts` | `bool` | `True` | Whether to display the count of objects entering the region. |
| `view_out_counts` | `bool` | `True` | Whether to display the count of objects exiting the region. |
@ -288,7 +280,6 @@ A heatmap generated with [Ultralytics YOLO11](https://github.com/ultralytics/ult
| `region_thickness` | `int` | `5` | Thickness of the region line. |
| `line_dist_thresh` | `int` | `15` | Distance threshold for line-based counting. |
| `line_thickness` | `int` | `2` | Thickness of the lines used in drawing. |
| `decay_factor` | `float` | `0.99` | Decay factor for the heatmap to reduce intensity over time. |
| `shape` | `str` | `"circle"` | Shape of the heatmap blobs ('circle' or 'rect'). |
### Arguments `model.track`

@ -8,6 +8,8 @@ keywords: Ultralytics, supported models, YOLOv3, YOLOv4, YOLOv5, YOLOv6, YOLOv7,
Welcome to Ultralytics' model documentation! We offer support for a wide range of models, each tailored to specific tasks like [object detection](../tasks/detect.md), [instance segmentation](../tasks/segment.md), [image classification](../tasks/classify.md), [pose estimation](../tasks/pose.md), and [multi-object tracking](../modes/track.md). If you're interested in contributing your model architecture to Ultralytics, check out our [Contributing Guide](../help/contributing.md).
![Ultralytics YOLO11 Comparison Plots](https://github.com/user-attachments/assets/a311a4ed-bbf2-43b5-8012-5f183a28a845)
## Featured Models
Here are some of the key models supported:

@ -67,3 +67,85 @@ window.onhashchange = function() {
hash: window.location.pathname + window.location.search + window.location.hash
}, '*');
};
// Add Inkeep button
document.addEventListener("DOMContentLoaded", () => {
const inkeepScript = document.createElement("script");
inkeepScript.src = "https://unpkg.com/@inkeep/uikit-js@0.3.11/dist/embed.js";
inkeepScript.type = "module";
inkeepScript.defer = true;
document.head.appendChild(inkeepScript);
// Configure and initialize the widget
const addInkeepWidget = () => {
const inkeepWidget = Inkeep().embed({
componentType: "ChatButton",
colorModeSync: {
observedElement: document.documentElement,
isDarkModeCallback: (el) => {
const currentTheme = el.getAttribute("data-color-mode");
return currentTheme === "dark";
},
colorModeAttribute: "data-color-mode",
},
properties: {
chatButtonType: "PILL",
fixedPositionYOffset: "3rem",
chatButtonBgColor: "#F3F3F3",
baseSettings: {
apiKey: "13dfec2e75982bc9bae3199a08e13b86b5fbacd64e9b2f89", // required
integrationId: "cm1shscmm00y26sj83lgxzvkw", // required
organizationId: "org_e3869az6hQZ0mXdF", // required
primaryBrandColor: "#111F68", // Ultralytics brand color
organizationDisplayName: "Ultralytics",
theme: {
stylesheetUrls: ["../stylesheets/style.css"],
},
// ...optional settings
},
modalSettings: {
// optional settings
},
searchSettings: {
// optional settings
},
aiChatSettings: {
chatSubjectName: "Ultralytics",
botAvatarSrcUrl: "https://storage.googleapis.com/organization-image-assets/ultralytics-botAvatarSrcUrl-1727908259285.png",
botAvatarDarkSrcUrl: "https://storage.googleapis.com/organization-image-assets/ultralytics-botAvatarDarkSrcUrl-1727908258478.png",
quickQuestions: [
"What's new in Ultralytics YOLO11?",
"How can I get started with Ultralytics HUB?",
"How does Ultralytics Enterprise Licensing work?"
],
getHelpCallToActions: [
{
name: "Ask on Ultralytics GitHub",
url: "https://github.com/ultralytics/ultralytics",
icon: {
builtIn: "FaGithub"
}
},
{
name: "Ask on Ultralytics Discourse",
url: "https://community.ultralytics.com/",
icon: {
builtIn: "FaDiscourse"
}
},
{
name: "Ask on Ultralytics Discord",
url: "https://discord.com/invite/ultralytics",
icon: {
builtIn: "FaDiscord"
}
}
],
},
},
});
};
inkeepScript.addEventListener("load", () => {
addInkeepWidget(); // initialize the widget
});
});

@ -264,3 +264,9 @@ div.highlight {
}
}
/* MkDocs Ultralytics Plugin ---------------------------------------------------------------------------------------- */
/* Inkeep button font color ----------------------------------------------------------------------------------------- */
.ikp-floating-button {
color: #111f68;
}
/* Inkeep button ---------------------------------------------------------------------------------------------------- */

@ -19,10 +19,7 @@ class Heatmap:
def __init__(
self,
names,
imw=0,
imh=0,
colormap=cv2.COLORMAP_JET,
heatmap_alpha=0.5,
view_img=False,
view_in_counts=True,
view_out_counts=True,
@ -33,7 +30,6 @@ class Heatmap:
region_thickness=5,
line_dist_thresh=15,
line_thickness=2,
decay_factor=0.99,
shape="circle",
):
"""Initializes the heatmap class with default values for Visual, Image, track, count and heatmap parameters."""
@ -46,8 +42,6 @@ class Heatmap:
self.names = names # Classes names
# Image information
self.imw = imw
self.imh = imh
self.im0 = None
self.tf = line_thickness
self.view_in_counts = view_in_counts
@ -56,7 +50,6 @@ class Heatmap:
# Heatmap colormap and heatmap np array
self.colormap = colormap
self.heatmap = None
self.heatmap_alpha = heatmap_alpha
# Predict/track information
self.boxes = []
@ -79,9 +72,6 @@ class Heatmap:
self.count_bg_color = count_bg_color
self.cls_txtdisplay_gap = 50
# Decay factor
self.decay_factor = decay_factor
# Check if environment supports imshow
self.env_check = check_imshow(warn=True)
@ -133,7 +123,7 @@ class Heatmap:
self.heatmap = np.zeros((int(self.im0.shape[0]), int(self.im0.shape[1])), dtype=np.float32)
self.initialized = True
self.heatmap *= self.decay_factor # decay factor
self.heatmap *= 0.99 # decay factor
self.extract_results(tracks)
self.annotator = Annotator(self.im0, self.tf, None)
@ -239,7 +229,7 @@ class Heatmap:
# Normalize, apply colormap to heatmap and combine with original image
heatmap_normalized = cv2.normalize(self.heatmap, None, 0, 255, cv2.NORM_MINMAX)
heatmap_colored = cv2.applyColorMap(heatmap_normalized.astype(np.uint8), self.colormap)
self.im0 = cv2.addWeighted(self.im0, 1 - self.heatmap_alpha, heatmap_colored, self.heatmap_alpha, 0)
self.im0 = cv2.addWeighted(self.im0, 0.5, heatmap_colored, 0.5, 0)
if self.env_check and self.view_img:
self.display_frames()

Loading…
Cancel
Save