Views
No views yet
| Property | Value |
|---|---|
| Category | Object Detection (Person Detection) |
| Base Model | YOLO26 (Ultralytics) |
| Source Framework | PyTorch (Ultralytics) |
| Supported Precisions | FP32, FP16, INT8 (mixed-precision) |
| Inference Engine | OpenVINO |
| Hardware | CPU, GPU, NPU |
| Detected Class | person (COCO class 0) |
person class.
The quantized INT8 model delivers high throughput on Intel CPUs, GPUs, and NPUs while maintaining strong detection accuracy.yolo26n, yolo26s, yolo26m, yolo26l, yolo26x.
Smaller variants (yolo26n, yolo26s) are recommended for high-FPS edge deployment; larger variants improve recall in dense scenes.1python3 -m venv .venv --system-site-packages
2source .venv/bin/activateNote: The--system-site-packagesflag is required so the virtual environment can access the system-installed OpenVINO and DLStreamer Python packages.
1chmod +x export_and_quantize.sh
2./export_and_quantize.sh1./export_and_quantize.sh yolo26n FP32 # full-precision
2./export_and_quantize.sh yolo26n INT8 # quantized
3./export_and_quantize.sh yolo26s # larger variant, default FP16yolo26n with any variant (yolo26s, yolo26m, yolo26l, yolo26x).
The second argument selects the precision (FP32, FP16, INT8); the default is FP16.openvino, ultralytics; adds nncf for INT8).test.jpg) and a sample test video (test_video.mp4).yolo26n_openvino_model/ -- FP32 or FP16 OpenVINO IR model directory.yolo26n_person_int8.xml / yolo26n_person_int8.bin -- INT8 quantized model (only when INT8 is selected).| Precision | CPU | GPU | NPU |
|---|---|---|---|
| FP32 | Yes | Yes | No |
| FP16 | Yes | Yes | Yes |
| INT8 | Yes | Yes | Yes |
Note: The INT8 calibration uses the bundled sample image. For production accuracy, replace it with a representative set of frames from the target deployment site.
person class, and reports the person count for a single image.
YOLO26 is end-to-end (NMS-free), so no manual non-maximum suppression is needed.
Change the device string to run on CPU, GPU, or NPU.1import cv2
2import numpy as np
3import openvino as ov
4
5PERSON_CLASS_ID = 0
6CONF_THRESHOLD = 0.4
7INPUT_SIZE = 640
8
9core = ov.Core()
10model = core.read_model("yolo26n_openvino_model/yolo26n.xml")
11
12# Change device to "GPU" or "NPU" to run on integrated GPU or NPU.
13compiled = core.compile_model(model, "CPU")
14
15image = cv2.imread("test.jpg")
16h0, w0 = image.shape[:2]
17
18blob = cv2.resize(image, (INPUT_SIZE, INPUT_SIZE))
19blob = cv2.cvtColor(blob, cv2.COLOR_BGR2RGB).astype(np.float32) / 255.0
20blob = blob.transpose(2, 0, 1)[np.newaxis, ...] # NCHW
21
22# YOLO26 end-to-end output: [1, 300, 6] = [x1, y1, x2, y2, confidence, class_id]
23output = compiled([blob])[compiled.output(0)][0]
24mask = (output[:, 4] >= CONF_THRESHOLD) & (output[:, 5].astype(int) == PERSON_CLASS_ID)
25dets = output[mask]
26
27sx, sy = w0 / INPUT_SIZE, h0 / INPUT_SIZE
28person_count = len(dets)
29print(f"Detected persons: {person_count}")
30
31for det in dets:
32 x1 = int(det[0] * sx)
33 y1 = int(det[1] * sy)
34 x2 = int(det[2] * sx)
35 y2 = int(det[3] * sy)
36 cv2.rectangle(image, (x1, y1), (x2, y2), (0, 255, 0), 2)
37
38cv2.putText(
39 image, f"Persons: {person_count}", (10, 30),
40 cv2.FONT_HERSHEY_SIMPLEX, 1.0, (0, 255, 0), 2,
41)
42cv2.imwrite("output_openvino.jpg", image)"CPU" -- default, works on all Intel platforms."GPU" -- Intel integrated or discrete GPU."NPU" -- Intel NPU (different throughput profile; validate with benchmark_app -d NPU).export_and_quantize.sh script downloads test.jpg automatically.
Re-run the OpenVINO sample above.
The script reads test.jpg, prints the person count to the console, and writes the annotated frame to output_openvino.jpg.Detected persons: 2output_openvino.jpg shows a green bounding box around each detected person and the text Persons: 2 in the top-left corner.
gvadetect, filters detections to the person class in a buffer probe using
the GStreamer Analytics metadata API (GstAnalytics), overlays bounding boxes,
saves the annotated result to output_dlstreamer.mp4, and prints the person count per
frame.Notes on running this sample:
Use the FP16 IR (yolo26n_openvino_model/yolo26n.xml). On DLStreamer 2026.1,gvadetectcannot auto-derive a YOLO post-processor from the INT8 model produced by the bundled script. To use the INT8 model, supply a matchingmodel-procJSON. Class names are read automatically from the model's embeddedmetadata.yamlby DLStreamer 2026.0+ -- no externallabels-fileis required. ExportPYTHONPATHso the DLStreamer Python module is importable:bash1source /opt/intel/openvino_2026/setupvars.sh 2source /opt/intel/dlstreamer/scripts/setup_dls_env.sh 3export PYTHONPATH=/opt/intel/dlstreamer/python:\ 4/opt/intel/dlstreamer/gstreamer/lib/python3/dist-packages:${PYTHONPATH:-}
1import gi
2
3gi.require_version("Gst", "1.0")
4gi.require_version("GstAnalytics", "1.0")
5from gi.repository import Gst, GLib, GstAnalytics
6
7Gst.init([])
8
9INPUT_VIDEO = "test_video.mp4"
10
11# For CPU: change device=GPU to device=CPU.
12# For NPU: change device=GPU to device=NPU (batch-size=1, nireq=4 recommended).
13pipeline_str = (
14 f"filesrc location={INPUT_VIDEO} ! decodebin3 ! "
15 "videoconvert ! "
16 "gvadetect model=yolo26n_openvino_model/yolo26n.xml "
17 "device=GPU "
18 "threshold=0.4 ! queue ! "
19 "gvawatermark displ-cfg=show-roi=person ! "
20 "videoconvert ! video/x-raw,format=I420 ! "
21 "openh264enc ! h264parse ! "
22 "mp4mux ! filesink name=sink location=output_dlstreamer.mp4"
23)
24pipeline = Gst.parse_launch(pipeline_str)
25
26
27def on_buffer(pad, info):
28 buf = info.get_buffer()
29 rmeta = GstAnalytics.buffer_get_analytics_relation_meta(buf)
30 if rmeta is None:
31 return Gst.PadProbeReturn.OK
32 person_count = 0
33 idx = 1
34 while True:
35 ok, od = rmeta.get_od_mtd(idx)
36 if not ok:
37 break
38 if GLib.quark_to_string(od.get_obj_type()) == "person":
39 person_count += 1
40 idx += 1
41 if person_count:
42 print(f"Person count: {person_count}", flush=True)
43 return Gst.PadProbeReturn.OK
44
45
46sink = pipeline.get_by_name("sink")
47sink_pad = sink.get_static_pad("sink")
48sink_pad.add_probe(Gst.PadProbeType.BUFFER, on_buffer)
49
50pipeline.set_state(Gst.State.PLAYING)
51bus = pipeline.get_bus()
52bus.timed_pop_filtered(
53 Gst.CLOCK_TIME_NONE,
54 Gst.MessageType.EOS | Gst.MessageType.ERROR,
55)
56pipeline.set_state(Gst.State.NULL)
device=GPU -- default in the sample code.device=CPU -- change device=GPU to device=CPU.device=NPU -- change device=GPU to device=NPU; use batch-size=1 and nireq=4 for best NPU utilization.