> 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-hi/computer-vision/yolov8-detection.md).

# YOLOv8 Detection

Ultralytics YOLOv8 और YOLOv11 के साथ वास्तविक समय ऑब्जेक्ट डिटेक्शन चलाएँ।

{% hint style="success" %}
सभी उदाहरण GPU सर्वरों पर चलाए जा सकते हैं जिन्हें द्वारा किराए पर लिया गया है [CLORE.AI मार्केटप्लेस](https://clore.ai/marketplace).
{% endhint %}

{% hint style="info" %}
**अपडेट: YOLOv11 (2025) — 22% तेज़**

YOLOv11 अब उसी के माध्यम से उपलब्ध है `ultralytics` पैकेज। यह प्रदान करता है **22% तेज़ इंफ़रेंस** और YOLOv8 की तुलना में बेहतर mAP, वही सरल API के साथ। नई विशेषताओं में Oriented Bounding Box (OBB) डिटेक्शन शामिल है। अपग्रेड करने के लिए चलाएँ `pip install -U ultralytics`.
{% endhint %}

## CLORE.AI पर किराये पर लेना

1. पर जाएँ [CLORE.AI मार्केटप्लेस](https://clore.ai/marketplace)
2. GPU प्रकार, VRAM, और मूल्य के अनुसार फ़िल्टर करें
3. चुनें **ऑन-डिमांड** (निश्चित दर) या **स्पॉट** (बिड प्राइस)
4. अपना ऑर्डर कॉन्फ़िगर करें:
   * Docker इमेज चुनें
   * पोर्ट सेट करें (SSH के लिए TCP, वेब UI के लिए HTTP)
   * यदि आवश्यक हो तो एनवायरनमेंट वेरिएबल जोड़ें
   * स्टार्टअप कमांड दर्ज करें
5. भुगतान चुनें: **CLORE**, **BTC**, या **USDT/USDC**
6. ऑर्डर बनाएं और डिप्लॉयमेंट का इंतज़ार करें

### अपने सर्वर तक पहुँचें

* कनेक्शन विवरण में खोजें **मेरे ऑर्डर**
* वेब इंटरफेस: HTTP पोर्ट URL का उपयोग करें
* SSH: `ssh -p <port> root@<proxy-address>`

## YOLOv8 क्या है?

YOLOv8 एक उच्च-प्रदर्शन YOLO मॉडल है जो प्रदान करता है:

* ऑब्जेक्ट डिटेक्शन
* इंसटेंस सेगमेंटेशन
* पोज़ एस्टिमेशन
* इमेज क्लासिफिकेशन
* ऑब्जेक्ट ट्रैकिंग

## YOLOv11 क्या है?

YOLOv11 (2025) नवीनतम पीढ़ी है, जो जोड़ती है:

* **22% तेज़ इंफ़रेंस** YOLOv8 के मुकाबले
* सभी मॉडल साइज़ में उच्चतर mAP
* **Oriented Bounding Box (OBB)** डिटेक्शन — नई कार्यक्षमता
* सुधरी आर्किटेक्चर (C3k2 ब्लॉक्स, SPPF, C2PSA)
* समान `ultralytics` पैकेज, ड्रॉप-इन प्रतिस्थापन

### समर्थित कार्य (YOLOv11)

| कार्य      | सफिक्स       | विवरण                                              |
| ---------- | ------------ | -------------------------------------------------- |
| `detect`   | *(कोई नहीं)* | बाउंडिंग बॉक्स के साथ ऑब्जेक्ट डिटेक्शन            |
| `segment`  | `-seg`       | मास्क के साथ इंसटेंस सेगमेंटेशन                    |
| `classify` | `-cls`       | इमेज क्लासिफिकेशन                                  |
| `pose`     | `-pose`      | मानव पोज़ अनुमान                                   |
| `obb`      | `-obb`       | **नया** ओरिएंटेड बाउंडिंग बॉक्स (रोटेटेड डिटेक्शन) |

## मॉडल आकार

### YOLOv8 मॉडल

| मॉडल    | आकार  | mAP  | स्पीड (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 मॉडल

| मॉडल    | आकार  | mAP  | स्पीड (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 बनाम YOLOv11 तुलना

| मेट्रिक               | YOLOv8x | yolo11x | सुधार           |
| --------------------- | ------- | ------- | --------------- |
| पैरामीटर              | 68.2M   | 56.9M   | **-17% छोटे**   |
| mAP50-95 (COCO)       | 53.9    | 54.7    | **+0.8 mAP**    |
| इंफरेंस (RTX 3090)    | \~8ms   | \~6.5ms | **+22% तेज़**   |
| FPS (RTX 3090, 640px) | \~150   | \~183   | **+22% तेज़**   |
| OBB कार्य             | ❌       | ✅       | **v11 में नया** |

## त्वरित तैनाती

**Docker इमेज:**

```
pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime
```

**पोर्ट:**

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

**कमांड (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)
"
```

## अपनी सेवा तक पहुँचना

डिप्लॉयमेंट के बाद, अपना खोजें `http_pub` URL में **मेरे ऑर्डर**:

1. जाएँ **मेरे ऑर्डर** पृष्ठ
2. अपने ऑर्डर पर क्लिक करें
3. खोजें `http_pub` URL (उदा., `abc123.clorecloud.net`)

उपयोग करें `https://YOUR_HTTP_PUB_URL` की बजाय `localhost` नीचे दिए उदाहरणों में।

## इंस्टॉलेशन

```bash
pip install ultralytics
```

दोनों YOLOv8 और YOLOv11 के लिए वही पैकेज। YOLOv11 प्राप्त करने के लिए अपग्रेड करें:

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

## YOLOv11 ऑब्जेक्ट डिटेक्शन

### yolo11m के साथ बुनियादी डिटेक्शन

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

# YOLOv11 मीडियम मॉडल लोड करें
model = YOLO('yolo11m.pt')

# इंफरेंस चलाएँ
results = model('image.jpg')

# परिणाम दिखाएँ
results[0].show()

# परिणाम सहेजें
results[0].save('output.jpg')
```

### डिटेक्शन्स प्राप्त करें

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

for result in results:
    boxes = result.boxes
    for box in boxes:
        # निर्देशांक
        x1, y1, x2, y2 = box.xyxy[0].tolist()

        # विश्वसनीयता
        conf = box.conf[0].item()

        # क्लास
        cls = int(box.cls[0].item())
        name = model.names[cls]

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

### बैच प्रोसेसिंग

```python
from ultralytics import YOLO
import os

model = YOLO('yolo11m.pt')

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

# सभी इमेज प्रोसेस करें
results = model(input_dir, save=True, project=output_dir)
```

## YOLOv11 कार्य

### इंसटेंस सेगमेंटेशन

```python
from ultralytics import YOLO

# YOLOv11 सेगमेंटेशन मॉडल लोड करें
model = YOLO('yolo11m-seg.pt')

results = model('image.jpg')

for result in results:
    masks = result.masks  # सेगमेंटेशन मास्क
    if masks is not None:
        for mask in masks.data:
            # मास्क एक बाइनरी टेन्सर है
            pass
```

### पोज़ अनुमान

```python
from ultralytics import YOLO

# YOLOv11 पोज़ मॉडल लोड करें
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 की-पॉइंट्स: नाक, आँखें, कान, कंधे, कोहनी, कलाइयां, हिप्स, घुटने, टखने
            pass
```

### क्लासिफिकेशन

```python
from ultralytics import YOLO

# YOLOv11 क्लासिफिकेशन मॉडल लोड करें
model = YOLO('yolo11m-cls.pt')

results = model('image.jpg')
for result in results:
    # टॉप-1 क्लास और कॉन्फिडेंस
    top1 = result.probs.top1
    top1conf = result.probs.top1conf.item()
    print(f"Class: {result.names[top1]} ({top1conf:.2f})")
```

### Oriented Bounding Box (OBB) — YOLOv11 में नया

OBB किसी भी रोटेशन एंगल पर ऑब्जेक्ट्स का पता लगाता है — हवाई/उपग्रह इमेजरी, डॉक्यूमेंट स्कैनिंग और टेक्स्ट डिटेक्शन के लिए उपयुक्त।

```python
from ultralytics import YOLO

# YOLOv11 OBB मॉडल लोड करें
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:
            # रोटेटेड बॉक्स: 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} rotated box: {xywhr}")
```

## वीडियो प्रोसेसिंग

### वीडियो प्रोसेस करें

```python
from ultralytics import YOLO

model = YOLO('yolo11m.pt')

# वीडियो प्रोसेस करें
results = model('video.mp4', save=True)
```

### रियल-टाइम वेबकैम

```python
from ultralytics import YOLO
import cv2

model = YOLO('yolo11n.pt')  # रियल-टाइम के लिए नैनो मॉडल का उपयोग करें

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()
```

### प्रोसेस किया गया वीडियो सहेजें

```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()
```

## ऑब्जेक्ट ट्रैकिंग

```python
from ultralytics import YOLO

model = YOLO('yolo11m.pt')

# वीडियो में ऑब्जेक्ट्स को ट्रैक करें
results = model.track('video.mp4', save=True, tracker='bytetrack.yaml')

# ट्रैकिंग IDs तक पहुँचें
for result in results:
    boxes = result.boxes
    if boxes.id is not None:
        track_ids = boxes.id.tolist()
```

## कस्टम ट्रेनिंग

### डेटासेट तैयार करें

```yaml

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

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

### YOLOv11 ट्रेन करें

```python
from ultralytics import YOLO

# प्रीट्रेन्ड YOLOv11 मॉडल लोड करें
model = YOLO('yolo11n.pt')

# ट्रेन
results = model.train(
    data='dataset.yaml',
    epochs=100,
    imgsz=640,
    batch=16,
    device=0
)
```

### ट्रेनिंग आर्ग्युमेंट्स

```python
model.train(
    data='dataset.yaml',
    epochs=100,
    imgsz=640,
    batch=16,
    device=0,
    workers=8,
    patience=50,         # अर्ली स्टॉपिंग
    save=True,
    save_period=10,      # हर N एपोच पर सेव करें
    cache=True,          # इमेजेस को कैश करें
    amp=True,            # मिक्स्ड प्रिसिशन
    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,
)
```

## मॉडल एक्सपोर्ट करें

```python
from ultralytics import YOLO

model = YOLO('yolo11m.pt')

# विभिन्न फॉर्मैट में एक्सपोर्ट करें
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 सर्वर

```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)

    # एनोटेटेड इमेज लौटाएँ
    annotated = results[0].plot()
    # ... कनवर्ट करें और लौटाएँ

# चलाएँ: uvicorn server:app --host 0.0.0.0 --port 8000
```

## प्रदर्शन अनुकूलन

### TensorRT एक्सपोर्ट

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

# एक्सपोर्ट किए गए मॉडल का उपयोग करें
model_trt = YOLO('yolo11m.engine')
results = model_trt('image.jpg')
```

### बैच इंफरेंस

```python

# एक साथ कई इमेज प्रोसेस करें
images = ['img1.jpg', 'img2.jpg', 'img3.jpg', 'img4.jpg']
results = model(images, batch=4)
```

## प्रदर्शन बेंचमार्क

### YOLOv11 FPS (640px इनपुट)

| मॉडल    | 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 इनपुट) — पिछली पीढ़ी

| मॉडल    | GPU      | FPS   |
| ------- | -------- | ----- |
| YOLOv8n | RTX 3090 | \~900 |
| YOLOv8s | RTX 3090 | \~600 |
| YOLOv8m | RTX 3090 | \~300 |
| YOLOv8x | RTX 3090 | \~150 |
| YOLOv8x | RTX 4090 | \~250 |

## समस्याओं का निवारण

### आउट ऑफ मेमोरी

```python

# छोटे मॉडल का उपयोग करें
model = YOLO('yolo11n.pt')

# या इमेज साइज कम करें
results = model('image.jpg', imgsz=320)
```

### धीमा प्रोसेसिंग

* TensorRT एक्सपोर्ट का उपयोग करें
* छोटा मॉडल उपयोग करें (yolo11n या yolo11s)
* इमेज साइज घटाएँ

### कम सटीकता

* बड़ा मॉडल उपयोग करें (yolo11x के बजाय yolo11n)
* कस्टम डेटा पर ट्रेन करें
* इमेज साइज बढ़ाएँ

## लागत अनुमान

सामान्य CLORE.AI मार्केटप्लेस रेट्स (2025 के अनुसार):

| GPU       | घंटात्मक दर | दैनिक दर | 4-घंटे सत्र |
| --------- | ----------- | -------- | ----------- |
| 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     |

*कीमतें प्रदाता और मांग के अनुसार बदलती हैं। जाँच करें* [*CLORE.AI मार्केटप्लेस*](https://clore.ai/marketplace) *वर्तमान दरों के लिए।*

**पैसे बचाएँ:**

* उपयोग करें **स्पॉट** लचीले वर्कलोड के लिए मार्केट (अक्सर 30-50% सस्ता)
* भुगतान करें **CLORE** टोकन के साथ
* विभिन्न प्रदाताओं के बीच कीमतों की तुलना करें

## अगले कदम

* [कुछ भी सेगमेंट करें](/guides/guides_v2-hi/image-processing/segment-anything.md) - उन्नत सेगमेंटेशन
* Detectron2 - अधिक डिटेक्शन विकल्प
* [Real-ESRGAN](/guides/guides_v2-hi/image-processing/real-esrgan-upscaling.md) - डिटेक्ट किए गए ऑब्जेक्ट्स को बढ़ाएँ


---

# 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-hi/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.
