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

Fix small image filtering in chart extraction stage #446

Merged
merged 2 commits into from
Feb 18, 2025

Conversation

edknv
Copy link
Collaborator

@edknv edknv commented Feb 14, 2025

Description

This PR fixes the logic for filtering out small images in the chart extraction stage. When we filter out small images, we keep track of the indices in the original image batch in valid_indices and use valid_indices later to restore the original order in the results. The table extraction has similar logic:

if width >= PADDLE_MIN_WIDTH and height >= PADDLE_MIN_HEIGHT:
valid_images.append(img)
valid_indices.append(i)
else:
# Image is too small; mark as skipped.
results[i] = (img, (None, None))

# Assign each result back to its original position.
for idx, result in enumerate(paddle_result):
original_index = valid_indices[idx]
results[original_index] = (base64_images[original_index], result)

which we also follow in this PR.

Checklist

  • [] I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@edknv edknv requested a review from drobison00 February 14, 2025 02:15
@edknv edknv requested a review from a team as a code owner February 18, 2025 20:33
@edknv edknv merged commit deb225a into NVIDIA:main Feb 18, 2025
2 of 3 checks passed
@edknv edknv deleted the edwardk/paddle-filter-small-images branch February 18, 2025 23:04
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

Successfully merging this pull request may close these issues.

2 participants