INNER CODE UNIT · Python

overlap

gokayfem/awesome-vlm-architectures · scripts/extract_architecture_figures.py:86

        overlap = max(0.0, min(rect.x1, x_clip.x1) - max(rect.x0, x_clip.x0))
        if (
            rect.y1 < caption.y0 - 14
            and overlap > min(rect.width, x_clip.width) * 0.45
            and len(text) > 180
            and len(text.split()) > 28
        ):
            candidates.append(rect)
    return max(candidates, key=lambda rect: rect.y1) if candidates else None


def initial_clip(page: fitz.Page, caption: fitz.Rect) -> fitz.Rect:
    page_rect = page.rect
    if caption.width < page_rect.width * 0.57:
        center = (caption.x0 + caption.x1) / 2
        if center < page_rect.width / 2:
            x0, x1 = page_rect.width * 0.035, page_rect.width * 0.51
        else:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…