# Luxonis OAK

The [Luxonis OAK (OpenCV AI Kit)](https://shop.luxonis.com/) एक edge device है जिसका उपयोग embedded computer vision systems की deployment के लिए लोकप्रिय रूप से किया जाता है।

OAK devices को एक host machine के साथ pair किया जाता है जो downstream application के संचालन को चलाती है। कुछ रोचक प्रेरणा के लिए, देखें [Luxonis के use cases](https://docs.luxonis.com/en/latest/#example-use-cases) और [Roboflow के case studies](https://blog.roboflow.com/tag/case-studies/).

**वैसे:** यदि आपके पास अभी तक आपका OAK device नहीं है, तो आप [Roboflow Store के माध्यम से एक खरीद सकते हैं](https://store.roboflow.com/) 10% discount पाने के लिए।

### Task Support

निम्नलिखित task types hosted API द्वारा supported हैं:

| Task Type                                                                                                                                                                       | Supported by Luxonis OAK Deployment |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
| <p>Object Detection:</p><ul><li>YOLOv8 models, जो Roboflow पर trained हैं (सभी sizes: Nano, Small, Medium, Large, X Large)</li><li>Roboflow पर trained YOLOv11 models</li></ul> | ✅                                   |
| Classification                                                                                                                                                                  |                                     |
| Instance Segmentation                                                                                                                                                           |                                     |
| Semantic Segmentation                                                                                                                                                           |                                     |

### Luxonis OAK पर एक Model Deploy करें

#### Supported Luxonis Devices and Host Requirements

Roboflow Inference Server निम्नलिखित devices को support करता है:

* OAK-D
* OAK-D-Lite
* OAK-D-POE
* OAK-1 (no depth)

#### Installation

इंस्टॉल करें `roboflowoak`, `depthai`, और `opencv-python` packages:

```python
pip install roboflowoak
pip install depthai
pip install opencv-python
```

अब आप `roboflowoak` package का उपयोग करके अपना custom trained Roboflow model चला सकते हैं।

#### Running Inference: Deployment

यदि आप Depth capabilities के बिना किसी OAK device पर deploy कर रहे हैं, तो सेट करें `depth=False` जब आप `rf` object को instantiate (create) कर रहे हों। Depth वाले OAK के model name के साथ "D" जुड़ा होता है, जैसे OAK-D और OAK-D-Lite।

साथ ही, comment out करें `max_depth = np.amax(depth)` और `cv2.imshow("depth", depth/max_depth)`

```python
from roboflowoak import RoboflowOak
import cv2
import time
import numpy as np

if __name__ == '__main__':
    # RoboflowOak module के साथ एक object (rf) को instantiate कर रहे हैं
    rf = RoboflowOak(model="YOUR-MODEL-ID", confidence=0.05, overlap=0.5,
    version="YOUR-MODEL-VERSION-#", api_key="YOUR-PRIVATE_API_KEY", rgb=True,
    depth=True, device=None, blocking=True)
    # अपना model चला रहे हैं और detections के साथ video output दिखा रहे हैं
    while True:
        t0 = time.time()
        # rf.detect() function model inference चलाता है
        result, frame, raw_frame, depth = rf.detect()
        predictions = result["predictions"]
        #{
        #    predictions:
        #    [ {
        #        x: (middle),
        #        y:(middle),
        #        width:
        #        height:
        #        depth: ###->
        #        confidence:
        #        class:
        #        mask: {
        #    ]
        #}
        #frame - preprocs के बाद frame, predictions के साथ
        #raw_frame - आपके OAK से original frame
        #depth - raw_frame के लिए depth map, center camera के लिए center-rectified
        
        # timing: benchmarking purposes के लिए
        t = time.time()-t0
        print("FPS ", 1/t)
        print("PREDICTIONS ", [p.json() for p in predictions])

        # depth calculation के लिए parameters सेट करना
        # यदि आप Depth के बिना OAK उपयोग कर रहे हैं, तो निम्नलिखित 2 lines को comment out करें
        max_depth = np.amax(depth)
        cv2.imshow("depth", depth/max_depth)
        # video feed को successive frames के रूप में display करना
        cv2.imshow("frame", frame)
    
        # OAK inference window को कैसे बंद करें / inference रोकें: CTRL+q या CTRL+c
        if cv2.waitKey(1) == ord('q'):
            break
```

नीचे दिया गया code दर्ज करें (placeholder text को अपनी Python script के path से बदलने के बाद)

```python
# window बंद करने के लिए (interrupt या end inference), अपने keyboard पर CTRL+c दर्ज करें
python3 /path/to/[YOUR-PYTHON-FILE].py
```

Apple Macbook Air (M1) को host device के रूप में उपयोग करने पर inference speed (milliseconds में) औसतन लगभग 15 ms, या 66 FPS थी। ***Note**: OAK के साथ उपयोग किए गए host device का FPS पर बहुत बड़ा प्रभाव पड़ेगा। अपना system बनाते समय इसे ध्यान में रखें।*

#### Troubleshooting

यदि आपको अपना OAK device सेट अप करने में समस्याएँ आ रही हैं, तो Luxonis के installation instructions देखें और सुनिश्चित करें कि आप RGB example को सफलतापूर्वक चला सकते हैं [Luxonis installation](https://docs.luxonis.com/en/latest/#demo-script). आप सहायता के लिए यहां भी पोस्ट कर सकते हैं [Roboflow Forum](https://discuss.roboflow.com/).

### See Also

* [Step-by-step Luxonis OAK setup guide](https://blog.roboflow.com/opencv-ai-kit-deployment/)
* [M1 Chip का उपयोग करते समय installation issue · Issue #299 · luxonis/depthai · GitHub](https://github.com/luxonis/depthai/issues/299) (depthai SDK)


---

# Agent Instructions: 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.roboflow.com/roboflow/roboflow-hi/deploy/sdks/luxonis-oak.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.
