Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
Windows Tipps & SecurityGrafikkarte vor Überhitzung schützen: So geht’s(25.09.2026 um 08:00 Uhr)
••••••••••
Windows Tipps & SecurityGrafikkarte vor Überhitzung schützen: So geht’s(25.09.2026 um 08:00 Uhr)
••••••••••
Intelligence View
⚡ tsecurity.de Intelligence

How We Built a 200ms Image Moderation API on Cheap CPUs Using YOLOv8 and ONNX

Moderating user-generated content (UGC) is a necessity for almost any modern web application. But if you rely on major cloud providers like AWS Rekognition or Google Cloud Vision, scaling your platform can quickly lead to eye-watering API…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!



Moderating user-generated content (UGC) is a necessity for almost any modern web application. But if you rely on major cloud providers like AWS Rekognition or Google Cloud Vision, scaling your platform can quickly lead to eye-watering API bills.



Moreover, hosting heavy PyTorch or TensorFlow models on GPU-enabled servers is a massive overhead for indie projects.



I wanted to solve this. So I spent the last few months building SafeVision — a real-time, CPU-optimized image moderation API that runs in under 200ms on a basic VPS.



Here is the exact architecture and optimization stack I used to make it happen.









The Architecture: Object Detection + Scene Classification



To avoid false positives, a single model isn't enough. We implemented a dual-model consensus engine:





  1. YOLOv8 Object Detector (Hawk Model): Specialized in identifying specific threat objects like weapons, blades, and blood. It returns precise bounding boxes.


  2. EfficientNet Classifier: Evaluates the overall scene context (NSFW, violence, gore). This prevents a medical surgery image from being flagged as a crime scene.


  3. Decision Engine: Merges results from both models based on dynamic threshold rules to make the final "allow" or "block" decision.









The Optimization: Porting to ONNX Runtime



Running PyTorch models on standard CPU servers usually results in terrible latency (often >1.5 seconds per image). To optimize the engine, we did the following:





  • ONNX Conversion: We converted our trained YOLOv8 and CNN models to ONNX format.


  • CPU Execution Provider: By using ONNX Runtime optimized for CPU execution, we reduced memory footprint by 70% and cut inference time down to 150ms - 200ms.


  • Lazy Loading & Caching: Weights are loaded into memory once on startup and cached, avoiding filesystem I/O overhead on incoming requests.









The API and Client-Side Blurring



We built the backend using FastAPI due to its asynchronous performance. Instead of doing heavy image manipulation on the server, the API returns the bounding boxes of the flagged objects:




{
"safe": false,
"categories": [
{
"type": "weapon",
"confidence": 0.94,
"box": {
"x": 120,
"y": 80,
"width": 250,
"height": 180
}
}
],
"latency_ms": 180
}












Give it a try!



I have just launched SafeVision on Product Hunt and opened a free Developer Sandbox (1,000 monthly scans).



Check the live demo here: SafeVision



Product Hunt Launch: If you want to support a solo developer building open-alternatives, check us out on Product Hunt: Product Hunt



I would love to hear your feedback on the API latency or how we can optimize ONNX inference even further!

1. Sofort-Triage & Abwehrmaßnahmen

SOC Incident Playbook: Vulnerability Remediation & Verification
Syntax validiert (0 Fehler)
title: Detect Exploitation - How We Built a 200ms Image Moderation API on Cheap CPUs Using YOLOv8 and ONNX
id: 03d3edac-f072-4491-8b6e-b0232a489263
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-25
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
Syntax validiert (0 Fehler)
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-25"
        description = "YARA Signature for "
    strings:
        $str = "How We Built a 200ms Image Mod" ascii wide
    condition:
        any of them
}
Syntax validiert (0 Fehler)
index=security sourcetype IN ("cisco:asa", "pan:traffic", "zeek_conn", "suricata", "WinEventLog:Security")
("How We Built a 200ms Image Moderation AP")
| stats count earliest(_time) as first_seen latest(_time) as last_seen by src_ip, dest_ip, dest_host, signature
| eval first_seen=strftime(first_seen, "%Y-%m-%d %H:%M:%S"), last_seen=strftime(last_seen, "%Y-%m-%d %H:%M:%S")
| sort - count
Syntax validiert (0 Fehler)
message: "*How We Built a 200ms Image Moderation AP*"
Syntax validiert (0 Fehler)
CommonSecurityLog
| where Message has "How We Built a 200ms Image Moderation AP"
| summarize EventCount = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by SourceIP, DestinationIP, DestinationPort, Activity
| extend DetectionRule = "iShareStuff-CTI-Compiled"
| sort by EventCount desc

2. Cyber Threat Intelligence & Forensik

CTI Threat Relationship Graph2 Knoten / 1 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
🎯
MITRE ATT&CK Matrix Navigator 14 Taktiken
Reconnaissance
-
Resource Development
-
Initial Access
Execution
Persistence
-
Privilege Escalation
Defense Evasion
Credential Access
-
Discovery
-
Lateral Movement
-
Collection
-
Command and Control
Exfiltration
-
Impact
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich How We Built a 200ms Image Moderation AP.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

⚡ Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten How We Built a 200ms Image Moderation API on Cheap CPUs Using YOLOv8 and ONNX

Thematisch verwandte Begriffe: Built, 200ms, Image, Moderation · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-97898 | Insecure Direct Object Reference / missing object-level authorization in…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag