Implementation:Datajuicer Data juicer ImageBlurMapper
| Knowledge Sources | |
|---|---|
| Domains | Data_Processing, Mapping |
| Last Updated | 2026-02-14 16:00 GMT |
Overview
Concrete tool for applying blur effects to images in the dataset provided by Data-Juicer.
Description
ImageBlurMapper is a mapper operator that blurs images using one of three supported blur types: mean, box, or Gaussian. The probability of an image being blurred is controlled by the p parameter. The blur effect is applied using a kernel with a specified radius via PIL's ImageFilter module. Blurred images are saved to a configurable output directory. The operator tracks original source file paths for provenance.
Usage
Use when you need to add controlled blur effects to training images for improving model robustness to image quality variations or for privacy-preserving data transformations.
Code Reference
Source Location
- Repository: Datajuicer_Data_juicer
- File: data_juicer/ops/mapper/image_blur_mapper.py
Signature
@OPERATORS.register_module("image_blur_mapper")
class ImageBlurMapper(Mapper):
def __init__(self,
p: float = 0.2,
blur_type: str = "gaussian",
radius: float = 2,
save_dir: str = None,
*args, **kwargs):
Import
from data_juicer.ops.mapper.image_blur_mapper import ImageBlurMapper
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| p | float | No | Probability of the image being blurred, defaults to 0.2 |
| blur_type | str | No | Type of blur kernel: mean, box, or gaussian; defaults to "gaussian" |
| radius | float | No | Radius of blur kernel, defaults to 2 |
| save_dir | str | No | Directory to store generated image files; if not specified, saves in same directory as input |
Outputs
| Name | Type | Description |
|---|---|---|
| samples | Dict | Transformed samples with blurred image paths updated |
Usage Examples
process:
- image_blur_mapper:
p: 0.2
blur_type: "gaussian"
radius: 2