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
Downsample / reduce resolution to limit size before encoding
- vision_unlearning.benchmarks.I_care.utils._decode_image(image_data: str) io.BytesIO
- vision_unlearning.benchmarks.I_care.utils.explanation_to_dict(expl: Any) Dict[str, Any]
Serialize a shap.Explanation to a plain dict (JSON-serializable).
- vision_unlearning.benchmarks.I_care.utils.dict_to_explanation(d: Dict[str, Any]) Any
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]).
- exception vision_unlearning.benchmarks.I_care.utils.InvalidAttributeTypeError
Bases:
ValueErrorInappropriate argument value (of correct type).
- exception vision_unlearning.benchmarks.I_care.utils.InsufficientSamplesError
Bases:
ValueErrorInappropriate argument value (of correct type).