Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/BIT-DataLab/Edit-Banana
/ functions
Functions
308 in github.com/BIT-DataLab/Edit-Banana
⨍
Functions
308
◇
Types & classes
50
↳
Endpoints
7
Method
__init__
(self, endpoints: List[str], timeout: int = 60)
sam3_service/rmbg_client.py:39
Method
__init__
( self, config_path: str, device: str = "cuda", cache_size: int = 2, )
sam3_service/server.py:82
Method
__init__
(self, model_path: str)
sam3_service/rmbg_server.py:25
Method
__new__
(cls)
modules/sam3_info_extractor.py:69
Method
_analyze_region_complexity
Analyze region complexity (texture, border) for shape vs image classification.
modules/sam3_info_extractor.py:677
Method
_create_mxcell_xml
生成mxCell XML字符串 - 供子模块使用 Args: cell_id: 临时ID(合并时会被重新分配) style: DrawIO样式字符串 x, y: 位置
modules/base.py:150
Method
_ensure_output_dir
确保输出目录存在
modules/base.py:140
Method
_merge_overlapping_boxes
合并重叠的边界框
modules/metric_evaluator.py:950
Method
_should_merge
判断两个文字块是否应该合并
modules/text/processors/style.py:288
Method
add_element
添加元素
modules/data_types.py:221
Method
add_prompts_to_group
向指定组添加提示词(运行时)
modules/sam3_info_extractor.py:1048
Method
add_xml_fragment
添加XML片段
modules/data_types.py:225
Method
add_xml_fragment
添加XML片段
modules/base.py:64
Method
analyze_image
(self, image_path: str)
modules/text/ocr/paddle_ocr.py:156
Method
analyze_image
分析图像 Args: image_path: 图像文件路径 Returns: Pix2TextResult: 识别结果(包含文字和公式)
modules/text/ocr/pix2text.py:95
Method
area
(self)
modules/data_types.py:82
Method
area
获取面积(用于排序)
modules/data_types.py:177
Method
box_distance
计算两个框之间的最小距离
modules/metric_evaluator.py:874
Function
calculate_iou
计算两个 bbox [x1,y1,x2,y2] 的 IoU
modules/utils/image_utils.py:8
Method
center
(self)
modules/data_types.py:86
Method
clear_cache
清空图像缓存
modules/sam3_info_extractor.py:362
Function
compute_content_coverage
计算内容覆盖率的简化函数 Args: image_path: 图片路径 bboxes: bbox列表,格式 [[x1,y1,x2,y2], ...] content_threshold: 内容检测阈值
modules/metric_evaluator.py:1470
Function
convert
Upload an image and get editable DrawIO XML. Supported: PNG, JPG, BMP, TIFF, WebP.
server_pa.py:37
Method
convert_to_native
(obj)
modules/metric_evaluator.py:1262
Function
create_geometry
创建 mxGeometry 元素
modules/utils/xml_utils.py:29
Function
create_mxcell
创建 mxCell 元素
modules/utils/xml_utils.py:10
Function
detect_missing_from_rendered_diff
从渲染对比中检测遗漏区域,并裁剪保存 这个函数会: 1. 对比原图和渲染图 2. 找出遗漏的区域 3. 从原图裁剪这些区域 4. 可选保存为单独的图片 Args: original_path: 原始图片路径
modules/metric_evaluator.py:1628
Function
evaluate_and_refine
一键执行评估+补救的便捷函数 这个函数整合了MetricEvaluator和RefinementProcessor的完整流程。 Args: elements: 已检测的元素列表 image_path: 原始图片路径
modules/refinement_processor.py:475
Function
evaluate_result
快捷函数 - 评估转换结果 Args: elements: 元素列表 image_path: 原始图片路径 canvas_width: 画布宽度(可选,会自动从图片获取) canvas_height: 画布高
modules/metric_evaluator.py:1426
Function
extract_elements
快捷函数 - 一行代码提取元素 Args: image_path: 图片路径 groups: 要处理的组列表(默认全部) Returns: ProcessingResult
modules/sam3_info_extractor.py:1091
Function
extract_shape_colors
快捷函数 - 提取所有基本图形的颜色 Args: elements: 元素列表 image_path: 原始图片路径 Returns: 处理后的元素列表
modules/basic_shape_processor.py:1761
Function
extract_with_prompts
Convenience: extract with custom prompts only.
modules/sam3_info_extractor.py:1131
Method
find
(x)
modules/text/processors/style.py:173
Method
find
(x)
modules/text/processors/font_size.py:80
Method
find
(x)
modules/text/processors/font_family.py:261
Method
from_dict
从字典创建
modules/data_types.py:149
Method
from_yaml
从YAML文件加载配置
modules/data_types.py:243
Method
get_all_prompts
Return all prompt groups.
modules/sam3_info_extractor.py:1037
Method
get_all_xml_fragments
获取所有XML片段(优先从xml_fragments,否则从elements提取)
modules/data_types.py:201
Method
get_area
(block)
modules/text/restorer.py:486
Method
get_bbox
(p)
modules/text/restorer.py:424
Function
get_drawio_style
Default DrawIO style by shape type (overridable).
modules/utils/drawio_library.py:23
Method
get_drawio_styles
获取DrawIO样式配置
modules/sam3_info_extractor.py:201
Method
get_elements_by_type
按类型筛选元素
modules/data_types.py:197
Method
get_elements_by_type
按类型获取元素
modules/base.py:52
Method
get_elements_with_xml
获取已经生成XML的元素
modules/base.py:60
Method
get_elements_without_xml
获取还没有生成XML的元素
modules/base.py:56
Method
get_group_config
获取指定组的配置
modules/sam3_info_extractor.py:1044
Function
get_layer_level
根据元素类型获取默认层级 供各子模块使用,确保层级分配一致
modules/data_types.py:258
Function
health
()
server_pa.py:27
Function
health
()
sam3_service/server.py:253
Function
health
()
sam3_service/rmbg_server.py:75
Method
health
(self)
sam3_service/client.py:13
Method
health
(self)
sam3_service/client.py:58
Method
health
(self)
sam3_service/rmbg_client.py:15
Method
health
(self)
sam3_service/rmbg_client.py:58
Method
height
(self)
modules/data_types.py:78
Function
hex_to_rgb
#RRGGBB -> (r, g, b)
modules/utils/color_utils.py:21
Method
icon_processor
(self)
main.py:111
Function
is_complex_image
Whether image is complex enough to treat as picture.
modules/icon_picture_processor.py:431
Method
is_loaded
(self)
modules/base.py:215
Method
layout_ocr
Lazy-init layout OCR (tesseract or paddleocr); fallback to Tesseract if PaddleOCR fails.
modules/text/restorer.py:63
Method
load
加载模型
modules/base.py:200
Method
load_model
加载模型 - 子类可以重写以实现模型加载 模型加载应该是懒加载的,只在第一次需要时加载。 调用模型时应该就是简单的一行代码。
modules/base.py:127
Method
load_model
Alias: load RMBG model.
modules/icon_picture_processor.py:262
Function
main
()
server_pa.py:84
Function
main
()
scripts/merge_xml.py:23
Function
match_element_to_drawio
Map internal type to DrawIO shape name.
modules/utils/drawio_library.py:30
Function
merge_fragments
快捷函数 - 合并XML片段 Args: fragments: XMLFragment列表 canvas_width: 画布宽度 canvas_height: 画布高度 output_path: 输出路径
modules/xml_merger.py:639
Function
merge_shape_and_text
快捷函数 - 合并图形XML和文字XML Args: shape_xml: 图形XML路径 text_xml: 文字XML路径 output_path: 输出路径 Returns:
modules/xml_merger.py:692
Method
merge_xml_files
合并多个XML文件 Args: xml_paths: XML文件路径列表 output_path: 输出路径 canvas_width: 画布宽度 ca
modules/xml_merger.py:459
Method
metric_evaluator
(self)
main.py:131
Method
name
模块名称(用于日志和标识)
modules/base.py:103
Function
parse_drawio_xml
解析 DrawIO XML 文件或字符串,返回根元素
modules/utils/xml_utils.py:58
Method
pix2text_ocr
Lazy-init Pix2Text OCR (None if pix2text not installed).
modules/text/restorer.py:83
Function
predict
(request: PredictRequest)
sam3_service/server.py:257
Method
predict
模型推理
modules/base.py:205
Method
predict
( self, image_path: str, prompts: List[str], return_masks: bool = False,
sam3_service/client.py:17
Method
predict
(self, *args, **kwargs)
sam3_service/client.py:53
Function
prettify_xml
格式化 XML 输出(移除声明、过滤空行)
modules/utils/xml_utils.py:44
Method
process
处理字体(主入口) Args: text_blocks: 文字块列表 global_font: 全局主字体(从最大文字块识别) unify: 是否执行聚类统一
modules/text/processors/font_family.py:92
Function
process_basic_shapes
处理所有基本图形(SAM3结果 + CV补充检测),生成DrawIO XML。 :param image: 原始图像 (BGR) :param sam3_elements: SAM3提取的元素字典 :return: 格式化的XML字符串
modules/basic_shape_processor.py:1601
Function
process_icons_pictures
Process all icon/picture elements. Example: process_icons_pictures(elements, 'test.png').
modules/icon_picture_processor.py:438
Function
refine_bad_regions
快捷函数 - 处理问题区域 Args: elements: 现有元素列表 bad_regions: 问题区域列表(来自MetricEvaluator) image_path: 原始图片路径 config: 可
modules/refinement_processor.py:439
Function
refine_from_rendered_comparison
基于渲染对比进行补救 流程: 1. 对比原图和渲染后的图像 2. 找出差异区域(遗漏的内容) 3. 从原图裁剪这些区域 4. 作为picture元素添加 Args: elements: 现有元素列表
modules/refinement_processor.py:532
Method
refinement_processor
(self)
main.py:137
Method
reload_config
Reload config from disk.
modules/sam3_info_extractor.py:388
Method
remove
(self, image_base64: str)
sam3_service/rmbg_client.py:19
Function
remove_bg
Sync handler so FastAPI runs it in a threadpool, avoiding event-loop starvation.
sam3_service/rmbg_server.py:79
Method
remove_prompts_from_group
Remove prompts from a group at runtime.
modules/sam3_info_extractor.py:1054
Function
rgb_to_hex
RGB -> #RRGGBB
modules/utils/color_utils.py:8
Function
root
()
server_pa.py:32
Method
sam3_extractor
(self)
main.py:105
Method
save_uncovered_mask
保存问题区域可视化图 显示: 1. 检测到的问题区域(红色边框 + 半透明填充) 2. 有 base64 的图片元素(绿色边框) 3. 无 base64 的图片类元素(黄色边框)
modules/metric_evaluator.py:1345
Method
save_visualization
Save visualization (one color per group).
modules/sam3_info_extractor.py:965
Method
save_visualization
保存refinement结果可视化图 Args: context: 处理上下文 new_elements: 新增的元素列表 output_path: 输出路径
modules/refinement_processor.py:383
Method
set_group_threshold
Set group thresholds at runtime.
modules/sam3_info_extractor.py:1060
Method
shape_processor
(self)
main.py:119
Method
text_restorer
OCR/text step; None if deps missing.
main.py:94
Method
union
(x, y)
modules/metric_evaluator.py:904
← previous
next →
201–300 of 308, ranked by callers