{"id":19070757,"url":"https://github.com/bing-su/asdff","last_synced_at":"2025-04-15T03:53:21.927Z","repository":{"id":182720384,"uuid":"668979968","full_name":"Bing-su/asdff","owner":"Bing-su","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-13T00:45:50.000Z","size":117,"stargazers_count":55,"open_issues_count":9,"forks_count":15,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-15T03:52:58.383Z","etag":null,"topics":["diffusers","python","stable-diffusion"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Bing-su.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-21T04:10:13.000Z","updated_at":"2025-02-18T03:58:14.000Z","dependencies_parsed_at":"2024-11-16T10:03:38.607Z","dependency_job_id":null,"html_url":"https://github.com/Bing-su/asdff","commit_stats":null,"previous_names":["bing-su/asdff"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bing-su%2Fasdff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bing-su%2Fasdff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bing-su%2Fasdff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bing-su%2Fasdff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bing-su","download_url":"https://codeload.github.com/Bing-su/asdff/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249003955,"owners_count":21196794,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["diffusers","python","stable-diffusion"],"created_at":"2024-11-09T01:20:26.620Z","updated_at":"2025-04-15T03:53:21.910Z","avatar_url":"https://github.com/Bing-su.png","language":"Python","readme":"# asdff\n\nAdetailer Stable Diffusion diFFusers pipeline\n\n## 예시\n\n### from pip install\n\n```\npip install asdff\n```\n\n```py\nimport torch\nfrom asdff import AdPipeline\n\npipe = AdPipeline.from_pretrained(\"stablediffusionapi/counterfeit-v30\", torch_dtype=torch.float16)\npipe.safety_checker = None\npipe.to(\"cuda\")\n\ncommon = {\"prompt\": \"masterpiece, best quality, 1girl\", \"num_inference_steps\": 28}\nresult = pipe(common=common)\n\nimages = result[0]\n```\n\n### from custom pipeline\n\nultralytics 설치 필요\n\n```\npip install ultralytics\n```\n\n```py\nimport torch\nfrom diffusers import DiffusionPipeline\n\npipe = DiffusionPipeline.from_pretrained(\n    \"stablediffusionapi/counterfeit-v30\",\n    torch_dtype=torch.float16,\n    custom_pipeline=\"Bingsu/adsd_pipeline\"\n)\npipe.safety_checker = None\npipe.to(\"cuda\")\n\ncommon = {\"prompt\": \"masterpiece, best quality, 1girl\", \"num_inference_steps\": 28}\nresult = pipe(common=common)\n\nimages = result[0]\n```\n\n### 그 외\n\n스케줄러를 변경하고, 입력 이미지를 제공하는 예시\n\n```py\nimport torch\nfrom asdff import AdPipeline\nfrom diffusers import DPMSolverMultistepScheduler\nfrom diffusers.utils import load_image\n\npipe = AdPipeline.from_pretrained(\"stablediffusionapi/counterfeit-v30\", torch_dtype=torch.float16)\npipe.safety_checker = None\npipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)\npipe = pipe.to(\"cuda\")\n\ncommon = {\"prompt\": \"masterpiece, best quality, 1girl\", \"num_inference_steps\": 20}\nimages = load_image(\"https://i.imgur.com/8TX2AX6.png\")\nresult = pipe(common=common, images=[images])\n```\n\n\n## arguments\n\n- `common: Mapping[str, Any] | None`\n\ntxt2img와 inpaint에서 공통적으로 사용할 인자들\n\n- `txt2img_only: Mapping[str, Any] | None`\n\ntxt2img에서만 사용할 인자. common과 겹치는 인자는 덮어씁니다.\n\n[StableDiffusionPipeline.__call__](https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline.__call__)\n\n- `inpaint_only: Mapping[str, Any] | None`\n\ninpaint에서만 사용할 인자. common과 겹치는 인자는 덮어씁니다.\n\n`strength: 0.4`가 기본값으로 적용됩니다.\n\n[StableDiffusionInpaintPipeline.__call__](https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/inpaint#diffusers.StableDiffusionInpaintPipeline.__call__)\n\n- `images: Image | Iterable[Image] | None`\n\ninpaint를 수행할 이미지들. 주어지면 txt2img의 결과를 대체하기 때문에 `txt2img_only`는 무시됩니다.\n\n- `detectors: DetectorType | Iterable[DetectorType] | None`\n\n`DetectorType: Callable[[Image.Image], Optional[List[Image.Image]]]`\n\npil Image를 입력으로 받아 마스크 이미지의 리스트(마스크), 또는 None을 반환하는 Callable.\n\n그런 Callable 하나, Callable의 리스트 또는 None\n\n`None`일경우, `default_detector`가 사용됩니다.\n\n```py\nfrom asdff import AdPipeline\n\npipe = AdPipeline.from_pretrained(...)\npipe.default_detector\n\u003e\u003e\u003e \u003cfunction asdff.yolo.yolo_detector(image: 'Image.Image', model_path: 'str | None' = None, confidence: 'float' = 0.3) -\u003e 'list[Image.Image] | None'\u003e\n```\n\n사용 예시\n\n```py\nfrom functools import partial\n\nimport torch\nfrom asdff import AdPipeline, yolo_detector\nfrom huggingface_hub import hf_hub_download\n\npipe = AdPipeline.from_pretrained(\"stablediffusionapi/counterfeit-v30\", torch_dtype=torch.float16)\npipe.safety_checker = None\npipe.to(\"cuda\")\n\nperson_model_path = hf_hub_download(\"Bingsu/adetailer\", \"person_yolov8s-seg.pt\")\nperson_detector = partial(yolo_detector, model_path=person_model_path)\ncommon = {\"prompt\": \"masterpiece, best quality, 1girl\", \"num_inference_steps\": 28}\nresult = pipe(common=common, detectors=[person_detector, pipe.default_detector])\nresult\n```\n\n- `mask_dilation: int, default = 4`\n\n마스크 감지 후, cv2.dilate 함수를 적용해 마스크 영역을 키우는 데, 이 때 적용할 커널의 크기.\n\n- `mask_blur: int, default = 4`\n\ndilation 후 적용할 가우시안 블러의 커널 크기.\n\n- `mask_padding: int, default = 32`\n\ndilation 적용 후 이 값만큼 bbox의 가로세로 영역을 더해서 이미지를 자른 뒤, inpaint를 시도하게 됩니다.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbing-su%2Fasdff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbing-su%2Fasdff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbing-su%2Fasdff/lists"}