Skip to content

Add CIELAB+Sobel physical-consistency losses for inpainting - #32

Open
remyx-ai[bot] wants to merge 1 commit into
mainfrom
structured-prior-guided-diffusion-inpainting-with-physical-c
Open

Add CIELAB+Sobel physical-consistency losses for inpainting#32
remyx-ai[bot] wants to merge 1 commit into
mainfrom
structured-prior-guided-diffusion-inpainting-with-physical-c

Conversation

@remyx-ai

@remyx-ai remyx-ai Bot commented Sep 9, 2026

Copy link
Copy Markdown

What does this PR do?

Adds a pair of physical-consistency losses (CIELAB color + Sobel edge) for structured-object inpainting, packaged as a new research project training script under examples/research_projects/physical_consistency_inpaint/. The losses layer onto components diffusers already ships — SD1.5-inpaint + ControlNet + IP-Adapter — reusing those existing call sites and adding src/loss.py-style CIELAB+Sobel terms. This injects semantic (text/JSON), appearance (IP-Adapter), and geometric (ControlNet) priors together with the two consistency losses to improve fidelity for data-augmentation and precise-editing use cases.

New files include examples/research_projects/physical_consistency_inpaint/requirements.txt (a dependency manifest — please confirm the pins on review).

Test results

Tests could not run in CI — the runner lacks this repo's example dependencies (a collection/import error, not a code failure). Please run the suite locally to validate.

Traceback:
/opt/hostedtoolcache/Python/3.11.16/x64/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
examples/controlnet/test_controlnet.py:23: in <module>
    from test_examples_utils import ExamplesTestsAccelerate, run_command  # noqa: E402
examples/test_examples_utils.py:23: in <module>
    from accelerate.utils import write_basic_config
E   ModuleNotFoundError: No module named 'accelerate'
=========================== short test summary info ============================
ERROR examples/advanced_diffusion_training/test_dreambooth_lora_flux_advanced.py
ERROR examples/consistency_distillation/test_lcm_lora.py
ERROR examples/controlnet/test_controlnet.py
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 3 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
3 errors in 0.11s

Before submitting

  • Did you read the contributor guideline?
  • Did you write any new necessary tests?

Who can review?

@yiyixuxu @sayakpaul

Drafted by Outrider — paper: arXiv:2609.02348.

Discovery context

Drafted by an autonomous discovery loop — Remyx ranks recent arXiv papers against this team's research interest and shipping history; Claude Code selects the candidate most directly implementable against this repo from the lookback window and drafts it.

Research interest: [crossrepo-eval] huggingface/diffusers

Implements Structured-Prior-Guided Diffusion Inpainting with Physical Consistency for Traffic Sign Augmentation.

Reference: https://github.com/52hz-whale/TrafficSignInpaint

License: Apache-2.0 (class: permissive, compat: 1.00, source: github) — safe to adopt.

Why this paper for this team: The paper is a blueprint for specialized controllable generation and inpainting using diffusers components. It addresses maintaining physical consistency in generated images — important for data augmentation where fidelity matters — by injecting semantic (JSON), appearance (IP-Adapter), and geometric (ControlNet) priors combined with physical-consistency losses (CIELAB, Sobel), showing how to combine popular control mechanisms with custom losses for domain-specific generation.

Why this candidate: The contribution is a pair of self-contained, code-backed physical-consistency losses layered onto components diffusers already ships (SD1.5-inpaint + ControlNet + IP-Adapter), so it drops in as a new research_project training script that reuses existing call sites and adds src/loss.py-style CIELAB+Sobel terms — a clean addition with a permissive (Apache-2.0) source. It was the only pool candidate combining real portable code with a verified existing call site; higher-relevance peers lacked real method code ([6],[7]) or a usable license ([10]), and the best-anchored alternative [4] fails the no-code override (training recipe, not a self-contained signal).

Suggested experiment: Use a Stable Diffusion 1.5 model and ControlNet/IP-Adapter in diffusers. Inpaint a structured object (e.g., a license plate on a car) by providing semantic guidance (text prompt), an appearance prior (IP-Adapter embedding of the desired number style), and a geometric prior (ControlNet from a simple template).

Co-Authored-By: remyx-ai[bot] <289541483+remyx-ai[bot]@users.noreply.github.com>

@remyx-ai remyx-ai Bot added outrider:fidelity-done Outrider refinement chain stage label outrider:convention-done and removed outrider:fidelity-done Outrider refinement chain stage label labels Sep 9, 2026
@remyx-ai
remyx-ai Bot marked this pull request as ready for review September 9, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants