Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] bbox internvl #941

Open
3 tasks
lixianyan2023 opened this issue Mar 4, 2025 · 2 comments
Open
3 tasks

[Bug] bbox internvl #941

lixianyan2023 opened this issue Mar 4, 2025 · 2 comments

Comments

@lixianyan2023
Copy link

Checklist

  • 1. I have searched related issues but cannot get the expected help.
  • 2. The bug has not been fixed in the latest version.
  • 3. Please note that if the bug-related issue you submitted lacks corresponding environment info and a minimal reproducible demo, it will be challenging for us to reproduce and resolve the issue, reducing the likelihood of receiving feedback.

Describe the bug

我得出了目标信息的bbox,我要怎么画出他的框呢?如何获取原始图像的高和宽

Reproduction

我得出了目标信息的bbox,我要怎么画出他的框呢?如何获取原始图像的高和宽

Environment

no

Error traceback

@lixianyan2023
Copy link
Author

def collate_fn(batches):
pixel_values = torch.cat([['pixel_values'] for _ in batches], dim=0)
texts = [
['text'] for _ in batches]
bboxes = [['bbox'] for _ in batches]
hws = [
['hw'] for _ in batches]
return pixel_values, texts, bboxes, hws
这里面的hws是image.size得到的吗?

@yuecao0119
Copy link
Collaborator

你好,

你可以通过PIL库打开原始图片,然后获得宽高

from PIL import Image

# 打开图像
image = Image.open('your_image.jpg')

# 获取图像的宽度和高度
width, height = image.size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants