error: CUDA out of memory with targets = mask
Request Body
{
"model": "DINO-X-1.0",
"image": "https://i.postimg.cc/t9LHkxk6/BH9z-SGd34-Sz-Xe-Dt-E3-W-p3.jpg
",
"prompt": {
"type": "text",
"text": "product package"
},
"targets": [
"bbox",
"mask"
],
"bbox_threshold": 0.15,
"iou_threshold": 0.8
}
Response
{
"code": 0,
"msg": "ok",
"data": {
"error": "CUDA out of memory.",
"result": null,
"session_id": "",
"status": "failed",
"uuid": "6ec816c0-5922-4ac2-b81f-bb6a53b175c3"
}
}
Image size is 3200x3200px The doc says it will resize image automatically, I don't want to resize at my code cause the bbox will be different vs origin image
Hi, @justin-rwazi
Sorry for any misunderstanding caused. For your original image of 3200x3200px, the model will automatically resize the image proportionally so that the longer side is 1536 pixels before inference. However, the inference results (such as bbox coordinates) are always returned in the original image size, so you do not need to resize the image again in your code.
Regarding the error for task 6ec816c0-5922-4ac2-b81f-bb6a53b175c3, it was caused by the combination of a very high image resolution and a large number of detected objects, which led to mask calculation exceeding the GPU memory limit.
We will continue to optimize our code to better handle such cases. In the meantime, if you encounter similar issues, we recommend compressing the image before inference as a temporary solution.
Thank you for your understanding!
Thank @xifanii for your response
as I understand the issue only occur when I set "mask" option, "bbox" option works fine is there any other workaround? such as resize image or option with higher VRAM?
@justin-rwazi Yes, your understanding is correct. The error only occurs when requesting the mask output, as the mask processing logic requires handling the image at its original resolution.
For now, you can try resizing or compressing your image before inference to avoid this error.
We are also working on optimizing the code to support higher-resolution inference, and this improvement will be available in a future update.
Thanks @xifanii It've been a while, did you update this?