A sophisticated framework for generating dynamic masks and performing image inpainting using state-of-the-art diffusion models. This framework automates the process of creating diverse mask patterns and applying intelligent inpainting for image manipulation.
-
Dynamic Mask Generation: Creates various types of masks including:
- Rectangle shapes
- Circular patterns
- Elliptical shapes
- Bacteria-like organic patterns
- Freeform shapes with natural contours
-
Automated Inpainting Pipeline: Utilizes advanced diffusion models for seamless image restoration
-
Configurable Parameters: Easily customize mask generation and inpainting settings
-
COCO Dataset Integration: Built-in support for the COCO dataset
-
Logging System: Comprehensive logging for pipeline monitoring
-
Clone the repository:
git clone https://github.com/raghulchandramouli/data_framework cd data_framework -
Install the required dependencies:
pip install -r requirements.txt
The framework uses a YAML configuration file (config.yaml) to manage various settings:
paths:
coco_dir: "path/to/coco/dataset"
mask_dir: "path/to/mask/output"
inpainted_dir: "path/to/inpainted/output"
dataset:
num_images_to_process: 100
start_index: 0
mask:
dilation_kernel: 15
dilation_iterations: 5You can run the pipeline directly from the command line:
python pipeline.pyTo specify a custom configuration file:
python pipeline.py custom_config.yamlAlternatively, you can import and run the pipeline in a Python script:
from pipeline import run_pipeline
# Run with default configuration
run_pipeline()
# Or specify a custom config file
run_pipeline("custom_config.yaml")from mask_generator import generate_dynamic_mask
generate_dynamic_mask(
image_path="path/to/input/image.jpg",
mask_path="path/to/output/mask.png"
)from inpainting import inpaint_image
inpaint_image(
pipe=your_inpainting_pipeline,
image_path="path/to/input/image.jpg",
mask_path="path/to/mask.png",
output_path="path/to/output/inpainted.jpg"
)The mask generator creates dynamic binary masks using various geometric shapes:
- Rectangle: Creates rectangular masks with random positions and sizes
- Circle: Generates circular masks with varying radii
- Ellipse: Produces elliptical masks with random orientations
- Bacteria: Creates organic, bacteria-like shapes using random points
- Freeform: Generates natural-looking irregular shapes
The inpainting system uses a state-of-the-art diffusion model to fill masked regions with contextually appropriate content. Key features include:
- Customizable prompt for guiding the inpainting process
- Adjustable strength parameter for controlling the intensity of changes
- Configurable number of inference steps for quality control
├── config.py # Configuration loading utilities
├── config.yaml # Configuration settings
├── dataset_manager.py # Dataset handling functions
├── inpainting.py # Inpainting implementation
├── mask_generator.py # Mask generation logic
├── pipeline.py # Main pipeline orchestration
├── requirements.txt # Project dependencies
└── utils.py # Utility functions
Contributions are welcome! Please feel free to submit a Pull Request.
[MIT License]