Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Datajuicer Data juicer ImageBlurMapper

From Leeroopedia
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

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

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment