> ## Documentation Index
> Fetch the complete documentation index at: https://rtsp-human-capture.docs.itsyourap.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# GPU Acceleration

> Enable CUDA GPU support for 5-10x faster person detection inference

## Overview

GPU acceleration using NVIDIA CUDA dramatically improves inference performance:

* **CPU inference:** \~100-300ms per frame (YOLOv4)
* **GPU inference:** \~10-30ms per frame (YOLOv4)
* **Speedup:** 5-10x faster

<Note>
  GPU acceleration is automatic when CUDA is available. No code changes required.
</Note>

## Benefits of GPU Acceleration

<CardGroup cols={2}>
  <Card title="Faster Detection" icon="bolt">
    10x speedup means more frequent detection or processing more streams.
  </Card>

  <Card title="Lower frame_skip" icon="forward">
    Process every 5-10 frames instead of every 30 frames.
  </Card>

  <Card title="More Streams" icon="grid">
    Handle 12-16 cameras instead of 4-8 with acceptable performance.
  </Card>

  <Card title="Better Responsiveness" icon="gauge-high">
    Detect persons entering frame within 0.5 seconds instead of 2-3 seconds.
  </Card>
</CardGroup>

## How GPU Detection Works

RTSP Human Capture automatically detects and uses CUDA GPUs:

### GPU Detection Logic

From `person_detector.py:62-72`:

```python theme={null}
# Try to use NVIDIA GPU via CUDA backend
if self.net is not None:
    cuda_available = cv2.cuda.getCudaEnabledDeviceCount() > 0
    if cuda_available:
        print("CUDA available, using GPU for inference")
        self.net.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA)
        self.net.setPreferableTarget(cv2.dnn.DNN_TARGET_CUDA)
    else:
        print("CUDA not available, using CPU for inference")
        self.net.setPreferableBackend(cv2.dnn.DNN_BACKEND_OPENCV)
        self.net.setPreferableTarget(cv2.dnn.DNN_TARGET_CPU)
```

<Steps>
  <Step title="Check CUDA device count">
    ```python theme={null}
    cuda_available = cv2.cuda.getCudaEnabledDeviceCount() > 0
    ```

    Returns number of CUDA-capable GPUs detected by OpenCV.
  </Step>

  <Step title="Configure DNN backend">
    If CUDA available:

    ```python theme={null}
    self.net.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA)
    self.net.setPreferableTarget(cv2.dnn.DNN_TARGET_CUDA)
    ```

    If not:

    ```python theme={null}
    self.net.setPreferableBackend(cv2.dnn.DNN_BACKEND_OPENCV)
    self.net.setPreferableTarget(cv2.dnn.DNN_TARGET_CPU)
    ```
  </Step>

  <Step title="Run inference">
    ```python theme={null}
    self.net.setInput(blob)
    outputs = self.net.forward(self.output_layers)
    ```

    Automatically uses GPU if configured, CPU otherwise.
  </Step>
</Steps>

<Tip>
  **No configuration needed!** If you have CUDA installed and CUDA-enabled OpenCV, GPU acceleration is automatic.
</Tip>

## Requirements

To enable GPU acceleration, you need:

<AccordionGroup>
  <Accordion title="1. NVIDIA GPU" icon="microchip">
    **Compatible GPUs:**

    * NVIDIA GTX 10-series or newer
    * NVIDIA RTX 20/30/40-series
    * NVIDIA Tesla/Quadro data center GPUs
    * Compute Capability 3.5 or higher

    **Check your GPU:**

    ```bash theme={null}
    lspci | grep -i nvidia
    ```

    **Expected output:**

    ```text theme={null}
    01:00.0 VGA compatible controller: NVIDIA Corporation GA106 [GeForce RTX 3060]
    ```
  </Accordion>

  <Accordion title="2. CUDA Toolkit" icon="toolbox">
    **Supported versions:**

    * CUDA 11.2 or newer
    * CUDA 12.x recommended

    **Check CUDA version:**

    ```bash theme={null}
    nvcc --version
    ```

    **Expected output:**

    ```text theme={null}
    nvcc: NVIDIA (R) Cuda compiler driver
    Copyright (c) 2005-2024 NVIDIA Corporation
    Built on Thu_Mar_28_02:18:24_PDT_2024
    Cuda compilation tools, release 12.4, V12.4.131
    ```

    **Install CUDA Toolkit:**

    <Tabs>
      <Tab title="Ubuntu/Debian">
        ```bash theme={null}
        # Add NVIDIA repository
        wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
        sudo dpkg -i cuda-keyring_1.1-1_all.deb
        sudo apt-get update

        # Install CUDA
        sudo apt-get install cuda-toolkit-12-4
        ```
      </Tab>

      <Tab title="Fedora/RHEL">
        ```bash theme={null}
        # Add NVIDIA repository
        sudo dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel9/x86_64/cuda-rhel9.repo

        # Install CUDA
        sudo dnf install cuda-toolkit-12-4
        ```
      </Tab>

      <Tab title="Windows">
        Download installer from:
        [https://developer.nvidia.com/cuda-downloads](https://developer.nvidia.com/cuda-downloads)

        Follow the installation wizard.
      </Tab>
    </Tabs>
  </Accordion>

  <Accordion title="3. cuDNN (Optional but Recommended)" icon="brain">
    **NVIDIA cuDNN** (CUDA Deep Neural Network library) further optimizes performance.

    **Download:**

    1. Go to [https://developer.nvidia.com/cudnn](https://developer.nvidia.com/cudnn)
    2. Sign up for NVIDIA Developer Program (free)
    3. Download cuDNN for your CUDA version
    4. Extract and copy files:

    ```bash theme={null}
    tar -xvf cudnn-linux-x86_64-8.9.7.29_cuda12-archive.tar.xz
    sudo cp cudnn-linux-x86_64-8.9.7.29_cuda12-archive/include/* /usr/local/cuda/include/
    sudo cp cudnn-linux-x86_64-8.9.7.29_cuda12-archive/lib/* /usr/local/cuda/lib64/
    sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*
    ```
  </Accordion>

  <Accordion title="4. CUDA-enabled OpenCV" icon="eye">
    **This is the critical requirement!** Standard OpenCV doesn't include CUDA support.

    You need `opencv-contrib-python` compiled with CUDA.
  </Accordion>
</AccordionGroup>

## Installing CUDA-enabled OpenCV

Standard OpenCV from PyPI does NOT include CUDA support. You have three options:

### Option 1: Pre-built CUDA Wheels (Recommended)

Use pre-compiled wheels from the opencv-python-cuda-wheels project:

<Steps>
  <Step title="Download appropriate wheel">
    Visit: [https://github.com/cudawarped/opencv-python-cuda-wheels/releases/latest](https://github.com/cudawarped/opencv-python-cuda-wheels/releases/latest)

    **Select wheel matching:**

    * Your Python version (e.g., cp312 = Python 3.12)
    * Your platform (e.g., linux\_x86\_64)
    * Your CUDA version (e.g., cuda122 = CUDA 12.2)

    **Example filename:**

    ```text theme={null}
    opencv_contrib_python-4.9.0+cuda122-cp312-cp312-linux_x86_64.whl
    ```
  </Step>

  <Step title="Create deps directory">
    ```bash theme={null}
    mkdir -p deps
    cd deps
    ```
  </Step>

  <Step title="Download wheel">
    ```bash theme={null}
    wget https://github.com/cudawarped/opencv-python-cuda-wheels/releases/download/latest/opencv_contrib_python-4.9.0+cuda122-cp312-cp312-linux_x86_64.whl
    ```

    Replace with your specific wheel URL.
  </Step>

  <Step title="Install with uv">
    ```bash theme={null}
    cd ..
    uv pip install deps/opencv_contrib_python-4.9.0+cuda122-cp312-cp312-linux_x86_64.whl
    ```
  </Step>

  <Step title="Verify CUDA support">
    ```bash theme={null}
    python -c "import cv2; print('CUDA devices:', cv2.cuda.getCudaEnabledDeviceCount())"
    ```

    **Expected output:**

    ```text theme={null}
    CUDA devices: 1
    ```

    If you see `0`, CUDA is not available.
  </Step>
</Steps>

<Note>
  The `pyproject.toml` in this repository is configured to look for CUDA wheels in the `deps/` directory.
</Note>

***

### Option 2: Build from Source

Build OpenCV with CUDA support yourself:

<Warning>
  This is time-consuming (1-2 hours) and error-prone. Only recommended if pre-built wheels don't work.
</Warning>

<Steps>
  <Step title="Install build dependencies">
    ```bash theme={null}
    sudo apt-get update
    sudo apt-get install -y \
        build-essential cmake git pkg-config \
        libjpeg-dev libpng-dev libtiff-dev \
        libavcodec-dev libavformat-dev libswscale-dev \
        libv4l-dev libxvidcore-dev libx264-dev \
        libgtk-3-dev libatlas-base-dev gfortran \
        python3-dev
    ```
  </Step>

  <Step title="Clone OpenCV repositories">
    ```bash theme={null}
    git clone https://github.com/opencv/opencv.git
    git clone https://github.com/opencv/opencv_contrib.git
    cd opencv
    mkdir build
    cd build
    ```
  </Step>

  <Step title="Configure with CMake">
    ```bash theme={null}
    cmake -D CMAKE_BUILD_TYPE=RELEASE \
        -D CMAKE_INSTALL_PREFIX=/usr/local \
        -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
        -D WITH_CUDA=ON \
        -D CUDA_ARCH_BIN=8.6 \
        -D WITH_CUDNN=ON \
        -D OPENCV_DNN_CUDA=ON \
        -D ENABLE_FAST_MATH=ON \
        -D CUDA_FAST_MATH=ON \
        -D WITH_CUBLAS=ON \
        -D BUILD_opencv_python3=ON \
        ..
    ```

    **Replace `CUDA_ARCH_BIN`** with your GPU's compute capability:

    * RTX 3060/3070/3080/3090: `8.6`
    * RTX 4060/4070/4080/4090: `8.9`
    * RTX 2060/2070/2080: `7.5`
    * GTX 1060/1070/1080: `6.1`

    Check your GPU: [https://developer.nvidia.com/cuda-gpus](https://developer.nvidia.com/cuda-gpus)
  </Step>

  <Step title="Build (this takes 1-2 hours)">
    ```bash theme={null}
    make -j$(nproc)
    sudo make install
    sudo ldconfig
    ```
  </Step>

  <Step title="Verify installation">
    ```bash theme={null}
    python3 -c "import cv2; print(cv2.getBuildInformation())" | grep -i cuda
    ```

    Should show CUDA-related build flags.
  </Step>
</Steps>

***

### Option 3: Docker with CUDA

Use NVIDIA's official CUDA container:

```dockerfile Dockerfile theme={null}
FROM nvidia/cuda:12.4.0-cudnn-runtime-ubuntu22.04

RUN apt-get update && apt-get install -y \
    python3.12 python3-pip \
    libgl1-mesa-glx libglib2.0-0

WORKDIR /app
COPY . /app

RUN pip install uv
RUN uv sync

CMD ["uv", "run", "main.py"]
```

```bash theme={null}
# Build container
docker build -t rtsp-human-capture .

# Run with GPU access
docker run --gpus all rtsp-human-capture \
    --rtsp "rtsp://camera.local/stream" --save image
```

<Note>
  Requires **nvidia-docker2** or **NVIDIA Container Toolkit** installed on host.
</Note>

## Verifying GPU Acceleration

### Check 1: CUDA Device Count

```bash theme={null}
python -c "import cv2; print('CUDA devices:', cv2.cuda.getCudaEnabledDeviceCount())"
```

**Expected output:**

```text theme={null}
CUDA devices: 1
```

<Tabs>
  <Tab title="Success (devices > 0)">
    ```text theme={null}
    CUDA devices: 1
    ```

    OpenCV detects your GPU. GPU acceleration will work.
  </Tab>

  <Tab title="Failure (devices = 0)">
    ```text theme={null}
    CUDA devices: 0
    ```

    **Causes:**

    * OpenCV not built with CUDA
    * CUDA toolkit not installed
    * NVIDIA driver not installed
    * GPU not compatible
  </Tab>
</Tabs>

### Check 2: Application Output

Run the application and look for the startup message:

```bash theme={null}
python main.py --rtsp "rtsp://camera.local/stream" --save image
```

**With GPU:**

```text theme={null}
Loading person detection model...
CUDA available, using GPU for inference
Model loaded: YOLOv4
```

**Without GPU:**

```text theme={null}
Loading person detection model...
CUDA not available, using CPU for inference
Model loaded: YOLOv4
```

### Check 3: GPU Utilization

Monitor GPU usage during processing:

```bash theme={null}
watch -n 1 nvidia-smi
```

**Expected output:**

```text theme={null}
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 535.183.01   Driver Version: 535.183.01   CUDA Version: 12.4   |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:01:00.0  On |                  N/A |
| 30%   45C    P2    85W / 170W |   1024MiB /  12288MB |     35%      Default |
+-------------------------------+----------------------+----------------------+
```

**Key metrics:**

* **GPU-Util:** Should be 20-50% during inference
* **Memory-Usage:** \~300-500 MB for YOLOv4
* **Power:** Should increase when processing

<Warning>
  If GPU-Util stays at 0%, GPU is not being used despite CUDA being available.
</Warning>

### Check 4: Performance Benchmark

Compare inference times:

<Tabs>
  <Tab title="CPU Baseline">
    Disable GPU temporarily:

    ```python theme={null}
    # Modify person_detector.py line 64-65:
    cuda_available = False  # Force CPU
    ```

    Run and observe frame processing times in console output.

    **Expected:** Detection messages every 1-3 seconds (with frame\_skip=15)
  </Tab>

  <Tab title="GPU Accelerated">
    Restore GPU detection:

    ```python theme={null}
    cuda_available = cv2.cuda.getCudaEnabledDeviceCount() > 0
    ```

    Run and observe frame processing times.

    **Expected:** Detection messages every 0.5-1 seconds (same frame\_skip)

    Should be noticeably faster.
  </Tab>
</Tabs>

## Performance Comparison

### Single Stream

| Configuration | Detection Latency | Max Streams |
| ------------- | ----------------- | ----------- |
| CPU (YOLOv4)  | \~100-300ms       | 1-2         |
| GPU (YOLOv4)  | \~10-30ms         | 8-16        |
| CPU (YOLOv3)  | \~80-250ms        | 1-3         |
| GPU (YOLOv3)  | \~8-25ms          | 10-20       |
| CPU (HOG)     | \~50-150ms        | 2-4         |

<Note>
  Times measured on:

  * CPU: Intel i7-9700K @ 3.6GHz
  * GPU: NVIDIA RTX 3060 12GB
  * Resolution: 1920×1080
</Note>

### Multi-Stream Scalability

**With frame\_skip=15 (2 fps detection rate):**

| Streams | CPU Load           | GPU Load | Recommended Hardware       |
| ------- | ------------------ | -------- | -------------------------- |
| 1-2     | 40-80%             | 10-20%   | Any                        |
| 3-4     | 80-100%            | 20-35%   | CPU: Mid-range, GPU: Any   |
| 5-8     | >100% (bottleneck) | 35-60%   | GPU: Mid-range (GTX 1660+) |
| 9-16    | N/A                | 60-85%   | GPU: High-end (RTX 3060+)  |

<Warning>
  **CPU bottleneck:** With >3 streams on CPU, frame\_skip must be increased to 30+ for usable performance.

  **GPU bottleneck:** With >12 streams on mid-range GPU, consider lowering frame\_skip or using multiple instances.
</Warning>

## Optimizing GPU Performance

### 1. Adjust Batch Size

YOLO processes one frame at a time. For multi-stream, this is actually optimal since:

* Threads queue up at the inference lock
* GPU processes frames sequentially
* No benefit to batching in this architecture

### 2. Lower frame\_skip for GPU

With GPU, you can afford more frequent detection:

```bash theme={null}
# CPU: Process every 30th frame
python main.py --rtsp-file streams.txt --save video --frame-skip 30

# GPU: Process every 10th frame
python main.py --rtsp-file streams.txt --save video --frame-skip 10
```

**Result:**

* 3x more frequent detection
* Still faster than CPU at frame\_skip=30
* Better responsiveness

### 3. Monitor GPU Memory

Each model loaded into GPU memory:

| Model  | GPU Memory |
| ------ | ---------- |
| YOLOv4 | \~250 MB   |
| YOLOv3 | \~248 MB   |

**Plus per-frame buffers:**

* 1920×1080: \~8 MB per frame
* Intermediate layers: \~50-100 MB

**Total:** \~350-450 MB for single instance

<Tip>
  **Running multiple instances?**
  Ensure total GPU memory usage \< 80% of available VRAM:

  * RTX 3060 (12GB): Can run 20+ instances
  * GTX 1660 (6GB): Can run 10+ instances
</Tip>

### 4. Use Appropriate CUDA Arch

When building OpenCV from source, match `CUDA_ARCH_BIN` to your GPU:

```bash theme={null}
cmake -D CUDA_ARCH_BIN=8.6 ...  # RTX 3060
```

Mismatch causes performance loss (10-30% slower).

## Troubleshooting

<AccordionGroup>
  <Accordion title="CUDA devices: 0" icon="circle-xmark">
    **Issue:** OpenCV doesn't detect GPU

    **Diagnosis:**

    1. **Check NVIDIA driver:**
       ```bash theme={null}
       nvidia-smi
       ```
       Should show GPU info. If not, driver not installed.

    2. **Check CUDA toolkit:**
       ```bash theme={null}
       nvcc --version
       ```
       Should show CUDA version. If not, toolkit not installed.

    3. **Check OpenCV build:**
       ```bash theme={null}
       python -c "import cv2; print(cv2.getBuildInformation())" | grep -i cuda
       ```
       Should show CUDA-related flags. If not, OpenCV not built with CUDA.

    **Solution:**

    * Install NVIDIA driver
    * Install CUDA toolkit
    * Install/build CUDA-enabled OpenCV
  </Accordion>

  <Accordion title="Application still says 'using CPU'" icon="microchip">
    **Issue:**

    ```text theme={null}
    CUDA not available, using CPU for inference
    ```

    Even though `cv2.cuda.getCudaEnabledDeviceCount()` returns > 0.

    **Cause:** OpenCV DNN module built without CUDA support (need `OPENCV_DNN_CUDA=ON`).

    **Verify:**

    ```bash theme={null}
    python -c "import cv2; print(cv2.getBuildInformation())" | grep -i "dnn.*cuda"
    ```

    Should show:

    ```text theme={null}
    OPENCV_DNN_CUDA:                 YES
    ```

    **Solution:**
    Use pre-built wheels from opencv-python-cuda-wheels (they have DNN CUDA enabled).
  </Accordion>

  <Accordion title="Out of memory errors" icon="memory">
    **Error:**

    ```text theme={null}
    CUDA error: out of memory
    ```

    **Causes:**

    * GPU doesn't have enough VRAM
    * Multiple applications using GPU
    * Memory leak

    **Solutions:**

    1. **Check available memory:**
       ```bash theme={null}
       nvidia-smi
       ```

    2. **Close other GPU applications** (Chrome, games, etc.)

    3. **Use smaller model** (YOLOv3-tiny instead of YOLOv4)

    4. **Process fewer streams**
  </Accordion>

  <Accordion title="GPU utilization is low" icon="gauge">
    **Issue:** GPU-Util in `nvidia-smi` shows less than 10%

    **Causes:**

    * Not enough streams (GPU waiting for CPU)
    * frame\_skip too high
    * Display rendering is bottleneck

    **Solutions:**

    1. **Lower frame\_skip:**
       ```bash theme={null}
       --frame-skip 5  # More frequent detection
       ```

    2. **Add more streams:**
       GPU can handle 8-16 streams efficiently

    3. **Disable display:**
       ```bash theme={null}
       # Remove --display flag
       ```
  </Accordion>

  <Accordion title="Slower than expected" icon="turtle">
    **Issue:** GPU not providing expected speedup

    **Check:**

    1. **GPU actually being used:**
       ```bash theme={null}
       watch -n 1 nvidia-smi
       ```
       GPU-Util should be >0% and spike during detection.

    2. **Power mode:**
       ```bash theme={null}
       nvidia-smi -q -d PERFORMANCE
       ```
       Should show "P2" or "P0" (performance mode), not "P8" (idle).

    3. **Thermal throttling:**
       Check temperature in `nvidia-smi`. If >80°C, may be throttling.

    4. **CUDA architecture mismatch:**
       Rebuild OpenCV with correct `CUDA_ARCH_BIN` for your GPU.
  </Accordion>
</AccordionGroup>

## GPU Selection (Multi-GPU Systems)

If you have multiple GPUs, OpenCV uses GPU 0 by default.

To select a different GPU:

```bash theme={null}
# Use GPU 1
export CUDA_VISIBLE_DEVICES=1
python main.py --rtsp "rtsp://..." --save image

# Use GPUs 0 and 2 (for multiple instances)
export CUDA_VISIBLE_DEVICES=0,2
```

**For multiple instances across GPUs:**

```bash theme={null}
# Terminal 1: Use GPU 0
CUDA_VISIBLE_DEVICES=0 python main.py --rtsp-file cameras_1-8.txt --save video

# Terminal 2: Use GPU 1
CUDA_VISIBLE_DEVICES=1 python main.py --rtsp-file cameras_9-16.txt --save video
```

## Best Practices

<CardGroup cols={2}>
  <Card title="Use Pre-built Wheels" icon="download">
    Easier and more reliable than building from source. Get from opencv-python-cuda-wheels.
  </Card>

  <Card title="Monitor GPU Usage" icon="chart-line">
    Keep `nvidia-smi` running in a separate terminal to watch GPU utilization.
  </Card>

  <Card title="Update Drivers Regularly" icon="arrows-rotate">
    Newer NVIDIA drivers often include performance improvements.
  </Card>

  <Card title="Match CUDA Versions" icon="link">
    Ensure OpenCV CUDA version matches installed CUDA toolkit version.
  </Card>

  <Card title="Test Before Deploying" icon="vial">
    Verify GPU acceleration works with test streams before production deployment.
  </Card>

  <Card title="Plan for Scaling" icon="arrow-up-right-dots">
    GPU allows 3-5x more streams than CPU. Plan hardware accordingly.
  </Card>
</CardGroup>

## Recommended Hardware

### Budget Setup (\$300-500)

**GPU:** NVIDIA GTX 1660 Super (6GB)

* 4-8 streams at 1080p
* 2 fps detection rate
* YOLOv4

### Mid-Range Setup (\$500-800)

**GPU:** NVIDIA RTX 3060 (12GB)

* 8-12 streams at 1080p
* 2-3 fps detection rate
* YOLOv4
* Room for growth

### High-End Setup (\$1000+)

**GPU:** NVIDIA RTX 4070 (12GB) or RTX 3080 (10GB)

* 12-16 streams at 1080p
* 3-5 fps detection rate
* YOLOv4
* Multiple instances possible

### Enterprise/Data Center

**GPU:** NVIDIA A4000/A5000 or Tesla T4

* 16-24 streams at 1080p
* 5+ fps detection rate
* ECC memory
* 24/7 reliability

<Note>
  All recommendations assume:

  * 1920×1080 resolution streams
  * YOLOv4 model
  * frame\_skip tuned appropriately
</Note>

## Docker GPU Setup

For containerized deployments with GPU:

### Install NVIDIA Container Toolkit

```bash theme={null}
# Add repository
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | \
  sudo tee /etc/apt/sources.list.d/nvidia-docker.list

# Install
sudo apt-get update
sudo apt-get install -y nvidia-docker2
sudo systemctl restart docker
```

### Test GPU Access

```bash theme={null}
docker run --rm --gpus all nvidia/cuda:12.4.0-base-ubuntu22.04 nvidia-smi
```

Should show your GPU info.

### Run Application with GPU

```bash theme={null}
docker run --gpus all \
  -v $(pwd)/output:/app/output \
  -v $(pwd)/model:/app/model \
  rtsp-human-capture \
  --rtsp "rtsp://camera.local/stream" --save image
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Multi-Stream Processing" icon="grid" href="/guides/multi-stream">
    Leverage GPU to process many streams
  </Card>

  <Card title="Configuration Tuning" icon="sliders" href="/guides/configuration">
    Optimize settings for GPU performance
  </Card>

  <Card title="Model Setup" icon="download" href="/guides/model-setup">
    Configure YOLO models
  </Card>

  <Card title="Single Stream" icon="video" href="/guides/single-stream">
    Test GPU with single stream first
  </Card>
</CardGroup>
