> For the complete documentation index, see [llms.txt](https://docs.clore.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clore.ai/guides/guides_v2-de/computer-vision/yolov8-detection.md).

# YOLOv8-Erkennung

Echtzeit-Objekterkennung mit YOLOv8 und YOLOv11 auf Clore.ai

Führe Objekterkennung in Echtzeit mit Ultralytics YOLOv8 und YOLOv11 aus.

{% hint style="success" %}
Alle Beispiele können auf GPU-Servern ausgeführt werden, die gemietet wurden über [CLORE.AI-Marktplatz](https://clore.ai/marketplace).
{% endhint %}

{% hint style="info" %}
**Update: YOLOv11 (2025) — 22 % schneller**

YOLOv11 ist jetzt über dasselbe `ultralytics` Paket verfügbar. Es liefert **22 % schnellere Inferenz** und eine verbesserte mAP gegenüber YOLOv8, mit derselben einfachen API. Zu den neuen Funktionen gehört die Erkennung orientierter Bounding Boxes (OBB). Aktualisiere mit `pip install -U ultralytics`.
{% endhint %}

## Mieten auf CLORE.AI

1. Besuchen [CLORE.AI-Marktplatz](https://clore.ai/marketplace)
2. Filtern nach GPU-Typ, VRAM und Preis
3. Wähle **On-Demand** (Festpreis) oder **Spot** (Gebotspreis)
4. Konfiguriere deine Bestellung:
   * Docker-Image auswählen
   * Ports festlegen (TCP für SSH, HTTP für Web-UIs)
   * Bei Bedarf Umgebungsvariablen hinzufügen
   * Startbefehl eingeben
5. Zahlung auswählen: **CLORE**, **BTC**, oder **USDT/USDC**
6. Bestellung erstellen und auf die Bereitstellung warten

### Greife auf deinen Server zu

* Verbindungsdetails finden in **Meine Bestellungen**
* Web-Oberflächen: Verwende die HTTP-Port-URL
* SSH: `ssh -p <port> root@<proxy-address>`

## Was ist YOLOv8?

YOLOv8 ist ein Hochleistungs-YOLO-Modell mit folgenden Funktionen:

* Objekterkennung
* Instanzsegmentierung
* Pose-Schätzung
* Bildklassifizierung
* Objektverfolgung

## Was ist YOLOv11?

YOLOv11 (2025) ist die neueste Generation und ergänzt:

* **22 % schnellere Inferenz** gegenüber YOLOv8
* Höhere mAP über alle Modellgrößen hinweg
* **Orientierte Bounding Box (OBB)** Erkennung — neue Aufgabe
* Verbesserte Architektur (C3k2-Blöcke, SPPF, C2PSA)
* Dasselbe `ultralytics` Paket, Drop-in-Ersatz

### Unterstützte Aufgaben (YOLOv11)

| Aufgabe    | Suffix    | Beschreibung                                            |
| ---------- | --------- | ------------------------------------------------------- |
| `detect`   | *(keins)* | Objekterkennung mit Bounding Boxes                      |
| `segment`  | `-seg`    | Instanzsegmentierung mit Masken                         |
| `classify` | `-cls`    | Bildklassifizierung                                     |
| `pose`     | `-pose`   | Menschliche Pose-Schätzung                              |
| `obb`      | `-obb`    | **NEU** Orientierte Bounding Boxes (gedrehte Erkennung) |

## Modellgrößen

### YOLOv8-Modelle

| Modell  | Größe     | mAP  | Geschwindigkeit (RTX 3090) |
| ------- | --------- | ---- | -------------------------- |
| YOLOv8n | 3,2 Mio.  | 37.3 | \~1 ms                     |
| YOLOv8s | 11,2 Mio. | 44.9 | \~2 ms                     |
| YOLOv8m | 25,9 Mio. | 50.2 | \~4 ms                     |
| YOLOv8l | 43,7 Mio. | 52.9 | \~6 ms                     |
| YOLOv8x | 68,2 Mio. | 53.9 | \~8 ms                     |

### YOLOv11-Modelle

| Modell  | Größe     | mAP  | Geschwindigkeit (RTX 3090) |
| ------- | --------- | ---- | -------------------------- |
| yolo11n | 2,6 Mio.  | 39.5 | \~0,8 ms                   |
| yolo11s | 9,4 Mio.  | 47.0 | \~1,5 ms                   |
| yolo11m | 20,1 Mio. | 51.5 | \~3,2 ms                   |
| yolo11l | 25,3 Mio. | 53.4 | \~4,7 ms                   |
| yolo11x | 56,9 Mio. | 54.7 | \~6,5 ms                   |

### Vergleich YOLOv8 vs. YOLOv11

| Kennzahl               | YOLOv8x   | yolo11x   | Verbesserung        |
| ---------------------- | --------- | --------- | ------------------- |
| Parameter              | 68,2 Mio. | 56,9 Mio. | **-17 % kleiner**   |
| mAP50-95 (COCO)        | 53.9      | 54.7      | **+0,8 mAP**        |
| Inferenz (RTX 3090)    | \~8 ms    | \~6,5 ms  | **+22 % schneller** |
| FPS (RTX 3090, 640 px) | \~150     | \~183     | **+22 % schneller** |
| OBB-Aufgabe            | ❌         | ✅         | **Neu in v11**      |

## Schnelle Bereitstellung

**Docker-Image:**

```
pytorch/pytorch:2.11.0-cuda12.8-cudnn9-runtime
```

**Ports:**

```
22/tcp
7860/http
```

**Befehl (YOLOv11):**

```bash
pip install ultralytics gradio && \\
python -c "
import gradio as gr
from ultralytics import YOLO
from PIL import Image

model = YOLO('yolo11m.pt')

def detect(image):
    results = model(image)
    return Image.fromarray(results[0].plot())

demo = gr.Interface(fn=detect, inputs=gr.Image(type='pil'), outputs=gr.Image(), title='YOLOv11-Erkennung')
demo.launch(server_name='0.0.0.0', server_port=7860)
"
```

## Auf deinen Dienst zugreifen

Nach der Bereitstellung findest du deine `http_pub` URL in **Meine Bestellungen**:

1. Gehe zu **Meine Bestellungen** Seite
2. Klicke auf deine Bestellung
3. Finde die `http_pub` URL (z. B. `abc123.clorecloud.net`)

Verwende `https://YOUR_HTTP_PUB_URL` anstelle von `localhost` in den folgenden Beispielen.

## Installation

```bash
pip install ultralytics
```

Dasselbe Paket für sowohl YOLOv8 als auch YOLOv11. Upgraden, um YOLOv11 zu erhalten:

```bash
pip install -U ultralytics
```

## YOLOv11-Objekterkennung

### Grundlegende Erkennung mit yolo11m

```python
from ultralytics import YOLO
from PIL import Image

# Lade das YOLOv11-Medium-Modell
model = YOLO('yolo11m.pt')

# Führe Inferenz aus
results = model('image.jpg')

# Ergebnisse anzeigen
results[0].show()

# Ergebnisse speichern
results[0].save('output.jpg')
```

### Erkennungen abrufen

```python
results = model('image.jpg')

for result in results:
    boxes = result.boxes
    for box in boxes:
        # Koordinaten
        x1, y1, x2, y2 = box.xyxy[0].tolist()

        # Konfidenz
        conf = box.conf[0].item()

        # Klasse
        cls = int(box.cls[0].item())
        name = model.names[cls]

        print(f"{name}: {conf:.2f} bei ({x1:.0f}, {y1:.0f}, {x2:.0f}, {y2:.0f})")
```

### Batch-Verarbeitung

```python
from ultralytics import YOLO
import os

model = YOLO('yolo11m.pt')

input_dir = './images'
output_dir = './detected'
os.makedirs(output_dir, exist_ok=True)

# Alle Bilder verarbeiten
results = model(input_dir, save=True, project=output_dir)
```

## YOLOv11-Aufgaben

### Instanzsegmentierung

```python
from ultralytics import YOLO

# Lade das YOLOv11-Segmentierungsmodell
model = YOLO('yolo11m-seg.pt')

results = model('image.jpg')

for result in results:
    masks = result.masks  # Segmentierungsmasken
    if masks is not None:
        for mask in masks.data:
            # Maske ist ein binärer Tensor
            pass
```

### Pose-Schätzung

```python
from ultralytics import YOLO

# Lade das YOLOv11-Pose-Modell
model = YOLO('yolo11m-pose.pt')

results = model('image.jpg')

for result in results:
    keypoints = result.keypoints
    if keypoints is not None:
        for kp in keypoints.data:
            # 17 Keypoints: Nase, Augen, Ohren, Schultern, Ellbogen, Handgelenke, Hüften, Knie, Knöchel
            pass
```

### Klassifizierung

```python
from ultralytics import YOLO

# Lade das YOLOv11-Klassifizierungsmodell
model = YOLO('yolo11m-cls.pt')

results = model('image.jpg')
for result in results:
    # Top-1-Klasse und Konfidenz
    top1 = result.probs.top1
    top1conf = result.probs.top1conf.item()
    print(f"Klasse: {result.names[top1]} ({top1conf:.2f})")
```

### Orientierte Bounding Box (OBB) — NEU in YOLOv11

OBB erkennt Objekte bei beliebigem Rotationswinkel — perfekt für Luft-/Satellitenbilder, Dokumentenscans und Texterkennung.

```python
from ultralytics import YOLO

# Lade das YOLOv11-OBB-Modell
model = YOLO('yolo11m-obb.pt')

results = model('aerial_image.jpg')

for result in results:
    obb = result.obb
    if obb is not None:
        for box in obb:
            # Gedrehte Box: x_center, y_center, width, height, angle
            xywhr = box.xywhr[0].tolist()
            conf = box.conf[0].item()
            cls = int(box.cls[0].item())
            print(f"{result.names[cls]}: {conf:.2f} gedrehte Box: {xywhr}")
```

## Videoverarbeitung

### Video verarbeiten

```python
from ultralytics import YOLO

model = YOLO('yolo11m.pt')

# Video verarbeiten
results = model('video.mp4', save=True)
```

### Webcam in Echtzeit

```python
from ultralytics import YOLO
import cv2

model = YOLO('yolo11n.pt')  # Verwende das Nano-Modell für Echtzeit

cap = cv2.VideoCapture(0)

while True:
    ret, frame = cap.read()
    if not ret:
        break

    results = model(frame)
    annotated = results[0].plot()

    cv2.imshow('YOLOv11', annotated)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()
```

### Verarbeiteten Videostream speichern

```python
from ultralytics import YOLO
import cv2

model = YOLO('yolo11m.pt')

cap = cv2.VideoCapture('input.mp4')
fps = cap.get(cv2.CAP_PROP_FPS)
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))

out = cv2.VideoWriter('output.mp4', cv2.VideoWriter_fourcc(*'mp4v'), fps, (width, height))

while cap.isOpened():
    ret, frame = cap.read()
    if not ret:
        break

    results = model(frame)
    annotated = results[0].plot()
    out.write(annotated)

cap.release()
out.release()
```

## Objektverfolgung

```python
from ultralytics import YOLO

model = YOLO('yolo11m.pt')

# Objekte im Video verfolgen
results = model.track('video.mp4', save=True, tracker='bytetrack.yaml')

# Tracking-IDs abrufen
for result in results:
    boxes = result.boxes
    if boxes.id is not None:
        track_ids = boxes.id.tolist()
```

## Benutzerdefiniertes Training

### Datensatz vorbereiten

```yaml

# dataset.yaml
path: /workspace/dataset
train: images/train
val: images/val

names:
  0: cat
  1: dog
  2: bird
```

### YOLOv11 trainieren

```python
from ultralytics import YOLO

# Vorgetrainiertes YOLOv11-Modell laden
model = YOLO('yolo11n.pt')

# Trainieren
results = model.train(
    data='dataset.yaml',
    epochs=100,
    imgsz=640,
    batch=16,
    device=0
)
```

### Trainingsargumente

```python
model.train(
    data='dataset.yaml',
    epochs=100,
    imgsz=640,
    batch=16,
    device=0,
    workers=8,
    patience=50,         # Frühes Stoppen
    save=True,
    save_period=10,      # Alle N Epochen speichern
    cache=True,          # Bilder zwischenspeichern
    amp=True,            # Gemischte Präzision
    lr0=0.01,
    lrf=0.01,
    momentum=0.937,
    weight_decay=0.0005,
    warmup_epochs=3.0,
    box=7.5,
    cls=0.5,
    dfl=1.5,
    augment=True,
    hsv_h=0.015,
    hsv_s=0.7,
    hsv_v=0.4,
    flipud=0.0,
    fliplr=0.5,
    mosaic=1.0,
    mixup=0.0,
)
```

## Modell exportieren

```python
from ultralytics import YOLO

model = YOLO('yolo11m.pt')

# In verschiedene Formate exportieren
model.export(format='onnx')           # ONNX
model.export(format='tensorrt')       # TensorRT
model.export(format='openvino')       # OpenVINO
model.export(format='coreml')         # CoreML
model.export(format='tflite')         # TensorFlow Lite
```

## API-Server

```python
from fastapi import FastAPI, UploadFile
from fastapi.responses import JSONResponse
from ultralytics import YOLO
from PIL import Image
import io

app = FastAPI()
model = YOLO('yolo11m.pt')

@app.post("/detect")
async def detect(file: UploadFile):
    contents = await file.read()
    image = Image.open(io.BytesIO(contents))

    results = model(image)

    detections = []
    for box in results[0].boxes:
        detections.append({
            "class": model.names[int(box.cls[0])],
            "confidence": float(box.conf[0]),
            "bbox": box.xyxy[0].tolist()
        })

    return JSONResponse(content={"detections": detections})

@app.post("/segment")
async def segment(file: UploadFile):
    contents = await file.read()
    image = Image.open(io.BytesIO(contents))

    model_seg = YOLO('yolo11m-seg.pt')
    results = model_seg(image)

    # Kommentiertes Bild zurückgeben
    annotated = results[0].plot()
    # ... konvertieren und zurückgeben

# Ausführen: uvicorn server:app --host 0.0.0.0 --port 8000
```

## Leistungsoptimierung

### TensorRT-Export

```python
model = YOLO('yolo11m.pt')
model.export(format='tensorrt', half=True)

# Exportiertes Modell verwenden
model_trt = YOLO('yolo11m.engine')
results = model_trt('image.jpg')
```

### Batch-Inferenz

```python

# Mehrere Bilder auf einmal verarbeiten
images = ['img1.jpg', 'img2.jpg', 'img3.jpg', 'img4.jpg']
results = model(images, batch=4)
```

## Leistungs-Benchmarks

### YOLOv11 FPS (640px Eingabe)

| Modell  | GPU      | FPS    |
| ------- | -------- | ------ |
| yolo11n | RTX 3090 | \~1100 |
| yolo11s | RTX 3090 | \~730  |
| yolo11m | RTX 3090 | \~370  |
| yolo11x | RTX 3090 | \~183  |
| yolo11x | RTX 4090 | \~305  |

### YOLOv8 FPS (640px Eingabe) — Vorherige Generation

| Modell  | GPU      | FPS   |
| ------- | -------- | ----- |
| YOLOv8n | RTX 3090 | \~900 |
| YOLOv8s | RTX 3090 | \~600 |
| YOLOv8m | RTX 3090 | \~300 |
| YOLOv8x | RTX 3090 | \~150 |
| YOLOv8x | RTX 4090 | \~250 |

## Fehlerbehebung

### Speicher erschöpft

```python

# Kleinere Modell verwenden
model = YOLO('yolo11n.pt')

# Oder die Bildgröße verringern
results = model('image.jpg', imgsz=320)
```

### Langsame Verarbeitung

* TensorRT-Export verwenden
* Kleineres Modell verwenden (yolo11n oder yolo11s)
* Bildgröße verringern

### Geringe Genauigkeit

* Größeres Modell verwenden (yolo11x statt yolo11n)
* Auf benutzerspezifischen Daten trainieren
* Bildgröße erhöhen

## Kostenschätzung

Typische CLORE.AI-Marktplatzpreise (Stand 2025):

| GPU       | Stundensatz | Tagessatz | 4-Stunden-Sitzung |
| --------- | ----------- | --------- | ----------------- |
| RTX 3060  | \~$0.03     | \~$0.70   | \~$0.12           |
| RTX 3090  | \~$0.06     | \~$1.50   | \~$0.25           |
| RTX 4090  | \~$0.10     | \~$2.30   | \~$0.40           |
| A100 40GB | \~$0.17     | \~$4.00   | \~$0.70           |
| A100 80GB | \~$0.25     | \~$6.00   | \~$1.00           |

*Die Preise variieren je nach Anbieter und Nachfrage. Prüfen Sie* [*CLORE.AI-Marktplatz*](https://clore.ai/marketplace) *für aktuelle Preise.*

**Geld sparen:**

* Nutzen Sie den **Spot** Markt für unterbrechbare Arbeit — etwa ein Drittel der Server bietet Spot-Preise unter dem On-Demand-Preis (Median ca. 13 % Rabatt), der Rest ist gleichauf
* Bezahlen Sie mit **CLORE** Tokens
* Vergleichen Sie Preise zwischen verschiedenen Anbietern

## Nächste Schritte

* [Segment Anything](/guides/guides_v2-de/bildverarbeitung/segment-anything.md) - Fortgeschrittene Segmentierung
* Detectron2 - Weitere Detektionsoptionen
* [Real-ESRGAN](/guides/guides_v2-de/bildverarbeitung/real-esrgan-upscaling.md) - Erkannte Objekte verbessern


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.clore.ai/guides/guides_v2-de/computer-vision/yolov8-detection.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
