adetailer icon indicating copy to clipboard operation
adetailer copied to clipboard

Feature Request: Only modify target at index N

Open williamkmlau opened this issue 1 year ago • 3 comments

There is currently a huge downside for adetailer, and that is we cannot use it on images with multiple subjects. For example if we have 5 people in an image, adetailer face will modify all subjects.

If we can have an option to only target subject at index N (of the list of detected targets), this will greatly enhance the usability of adetailer. For example if our image has a man and a woman, we can limit 1st tab to index 0 and inpaint a man, and limit 2nd tab to index 1 to inpaint the woman.

williamkmlau avatar May 14 '23 07:05 williamkmlau

I'll try, but I don't think I'll be able to control it as intended.

Bing-su avatar May 14 '23 13:05 Bing-su

How about this: https://github.com/Bing-su/adetailer/wiki/Advanced

Bing-su avatar May 15 '23 07:05 Bing-su

Thanks! This will solve most use cases and is a very big upgrade. The only unfortunate case is that we're still not able to "skip" one of the targets even with the blank option.

williamkmlau avatar May 15 '23 13:05 williamkmlau

hi a did it for version at 26.05.2023 you need change thats files in that version

  1. open !adetailer.py in editor
  2. find-> for j in range(steps):
  3. add after this string -> if j != args.ad_instance_num: continue
  4. open args.py in editor
  5. find-> ad_negative_prompt: str = ""
  6. add after this string-> ad_instance_num: int = 0
  7. find-> ppop = partial(self.ppop, p)
  8. add after-> ppop("ADetailer instance num")
  9. find-> ("ad_negative_prompt", "ADetailer negative prompt"),
  10. add after-> ("ad_instance_num", "ADetailer instance num"),
  11. open ui.py in editor
  12. find-> elem_id=eid("ad_conf"), )
  13. add after-> w.ad_instance_num = gr.Slider( label="Detection instance number" + suffix(n), minimum=0, maximum=6, step=1, value=0, visible=True, elem_id=eid("ad_instance_num"), ) formatting indents are important to keep After this and restart bat you see in UI under Detection spoiler new slider named "Detection instance number" counter of order starts from 0(0 - work with fist only instanse and etc.). Impotant save original files for packed proccessing multimask in the future.

YB-Soft avatar Jun 03 '23 14:06 YB-Soft

also set in settings Sort bounding boxes by Position(left-to-right) And need to undestand when you deleting person or face from original picture using early tabs, in next tabs order of masks changes because in every next tabs list of masks detecting from start

YB-Soft avatar Jun 03 '23 15:06 YB-Soft

Thanks! This will solve most use cases and is a very big upgrade. The only unfortunate case is that we're still not able to "skip" one of the targets even with the blank option.

You can actually now SKIP, see https://github.com/Bing-su/adetailer/wiki/Advanced. And if you changethe order in the Settings to be from big to small area, more or less you can figure out the order in which the faces will be changed. And then you can prompt for each individual one in a wildcard, or skip those that you want to skip.

andupotorac avatar Jun 14 '23 00:06 andupotorac