Implementation:Open compass VLMEvalKit ChartMimic Color Evaluator Prefix
| Field | Value |
|---|---|
| source | VLMEvalKit |
| domain | Vision, Evaluation, Chart Understanding, Color Extraction |
Overview
Implements prefix-based color extraction by intercepting matplotlib drawing calls and tracking drawn colors and objects for the ChartMimic benchmark.
Description
This module extends the color evaluation approach by monkey-patching matplotlib, networkx, squarify, and other visualization libraries to capture colors and drawn objects during chart rendering. It maintains global drawed_colors and drawed_objects lists/dictionaries, using convert_color_to_hex to normalize all color formats. The prefix evaluator supports advanced chart types including Venn diagrams, tripcolor plots, circle patches, and 3D visualizations. Colors are filtered using filter_color to remove background and axis colors before comparison.
Usage
Called internally by the ChartMimic evaluator during prefix-based color extraction and comparison.
Code Reference
- Source:
vlmeval/dataset/utils/chartmimic/evaluator/color_evaluator_prefix.py, Lines: L1-838 - Import:
from vlmeval.dataset.utils.chartmimic.evaluator.color_evaluator_prefix import convert_color_to_hex, drawed_colors
Key Functions:
def convert_color_to_hex(color): ...
def log_function_specific_for_draw_networkx_labels(func): ...
# Global state variables
drawed_colors = []
drawed_objects = {}
I/O Contract
| Direction | Description |
|---|---|
| Inputs | Model-generated matplotlib code execution that triggers monkey-patched drawing functions |
| Outputs | Global lists of hex color strings (drawed_colors) and object tracking dictionaries (drawed_objects) captured during rendering |
Usage Examples
# Internal usage example
from vlmeval.dataset.utils.chartmimic.evaluator.color_evaluator_prefix import drawed_colors, convert_color_to_hex
hex_val = convert_color_to_hex((0.1, 0.2, 0.3, 1.0))