> 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-Detektion

Führen Sie Echtzeit-Objekterkennung mit Ultralytics YOLOv8 und YOLOv11 durch.

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

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

YOLOv11 ist jetzt über dasselbe `ultralytics` Paket verfügbar. Es bietet **22% schnellere Inferenz** und verbesserte mAP gegenüber YOLOv8 bei gleicher einfacher API. Neue Funktionen umfassen die Erkennung von orientierten Begrenzungsrahmen (OBB). Aktualisieren Sie, indem Sie `pip install -U ultralytics`.
{% endhint %}

## Mieten auf CLORE.AI

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

### Zugriff auf Ihren Server

* Verbindungsdetails finden Sie in **Meine Bestellungen**
* Webschnittstellen: Verwenden Sie die HTTP-Port-URL
* SSH: `ssh -p <port> root@<proxy-address>`

## Was ist YOLOv8?

YOLOv8 ist ein leistungsstarkes YOLO-Modell und bietet:

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

## Was ist YOLOv11?

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

* **22% schnellere Inferenz** vs YOLOv8
* Höhere mAP über alle Modellgrößen
* **Erkennung von orientierten Begrenzungsrahmen (OBB)** — neue Aufgabe
* Verbesserte Architektur (C3k2-Blöcke, SPPF, C2PSA)
* Gleiches `ultralytics` Paket, Drop-in-Ersatz

### Unterstützte Aufgaben (YOLOv11)

| Aufgabe    | Suffix     | Beschreibung                                               |
| ---------- | ---------- | ---------------------------------------------------------- |
| `detect`   | *(keines)* | Objekterkennung mit Begrenzungsrahmen                      |
| `segment`  | `-seg`     | Instanzsegmentierung mit Masken                            |
| `classify` | `-cls`     | Bildklassifikation                                         |
| `pose`     | `-pose`    | Schätzung menschlicher Posen                               |
| `obb`      | `-obb`     | **NEU** Orientierte Begrenzungsrahmen (gedrehte Erkennung) |

## Modellgrößen

### YOLOv8-Modelle

| Modell  | Größe | mAP  | Geschwindigkeit (RTX 3090) |
| ------- | ----- | ---- | -------------------------- |
| YOLOv8n | 3.2M  | 37.3 | \~1ms                      |
| YOLOv8s | 11.2M | 44.9 | \~2ms                      |
| YOLOv8m | 25.9M | 50.2 | \~4ms                      |
| YOLOv8l | 43.7M | 52.9 | \~6ms                      |
| YOLOv8x | 68.2M | 53.9 | \~8ms                      |

### YOLOv11-Modelle

| Modell  | Größe | mAP  | Geschwindigkeit (RTX 3090) |
| ------- | ----- | ---- | -------------------------- |
| yolo11n | 2.6M  | 39.5 | \~0.8ms                    |
| yolo11s | 9.4M  | 47.0 | \~1.5ms                    |
| yolo11m | 20.1M | 51.5 | \~3.2ms                    |
| yolo11l | 25.3M | 53.4 | \~4.7ms                    |
| yolo11x | 56.9M | 54.7 | \~6.5ms                    |

### YOLOv8 vs YOLOv11 Vergleich

| Metrik                | YOLOv8x | yolo11x | Verbesserung       |
| --------------------- | ------- | ------- | ------------------ |
| Parameter             | 68.2M   | 56.9M   | **-17% kleiner**   |
| mAP50-95 (COCO)       | 53.9    | 54.7    | **+0.8 mAP**       |
| Inferenz (RTX 3090)   | \~8ms   | \~6.5ms | **+22% schneller** |
| FPS (RTX 3090, 640px) | \~150   | \~183   | **+22% schneller** |
| OBB-Aufgabe           | ❌       | ✅       | **Neu in v11**     |

## Schnelle Bereitstellung

**Docker-Image:**

```
pytorch/pytorch:2.5.1-cuda12.4-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 Detection')
demo.launch(server_name='0.0.0.0', server_port=7860)
"
```

## Zugriff auf Ihren Dienst

Nach der Bereitstellung finden Sie Ihre `http_pub` URL in **Meine Bestellungen**:

1. Gehen Sie zur **Meine Bestellungen** Seite
2. Klicken Sie auf Ihre Bestellung
3. Finden Sie die `http_pub` URL (z. B., `abc123.clorecloud.net`)

Verwenden Sie `https://IHRE_HTTP_PUB_URL` anstelle von `localhost` in den Beispielen unten.

## Installation

```bash
pip install ultralytics
```

Dasselbe Paket für YOLOv8 und YOLOv11. Aktualisieren Sie, um YOLOv11 zu erhalten:

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

## YOLOv11 Objekterkennung

### Grundlegende Erkennung mit yolo11m

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

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

# Inferenz ausführen
results = model('image.jpg')

# Ergebnisse anzeigen
results[0].show()

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

### Erhalte Detektionen

```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} at ({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)

# Verarbeite alle Bilder
results = model(input_dir, save=True, project=output_dir)
```

## YOLOv11 Aufgaben

### Instanzsegmentierung

```python
from ultralytics import YOLO

# YOLOv11 Segmentierungsmodell laden
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:
            # mask ist ein binärer Tensor
            pass
```

### Pose-Schätzung

```python
from ultralytics import YOLO

# YOLOv11 Pose-Modell laden
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
```

### Klassifikation

```python
from ultralytics import YOLO

# YOLOv11 Klassifikationsmodell laden
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"Class: {result.names[top1]} ({top1conf:.2f})")
```

### Orientierte Begrenzungsrahmen (OBB) — NEU in YOLOv11

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

```python
from ultralytics import YOLO

# YOLOv11 OBB-Modell laden
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, Breite, Höhe, Winkel
            xywhr = box.xywhr[0].tolist()
            conf = box.conf[0].item()
            cls = int(box.cls[0].item())
            print(f"{result.names[cls]}: {conf:.2f} rotated box: {xywhr}")
```

## Videobearbeitung

### Video verarbeiten

```python
from ultralytics import YOLO

model = YOLO('yolo11m.pt')

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

### Echtzeit-Webcam

```python
from ultralytics import YOLO
import cv2

model = YOLO('yolo11n.pt')  # Verwenden Sie 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()
```

### Verarbeitetes Video 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')

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

# Zugreifen auf Tracking-IDs
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

# Vorgefertigtes 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 Genauigkeit
    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)

    # Annotiertes 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 gleichzeitig verarbeiten
images = ['img1.jpg', 'img2.jpg', 'img3.jpg', 'img4.jpg']
results = model(images, batch=4)
```

## Leistungsbenchmarks

### 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

### Nicht genügend Arbeitsspeicher

```python

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

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

### Langsame Verarbeitung

* Verwenden Sie TensorRT-Export
* Verwenden Sie ein kleineres Modell (yolo11n oder yolo11s)
* Bildgröße reduzieren

### Geringe Genauigkeit

* Verwenden Sie ein größeres Modell (yolo11x statt yolo11n)
* Auf eigenen Daten trainieren
* Bildgröße erhöhen

## Kostenabschätzung

Typische CLORE.AI Marketplace-Preise (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           |

*Preise variieren je nach Anbieter und Nachfrage. Prüfen Sie* [*CLORE.AI Marketplace*](https://clore.ai/marketplace) *auf aktuelle Preise.*

**Geld sparen:**

* Verwenden Sie **Spot** Markt für flexible Workloads (oft 30–50% günstiger)
* Bezahlen mit **CLORE** Token
* Preise bei verschiedenen Anbietern vergleichen

## Nächste Schritte

* [Segmentiere alles](/guides/guides_v2-de/bildverarbeitung/segment-anything.md) - Erweiterte Segmentierung
* Detectron2 - Mehr Erkennungsoptionen
* [Real-ESRGAN](/guides/guides_v2-de/bildverarbeitung/real-esrgan-upscaling.md) - Erkennte 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:

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

The question should be specific, self-contained, and written in natural language.
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.
