Merge branch 'main' into sam3-imgsz

This commit is contained in:
Onuralp SEZER 2026-04-17 11:17:31 +03:00 committed by GitHub
commit 3b806034da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 76 additions and 7 deletions

View file

@ -109,6 +109,15 @@ Parking management with [Ultralytics YOLO26](https://github.com/ultralytics/ultr
cv2.destroyAllWindows() # destroy all opened windows
```
=== "CLI"
```bash
yolo solutions parking source="path/to/video.mp4" json_file="bounding_boxes.json" show=True
```
!!! note
Create parking zone annotations first using `ParkingPtsSelection()` in Python (Step 2 above), then pass the JSON file to the CLI command.
### `ParkingManagement` Arguments
Here's a table with the `ParkingManagement` arguments:

View file

@ -87,6 +87,12 @@ keywords: object counting, regions, YOLO26, computer vision, Ultralytics, effici
cv2.destroyAllWindows() # destroy all opened windows
```
=== "CLI"
```bash
yolo solutions region source="path/to/video.mp4" show=True region="[(20, 400), (1080, 400), (1080, 360), (20, 360)]"
```
!!! tip "Ultralytics Example Code"
The Ultralytics region counting module is available in our [examples section](https://github.com/ultralytics/ultralytics/blob/main/examples/YOLOv8-Region-Counter/yolov8_region_counter.py). You can explore this example for code customization and modify it to suit your specific use case.

View file

@ -79,6 +79,15 @@ The Security Alarm System Project utilizing Ultralytics YOLO26 integrates advanc
cv2.destroyAllWindows() # destroy all opened windows
```
=== "CLI"
```bash
yolo solutions security source="path/to/video.mp4" show=True
```
!!! note
Email alerts require the Python API to call `.authenticate()`. The CLI provides detection and visualization only.
When you run the code, you will receive a single email notification if any object is detected. The notification is sent immediately, not repeatedly. You can customize the code to suit your project requirements.
#### Email Received Sample

View file

@ -44,6 +44,10 @@ Currently, you can only export models that include the following tasks to IMX500
- [Classification](https://docs.ultralytics.com/tasks/classify/)
- [Instance segmentation](https://docs.ultralytics.com/tasks/segment/)
!!! note "Supported model variants"
IMX export is designed and benchmarked for **YOLOv8n** and **YOLO11n** (nano). Other architectures and model scales are not supported.
## Usage Examples
Export an Ultralytics YOLO11 model to IMX500 format and run inference with the exported model.

View file

@ -365,6 +365,34 @@ Ultralytics provides ready-to-use solutions for common computer vision applicati
yolo solutions trackzone region="[(150, 150), (1130, 150), (1130, 570), (150, 570)]" # configure zone coordinates
```
=== "Region"
Count objects inside specific polygonal regions:
```bash
yolo solutions region show=True
yolo solutions region source="path/to/video.mp4" # specify video file path
yolo solutions region region="[(20, 400), (1080, 400), (1080, 360), (20, 360)]" # configure region coordinates
```
=== "Security"
Run security alarm monitoring with object detection:
```bash
yolo solutions security show=True
yolo solutions security source="path/to/video.mp4" # specify video file path
```
=== "Parking"
Monitor parking lot occupancy using pre-defined zones:
```bash
yolo solutions parking source="path/to/video.mp4" json_file="bounding_boxes.json" # requires pre-built JSON
yolo solutions parking source="path/to/video.mp4" json_file="bounding_boxes.json" model="yolo26n.pt"
```
=== "Help"
View available solutions and their options:

View file

@ -48,6 +48,9 @@ SOLUTION_MAP = {
"analytics": "Analytics",
"inference": "Inference",
"trackzone": "TrackZone",
"region": "RegionCounter",
"security": "SecurityAlarm",
"parking": "ParkingManagement",
"help": None,
}
@ -111,7 +114,16 @@ SOLUTIONS_HELP_MSG = f"""
6. Track objects within specific zones
yolo solutions trackzone source="path/to/video.mp4" region="[(150, 150), (1130, 150), (1130, 570), (150, 570)]"
7. Streamlit real-time webcam inference GUI
7. Count objects inside specific regions
yolo solutions region source="path/to/video.mp4" region="[(20, 400), (1080, 400), (1080, 360), (20, 360)]"
8. Run security alarm monitoring (email alerts require Python API)
yolo solutions security source="path/to/video.mp4"
9. Monitor parking occupancy (create JSON annotations first via Python ParkingPtsSelection)
yolo solutions parking source="path/to/video.mp4" json_file="bounding_boxes.json"
10. Streamlit real-time webcam inference GUI
yolo streamlit-predict
"""
CLI_HELP_MSG = f"""

View file

@ -140,7 +140,7 @@ class SecurityAlarm(BaseSolution):
annotator.box_label(box, label=self.names[cls], color=colors(cls, True))
total_det = len(self.clss)
if total_det >= self.records and not self.email_sent: # Only send email if not sent before
if total_det >= self.records and not self.email_sent and self.server:
self.send_email(im0, total_det)
self.email_sent = True

View file

@ -373,15 +373,16 @@ class RotatedTaskAlignedAssigner(TaskAlignedAssigner):
Returns:
(torch.Tensor): Boolean mask of positive anchors with shape (b, n_boxes, h*w).
"""
wh_mask = gt_bboxes[..., 2:4] < self.stride[0]
gt_bboxes[..., 2:4] = torch.where(
gt_bboxes_clone = gt_bboxes.clone()
wh_mask = gt_bboxes_clone[..., 2:4] < self.stride[0]
gt_bboxes_clone[..., 2:4] = torch.where(
(wh_mask * mask_gt).bool(),
torch.tensor(self.stride_val, dtype=gt_bboxes.dtype, device=gt_bboxes.device),
gt_bboxes[..., 2:4],
torch.tensor(self.stride_val, dtype=gt_bboxes_clone.dtype, device=gt_bboxes_clone.device),
gt_bboxes_clone[..., 2:4],
)
# (b, n_boxes, 5) --> (b, n_boxes, 4, 2)
corners = xywhr2xyxyxyxy(gt_bboxes)
corners = xywhr2xyxyxyxy(gt_bboxes_clone)
# (b, n_boxes, 1, 2)
a, b, _, d = corners.split(1, dim=-2)
ab = b - a