Data Science thesis · Universidad Mayor · 2026
Two YOLOv8 detectors implemented from scratch in TensorFlow/Keras and trained on COCO2017: one with standard convolutions (Conv2D) and one with depthwise separable convolutions (SeparableConv2D). The separable model loses 17% of mAP50 and runs no faster on a desktop, but on a Raspberry Pi it goes from one image every 14 seconds to one every 1.5.
01 · Summary
The question was whether a lighter convolution buys enough speed to justify the accuracy it gives up. The answer changes with where the model runs.
With an RTX 4060 Ti, or on the Ryzen CPU alone, both models run at the same speed (5.4–5.5 FPS on GPU, 2.3–2.4 on CPU). The bottleneck is data loading and the TensorFlow runtime, not the parameter count, so Conv2D keeps its quality edge for free.
Without a GPU, Conv2D needs 13.9 s per image with ±1.5 s of jitter; the separable model needs 1.48 s with ±0.01 s. Faster and stable, which is what a continuously running embedded system needs.
The separable model was trained for twice the epochs (100 vs. 50) and still finished below Conv2D on every quality metric. It was not undertrained: it lacks capacity.
02 · Problem
An object detector takes an image and returns a box and a label for every object it recognises: "person here, bicycle there". YOLO (You Only Look Once) does it in a single pass through a convolutional network, which is why it is the usual choice for real-time video: driver assistance, anti-collision systems, surveillance cameras, inspection on a production line.
The catch is cost. Almost all of YOLO's arithmetic happens in convolution layers, and a model that runs smoothly on a desktop GPU can be unusable on a small, cheap, low-power board mounted on a vehicle or a camera, which is exactly where these systems need to operate.
Research question: if YOLOv8's standard convolutions are replaced with separable ones, how much accuracy is lost, how much speed is gained, and does the answer change with the hardware?
Conv2D and a modified one with SeparableConv2D.Deep learning models adapted to reduced hardware deliver higher accuracy than traditional models relative to the resources available, measured on specific performance metrics (mAP, precision, speed and efficiency).
The hypothesis is checked under Conclusions.
03 · Background
Learns one 3×3 filter for every input–output channel pair. It looks at space (the 3×3 neighbourhood) and at channels (colour, edges, textures) at the same time.
Splits that into two steps: depthwise, one 3×3 filter per channel that captures spatial patterns, and pointwise, a 1×1 convolution that mixes the channels.
With 128 channels in and out, the standard layer has 147,456 weights and the separable one 17,536: about 8× fewer, with the same drop in multiplications. The price is expressiveness: the network can no longer learn any combination of "where" and "which channel" in a single step. It is the idea behind MobileNet and Xception.
| Family | What it brought | Limitation |
|---|---|---|
| SIFT / HOG | Hand-crafted features, consistent in stable scenes | Break with lighting changes, rotation and dynamic scenes |
| AlexNet and CNNs (2012) | Features learned from data | Need large datasets and compute |
| R-CNN family | Region proposals + classification | Multi-stage, slow |
| YOLO (2015 →) | Boxes and classes in one pass, real time | Weaker on small objects |
| SSD / FPN | Multi-scale detection | Lower accuracy in some scenes |
| Transformers (DETR) | Global image context | Costly to train and deploy |
Separable convolutions had already been tried in YOLOv3-Lite, YOLOv5 variants and YOLOv7's ELAN blocks. YOLOv8 does not include them out of the box: that is the gap this thesis tests.
04 · Method
A quantitative comparative design: both models go through exactly the same pipeline, so any difference comes from the architecture and not from the data or the evaluation.
Conv2D layers of the prediction Head with SeparableConv2D, leaving the feature extractor untouched. Parameters drop from 3,991,584 to 1,258,715.| Data and training | |
|---|---|
| Dataset | COCO2017 (public benchmark) |
| Train / validation | 118,287 / 5,000 images |
| Classes | 80 |
| Input | 640 × 640 × 3 |
| Annotations | YOLOv8 format, same preprocessing for both |
| Framework | TensorFlow / Keras, from scratch (no pretrained weights) |
| Cost | 10–12 h per epoch on an RTX 4060 Ti |
| Hardware | Desktop | Raspberry Pi 4 |
|---|---|---|
| CPU | Ryzen 7 5700X, 8C/16T 3.4 GHz | BCM2711, Cortex-A72 1.5 GHz |
| GPU | RTX 4060 Ti, 8 GB | None (NEON SIMD) |
| RAM | 32 GB DDR4-3200 | 8 GB LPDDR4-2133 |
| Power | 65 W CPU + 160 W GPU | ≈ 7 W |
| Runtime | TensorFlow + CUDA | TensorFlow Lite |
05 · Results
| Metric | YOLOv8-Conv2D | YOLOv8-Separable |
|---|---|---|
| Model | ||
| Training epochs | 50 | 100 |
| Parameters | 3,991,584 (15.2 MB) | 1,258,715 (4.8 MB) |
| Detection quality | ||
| mAP50 | 0.2119 | 0.1751 |
| Mean IoU | 0.8367 | 0.8302 |
| Precision | 0.6836 | 0.6734 |
| Recall | 0.3260 | 0.2933 |
| Inference speed | ||
| Desktop CPU (FPS) | 2.34 | 2.41 |
| Desktop GPU (FPS) | 5.48 | 5.36 |
| Raspberry Pi (FPS) | 0.07 | 0.68 |
| Time per image, CPU (s, mean ± sd) | 0.4273 ± 0.0207 | 0.4156 ± 0.0136 |
| Time per image, GPU (s, mean ± sd) | 0.1824 ± 0.0169 | 0.1866 ± 0.1671 |
| Time per image, Raspberry Pi (s, mean ± sd) | 13.9322 ± 1.5230 | 1.4754 ± 0.0142 |
Both models share data, input size, metrics and validation split; only the convolution type in the Head changes.
Conv2D wins every metric. The biggest gap is recall (0.326 vs. 0.293): the separable model misses objects, but when it finds one it locates it almost as well (IoU and precision nearly tied).
A 68% smaller model runs at the same speed. Fewer multiplications only help when multiplications are the bottleneck; on a modern GPU the time goes into moving images around and into the runtime itself.
Here every multiplication runs on a 1.5 GHz ARM CPU with little memory bandwidth, so the savings turn almost directly into speed: 9.4× more FPS and latency stable to the hundredth of a second.
Conv2D reaches its best mAP at epoch 50 and then degrades (overfitting). The separable model converges more slowly and noisily, settling around epoch 100.
Same validation images; ground truth in red and predictions in yellow. Conv2D keeps tighter, more stable boxes on small and medium objects; the separable model misses more of them, which is where its lower recall comes from.
06 · Deployment
Exporting to TensorFlow Lite was not straightforward. DepthwiseConv2dNative is not among TFLite's built-in operators, so the export needed Select TF Ops and the graph had to be restructured: pure inference was split from the label encoder and from non-maximum suppression (NMS), keeping only the layers needed for prediction.
The model then runs on the Pi, but part of the graph executes as Flex ops that miss some TFLite and XNNPACK optimizations. That penalises the heavier, more memory-hungry Conv2D graph most, and partly explains its high and erratic latency.
07 · Conclusions
Hypothesis: partly confirmed. In absolute terms the adapted model is less accurate (0.175 vs. 0.212 mAP50), and extra epochs did not close the gap. Relative to the resources it uses, it wins clearly on the device it was designed for: on the Raspberry Pi it delivers 83% of the accuracy at a tenth of the latency and a third of the size, while the standard model is not usable there (one image every 14 s). On a desktop the trade-off does not exist, because the lighter model is not faster.