MCPcopy Create free account

hub / github.com/BIT-DataLab/Edit-Banana / functions

Functions308 in github.com/BIT-DataLab/Edit-Banana

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
Methodadd_element
添加元素
modules/data_types.py:221
Methodadd_prompts_to_group
向指定组添加提示词(运行时)
modules/sam3_info_extractor.py:1048
Methodadd_xml_fragment
添加XML片段
modules/data_types.py:225
Methodadd_xml_fragment
添加XML片段
modules/base.py:64
Methodanalyze_image
(self, image_path: str)
modules/text/ocr/paddle_ocr.py:156
Methodanalyze_image
分析图像 Args: image_path: 图像文件路径 Returns: Pix2TextResult: 识别结果(包含文字和公式)
modules/text/ocr/pix2text.py:95
Methodarea
(self)
modules/data_types.py:82
Methodarea
获取面积(用于排序)
modules/data_types.py:177
Methodbox_distance
计算两个框之间的最小距离
modules/metric_evaluator.py:874
Functioncalculate_iou
计算两个 bbox [x1,y1,x2,y2] 的 IoU
modules/utils/image_utils.py:8
Methodcenter
(self)
modules/data_types.py:86
Methodclear_cache
清空图像缓存
modules/sam3_info_extractor.py:362
Functioncompute_content_coverage
计算内容覆盖率的简化函数 Args: image_path: 图片路径 bboxes: bbox列表,格式 [[x1,y1,x2,y2], ...] content_threshold: 内容检测阈值
modules/metric_evaluator.py:1470
Functionconvert
Upload an image and get editable DrawIO XML. Supported: PNG, JPG, BMP, TIFF, WebP.
server_pa.py:37
Methodconvert_to_native
(obj)
modules/metric_evaluator.py:1262
Functioncreate_geometry
创建 mxGeometry 元素
modules/utils/xml_utils.py:29
Functioncreate_mxcell
创建 mxCell 元素
modules/utils/xml_utils.py:10
Functiondetect_missing_from_rendered_diff
从渲染对比中检测遗漏区域,并裁剪保存 这个函数会: 1. 对比原图和渲染图 2. 找出遗漏的区域 3. 从原图裁剪这些区域 4. 可选保存为单独的图片 Args: original_path: 原始图片路径
modules/metric_evaluator.py:1628
Functionevaluate_and_refine
一键执行评估+补救的便捷函数 这个函数整合了MetricEvaluator和RefinementProcessor的完整流程。 Args: elements: 已检测的元素列表 image_path: 原始图片路径
modules/refinement_processor.py:475
Functionevaluate_result
快捷函数 - 评估转换结果 Args: elements: 元素列表 image_path: 原始图片路径 canvas_width: 画布宽度(可选,会自动从图片获取) canvas_height: 画布高
modules/metric_evaluator.py:1426
Functionextract_elements
快捷函数 - 一行代码提取元素 Args: image_path: 图片路径 groups: 要处理的组列表(默认全部) Returns: ProcessingResult
modules/sam3_info_extractor.py:1091
Functionextract_shape_colors
快捷函数 - 提取所有基本图形的颜色 Args: elements: 元素列表 image_path: 原始图片路径 Returns: 处理后的元素列表
modules/basic_shape_processor.py:1761
Functionextract_with_prompts
Convenience: extract with custom prompts only.
modules/sam3_info_extractor.py:1131
Methodfind
(x)
modules/text/processors/style.py:173
Methodfind
(x)
modules/text/processors/font_size.py:80
Methodfind
(x)
modules/text/processors/font_family.py:261
Methodfrom_dict
从字典创建
modules/data_types.py:149
Methodfrom_yaml
从YAML文件加载配置
modules/data_types.py:243
Methodget_all_prompts
Return all prompt groups.
modules/sam3_info_extractor.py:1037
Methodget_all_xml_fragments
获取所有XML片段(优先从xml_fragments,否则从elements提取)
modules/data_types.py:201
Methodget_area
(block)
modules/text/restorer.py:486
Methodget_bbox
(p)
modules/text/restorer.py:424
Functionget_drawio_style
Default DrawIO style by shape type (overridable).
modules/utils/drawio_library.py:23
Methodget_drawio_styles
获取DrawIO样式配置
modules/sam3_info_extractor.py:201
Methodget_elements_by_type
按类型筛选元素
modules/data_types.py:197
Methodget_elements_by_type
按类型获取元素
modules/base.py:52
Methodget_elements_with_xml
获取已经生成XML的元素
modules/base.py:60
Methodget_elements_without_xml
获取还没有生成XML的元素
modules/base.py:56
Methodget_group_config
获取指定组的配置
modules/sam3_info_extractor.py:1044
Functionget_layer_level
根据元素类型获取默认层级 供各子模块使用,确保层级分配一致
modules/data_types.py:258
Functionhealth
()
server_pa.py:27
Functionhealth
()
sam3_service/server.py:253
Functionhealth
()
sam3_service/rmbg_server.py:75
Methodhealth
(self)
sam3_service/client.py:13
Methodhealth
(self)
sam3_service/client.py:58
Methodhealth
(self)
sam3_service/rmbg_client.py:15
Methodhealth
(self)
sam3_service/rmbg_client.py:58
Methodheight
(self)
modules/data_types.py:78
Functionhex_to_rgb
#RRGGBB -> (r, g, b)
modules/utils/color_utils.py:21
Methodicon_processor
(self)
main.py:111
Functionis_complex_image
Whether image is complex enough to treat as picture.
modules/icon_picture_processor.py:431
Methodis_loaded
(self)
modules/base.py:215
Methodlayout_ocr
Lazy-init layout OCR (tesseract or paddleocr); fallback to Tesseract if PaddleOCR fails.
modules/text/restorer.py:63
Methodload
加载模型
modules/base.py:200
Methodload_model
加载模型 - 子类可以重写以实现模型加载 模型加载应该是懒加载的,只在第一次需要时加载。 调用模型时应该就是简单的一行代码。
modules/base.py:127
Methodload_model
Alias: load RMBG model.
modules/icon_picture_processor.py:262
Functionmain
()
server_pa.py:84
Functionmain
()
scripts/merge_xml.py:23
Functionmatch_element_to_drawio
Map internal type to DrawIO shape name.
modules/utils/drawio_library.py:30
Functionmerge_fragments
快捷函数 - 合并XML片段 Args: fragments: XMLFragment列表 canvas_width: 画布宽度 canvas_height: 画布高度 output_path: 输出路径
modules/xml_merger.py:639
Functionmerge_shape_and_text
快捷函数 - 合并图形XML和文字XML Args: shape_xml: 图形XML路径 text_xml: 文字XML路径 output_path: 输出路径 Returns:
modules/xml_merger.py:692
Methodmerge_xml_files
合并多个XML文件 Args: xml_paths: XML文件路径列表 output_path: 输出路径 canvas_width: 画布宽度 ca
modules/xml_merger.py:459
Methodmetric_evaluator
(self)
main.py:131
Methodname
模块名称(用于日志和标识)
modules/base.py:103
Functionparse_drawio_xml
解析 DrawIO XML 文件或字符串,返回根元素
modules/utils/xml_utils.py:58
Methodpix2text_ocr
Lazy-init Pix2Text OCR (None if pix2text not installed).
modules/text/restorer.py:83
Functionpredict
(request: PredictRequest)
sam3_service/server.py:257
Methodpredict
模型推理
modules/base.py:205
Methodpredict
( self, image_path: str, prompts: List[str], return_masks: bool = False,
sam3_service/client.py:17
Methodpredict
(self, *args, **kwargs)
sam3_service/client.py:53
Functionprettify_xml
格式化 XML 输出(移除声明、过滤空行)
modules/utils/xml_utils.py:44
Methodprocess
处理字体(主入口) Args: text_blocks: 文字块列表 global_font: 全局主字体(从最大文字块识别) unify: 是否执行聚类统一
modules/text/processors/font_family.py:92
Functionprocess_basic_shapes
处理所有基本图形(SAM3结果 + CV补充检测),生成DrawIO XML。 :param image: 原始图像 (BGR) :param sam3_elements: SAM3提取的元素字典 :return: 格式化的XML字符串
modules/basic_shape_processor.py:1601
Functionprocess_icons_pictures
Process all icon/picture elements. Example: process_icons_pictures(elements, 'test.png').
modules/icon_picture_processor.py:438
Functionrefine_bad_regions
快捷函数 - 处理问题区域 Args: elements: 现有元素列表 bad_regions: 问题区域列表(来自MetricEvaluator) image_path: 原始图片路径 config: 可
modules/refinement_processor.py:439
Functionrefine_from_rendered_comparison
基于渲染对比进行补救 流程: 1. 对比原图和渲染后的图像 2. 找出差异区域(遗漏的内容) 3. 从原图裁剪这些区域 4. 作为picture元素添加 Args: elements: 现有元素列表
modules/refinement_processor.py:532
Methodrefinement_processor
(self)
main.py:137
Methodreload_config
Reload config from disk.
modules/sam3_info_extractor.py:388
Methodremove
(self, image_base64: str)
sam3_service/rmbg_client.py:19
Functionremove_bg
Sync handler so FastAPI runs it in a threadpool, avoiding event-loop starvation.
sam3_service/rmbg_server.py:79
Methodremove_prompts_from_group
Remove prompts from a group at runtime.
modules/sam3_info_extractor.py:1054
Functionrgb_to_hex
RGB -> #RRGGBB
modules/utils/color_utils.py:8
Functionroot
()
server_pa.py:32
Methodsam3_extractor
(self)
main.py:105
Methodsave_uncovered_mask
保存问题区域可视化图 显示: 1. 检测到的问题区域(红色边框 + 半透明填充) 2. 有 base64 的图片元素(绿色边框) 3. 无 base64 的图片类元素(黄色边框)
modules/metric_evaluator.py:1345
Methodsave_visualization
Save visualization (one color per group).
modules/sam3_info_extractor.py:965
Methodsave_visualization
保存refinement结果可视化图 Args: context: 处理上下文 new_elements: 新增的元素列表 output_path: 输出路径
modules/refinement_processor.py:383
Methodset_group_threshold
Set group thresholds at runtime.
modules/sam3_info_extractor.py:1060
Methodshape_processor
(self)
main.py:119
Methodtext_restorer
OCR/text step; None if deps missing.
main.py:94
Methodunion
(x, y)
modules/metric_evaluator.py:904
← previousnext →201–300 of 308, ranked by callers