mustava1259
commited on
Commit
·
72dddd7
1
Parent(s):
8fb6003
This view is limited to 50 files because it contains too many changes.
See raw diff
- __init__.py +0 -0
- __pycache__/get_mask_pil.cpython-310.pyc +0 -0
- __pycache__/handler.cpython-310.pyc +0 -0
- __pycache__/main.cpython-310.pyc +0 -0
- babe.png +3 -0
- babe.py +24 -0
- babe2.png +3 -0
- checkpoints/groundingdino_swint_ogc.pth +3 -0
- checkpoints/sam_hq_vit_h.pth +3 -0
- config/GroundingDINO_SwinB.cfg.py +43 -0
- config/GroundingDINO_SwinT_OGC.py +43 -0
- controlnettest.py +74 -0
- dataset/!!.jpg +3 -0
- dataset/IMG-20230827-181628-646.jpg +3 -0
- dataset/IMG-20230827-181630-397.jpg +3 -0
- dataset/IMG-20230827-181632-690.jpg +3 -0
- dataset/IMG-20230827-181638-304.jpg +3 -0
- dataset/IMG-20230827-181643-885.jpg +3 -0
- dataset/IMG-20230827-181646-163.jpg +3 -0
- dataset/IMG-20230827-181649-851.jpg +3 -0
- dataset/IMG-20230827-181656-020.jpg +3 -0
- dataset/IMG-20230827-181658-282.jpg +3 -0
- dataset/IMG-20230827-181700-703.jpg +3 -0
- dataset/IMG-20230827-181703-067.jpg +3 -0
- dataset/IMG-20230827-181706-476.jpg +3 -0
- dataset/IMG-20230827-181710-771.jpg +3 -0
- dataset/IMG-20230827-181713-058.jpg +3 -0
- dataset/IMG-20230827-181715-473.jpg +3 -0
- dataset/IMG-20230827-181722-144.jpg +3 -0
- dataset/IMG-20230827-181723-992.jpg +3 -0
- dataset/IMG-20230827-181725-901.jpg +3 -0
- dataset/IMG-20230827-181728-513.jpg +3 -0
- dataset/IMG-20230827-181731-005.jpg +3 -0
- dataset/IMG-20230827-181733-095.jpg +3 -0
- dataset/IMG-20230827-181735-972.jpg +3 -0
- dataset/IMG-20230827-181738-954.jpg +3 -0
- dataset/IMG-20230827-181742-823.jpg +3 -0
- dataset/IMG-20230827-181744-861.jpg +3 -0
- dataset/IMG-20230827-181748-035.jpg +3 -0
- dataset/IMG-20230827-181750-138.jpg +3 -0
- dataset/IMG-20230827-181753-001.jpg +3 -0
- dataset/IMG-20230827-181756-132.jpg +3 -0
- dataset/IMG-20230827-181800-815.jpg +3 -0
- dataset/IMG-20230827-181803-220.jpg +3 -0
- dataset/IMG-20230827-181807-694.jpg +3 -0
- dataset/IMG-20230827-181811-150.jpg +3 -0
- dataset/IMG-20230827-181815-044.jpg +3 -0
- dataset/IMG-20230827-181817-215.jpg +3 -0
- dataset/IMG-20230827-181820-590.jpg +3 -0
- dataset/IMG-20230827-181824-801.jpg +3 -0
__init__.py
ADDED
File without changes
|
__pycache__/get_mask_pil.cpython-310.pyc
ADDED
Binary file (527 Bytes). View file
|
|
__pycache__/handler.cpython-310.pyc
ADDED
Binary file (3.29 kB). View file
|
|
__pycache__/main.cpython-310.pyc
ADDED
Binary file (8.47 kB). View file
|
|
babe.png
ADDED
Git LFS Details
|
babe.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
""" from main import get_nude
|
2 |
+
from PIL import Image
|
3 |
+
|
4 |
+
x = get_nude(Image.open("girl.png"))
|
5 |
+
x[0].save("babe.png")
|
6 |
+
|
7 |
+
x = get_nude(Image.open("girl.png"), loras="breastsizeslideroffset.safetensors", lora_weights="1")
|
8 |
+
x[0].save("babe2.png") """
|
9 |
+
|
10 |
+
import concurrent.futures
|
11 |
+
from main import get_nude
|
12 |
+
from PIL import Image
|
13 |
+
|
14 |
+
def process_image_1():
|
15 |
+
x = get_nude(Image.open("girl.png"))
|
16 |
+
x[0].save("babe.png")
|
17 |
+
|
18 |
+
def process_image_2():
|
19 |
+
x = get_nude(Image.open("girl.png"), loras="breastsizeslideroffset.safetensors", lora_weights="1")
|
20 |
+
x[0].save("babe2.png")
|
21 |
+
|
22 |
+
with concurrent.futures.ThreadPoolExecutor() as executor:
|
23 |
+
executor.submit(process_image_1)
|
24 |
+
executor.submit(process_image_2)
|
babe2.png
ADDED
Git LFS Details
|
checkpoints/groundingdino_swint_ogc.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3b3ca2563c77c69f651d7bd133e97139c186df06231157a64c507099c52bc799
|
3 |
+
size 693997677
|
checkpoints/sam_hq_vit_h.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a7ac14a085326d9fa6199c8c698c4f0e7280afdbb974d2c4660ec60877b45e35
|
3 |
+
size 2570940653
|
config/GroundingDINO_SwinB.cfg.py
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
batch_size = 1
|
2 |
+
modelname = "groundingdino"
|
3 |
+
backbone = "swin_B_384_22k"
|
4 |
+
position_embedding = "sine"
|
5 |
+
pe_temperatureH = 20
|
6 |
+
pe_temperatureW = 20
|
7 |
+
return_interm_indices = [1, 2, 3]
|
8 |
+
backbone_freeze_keywords = None
|
9 |
+
enc_layers = 6
|
10 |
+
dec_layers = 6
|
11 |
+
pre_norm = False
|
12 |
+
dim_feedforward = 2048
|
13 |
+
hidden_dim = 256
|
14 |
+
dropout = 0.0
|
15 |
+
nheads = 8
|
16 |
+
num_queries = 900
|
17 |
+
query_dim = 4
|
18 |
+
num_patterns = 0
|
19 |
+
num_feature_levels = 4
|
20 |
+
enc_n_points = 4
|
21 |
+
dec_n_points = 4
|
22 |
+
two_stage_type = "standard"
|
23 |
+
two_stage_bbox_embed_share = False
|
24 |
+
two_stage_class_embed_share = False
|
25 |
+
transformer_activation = "relu"
|
26 |
+
dec_pred_bbox_embed_share = True
|
27 |
+
dn_box_noise_scale = 1.0
|
28 |
+
dn_label_noise_ratio = 0.5
|
29 |
+
dn_label_coef = 1.0
|
30 |
+
dn_bbox_coef = 1.0
|
31 |
+
embed_init_tgt = True
|
32 |
+
dn_labelbook_size = 2000
|
33 |
+
max_text_len = 256
|
34 |
+
text_encoder_type = "bert-base-uncased"
|
35 |
+
use_text_enhancer = True
|
36 |
+
use_fusion_layer = True
|
37 |
+
use_checkpoint = True
|
38 |
+
use_transformer_ckpt = True
|
39 |
+
use_text_cross_attention = True
|
40 |
+
text_dropout = 0.0
|
41 |
+
fusion_dropout = 0.0
|
42 |
+
fusion_droppath = 0.1
|
43 |
+
sub_sentence_present = True
|
config/GroundingDINO_SwinT_OGC.py
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
batch_size = 1
|
2 |
+
modelname = "groundingdino"
|
3 |
+
backbone = "swin_T_224_1k"
|
4 |
+
position_embedding = "sine"
|
5 |
+
pe_temperatureH = 20
|
6 |
+
pe_temperatureW = 20
|
7 |
+
return_interm_indices = [1, 2, 3]
|
8 |
+
backbone_freeze_keywords = None
|
9 |
+
enc_layers = 6
|
10 |
+
dec_layers = 6
|
11 |
+
pre_norm = False
|
12 |
+
dim_feedforward = 2048
|
13 |
+
hidden_dim = 256
|
14 |
+
dropout = 0.0
|
15 |
+
nheads = 8
|
16 |
+
num_queries = 900
|
17 |
+
query_dim = 4
|
18 |
+
num_patterns = 0
|
19 |
+
num_feature_levels = 4
|
20 |
+
enc_n_points = 4
|
21 |
+
dec_n_points = 4
|
22 |
+
two_stage_type = "standard"
|
23 |
+
two_stage_bbox_embed_share = False
|
24 |
+
two_stage_class_embed_share = False
|
25 |
+
transformer_activation = "relu"
|
26 |
+
dec_pred_bbox_embed_share = True
|
27 |
+
dn_box_noise_scale = 1.0
|
28 |
+
dn_label_noise_ratio = 0.5
|
29 |
+
dn_label_coef = 1.0
|
30 |
+
dn_bbox_coef = 1.0
|
31 |
+
embed_init_tgt = True
|
32 |
+
dn_labelbook_size = 2000
|
33 |
+
max_text_len = 256
|
34 |
+
text_encoder_type = "bert-base-uncased"
|
35 |
+
use_text_enhancer = True
|
36 |
+
use_fusion_layer = True
|
37 |
+
use_checkpoint = True
|
38 |
+
use_transformer_ckpt = True
|
39 |
+
use_text_cross_attention = True
|
40 |
+
text_dropout = 0.0
|
41 |
+
fusion_dropout = 0.0
|
42 |
+
fusion_droppath = 0.1
|
43 |
+
sub_sentence_present = True
|
controlnettest.py
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# !pip install transformers accelerate
|
2 |
+
from diffusers import StableDiffusionControlNetInpaintPipeline, ControlNetModel, DDIMScheduler
|
3 |
+
from diffusers.utils import load_image
|
4 |
+
import numpy as np
|
5 |
+
import torch
|
6 |
+
from dw_pose.main import dwpose
|
7 |
+
from PIL import Image
|
8 |
+
|
9 |
+
init_image = load_image(
|
10 |
+
"https://huggingface.co/datasets/diffusers/test-arrays/resolve/main/stable_diffusion_inpaint/boy.png"
|
11 |
+
)
|
12 |
+
# init_image = init_image.resize((512, 512))
|
13 |
+
init_image = Image.open("./girl.png")
|
14 |
+
|
15 |
+
generator = torch.Generator(device="cpu").manual_seed(1)
|
16 |
+
|
17 |
+
mask_image = load_image(
|
18 |
+
"https://huggingface.co/datasets/diffusers/test-arrays/resolve/main/stable_diffusion_inpaint/boy_mask.png"
|
19 |
+
)
|
20 |
+
# mask_image = mask_image.resize((512, 512))
|
21 |
+
mask_image = Image.open("./girlmask.png")
|
22 |
+
|
23 |
+
print("doing dwpose")
|
24 |
+
|
25 |
+
control_image = dwpose(init_image, 512)
|
26 |
+
|
27 |
+
print("done dwpose")
|
28 |
+
|
29 |
+
control_image.save("thecontrolfucking.png")
|
30 |
+
|
31 |
+
print("loading openpose")
|
32 |
+
|
33 |
+
controlnet = ControlNetModel.from_pretrained(
|
34 |
+
"lllyasviel/control_v11p_sd15_openpose", torch_dtype=torch.float16
|
35 |
+
)
|
36 |
+
pipe = StableDiffusionControlNetInpaintPipeline.from_pretrained(
|
37 |
+
"runwayml/stable-diffusion-v1-5", controlnet=controlnet, torch_dtype=torch.float16
|
38 |
+
)
|
39 |
+
|
40 |
+
print("loaded openpsoe")
|
41 |
+
|
42 |
+
# speed up diffusion process with faster scheduler and memory optimization
|
43 |
+
pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
|
44 |
+
|
45 |
+
pipe.enable_model_cpu_offload()
|
46 |
+
|
47 |
+
pipe.safety_checker = None
|
48 |
+
|
49 |
+
init_image_width, init_image_height = init_image.size
|
50 |
+
|
51 |
+
from main import resize
|
52 |
+
|
53 |
+
new_size = resize(
|
54 |
+
init_image_width, init_image_height, 1500)
|
55 |
+
|
56 |
+
init_image_resized = init_image.resize((int(new_size['width']), int(new_size['height'])))
|
57 |
+
mask_image_resized = mask_image.resize((int(new_size['width']), int(new_size['height'])))
|
58 |
+
control_image_resized = control_image.resize((int(new_size['width']), int(new_size['height'])))
|
59 |
+
|
60 |
+
print("ccreating image")
|
61 |
+
|
62 |
+
# generate image
|
63 |
+
image = pipe(
|
64 |
+
"a fucking sexy girl naked",
|
65 |
+
num_inference_steps=20,
|
66 |
+
generator=generator,
|
67 |
+
guidance_scale=6.0,
|
68 |
+
eta=1.0,
|
69 |
+
image=init_image_resized,
|
70 |
+
mask_image=mask_image_resized,
|
71 |
+
control_image=control_image_resized,
|
72 |
+
).images[0].save("aha.png")
|
73 |
+
|
74 |
+
print("created image and saved")
|
dataset/!!.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181628-646.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181630-397.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181632-690.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181638-304.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181643-885.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181646-163.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181649-851.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181656-020.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181658-282.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181700-703.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181703-067.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181706-476.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181710-771.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181713-058.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181715-473.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181722-144.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181723-992.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181725-901.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181728-513.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181731-005.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181733-095.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181735-972.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181738-954.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181742-823.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181744-861.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181748-035.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181750-138.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181753-001.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181756-132.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181800-815.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181803-220.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181807-694.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181811-150.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181815-044.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181817-215.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181820-590.jpg
ADDED
Git LFS Details
|
dataset/IMG-20230827-181824-801.jpg
ADDED
Git LFS Details
|