Skip to content

CUDA out of memory #2

Description

@yuhaozhang7

In the current implementation, the target virtual pinhole image uses the following camera intrinsics:

pinhole_intrinsics: [463.99945, 463.25045, 400, 300]
pinhole_resolution: [800, 600]

The image aspect ratio is:

800 : 600 = 1 : 0.75

Depth Anything 3 (DA3) resizes the input image so that the longest side is 504 pixels by default. As a result, reducing the input resolution alone does not significantly reduce GPU memory usage, since the image is internally rescaled during inference.

If you encounter CUDA out-of-memory (OOM) errors, try one of the following approaches:

1. Reduce the image height

Decrease the image height while keeping the image width and camera intrinsics unchanged. For example:

pinhole_intrinsics: [463.99945, 463.25045, 400, 300]
pinhole_resolution: [800, 520]

Reducing the image height decreases the number of pixels processed after resizing, which can significantly reduce GPU memory usage during inference.

2. Lower the inference resolution

In depthanything.py, locate the model.inference() call and set process_res to a value smaller than 504.

This reduces the internal processing resolution while preserving the original aspect ratio, thereby lowering GPU memory consumption during inference.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions