1. 23 Oct, 2024 1 commit
    • myhloli's avatar
      feat(model): add support for DocLayout-YOLO model · 1279f2cd
      myhloli authored
      - Add new layout model option: DocLayout-YOLO
      - Implement model initialization and prediction for DocLayout-YOLO
      - Update configuration options to include new model- Modify existing code to support both LayoutLMv3 and DocLayout-YOLO models
      - Update Gradio app to support more Custom Switch
      1279f2cd
  2. 21 Oct, 2024 2 commits
  3. 18 Oct, 2024 1 commit
  4. 17 Oct, 2024 1 commit
  5. 15 Oct, 2024 4 commits
  6. 14 Oct, 2024 2 commits
    • myhloli's avatar
      fix(magic_pdf): include List and Index block types in processing · 0a9a6d3e
      myhloli authored
      Add List and Index to the list of block types being processed in the draw_bbox.py file. This inclusion ensures that these block types are handled similarly to other text-containing blocks, improving the overall document processing accuracy and consistency.
      0a9a6d3e
    • myhloli's avatar
      feat(list&index block): detect and merge list and index blocks · 1f1dd353
      myhloli authored
      - Add detection for list and index blocks in OCR processing- Implement merging of list and index blocks across pages
      - Update block types to include list and index categories
      - Adjust text merging logic to handle new block types
      - Modify layout drawing to distinguish list and index blocks
      1f1dd353
  7. 10 Oct, 2024 2 commits
  8. 08 Oct, 2024 5 commits
  9. 06 Oct, 2024 1 commit
    • myhloli's avatar
      refactor(model): improve timing information and performance · be1b1ae7
      myhloli authored
      - Enhance timing output precision to two decimal places for better readability- Calculate and log document analysis speed in pages per second
      - Optimize logging for YOLO and table recognition processes
      - Remove unnecessary comments and improve code efficiency
      be1b1ae7
  10. 30 Sep, 2024 1 commit
  11. 29 Sep, 2024 2 commits
  12. 28 Sep, 2024 3 commits
    • myhloli's avatar
      refactor(magic_pdf): import model helpers directly for clarity · 42a7d792
      myhloli authored
      Update import statements in `pdf_parse_union_core_v2.py` to directly import
      `prepare_inputs`, `boxes2inputs`, and `parse_logits` from `magic_pdf.model.v3.helpers`
      instead of from `magic_pdf.model.v3`. This change streamlines the imports, making the
      code more readable and maintaining a cleaner approach to modular design.
      42a7d792
    • myhloli's avatar
      refactor(pdf_parse_union_core_v2): update import paths to use new package structure · 5522d0a3
      myhloli authored
      Adapt import statements in `pdf_parse_union_core_v2.py` to reflect the updated packagestructure, changing from the `magic_pdf.v3.helpers` module to the `magic_pdf.model.v3`
      module. This ensures compatibility with the revised directory layout.
      5522d0a3
    • myhloli's avatar
      fix(pdf_parse): handle blocks without lines and enable bf16 on compatible devices · 2145a8b6
      myhloli authored
      Blocks without lines are now correctly indexed even when they contain textual content rendered
      as images. The sorting logic has been updated to accommodate this scenario. Additionally, the
      LayoutLMv3 model initialization has been enhanced to utilize bfloat16 precision on devices that
      support it, offering potential performance benefits on supported hardware.
      2145a8b6
  13. 27 Sep, 2024 9 commits
    • myhloli's avatar
      refactor(pdf_parse): remove redundant sorting and optimize block indexing · 177ab08e
      myhloli authored
      Removed redundant sorting of lines by model and optimized calculation of block
      indexes by using a single pass through the sorted lines. This change simplifies the
      code and potentially improves performance by reducing the number of sortingoperations and unnecessary iterations over blocks without lines.
      177ab08e
    • myhloli's avatar
      refactor(draw_bbox): remove commented-out code and streamline bbox... · 83c07387
      myhloli authored
      refactor(draw_bbox): remove commented-out code and streamline bbox drawingRemoved legacy commented-out code related to layout_bbox_list from draw_bbox.py, which
      was used for diagnostic purposes and was no longer necessary. This change streamlines
      the codebase and clarifies the drawing process of bounding boxes on PDF pages. The update
      also adjusts the order of operations slightly for improved readability without altering
      the functionality.
      83c07387
    • myhloli's avatar
      refactor(pdf_parse_union_core_v2): implement model initialization within... · b9dfdea3
      myhloli authored
      refactor(pdf_parse_union_core_v2): implement model initialization within classRefactored model initialization to be handled by a singleton class to ensure that model
      instances are reused across calls, avoiding redundant initializations. Removed logger
      information that was commented out and ensured consistency in logging behavior.
      b9dfdea3
    • myhloli's avatar
      refactor(drawing): simplify draw bbox functions and adjust debug config · b2790f6f
      myhloli authored
      Refactor the draw bbox functions by removing unused imports and simplifying the
      code logic for drawing layout and line sorting bounding boxes. Adjust the debug
      configuration to enable content list dumping and disable markdown making mode.
      b2790f6f
    • myhloli's avatar
      feat(draw_bbox): add option to toggle bounding box drawing · 43a57d56
      myhloli authored
      Introduce an additional argument `draw_bbox` in the `draw_bbox_with_number` function to
      enable toggling the drawing of bounding boxes on or off. When set to `False`, no bounding
      box will be drawn, allowing for situations where only text
      43a57d56
    • myhloli's avatar
      refactor(draw_bbox): remove conditional layout bbox drawing · c56de493
      myhloli authored
      Remove debug code related to layout bbox visualization and adjust drawing functions to
      support optional line sorting bboxes. This change includes the removal of `draw_layout_bbox`
      function and updates to `draw_bbox_with_number` to support variable line width for bbox drawing.
      c56de493
    • myhloli's avatar
      refactor(draw_bbox): add line sorting visualization · 34f89650
      myhloli authored
      Add a new function `draw_line_sort_bbox` to visualize the sorting of lines on each page.
      This includes indexing lines and handling both text and non-text elements such as tables
      and images for better content organization.
      
      Also, comment out GPU-related code for flexibility and remove overlaps in bounding box
      detection, which improves the accuracy of layout splitting.
      34f89650
    • myhloli's avatar
      refactor(pdf_parse_union): integrate LayoutLMv3 for block orderingReplace the... · 1efebe42
      myhloli authored
      refactor(pdf_parse_union): integrate LayoutLMv3 for block orderingReplace the heuristic-based block ordering algorithm with LayoutLMv3 model predictions toimprove the accuracy of block ordering on PDF pages. Additionally, refactor the span
      handling during block filling to ensure spans are correctly assigned.
      
      - Introduce LayoutLMv3ForTokenClassification from 'hantian/layoutreader' to predict block
        order.
      - Implement span replacement strategy to use pymu spans for non-OCR content.
      - Enhance cleanup process to free GPU memory more effectively after model use.
      - Adjust block ordering logic to use median line index for text, title, and interline equation blocks.
      - Refactor page parsing core logic for better maintainability.
      
      BREAKING CHANGE: The integration of LayoutLMv3 changes the internal block handling and
      ordering mechanism, which may affect downstream systems relying on the previous
      implementation. Ensure to test thoroughly before deployment.
      1efebe42
    • myhloli's avatar
      refactor(draw_bbox): clear cuda cache and update bbox sorting · 36220d69
      myhloli authored
      - Added CUDA cache clearing after layoutreader prediction to free up GPU memory.
      - Modified the bbox sorting logic to sort text and title blocks separately.
      - Adjusted drawing colors for better distinction in debug visualizations.
      36220d69
  14. 26 Sep, 2024 2 commits
    • myhloli's avatar
      refactor(draw_bbox): clear cuda cache and update bbox sorting · 00cda7a6
      myhloli authored
      - Added CUDA cache clearing after layoutreader prediction to free up GPU memory.
      - Modified the bbox sorting logic to sort text and title blocks separately.
      - Adjusted drawing colors for better distinction in debug visualizations.
      00cda7a6
    • myhloli's avatar
      feat(draw_bbox): add layout sorting visualization · 270ffb02
      myhloli authored
      Implement a new function `draw_layout_sort_bbox` in `draw_bbox.py` to visualize the
      layout sorting results using the `LayoutLMv3ForTokenClassification` model. This function
      predicts the order of layout elements and draws them in the sorted sequence on the PDF pages.
      270ffb02
  15. 25 Sep, 2024 1 commit
    • myhloli's avatar
      feat(draw_bbox): add layout sorting visualization · 3cbcf2de
      myhloli authored
      Implement a new function `draw_layout_sort_bbox` in `draw_bbox.py` to visualize the
      layout sorting results using the `LayoutLMv3ForTokenClassification` model. This function
      predicts the order of layout elements and draws them in the sorted sequence on the PDF pages.
      3cbcf2de
  16. 20 Sep, 2024 1 commit
  17. 19 Sep, 2024 2 commits