Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Support RandomChoice for random mask #112

Merged
merged 3 commits into from
Dec 13, 2023

Conversation

okotaku
Copy link
Owner

@okotaku okotaku commented Dec 13, 2023

Motivation

RandomChoice for random mask inpainting.

dict(type="RandomChoice",
         transforms=[
             [dict(
                type="LoadMask",
                mask_mode="irregular",
                mask_config=dict(
                    num_vertices=(4, 10),
                    max_angle=6.0,
                    length_range=(20, 200),
                    brush_width=(10, 100),
                    area_ratio_range=(0.15, 0.65)))],
             [dict(
                type="LoadMask",
                mask_mode="irregular",
                mask_config=dict(
                    num_vertices=(1, 5),
                    max_angle=6.0,
                    length_range=(40, 450),
                    brush_width=(20, 250),
                    area_ratio_range=(0.15, 0.65)))],
             [dict(
                type="LoadMask",
                mask_mode="irregular",
                mask_config=dict(
                    num_vertices=(4, 70),
                    max_angle=6.0,
                    length_range=(15, 100),
                    brush_width=(5, 20),
                    area_ratio_range=(0.15, 0.65)))],
             [dict(
                type="LoadMask",
                mask_mode="bbox",
                mask_config=dict(
                    max_bbox_shape=(150, 150),
                    max_bbox_delta=50,
                    min_margin=0))],
             [dict(
                type="LoadMask",
                mask_mode="bbox",
                mask_config=dict(
                    max_bbox_shape=(300, 300),
                    max_bbox_delta=100,
                    min_margin=10))],
         ]),

Results (Optional)

stable_diffusion_inpaint_dog_multi_mask

input

mask

example

Checklist

Before PR:

  • Pre-commit or other linting tools are used to fix the potential lint issues.
  • Bug fixes are fully covered by unit tests, the case that causes the bug should be added in the unit tests.
  • The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  • The documentation has been modified accordingly, like docstring or example tutorials.

📚 Documentation preview 📚: https://DiffEngine--112.org.readthedocs.build/en/112/

@okotaku okotaku self-assigned this Dec 13, 2023
@okotaku okotaku merged commit 3b62bbe into main Dec 13, 2023
2 checks passed
@okotaku okotaku deleted the feat/support_random_mask_choice branch December 13, 2023 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant