🏊 Lifeguard Drone — Z5CC
Side-view swimming-pool detector for an autonomous AI lifeguard system
Predictions on held-out test clips (never seen in training), confidence ≥ 0.5. Left: a person in distress flagged drowning. Right: normal swimmers.
⚠️ Research model, not a safety device. A swimmer box, or a high
drowningscore on one frame, does not establish that someone is drowning. Distress needs temporal and contextual evidence (how long it lasts, track history, submersion time) plus human confirmation. Pool-only scope. Licensing is unresolved (see Licensing), so this is not cleared for commercial use.
Highlights
| Task | Detect people in pool water, with a per-box swimming / drowning score |
| Camera | Side-view / poolside (lifeguard or CCTV angle) |
| Test result | mAP50 0.704 · drowning AP50 0.649 · drowning recall 0.633 (6 unseen videos) |
| Speed | ≈ 14 ms / frame on a GTX 1650 (real time) |
| In the system | A 2 s mean of the drowning score triggers a pre-alert for a human operator, never an alarm on its own. On 12 test clips it caught 5/6 near-drowning clips (1.9–8 s) with 0/6 false alerts |
Quick start
pip install "ultralytics==8.4.218" huggingface_hub
from huggingface_hub import hf_hub_download
from ultralytics import YOLO
model = YOLO(hf_hub_download("triq0/lifeguard-drone-z5cc", "z5cc_s448_final.pt"))
for r in model.predict("pool_frame.jpg", imgsz=448, conf=0.25):
for box in r.boxes:
print(model.names[int(box.cls)], float(box.conf), box.xyxy.tolist())
Checksum verification, video tracking and system integration: INFERENCE.md.
Ready-to-run dashboard demo with test videos:
triq0/lifeguard-drone-demo.
Model details
| Item | Value | Source |
|---|---|---|
| Architecture | Ultralytics YOLO11s DetectionModel (scale s), 9,428,566 parameters, strides 8/16/32 | checkpoint |
| Initialisation | yolo11s.pt (Ultralytics pretrained), full fine-tuning | checkpoint train_args |
| Framework | Ultralytics 8.4.218 | checkpoint |
| Weights | z5cc_s448_final.pt, PyTorch checkpoint, FP16, 19,149,786 bytes | file |
| SHA-256 | 8136a671120f9133bc2213fdbe3a143d5a71b19ae46113d99f292ffa71355f97 | SHA256SUMS.txt |
| Input size | 448 × 448 (must match training) | checkpoint, config.yaml |
Classes
| Index | Name | Meaning |
|---|---|---|
| 0 | swimming | a person in the pool water who is not labelled as drowning |
| 1 | drowning | a person labelled as drowning in the source video annotation |
In the Lifeguard System runtime, both classes count as "person" (person_class_ids: [0, 1]). The
class-1 confidence is the distress score (distress_class_ids: [1]), averaged per tracked swimmer
over 2 s.
System context
This detector is the perception front end of the Autonomous AI Lifeguard System, a student engineering project:
Pool camera → YOLO detector → ByteTrack tracking → rule-based risk engine → operator dashboard → (simulated) rescue drone.
The risk engine combines tracking features such as submersion time with the detector's distress score. It raises pre-alerts and alarms, and a human operator confirms each one before dispatch.
- Code, reports and configs: https://github.com/tarekmhmd/lifeguard-drone-dataset-analysis
- Training report:
docs/MODEL_TRAINING_REPORT.md§1 (source of every number on this page) - Runtime config:
configs/ai_z5cc.yaml(published copy:config.yaml)
Intended use
- Research, teaching and demos of pool-safety computer vision.
- Locating people in side-view pool video, as input to a tracker and a temporal risk engine.
- An aid to a trained lifeguard or operator, who keeps responsibility for every decision.
Out of scope
- The sole or primary drowning-prevention or life-safety system.
- Alarms or rescues triggered by single-frame
drowningscores without temporal evidence and human confirmation. - Open water, beaches, lakes, the sea, underwater cameras, aerial / drone footage, or overhead pool
cameras (for overhead views use
triq0/lifeguard-drone-ddt). - Identifying or profiling individuals, or surveillance beyond pool safety.
- Commercial deployment while licensing is unresolved.
Training data
| Item | Verified fact |
|---|---|
| Upstream dataset | Z5cc drowning-detection by David Nicklaser (2024), https://github.com/Z5cc/drowning-detection: 82 YouTube videos (mostly the "Lifeguard Rescue" channel) cut into 224 × 224 snippets at 30 FPS, boxes drawn by hand in CVAT on every 6th frame and interpolated in between, labels swim / drown |
| Copy used | A subset already split by video: train 37 videos, val 12, test 6 |
| Cleaning (Z5cc_v2) | train: near-duplicate consecutive frames removed, 29,109 → 22,884 images · val: 165 unlabelled frames removed, 6,830 → 6,665 · test: unchanged, 6,631 |
| Final training set | train + val = 49 videos (29,549 images) |
| Leakage check | No video appears in more than one split; 0 label flips between consecutive frames |
The dataset is not distributed here. This repository holds only the weights and documentation. To obtain the data, follow the upstream instructions.
Training
Trained on Google Colab (Tesla T4). Values from the checkpoint's train_args and the training report
§1.4–1.5.
| Setting | Value |
|---|---|
| Epochs | 25, fixed; final = last epoch (val was folded into training, so the count came from the earlier s448 run) |
| Batch / optimizer / lr0 / seed | 32 / MuSGD / 0.01 / 42 |
| Augmentation | mosaic 1.0, horizontal flip 0.5, HSV, scale, translate, random erasing 0.4, RandAugment, light blur/CLAHE, mixup 0.1; no vertical flip or rotation (fixed side-view camera) |
Experiment history (same test split):
| Run | Model / imgsz | test mAP50 | drowning AP50 | drowning recall |
|---|---|---|---|---|
| baseline | YOLO11n / 224 | 0.571 | 0.443 | 0.509 |
| s448 | YOLO11s / 448 | 0.627 | 0.516 | 0.579 |
| s448r (frozen backbone, rejected) | YOLO11s / 448 | 0.607 | 0.529 | 0.511 |
| final (train + val) | YOLO11s / 448 | 0.704 | 0.649 | 0.633 |
Evaluation
Held-out test split: 6 videos (12 clips, 6,631 images, 12,940 boxes) never used for training. Ultralytics metrics; per-class P/R at the max-F1 confidence. Source: training report §1.4 and the run's results table.
| Metric | Value |
|---|---|
| mAP50 (all) | 0.704 |
| mAP50-95 (all) | 0.330 |
swimming AP50 | 0.758 |
drowning AP50 | 0.649 |
drowning precision / recall | 0.737 / 0.633 |
At conf 0.25: true drowning → drowning 0.71, → swimming 0.16, missed 0.13; swimming found
0.90. The main error is drowning predicted as swimming, because many drowning frames look like
swimming in a single image.
Disclosures:
- One model-selection step (
s448overs448r) partly used test numbers. - The early-warning window rules were adjusted on the same 12 clips, so that result is evidence, not validation.
- The checkpoint's stored
train_metrics(mAP50 0.994) were computed on the validation split, which was part of training. Do not quote them.
Limitations and risks
- Single-frame limit: about a third of drowning boxes are missed or misclassified per frame (recall 0.633).
- Domain: low-resolution (224 px source) YouTube pool clips, upscaled to 448. Not validated on the project team's own camera or a real facility. False alarms per hour have not been measured.
- Annotation conventions differ between source videos (head-only vs whole-body boxes). Many
drowningboxes mark a person almost invisible under water. - Small test set (6 videos). The footage is mostly from one channel, so performance across ages, body types, skin tones, pools and lighting is unknown.
- False reassurance: a missed detection can delay a response. Always keep human supervision.
- The
.ptfile is a pickle checkpoint. Load it only after checkingSHA256SUMS.txt.
Licensing
Unresolved. No LICENSE file is included on purpose. Details: LICENSE_STATUS.md.
- Data: the upstream Z5cc repository has no licence, and its footage comes from third-party YouTube videos.
- Framework / base weights: the checkpoint records Ultralytics' licence as AGPL-3.0 (https://ultralytics.com/license). This is open decision OD-7 in the project.
Citation
Please cite the upstream dataset, as its author asks:
@misc{nicklaser2024drowning,
title = {Drowning Detection via Real-Time Spatio-Temporal Action Localization},
author = {Nicklaser, David},
year = {2024},
url = {https://github.com/Z5cc/drowning-detection}
}