Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/bytedance/Dolphin
/ functions
Functions
50 in github.com/bytedance/Dolphin
⨍
Functions
50
◇
Types & classes
4
↓ 6 callers
Method
convert
Convert recognition results to markdown format
utils/markdown_utils.py:308
↓ 4 callers
Function
process_element_batch
Process elements of the same type in batches
demo_page.py:289
↓ 4 callers
Function
resize_img
(image, max_size=1600, min_size=28)
utils/utils.py:434
↓ 3 callers
Function
parse_layout_string
Dolphin-V1.5 layout string parsing function Parse layout string to extract bbox and category information Supports multiple formats: 1
utils/utils.py:172
↓ 3 callers
Function
process_coordinates
(coords, pil_image)
utils/utils.py:204
↓ 3 callers
Function
save_outputs
Save JSON and markdown outputs
utils/utils.py:234
↓ 2 callers
Method
_handle_text
Process regular text content, preserving paragraph structure
utils/markdown_utils.py:162
↓ 2 callers
Method
chat
(self, prompt, image)
demo_page.py:43
↓ 2 callers
Function
convert_pdf_to_images
Convert PDF pages to images Args: pdf_path: Path to PDF file target_size: Target size for the longest dimension Returns:
utils/utils.py:55
↓ 2 callers
Function
process_single_image
Process a single image (either from file or converted from PDF page) Args: image: PIL Image object model: DOLPHIN model insta
demo_page.py:171
↓ 2 callers
Function
process_single_layout
Process layout for a single image Args: pil_image: PIL Image object model: DOLPHIN model instance save_dir: Directory
demo_layout.py:162
↓ 2 callers
Function
replace_repeated_cdots
(latex)
utils/markdown_utils.py:47
↓ 2 callers
Function
setup_output_dirs
Create necessary output directories
utils/utils.py:225
↓ 1 callers
Method
_handle_figure
Handle figure content
utils/markdown_utils.py:240
↓ 1 callers
Method
_handle_formula
Handle formula-specific content
utils/markdown_utils.py:286
↓ 1 callers
Method
_handle_heading
Convert section headings to appropriate markdown format
utils/markdown_utils.py:215
↓ 1 callers
Method
_handle_list_item
Convert list items to markdown list format
utils/markdown_utils.py:230
↓ 1 callers
Method
_handle_table
Convert table content to markdown format
utils/markdown_utils.py:271
↓ 1 callers
Method
_process_formulas_in_text
Process mathematical formulas in text by iteratively finding and replacing formulas. - Identify inline and block formulas - R
utils/markdown_utils.py:180
↓ 1 callers
Method
_remove_newline_in_heading
Remove newline in heading
utils/markdown_utils.py:196
↓ 1 callers
Function
aligned_to_array
(latex: str)
utils/markdown_utils.py:29
↓ 1 callers
Function
assign_colors_to_elements
Assign colors to elements in order Args: num_elements: Number of elements to assign colors to Returns: List of c
utils/utils.py:415
↓ 1 callers
Function
calculate_iou_matrix
Vectorized IoU matrix calculation [N, N] Args: boxes: List of bounding boxes in [x1, y1, x2, y2] format Returns:
utils/utils.py:461
↓ 1 callers
Method
chat
(self, prompt, image)
demo_layout.py:43
↓ 1 callers
Method
chat
(self, prompt, image)
demo_element.py:44
↓ 1 callers
Function
check_bbox_overlap
Check if bounding boxes have significant overlaps, indicating a distorted/photographed document If more than 60% of boxes have overlaps (IoU
utils/utils.py:489
↓ 1 callers
Function
extract_labels_from_string
from [202,217,921,325][para][author] extract para and author
utils/utils.py:158
↓ 1 callers
Function
extract_table_from_html
Extract and clean table tags from HTML string
utils/markdown_utils.py:11
↓ 1 callers
Function
gathered_to_aligned
(latex: str)
utils/markdown_utils.py:41
↓ 1 callers
Function
get_color_palette
Get a visually pleasing color palette for layout visualization Returns: List of BGR color tuples (semi-transparent, good for overlay)
utils/utils.py:382
↓ 1 callers
Function
main
()
demo_layout.py:196
↓ 1 callers
Function
main
()
demo_page.py:323
↓ 1 callers
Function
main
()
demo_element.py:169
↓ 1 callers
Function
process_document
Parse documents with two stages - Handles both images and PDFs
demo_page.py:127
↓ 1 callers
Function
process_element
Process a single element image (text, table, formula) Args: image_path: Path to the element image model: HFModel model instan
demo_element.py:121
↓ 1 callers
Function
process_elements
Parse all document elements with parallel decoding
demo_page.py:201
↓ 1 callers
Function
process_layout
Process layout detection for image or PDF Args: input_path: Path to input image or PDF model: DOLPHIN model instance
demo_layout.py:128
↓ 1 callers
Function
remove_numeric_quad_ending
(s: str)
utils/markdown_utils.py:23
↓ 1 callers
Function
save_combined_pdf_results
Save combined results for multi-page PDF with both JSON and Markdown Args: all_page_results: List of results for all pages pdf_pa
utils/utils.py:94
↓ 1 callers
Function
save_figure_to_local
Save cropped figure to local file system Args: pil_crop: PIL Image object of the cropped figure save_dir: Base directory to save
utils/utils.py:22
↓ 1 callers
Function
truncate_repeated_tail
(s, threshold=20, keep=1)
utils/markdown_utils.py:52
↓ 1 callers
Method
try_remove_newline
(self, text: str)
utils/markdown_utils.py:118
↓ 1 callers
Function
visualize_layout
Visualize layout detection results on the image Args: image_path: Path to the input image layout_results: List of (bbox, labe
utils/utils.py:293
Method
__init__
Initialize the Hugging Face model Args: model_id_or_path: Path to local model or Hugging Face model ID
demo_layout.py:19
Method
__init__
Initialize the Hugging Face model Args: model_id_or_path: Path to local model or Hugging Face model ID
demo_page.py:19
Method
__init__
Initialize the Hugging Face model Args: model_id_or_path: Path to local model or Hugging Face model ID
demo_element.py:20
Method
__init__
(self, post_process: Optional[bool] = False)
utils/markdown_utils.py:85
Function
crop_margin
Crop margins from image
utils/utils.py:257
Method
is_chinese
(char)
utils/markdown_utils.py:125
Function
repl
(match)
utils/markdown_utils.py:32