๐Ÿ• โšก
Python Pizza
Ultralytics

model.predict()

Real-Time Edge Vision with Ultralytics ๐Ÿ•โšก

Onuralp SEZER

Senior ML Engineer @ Ultralytics

Python Pizza Istanbul ๐Ÿ• 14 November 2026

Onuralp SEZER

whoami ๐Ÿ‘‹

Hi, Iโ€™m Onuralp!

Senior ML & Computer Vision Engineer at Ultralytics

๐Ÿ I maintain the ultralytics Python package

๐Ÿฆ€ and ultralytics/inference (Rust) and TrackForge

๐Ÿ” Co-maintainer of SAHI

๐Ÿง Fedora KDE SIG and Mindshare member

QR code to all links

All my links ๐Ÿ”—
@onuralpszr

2

pip install ultralytics ๐Ÿ“ฆ

One package for everything. ๐Ÿ

from ultralytics import YOLO model = YOLO("yolo26n.pt")results = model.predict("pizza.jpg") # that's it, boxes on your pizza ๐Ÿ•

Same API for every task

๐Ÿ“ฆ Detection๐ŸŽญ Instance Segmentation ๐Ÿ—บ๏ธ Semantic Segmentation๐Ÿ“ Depth Estimation ๐Ÿท๏ธ Classification๐Ÿ•บ Pose Estimation๐Ÿ“ OBB

Today we use YOLO26n, the smallest one. It is made for small devices. ๐Ÿ“ฑ

3

todayโ€™s model ๐Ÿ•

I had zero pizza photos. ๐Ÿ˜…

๐Ÿ•
๐ŸŽจ

Generate

2,376 pizza scenes made with ComfyUI

๐Ÿท๏ธ

Auto-label

a detector draws the first boxes for me

๐Ÿ› ๏ธ

Fix

clean up mistakes on Ultralytics Platform

๐Ÿ‹๏ธ

Train

YOLO26n, pizza and pizza_slice, about 20 min

4

before โžœ after ๐Ÿ”

What does predict() see?

Real boxes from my pizza model, on images it never trained on. Drag the slider! ๐Ÿ‘†

๐Ÿ• 0 pizza๐Ÿ”บ 0 slicesโฑ๏ธ 0 ms
conf0.40

โ†’ reveal / next image   B before   A after

before
after
beforeafter โœจ
5

fun fact ๐Ÿงช

I trained 6 different setups.
They all scored 0.856 to 0.863 mAP.

Longer training, a bigger model, AdamW, more augmentation. Almost no change! Better data helps way more than fancy settings. ๐Ÿ•

6

the problem ๐Ÿข

A .pt file is great for training.
Not so great on a tiny device.

๐Ÿ˜

Heavy runtime

Full PyTorch plus Python. A big install for a small box.

๐Ÿงฎ

32-bit math

Most chips are much faster with 16-bit or 8-bit numbers.

๐Ÿ”ง

Generic kernels

Nothing is tuned for your exact chip yet.

model.pt
โ†’
model.export()
โ†’

ONNX ๐ŸŒ

runs anywhere, CPU

TensorRT โšก

NVIDIA GPU, Jetson

CoreML / TFLite ๐Ÿ“ฑ

iPhone and Android

OpenVINO ๐Ÿ’ป

Intel CPU and NPU

7

the fix โœจ

Export is one line.

from ultralytics import YOLOmodel = YOLO("pizza-yolo26n.pt") model.export(format="onnx") # any CPU ๐ŸŒmodel.export(format="engine", half=True) # NVIDIA FP16 โšกmodel.export(format="engine", int8=True, data="pizza.yaml") # INT8 ๐Ÿ”ขmodel.export(format="coreml") # iPhone ๐Ÿmodel.export(format="tflite") # Android ๐Ÿค– YOLO("pizza-yolo26n.engine").predict("pizza.jpg") # same API ๐Ÿ•
8

smaller = faster ๐ŸŽ›๏ธ

Three knobs you can turn.

๐Ÿ• Model size

Start with nano. Go bigger only if you need it.

26s 1.4 ms, mAP 0.849
26n 1.0 ms, mAP 0.858

๐Ÿ–ผ๏ธ Image size

Fewer pixels, less work. Fine when objects are big.

640px 1.0 ms, mAP 0.858
320px 0.5 ms, mAP 0.807

๐Ÿ”ข Precision

FP32, FP16, INT8. INT8 needs a few calibration images.

FP16 1.0 ms, mAP 0.858
INT8 1.8 ms, mAP 0.846

FP32

FP16

INT8

๐Ÿคฏ

Plot twist: INT8 was slower than FP16 here!

1.8 ms vs 1.0 ms. Smaller numbers are not always faster. Always test on your own device.

TensorRT on my laptop (NVIDIA RTX Spark N1X), batch 1, 238 validation images, mAP = mAP50-95

9

real numbers โฑ๏ธ

Same pizza model, 7 ways to run it. ๐Ÿ•

format

time per image (log scale)

ms

FPS

mAP

PyTorch FP32 (CPU)

298.3 ms

3

0.859

ONNX FP32 (CPU)

18.8 ms

53

0.856

PyTorch FP32 (GPU)

2.9 ms

340

0.859

TensorRT FP16

1.0 ms

1010

0.858

TensorRT INT8

1.8 ms

568

0.846

TensorRT FP16 @320

0.5 ms

1852

0.807

YOLO26s TensorRT FP16

1.4 ms

699

0.849

YOLO26n at 640px unless noted, batch 1, model time only, on my laptop

10

before โžœ after ๐Ÿ

Pizza race! Same model, 10 seconds. ๐Ÿ•

๐Ÿข PyTorch CPUbefore: plain .pt

๐Ÿ•

0pizzas

๐Ÿ”ฅ PyTorch GPUbefore: plain .pt

๐Ÿ•

0pizzas

โšก TensorRT FP16after: model.export()

๐Ÿ•

0pizzas

Counters run at the real measured speed: 298 ms, 2.9 ms and 1.0 ms per image. Press R to restart the race.

11

result ๐Ÿš€

3.0ร— faster

than PyTorch on the same GPU.
301ร— faster than PyTorch on CPU.

Same accuracy: mAP 0.858 vs 0.859. That is 1010 pizzas per second! ๐Ÿ•๐Ÿ•๐Ÿ•

12

live ๐Ÿ”ด

Demo time! ๐Ÿ•

python demo.py --model models/pizza-yolo26n.pt python demo.py --model models/pizza-yolo26n-fp16.engine
13

npm install @ultralytics/yolo ๐ŸŒ

In the browser! ๐ŸŒ

inference

-

FPS

-

device

-

objects

-
14
Python Pizza
Ultralytics

Grazie! TeลŸekkรผrler! ๐Ÿ•

1๏ธโƒฃ Start small

2๏ธโƒฃ Export for your device

3๏ธโƒฃ Always measure

QR: trained models

๐Ÿ‹๏ธ Models

all training runs

QR: pizza dataset

๐Ÿ• Dataset

2,376 pizza images

QR: Onuralp's links

๐Ÿ‘‹ Me

@onuralpszr

โ†’ / space next ยท โ† back ยท F fullscreen ยท N notes window