ReFocus_Code icon indicating copy to clipboard operation
ReFocus_Code copied to clipboard

Inquiry About Grounding BBox Tool for Charts

Open zhaochen0110 opened this issue 1 year ago • 7 comments

Hi,

Thanks for the excellent work on this project. It's truly impressive!

I wanted to ask about one specific aspect of your workflow:

  • Which tool or method did you use to obtain the grounding BBox for the charts?
  • How do you ensure the accuracy of this tool when applied specifically to charts?

Looking forward to your response. Thanks in advance for your time and clarification!

Best regards, Zhaochen

zhaochen0110 avatar Jan 14 '25 04:01 zhaochen0110

Hi Zhaochen,

Thanks for your interest! As for your questions: Q1. For the bounding box coordinates, we used cv2 tools and heuristics to get them. Q2. During step1, we iteratively draw out the coordinates on the original images, e.g. to get images like this: Screenshot 2025-01-14 at 3 05 10 PM Screenshot 2025-01-14 at 3 06 15 PM By manually checking out the visualized result, we adjust step1 until the coordinates are mostly correct. Then we applied our ReFocus prompting method on the coordinates and see huge improvements by GPT-4o models, and that could further justify the coordinates' quality.

Best, Xingyu

zeyofu avatar Jan 14 '25 20:01 zeyofu

Hi Xingyu,

Thanks for your quick response! It’s impressive that cv2 and heuristics can generate accurate bounding box coordinates. I tried implementing a basic version (as I couldn’t find the corresponding code in your repo) to segment different parts of a plot, similar to your example 2.

Here’s my simple code and results:

import cv2

image_path = "image.png"  
image = cv2.imread(image_path)

gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

edges = cv2.Canny(gray, 50, 150)

contours, _ = cv2.findContours(edges, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)

image_contours = image.copy()
cv2.drawContours(image_contours, contours, -1, (0, 255, 0), 2)  # Green contours

cv2.imwrite("contours_result.png", image_contours)

However, the generated bounding boxes don’t precisely match the intended content. Could you provide more detailed instructions or share the relevant code for this part?

Thanks a lot!

Best regards, Zhaochen contours 990

zhaochen0110 avatar Jan 15 '25 12:01 zhaochen0110

There are a lot of magic numbers with multiple trials. The CharXiv code is in its corresponding prompt, https://github.com/zeyofu/ReFocus_Code/blob/8412b5fa2a08815b888b2ddf360359b720f0a4dd/src/prompt_need.py#L598

The chartQA code is very messy. Shoot me an email if you want that too, I could send you from there!

zeyofu avatar Jan 15 '25 20:01 zeyofu

Thanks a lot!

Here is my email: [email protected]

zhaochen0110 avatar Jan 16 '25 03:01 zhaochen0110

Could I also get the chartQA code, please? Thanks a lot. Here is my email: [email protected]

SereinQAQ avatar Jul 21 '25 02:07 SereinQAQ

Hi, I've put the code into this repo. Find it here: https://github.com/zeyofu/ReFocus_Code/tree/main/helper

zeyofu avatar Jul 22 '25 03:07 zeyofu

我看到了 谢谢你

在 2025-07-22 11:48:03,"Xingyu Fu" @.***> 写道:

Closed #1 as completed.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

SereinQAQ avatar Jul 29 '25 03:07 SereinQAQ