From e2d8ce9d34685af137466f7054935d693de1e195 Mon Sep 17 00:00:00 2001 From: Hyunmin-H Date: Sun, 16 Jul 2023 08:35:44 +0000 Subject: [PATCH] =?UTF-8?q?[Feat]=20=EC=9B=B9=20=EC=83=81=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EC=B5=9C=EC=A2=85=20=20=EA=B2=B0=EA=B3=BC=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20plotting=20#6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 웹에서 ladi 결과 이미지 출력 - __pycache__파일 github에서 삭제 related to: #7 --- .../app/__pycache__/__main__.cpython-310.pyc | Bin 286 -> 0 bytes .../app/__pycache__/__main__.cpython-38.pyc | Bin 292 -> 0 bytes .../confirm_button_hack.cpython-310.pyc | Bin 2880 -> 0 bytes .../confirm_button_hack.cpython-38.pyc | Bin 2871 -> 0 bytes backend/app/__pycache__/main.cpython-310.pyc | Bin 4867 -> 0 bytes backend/app/__pycache__/main.cpython-38.pyc | Bin 4865 -> 0 bytes backend/app/__pycache__/model.cpython-310.pyc | Bin 2908 -> 0 bytes backend/app/__pycache__/model.cpython-38.pyc | Bin 2910 -> 0 bytes backend/app/frontend.py | 10 +- backend/app/main.py | 17 +- .../__pycache__/inference.cpython-310.pyc | Bin 8610 -> 0 bytes .../ladi_vton/src/dataset/dresscode_modify.py | 380 ------------------ 12 files changed, 14 insertions(+), 393 deletions(-) delete mode 100644 backend/app/__pycache__/__main__.cpython-310.pyc delete mode 100644 backend/app/__pycache__/__main__.cpython-38.pyc delete mode 100644 backend/app/__pycache__/confirm_button_hack.cpython-310.pyc delete mode 100644 backend/app/__pycache__/confirm_button_hack.cpython-38.pyc delete mode 100644 backend/app/__pycache__/main.cpython-310.pyc delete mode 100644 backend/app/__pycache__/main.cpython-38.pyc delete mode 100644 backend/app/__pycache__/model.cpython-310.pyc delete mode 100644 backend/app/__pycache__/model.cpython-38.pyc delete mode 100644 model/ladi_vton/__pycache__/inference.cpython-310.pyc delete mode 100644 model/ladi_vton/src/dataset/dresscode_modify.py diff --git a/backend/app/__pycache__/__main__.cpython-310.pyc b/backend/app/__pycache__/__main__.cpython-310.pyc deleted file mode 100644 index 10a0574c4784acafd902f7a25b1684a8208d44a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 286 zcmYjLO-lnY5KXe{Hi|t7UOlhSjav_b6w!0Ri#_cn#GQ!SW|NTpfc8K5L%jKW_S%zw zK@glR6nw+HnKv*q&rPRi1hL$I!4~U&6#tQ+c*Jb3ku(9aVc`NOFhdKf>6$?VF`PgG zlaH7ZU@wPE`M{;DRb{38#!d3PJ6GOkgkG*RT>rXyKCAa_AazT z60~s&(r7$mRjs8gCS6~ZF4!Roo&6+Xw05AMg>b$VwGl@5+T6;rmv5C-#s|07WjibT lSw0u9s@!M`0^f_Hx6E$`zNj5^Mn6zI*l;9HIK5=??;q8-O85W( diff --git a/backend/app/__pycache__/__main__.cpython-38.pyc b/backend/app/__pycache__/__main__.cpython-38.pyc deleted file mode 100644 index 7456272b8d2f179ded79f98f2cafd8f508dd111d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 292 zcmYjLyGq1B6rD-N>?m&K2M88Iiexrg2qNOzX(7U{O`2iI9o=XqGfXB6yZ_)X*jxEO zX|4PPD{lnBbGhd};2h4wbh<|n2X7y+!TC8J|B>Kvh20$^X#(UW@<%`+YG_F{eU2ao z20M_z&{ImczYTb!KbGpwSX9}==mnjHGQ66e)}V_Gybkl|`;sj#g4h z%8$k7QX7bS>2FAYUVQ8C(KV-D`U84tXGm*zgXe$n zzs?cz90$|Ifx&I4>Ro6!;WQ;(`=wonJKQ}YU6<1h5_o^Y4zeCo{G1jSzF5ygRi8qm z$%r1(UqQ|>;m#`IE_}UJ@`OC0J%=}V^T>bfj2w`6F8T_N-Yc_MCwa!Wh;td~Tr!=r zff(e;P_SOTD)vQO;y%@$Wl$bQG8zaiq%y;maWTU*+7cVVN! zsWm7Dbv#i;8Xd4gCRV>Jvn;gkz|>W0Rkx^rC5?d4*`}L7cxCSAh(rn8Ew;E-a^8;?S(NedF|(k)94PSMVy&~!C-$OI{O4joi+NM1&ZLTX{^ zBNzzMrJMkzp^-poW20T}9r<04H$X^pIDBQ$w^!3Vj#9POt_dj|)74~cPew%{c!+x@ zv)e+4RwyKmJeVweZRqD4WS6_R^1@{y$>N1=KvkEZ;dDeoAZBR64#4WH-#c-t8L=Cs zC1fJ6S~j0ToDe6p@{~w>Cq&M`>A&xH@ZFwXT3xY>g4akQoA^){1DPB(P6lR$ncJube0Ye-<;ptHKLasi0Dl8 zT!oHx;4wrzgsg)hJLSqviF+kHkmSUzJS6qX!+Wfnmg0>UB|fE7@c}x{>^%z zMzkI@@Pd%n!?2nS!$Ho=6#K0({JD%$yCU(qmKasmtk$?^47_wUGCx5>o6z{gr}Lhi zulEO@yny{VY%XFmUXn(rk$3S-3Sc@Kzg=;fGsB<$@5nJW27cuzT{Vm{*#HDp(>`m) z57nHCWm4!6AATXLxec8cclTpaAgfBW9c-PLxd0R0^A@>D>%cXhs21Sy#)maM&3PL= zRm1#wOa)PEnk*L4A(x@K;LOri3lqwxP1paYNr(6UBliTr6^6X>JXKW#)vLg<*Y_T% zK5^tb@R3Ng0k!ky_Ab9ndDmc%jR$&}dRK-wUK?Wo^u*zp3EYMXyDcl>G}lnR^%cXO zfwAyP9e6Pc*ZsGB@Yw~&yDC3~AzT)|aMcX_0g7mlCR$#Bv01Z{krk)z!(X+jvWCQ4 J$GX#U{{>_MDG~qx diff --git a/backend/app/__pycache__/confirm_button_hack.cpython-38.pyc b/backend/app/__pycache__/confirm_button_hack.cpython-38.pyc deleted file mode 100644 index c6a0124bf7452a6e3a11fe89bd866c3adf613a34..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2871 zcmd5;Pj4JG6t`z~x07_!RxK$Ke@#Fn3(YPSh(nb|O&}?is;E-Z%OW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T;hR>>x!_tIRd!ZvZK#p1(V-Az{dJVpkOa27vM*TSI!t0hYP9q zpuwrC36B_P**rkR=ZHX)@pv9)TvAp)4`NW<#GCZg$JjO1>-kS6*dQBk>=k(aKZJ+nhP4P(1iD^UGNG-c-$9)o!*tJ*0Ei$o~ zw_)TgjBLYD?k%z8TrPHLFK{}4$56k7=N#oYC3o-rU#;G_)BE5Ppi^nX#Xd8g(sS`s zT%#eWa1B{HMt76)Qz@a;kUKb1@k_^eiFDfmGq*}80)qyvVOIBh50W& zwOzi|cYeP%(dx~2RCWMlcPs3?f;r;>GHc!il;q&ff&jq21k%nlx^@%5wqfIK4yN28 z2XnqKZZLXw0XaA9C315A27VIkAnH@RW2N*d4AoDgK&;csND0EZwDTuaV>H=>l)_d` zE`wnW5(~C#GbEk|ZLv5-r_rtZ0|CRAA20WQiI4#-ZwH2L5K3@DTJ6wixBXxqJA(cp zc%jp2{P^6oreBb+w>r%=@9fkfM*v77E@IR+P|pbcGHA2qhk|S!*YIk)p-Cc5B5AU8 zFt$dYY*%$Ps?$Y1A~q7@rD_OV@F}vhfYhWRit8PQdALFi&iJ zS?i}7g#@1tgFc*NCmAU<9rW}N6~j~z5E%#E3_r$!Hhj6|+gplDbe>AFigs+{(rul$ zD>hW%wp%!p9w8<|5cYlGwQ*s3Rg(wV2wSYS834KI^n!YVwz`;hoe`X3ig+h*TpqVG w6bOzlif%Dm+*5Q5nGsQNC&XyB;ATX|&WOS{wr&5%cM9L^FBV48n;Q}T1u$1k diff --git a/backend/app/__pycache__/main.cpython-38.pyc b/backend/app/__pycache__/main.cpython-38.pyc deleted file mode 100644 index 42f40053ef93560a593e900c7ec8dea9c6920245..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4865 zcmbVPO>7&-72eq&aOhXcEAOpqJiy?`5t%HDZpvJjgJ~MqIP)~0xy;vH-8Wo=;h653 zzU5lfHoTZ0cjLb8+SE6_F5ht-Kj9{*Z+S_-+wJyy+#bKz?e$Y`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qd3fvQ{M>xG(P)+b2Qz%`f&c&j diff --git a/backend/app/frontend.py b/backend/app/frontend.py index 36311c7..31734d9 100644 --- a/backend/app/frontend.py +++ b/backend/app/frontend.py @@ -49,9 +49,13 @@ def main(): ] response = requests.post("http://localhost:8001/order", files=files) - label = response.json()["products"][0]["result"] - st.write(f'label is {label}') - + # label = response.json()["products"][0]["result"] + # st.write(f'label is {label}') + category = 'lower_body' + output_ladi_buffer_dir = '/opt/ml/user_db/ladi/buffer' + final_result_dir = output_ladi_buffer_dir + final_img = Image.open(os.path.join(final_result_dir, f'{category}.png')) + st.image(final_img, caption='Final Image', use_column_width=True) @cache_on_button_press('Authenticate') def authenticate(password) -> bool: diff --git a/backend/app/main.py b/backend/app/main.py index 1c89695..c6e2a2b 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -40,11 +40,14 @@ def hello_world(): return {"hello": "world"} + class Product(BaseModel): + id: UUID = Field(default_factory=uuid4) name: str price: float result: Optional[List] + class Order(BaseModel): id: UUID = Field(default_factory=uuid4) products: List[Product] = Field(default_factory=list) @@ -90,13 +93,6 @@ async def get_order(order_id: UUID) -> Union[Order, dict]: def get_order_by_id(order_id: UUID) -> Optional[Order]: return next((order for order in orders if order.id == order_id), None) -def convert_png_to_jpg(png_file, jpg_file): - # PNG 파일 열기 - image = Image.open(png_file) - - # JPG로 변환하기 - image = image.convert("RGB") - image.save(jpg_file, "JPEG") # post!! @app.post("/order", description="주문을 요청합니다") @@ -132,7 +128,6 @@ async def make_order(files: List[UploadFile] = File(...), target_buffer_dir = f'{input_dir}/buffer/target' main_schp(target_buffer_dir) - # openpose output_openpose_buffer_dir = '/opt/ml/user_db/openpose/buffer' @@ -144,13 +139,15 @@ async def make_order(files: List[UploadFile] = File(...), db_dir = '/opt/ml/user_db' os.makedirs(output_ladi_buffer_dir, exist_ok=True) main_ladi(db_dir, output_ladi_buffer_dir) - + return None + ## return값 + ## output dir + inference_result = predict_from_image_byte(model=model, image_bytes=image_bytes, config=config) product = InferenceImageProduct(result=inference_result) products.append(product) - new_order = Order(products=products) orders.append(new_order) return new_order diff --git a/model/ladi_vton/__pycache__/inference.cpython-310.pyc b/model/ladi_vton/__pycache__/inference.cpython-310.pyc deleted file mode 100644 index ed496057953b9640d6c1ca8b6f0e836416a3714d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8610 zcmbVR%WoV$S4hvS`_|UR+DIvkg1#=2Uao!|s_; zbq^&DdW2wUV7&)!6d=f9lMTo{1lS;_Ah!TP{(}IE9D+V2$cd*M5+GT}j`I7edxoT( zL$EXGdVKX&)z@Er^}V`PEaoKq)PMSG_WRc)>0ha{|Cd1LT|C~BEJ;javLoqHE$g!A zE4qSOaT2bot8z4!)RST?<)#%$mfVbqFxkZsx#yc>%*d*bV}}s zJ|fyFXVe|j$3#2rjJxCdxM*jb33pPTbPwr=+{5}|cS@fU@T_yhoz|yCJLepAXY?7- z&O684^z8U2iCmz=lUv-(-l z9&ygOWxb5Ks&#%--oCISHD=l9lteAPVvVq|OY}R#l?FMpVU?@)&UTJ5wvS-hHE#Cb&Gp; zs|nzQ?HMmtTHFQ1FxO4nF_#?+1FHXwxn(sh-g$6u>8bU?f7oJ{6L(u{R@3fUJe;A? zPi)!pH=VKwGZMQAQZdx8lJrWUR_~3`}yv3Pexyu$~cC(Jr4Bp4^EQ_H%Tx+@Q zj&B*R<#W46lV_gz#M?!CWu-$5d&)N+H?5_3`CVKRshgj#F3eZwtIS%Tuh9Ybe{`AB zc<$iwy1@0NhRkH9Y{@+-kQxe0_z9-6Buj1KDhWs$kPOT2gXDabv*vPMBHp<4flJRN~MiRlTMBG0NyeW2M(4R*C=)V4pSozq#m5(zGuoLX$fWlLl za~l6Mb%nh(fSv{P9R6iM&+nt)f}a3gv!JWOssrpfHV?`c26S9xm$1v_LH})b#ZT_* zU)_(to!XIlvakB-MrJ$9uCePo%BI{?0)<^)OYpx9lt6Ce`Yj_D(AB%~s5^1D<2ah# zT(LMr!qU7Nx7#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w`6Q2gjf_NsUw{CNiYpL_E0u@kNO(zn_WqL!E=wYHYe@cIs@(u# diff --git a/model/ladi_vton/src/dataset/dresscode_modify.py b/model/ladi_vton/src/dataset/dresscode_modify.py deleted file mode 100644 index 779b837..0000000 --- a/model/ladi_vton/src/dataset/dresscode_modify.py +++ /dev/null @@ -1,380 +0,0 @@ -# File havily based on https://github.com/aimagelab/dress-code/blob/main/data/dataset.py - -import json -import os -import pickle -import random -import sys -from pathlib import Path -from typing import Tuple, Literal - -PROJECT_ROOT = Path(__file__).absolute().parents[2].absolute() -sys.path.insert(0, str(PROJECT_ROOT)) - -import cv2 -import numpy as np -import torch -import torch.utils.data as data -import torchvision.transforms as transforms -from PIL import Image, ImageDraw, ImageOps -from numpy.linalg import lstsq - -from src.utils.labelmap import label_map -from src.utils.posemap import kpoint_to_heatmap - - -class DressCodeDataset(data.Dataset): - def __init__(self, - dataroot_path: str, - phase: Literal['train', 'test'], - radius=5, - caption_filename: str = 'dresscode.json', - order: Literal['paired', 'unpaired'] = 'paired', - outputlist: Tuple[str] = ('c_name', 'im_name', 'cloth', 'image', 'im_cloth', 'shape', 'pose_map', - 'parse_array', 'im_mask', 'inpaint_mask', 'parse_mask_total', - 'captions', 'category', 'warped_cloth', 'clip_cloth_features'), - category: Tuple[str] = ('dresses', 'upper_body', 'lower_body'), - size: Tuple[int, int] = (512, 384), - ): - - super().__init__() - self.dataroot = dataroot_path - self.phase = phase - self.category = category - self.outputlist = outputlist - self.height = size[0] - self.width = size[1] - self.radius = radius - self.transform = transforms.Compose([ - transforms.ToTensor(), - transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)) - ]) - self.transform2D = transforms.Compose([ - transforms.ToTensor(), - transforms.Normalize((0.5,), (0.5,)) - ]) - self.order = order - - im_names = [] - c_names = [] - dataroot_names = [] - - possible_outputs = ['c_name', 'im_name', 'cloth', 'image', 'im_cloth', 'shape', 'im_head', 'im_pose', - 'pose_map', 'parse_array', 'dense_labels', 'dense_uv', 'skeleton', - 'im_mask', 'inpaint_mask', 'parse_mask_total', 'captions', 'category', 'hands', - 'parse_head_2', 'warped_cloth', 'clip_cloth_features'] - - assert all(x in possible_outputs for x in outputlist) - - if "captions" in self.outputlist: - try: - with open(PROJECT_ROOT / 'data' / 'noun_chunks' / caption_filename, 'r') as f: - self.captions_dict = json.load(f) - except FileNotFoundError as e: - print(f"File {caption_filename} not found. NO captions will be loaded.") - - for c in category: - assert c in ['dresses', 'upper_body', 'lower_body'] - - dataroot = os.path.join(self.dataroot, c) - if phase == 'train': - filename = os.path.join(dataroot, f"{phase}_pairs.txt") - else: - filename = os.path.join(dataroot, f"{phase}_pairs_{order}.txt") - - with open(filename, 'r') as f: - for line in f.readlines(): - im_name, c_name = line.strip().split() - - im_names.append(im_name) - c_names.append(c_name) - dataroot_names.append(dataroot) - - self.im_names = im_names - self.c_names = c_names - self.dataroot_names = dataroot_names - - if "clip_cloth_features" in self.outputlist: - self.clip_cloth_features = torch.load(os.path.join( - PROJECT_ROOT / 'data', 'clip_cloth_embeddings', 'dresscode', f'{phase}_last_hidden_state_features.pt'), - map_location='cpu').detach().requires_grad_(False) - - with open(os.path.join( - PROJECT_ROOT / 'data', 'clip_cloth_embeddings', 'dresscode', f'{phase}_features_names.pkl'), 'rb') as f: - self.clip_cloth_features_names = pickle.load(f) - - def __getitem__(self, index): - c_name = self.c_names[index] - im_name = self.im_names[index] - dataroot = self.dataroot_names[index] - category = dataroot.split('/')[-1] - - if "captions" in self.outputlist: # Captions - captions = self.captions_dict[c_name.split('_')[0]] - if self.phase == 'train': - # During training shuffle the captions - random.shuffle(captions) - # Join the captions into a single one - captions = ", ".join(captions) - - if "clip_cloth_features" in self.outputlist: # Precomputed CLIP in-shop embeddings - clip_cloth_features = self.clip_cloth_features[self.clip_cloth_features_names.index(c_name)].float() - - if "cloth" in self.outputlist: # In-shop clothing image - # Clothing image - cloth = Image.open(os.path.join(dataroot, 'images', c_name)) - mask = Image.open(os.path.join(dataroot, 'masks', c_name.replace(".jpg", ".png"))) - - # Mask out the background - cloth = Image.composite(ImageOps.invert(mask.convert('L')), cloth, ImageOps.invert(mask.convert('L'))) - cloth = cloth.resize((self.width, self.height)) - cloth = self.transform(cloth) # [-1,1] - - if "image" in self.outputlist or "im_head" in self.outputlist or "im_cloth" in self.outputlist: - # Person image - image = Image.open(os.path.join(dataroot, 'images', im_name)) - image = image.resize((self.width, self.height)) - image = self.transform(image) # [-1,1] - - if "warped_cloth" in self.outputlist: # Precomputed warped clothing image - if self.order == 'unpaired': - warped_cloth = Image.open( - os.path.join(PROJECT_ROOT, 'data', 'warped_cloths_unpaired', 'dresscode', category, - im_name.replace(".jpg", "") + "_" + c_name)) - warped_cloth = warped_cloth.resize((self.width, self.height)) - warped_cloth = self.transform(warped_cloth) # [-1,1] - - elif self.order == 'paired': - warped_cloth = Image.open( - os.path.join(PROJECT_ROOT, 'data', 'warped_cloths', 'dresscode', category, - im_name.replace(".jpg", "") + "_" + c_name)) - warped_cloth = warped_cloth.resize((self.width, self.height)) - warped_cloth = self.transform(warped_cloth) # [-1,1] - else: - raise ValueError( - f"Order {self.order} not implemented. Please choose between 'paired' and 'unpaired'." - ) - - if "skeleton" in self.outputlist: - # Skeleton - skeleton = Image.open(os.path.join(dataroot, 'skeletons', im_name.replace("_0", "_5"))) - skeleton = skeleton.resize((self.width, self.height)) - skeleton = self.transform(skeleton) - - if "im_pose" in self.outputlist or "parser_mask" in self.outputlist or "im_mask" in self.outputlist or \ - "parse_mask_total" in self.outputlist or "parse_array" in self.outputlist or "pose_map" in \ - self.outputlist or "parse_array" in self.outputlist or "shape" in self.outputlist or "im_head" in self.outputlist: - # Label Map - parse_name = im_name.replace('_0.jpg', '_4.png') - im_parse = Image.open(os.path.join(dataroot, 'label_maps', parse_name)) - im_parse = im_parse.resize((self.width, self.height), Image.NEAREST) - parse_array = np.array(im_parse) - - parse_shape = (parse_array > 0).astype(np.float32) - - parse_head = (parse_array == 1).astype(np.float32) + \ - (parse_array == 2).astype(np.float32) + \ - (parse_array == 3).astype(np.float32) + \ - (parse_array == 11).astype(np.float32) - - parser_mask_fixed = (parse_array == label_map["hair"]).astype(np.float32) + \ - (parse_array == label_map["left_shoe"]).astype(np.float32) + \ - (parse_array == label_map["right_shoe"]).astype(np.float32) + \ - (parse_array == label_map["hat"]).astype(np.float32) + \ - (parse_array == label_map["sunglasses"]).astype(np.float32) + \ - (parse_array == label_map["scarf"]).astype(np.float32) + \ - (parse_array == label_map["bag"]).astype(np.float32) - - parser_mask_changeable = (parse_array == label_map["background"]).astype(np.float32) - - arms = (parse_array == 14).astype(np.float32) + (parse_array == 15).astype(np.float32) - - if dataroot.split('/')[-1] == 'dresses': - label_cat = 7 - parse_cloth = (parse_array == 7).astype(np.float32) - parse_mask = (parse_array == 7).astype(np.float32) + \ - (parse_array == 12).astype(np.float32) + \ - (parse_array == 13).astype(np.float32) - parser_mask_changeable += np.logical_and(parse_array, np.logical_not(parser_mask_fixed)) - - elif dataroot.split('/')[-1] == 'upper_body': - label_cat = 4 - parse_cloth = (parse_array == 4).astype(np.float32) - parse_mask = (parse_array == 4).astype(np.float32) - - parser_mask_fixed += (parse_array == label_map["skirt"]).astype(np.float32) + \ - (parse_array == label_map["pants"]).astype(np.float32) - - parser_mask_changeable += np.logical_and(parse_array, np.logical_not(parser_mask_fixed)) - elif dataroot.split('/')[-1] == 'lower_body': - label_cat = 6 - parse_cloth = (parse_array == 6).astype(np.float32) - parse_mask = (parse_array == 6).astype(np.float32) + \ - (parse_array == 12).astype(np.float32) + \ - (parse_array == 13).astype(np.float32) - - parser_mask_fixed += (parse_array == label_map["upper_clothes"]).astype(np.float32) + \ - (parse_array == 14).astype(np.float32) + \ - (parse_array == 15).astype(np.float32) - parser_mask_changeable += np.logical_and(parse_array, np.logical_not(parser_mask_fixed)) - else: - raise NotImplementedError - - parse_head = torch.from_numpy(parse_head) # [0,1] - parse_cloth = torch.from_numpy(parse_cloth) # [0,1] - parse_mask = torch.from_numpy(parse_mask) # [0,1] - parser_mask_fixed = torch.from_numpy(parser_mask_fixed) - parser_mask_changeable = torch.from_numpy(parser_mask_changeable) - - parse_without_cloth = np.logical_and(parse_shape, np.logical_not(parse_mask)) - parse_mask = parse_mask.cpu().numpy() - - if "im_head" in self.outputlist: - # Masked cloth - im_head = image * parse_head - (1 - parse_head) - if "im_cloth" in self.outputlist: - im_cloth = image * parse_cloth + (1 - parse_cloth) - - # Shape - parse_shape = Image.fromarray((parse_shape * 255).astype(np.uint8)) - parse_shape = parse_shape.resize((self.width // 16, self.height // 16), Image.BILINEAR) - parse_shape = parse_shape.resize((self.width, self.height), Image.BILINEAR) - shape = self.transform2D(parse_shape) # [-1,1] - - # Load pose points - pose_name = im_name.replace('_0.jpg', '_2.json') - with open(os.path.join(dataroot, 'keypoints', pose_name), 'r') as f: - pose_label = json.load(f) - pose_data = pose_label['keypoints'] - pose_data = np.array(pose_data) - pose_data = pose_data.reshape((-1, 4)) - - point_num = pose_data.shape[0] - pose_map = torch.zeros(point_num, self.height, self.width) - r = self.radius * (self.height / 512.0) - im_pose = Image.new('L', (self.width, self.height)) - pose_draw = ImageDraw.Draw(im_pose) - neck = Image.new('L', (self.width, self.height)) - neck_draw = ImageDraw.Draw(neck) - for i in range(point_num): - one_map = Image.new('L', (self.width, self.height)) - draw = ImageDraw.Draw(one_map) - point_x = np.multiply(pose_data[i, 0], self.width / 384.0) - point_y = np.multiply(pose_data[i, 1], self.height / 512.0) - if point_x > 1 and point_y > 1: - draw.rectangle((point_x - r, point_y - r, point_x + r, point_y + r), 'white', 'white') - pose_draw.rectangle((point_x - r, point_y - r, point_x + r, point_y + r), 'white', 'white') - if i == 2 or i == 5: - neck_draw.ellipse((point_x - r * 4, point_y - r * 4, point_x + r * 4, point_y + r * 4), 'white', - 'white') - one_map = self.transform2D(one_map) - pose_map[i] = one_map[0] - - d = [] - for pose_d in pose_data: - ux = pose_d[0] / 384.0 - uy = pose_d[1] / 512.0 - - # scale posemap points - px = ux * self.width - py = uy * self.height - - d.append(kpoint_to_heatmap(np.array([px, py]), (self.height, self.width), 9)) - - pose_map = torch.stack(d) - - # just for visualization - im_pose = self.transform2D(im_pose) - - im_arms = Image.new('L', (self.width, self.height)) - arms_draw = ImageDraw.Draw(im_arms) - if dataroot.split('/')[-1] == 'dresses' or dataroot.split('/')[-1] == 'upper_body' or dataroot.split('/')[ - -1] == 'lower_body': - with open(os.path.join(dataroot, 'keypoints', pose_name), 'r') as f: - data = json.load(f) - shoulder_right = np.multiply(tuple(data['keypoints'][2][:2]), self.height / 512.0) - shoulder_left = np.multiply(tuple(data['keypoints'][5][:2]), self.height / 512.0) - elbow_right = np.multiply(tuple(data['keypoints'][3][:2]), self.height / 512.0) - elbow_left = np.multiply(tuple(data['keypoints'][6][:2]), self.height / 512.0) - wrist_right = np.multiply(tuple(data['keypoints'][4][:2]), self.height / 512.0) - wrist_left = np.multiply(tuple(data['keypoints'][7][:2]), self.height / 512.0) - if wrist_right[0] <= 1. and wrist_right[1] <= 1.: - if elbow_right[0] <= 1. and elbow_right[1] <= 1.: - arms_draw.line( - np.concatenate((wrist_left, elbow_left, shoulder_left, shoulder_right)).astype( - np.uint16).tolist(), 'white', 45, 'curve') - else: - arms_draw.line(np.concatenate( - (wrist_left, elbow_left, shoulder_left, shoulder_right, elbow_right)).astype( - np.uint16).tolist(), 'white', 45, 'curve') - elif wrist_left[0] <= 1. and wrist_left[1] <= 1.: - if elbow_left[0] <= 1. and elbow_left[1] <= 1.: - arms_draw.line( - np.concatenate((shoulder_left, shoulder_right, elbow_right, wrist_right)).astype( - np.uint16).tolist(), 'white', 45, 'curve') - else: - arms_draw.line(np.concatenate( - (elbow_left, shoulder_left, shoulder_right, elbow_right, wrist_right)).astype( - np.uint16).tolist(), 'white', 45, 'curve') - else: - arms_draw.line(np.concatenate( - (wrist_left, elbow_left, shoulder_left, shoulder_right, elbow_right, wrist_right)).astype( - np.uint16).tolist(), 'white', 45, 'curve') - - hands = np.logical_and(np.logical_not(im_arms), arms) - - if dataroot.split('/')[-1] == 'dresses' or dataroot.split('/')[-1] == 'upper_body': - parse_mask += im_arms - parser_mask_fixed += hands - - # delete neck - parse_head_2 = torch.clone(parse_head) - if dataroot.split('/')[-1] == 'dresses' or dataroot.split('/')[-1] == 'upper_body': - with open(os.path.join(dataroot, 'keypoints', pose_name), 'r') as f: - data = json.load(f) - points = [] - points.append(np.multiply(tuple(data['keypoints'][2][:2]), self.height / 512.0)) - points.append(np.multiply(tuple(data['keypoints'][5][:2]), self.height / 512.0)) - x_coords, y_coords = zip(*points) - A = np.vstack([x_coords, np.ones(len(x_coords))]).T - m, c = lstsq(A, y_coords, rcond=None)[0] - for i in range(parse_array.shape[1]): - y = i * m + c - parse_head_2[int(y - 20 * (self.height / 512.0)):, i] = 0 - - parser_mask_fixed = np.logical_or(parser_mask_fixed, np.array(parse_head_2, dtype=np.uint16)) - parse_mask += np.logical_or(parse_mask, np.logical_and(np.array(parse_head, dtype=np.uint16), - np.logical_not( - np.array(parse_head_2, dtype=np.uint16)))) - - parse_mask = cv2.dilate(parse_mask, np.ones((5, 5), np.uint16), iterations=5) - - parse_mask = np.logical_and(parser_mask_changeable, np.logical_not(parse_mask)) - parse_mask_total = np.logical_or(parse_mask, parser_mask_fixed) - im_mask = image * parse_mask_total - inpaint_mask = 1 - parse_mask_total - - inpaint_mask = inpaint_mask.unsqueeze(0) - parse_mask_total = parse_mask_total.numpy() - parse_mask_total = parse_array * parse_mask_total - parse_mask_total = torch.from_numpy(parse_mask_total) - - if "dense_uv" in self.outputlist: - dense_uv = np.load(os.path.join(dataroot, 'dense', im_name.replace('_0.jpg', '_5_uv.npz'))) - dense_uv = dense_uv['uv'] - dense_uv = torch.from_numpy(dense_uv) - dense_uv = transforms.functional.resize(dense_uv, (self.height, self.width), antialias=True) - - if "dense_labels" in self.outputlist: - labels = Image.open(os.path.join(dataroot, 'dense', im_name.replace('_0.jpg', '_5.png'))) - labels = labels.resize((self.width, self.height), Image.NEAREST) - labels = np.array(labels) - - result = {} - for k in self.outputlist: - result[k] = vars()[k] - - return result - - def __len__(self): - return len(self.c_names)