vision_unlearning.benchmarks.I_care.utils
Utility helpers for the I-CARE benchmark.
Image encoding/decoding (base64 PNG)
SHAP Explanation serialization (requires shap package — optional dep)
Error classes used across result templates
Note: shap is imported lazily inside functions to avoid forcing all users to install it. It is only needed for the SHAP-related result templates.
Exceptions
Inappropriate argument value (of correct type). |
|
Inappropriate argument value (of correct type). |
Functions
|
Downsample / reduce resolution to limit size before encoding |
|
|
|
Serialize a shap.Explanation to a plain dict (JSON-serializable). |
|
Deserialize a plain dict back to a shap.Explanation. |
Module Contents
- vision_unlearning.benchmarks.I_care.utils._encode_image_file(img_path: str, max_dim: int = 1024) str[source]
Downsample / reduce resolution to limit size before encoding
- vision_unlearning.benchmarks.I_care.utils.explanation_to_dict(expl: Any) Dict[str, Any][source]
Serialize a shap.Explanation to a plain dict (JSON-serializable).
- vision_unlearning.benchmarks.I_care.utils.dict_to_explanation(d: Dict[str, Any]) Any[source]
Deserialize a plain dict back to a shap.Explanation.
Requires ‘shap’ package (optional dependency — install with pip install shap or pip install vision-unlearning[testbed]).