Spaces:
Running
on
Zero
Running
on
Zero
guangkaixu
commited on
Commit
•
421cb45
1
Parent(s):
d2c1576
fix
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +2 -7
- app.py +36 -31
- depth_images/depth_1.jpg +3 -0
- depth_images/depth_2.jpg +3 -0
- depth_images/depth_3.jpg +3 -0
- depth_images/depth_4.jpg +3 -0
- depth_images/depth_5.jpg +3 -0
- depth_images/depth_6.jpg +3 -0
- depth_images/depth_7.jpg +3 -0
- depth_images/depth_8.jpg +3 -0
- depth_images/depth_anime_1.jpg +0 -0
- depth_images/depth_anime_2.jpg +0 -0
- depth_images/depth_anime_3.jpg +0 -0
- depth_images/depth_anime_4.jpg +0 -0
- depth_images/depth_anime_5.jpg +0 -0
- depth_images/depth_anime_6.jpg +0 -0
- depth_images/depth_anime_7.jpg +0 -0
- depth_images/depth_line_1.jpg +0 -0
- depth_images/depth_line_2.jpg +0 -0
- depth_images/depth_line_3.jpg +0 -0
- depth_images/depth_line_4.jpg +0 -0
- depth_images/depth_line_5.jpg +0 -0
- depth_images/depth_line_6.jpg +0 -0
- depth_images/depth_real_1.jpg +0 -0
- depth_images/depth_real_10.jpg +0 -0
- depth_images/depth_real_11.jpg +0 -0
- depth_images/depth_real_12.jpg +0 -0
- depth_images/depth_real_13.jpg +0 -0
- depth_images/depth_real_14.jpg +0 -0
- depth_images/depth_real_15.jpg +0 -0
- depth_images/depth_real_16.jpg +0 -0
- depth_images/depth_real_17.jpg +0 -0
- depth_images/depth_real_18.jpg +0 -0
- depth_images/depth_real_19.jpg +0 -0
- depth_images/depth_real_2.jpg +0 -0
- depth_images/depth_real_20.jpg +0 -0
- depth_images/depth_real_21.jpg +0 -0
- depth_images/depth_real_22.jpg +0 -0
- depth_images/depth_real_23.jpg +0 -0
- depth_images/depth_real_24.jpg +0 -0
- depth_images/depth_real_3.jpg +0 -0
- depth_images/depth_real_4.jpg +0 -0
- depth_images/depth_real_5.jpg +0 -0
- depth_images/depth_real_6.jpg +0 -0
- depth_images/depth_real_7.jpg +0 -0
- depth_images/depth_real_8.jpg +0 -0
- depth_images/depth_real_9.jpg +0 -0
- dis_images/dis_10.jpg +0 -0
- dis_images/dis_2.jpg +0 -0
- dis_images/dis_3.jpg +0 -0
.gitattributes
CHANGED
@@ -33,10 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
-
|
37 |
-
|
38 |
-
normal_images/normal_4.jpg filter=lfs diff=lfs merge=lfs -text
|
39 |
-
normal_images/normal_8.jpg filter=lfs diff=lfs merge=lfs -text
|
40 |
-
dis_images/dis_1.jpg filter=lfs diff=lfs merge=lfs -text
|
41 |
-
dis_images/dis_8.jpg filter=lfs diff=lfs merge=lfs -text
|
42 |
-
dis_images/dis_9.jpg filter=lfs diff=lfs merge=lfs -text
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
37 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
@@ -378,9 +378,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
|
|
378 |
)
|
379 |
|
380 |
filenames = []
|
381 |
-
filenames.extend(["
|
382 |
-
filenames.extend(["depth_line_%d.jpg" %(i+1) for i in range(6)])
|
383 |
-
filenames.extend(["depth_real_%d.jpg" %(i+1) for i in range(24)])
|
384 |
|
385 |
example_folder = os.path.join(os.path.dirname(__file__), "depth_images")
|
386 |
Examples(
|
@@ -426,7 +424,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
|
|
426 |
)
|
427 |
|
428 |
filenames = []
|
429 |
-
filenames.extend(["normal_%d.jpg" %(i+1) for i in range(
|
430 |
# example_folder = "images"
|
431 |
# print(os.path.join(example_folder, '1.jpg'))
|
432 |
# example_folder = os.path.join(os.path.dirname(__file__), "images")
|
@@ -572,7 +570,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
|
|
572 |
)
|
573 |
|
574 |
filenames = []
|
575 |
-
filenames.extend(["seg_%d.jpg" %(i+1) for i in range(
|
576 |
|
577 |
example_folder = os.path.join(os.path.dirname(__file__), "seg_images")
|
578 |
Examples(
|
@@ -618,9 +616,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
|
|
618 |
)
|
619 |
|
620 |
filenames = []
|
621 |
-
filenames.extend(["
|
622 |
-
filenames.extend(["depth_line_%d.jpg" %(i+1) for i in range(6)])
|
623 |
-
filenames.extend(["depth_real_%d.jpg" %(i+1) for i in range(24)])
|
624 |
|
625 |
example_folder = os.path.join(os.path.dirname(__file__), "depth_images")
|
626 |
Examples(
|
@@ -837,13 +833,22 @@ def main():
|
|
837 |
|
838 |
dtype = torch.float32
|
839 |
variant = None
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
847 |
|
848 |
scheduler = DDIMSchedulerCustomized.from_pretrained("hf_configs/scheduler_beta_1.0_1.0", subfolder='scheduler')
|
849 |
genpercept_pipeline = True
|
@@ -856,39 +861,39 @@ def main():
|
|
856 |
)
|
857 |
|
858 |
pipe_depth = GenPerceptPipeline.from_pretrained(
|
859 |
-
|
860 |
)
|
861 |
|
862 |
pipe_normal = GenPerceptPipeline.from_pretrained(
|
863 |
-
|
864 |
)
|
865 |
|
866 |
pipe_dis = GenPerceptPipeline.from_pretrained(
|
867 |
-
|
868 |
)
|
869 |
|
870 |
pipe_matting = GenPerceptPipeline.from_pretrained(
|
871 |
-
|
872 |
)
|
873 |
|
874 |
pipe_seg = GenPerceptPipeline.from_pretrained(
|
875 |
-
|
876 |
)
|
877 |
|
878 |
pipe_disparity = GenPerceptPipeline.from_pretrained(
|
879 |
-
|
880 |
)
|
881 |
|
882 |
-
try:
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
except:
|
891 |
-
|
892 |
|
893 |
pipe_depth = pipe_depth.to(device)
|
894 |
pipe_normal = pipe_normal.to(device)
|
|
|
378 |
)
|
379 |
|
380 |
filenames = []
|
381 |
+
filenames.extend(["depth_%d.jpg" %(i+1) for i in range(8)])
|
|
|
|
|
382 |
|
383 |
example_folder = os.path.join(os.path.dirname(__file__), "depth_images")
|
384 |
Examples(
|
|
|
424 |
)
|
425 |
|
426 |
filenames = []
|
427 |
+
filenames.extend(["normal_%d.jpg" %(i+1) for i in range(8)])
|
428 |
# example_folder = "images"
|
429 |
# print(os.path.join(example_folder, '1.jpg'))
|
430 |
# example_folder = os.path.join(os.path.dirname(__file__), "images")
|
|
|
570 |
)
|
571 |
|
572 |
filenames = []
|
573 |
+
filenames.extend(["seg_%d.jpg" %(i+1) for i in range(6)])
|
574 |
|
575 |
example_folder = os.path.join(os.path.dirname(__file__), "seg_images")
|
576 |
Examples(
|
|
|
616 |
)
|
617 |
|
618 |
filenames = []
|
619 |
+
filenames.extend(["depth_%d.jpg" %(i+1) for i in range(8)])
|
|
|
|
|
620 |
|
621 |
example_folder = os.path.join(os.path.dirname(__file__), "depth_images")
|
622 |
Examples(
|
|
|
833 |
|
834 |
dtype = torch.float32
|
835 |
variant = None
|
836 |
+
|
837 |
+
sd21_repo = "stabilityai/stable-diffusion-2-1"
|
838 |
+
unet_depth_v2 = CustomUNet2DConditionModel.from_pretrained('guangkaixu/genpercept-depth', subfolder="unet_depth_v2", use_safetensors=True).to(dtype)
|
839 |
+
unet_normal_v2 = CustomUNet2DConditionModel.from_pretrained('guangkaixu/genpercept-normal', subfolder="unet_normal_v2", use_safetensors=True).to(dtype)
|
840 |
+
unet_dis_v1 = CustomUNet2DConditionModel.from_pretrained('guangkaixu/genpercept-dis', subfolder="unet_dis_v1", use_safetensors=True).to(dtype)
|
841 |
+
unet_matting_v1 = CustomUNet2DConditionModel.from_pretrained('guangkaixu/genpercept-matting', subfolder="unet_matting_v1", use_safetensors=True).to(dtype)
|
842 |
+
unet_disparity_v2 = CustomUNet2DConditionModel.from_pretrained('guangkaixu/genpercept-disparity', subfolder="unet_disparity_v2", use_safetensors=True).to(dtype)
|
843 |
+
unet_seg_v2 = CustomUNet2DConditionModel.from_pretrained('guangkaixu/genpercept-seg', subfolder="unet_seg_v2", use_safetensors=True).to(dtype)
|
844 |
+
|
845 |
+
# sd21_repo = "/mnt/nas/share/home/xugk/code/repo_private/genpercept_from_marigold/pretrained_weights/stable-diffusion-2-1"
|
846 |
+
# unet_depth_v2 = CustomUNet2DConditionModel.from_pretrained('/mnt/nas/share/home/xugk/code/repo_private/genpercept_from_marigold/weights/main_paper/sd21_train_genpercept_exr_1card_ensure_depth_bs8_per_accu_pixel_mse_ssi_grad_loss', subfolder="unet", use_safetensors=True).to(dtype)
|
847 |
+
# unet_normal_v2 = CustomUNet2DConditionModel.from_pretrained('/mnt/nas/share/home/xugk/code/repo_private/genpercept_from_marigold/weights/main_paper/sd21_train_genpercept_exr_1card_ensure_normal_bs4_per_accu_768_angular_loss', subfolder="unet", use_safetensors=True).to(dtype)
|
848 |
+
# unet_dis_v1 = CustomUNet2DConditionModel.from_pretrained('/mnt/nas/share/home/xugk/code/repo_private/genpercept_from_marigold/weights/main_paper/sd21_train_genpercept_exr_1card_ensure_dis_bs4_per_accu_768_pixel_mse_loss', subfolder="unet", use_safetensors=True).to(dtype)
|
849 |
+
# unet_matting_v1 = CustomUNet2DConditionModel.from_pretrained('/mnt/nas/share/home/xugk/code/repo_private/genpercept_from_marigold/weights/main_paper/sd21_train_genpercept_exr_1card_ensure_matting_bs4_per_accu_768_pixel_mse_loss/unet', subfolder="unet", use_safetensors=True).to(dtype)
|
850 |
+
# unet_disparity_v2 = CustomUNet2DConditionModel.from_pretrained('/mnt/nas/share/home/xugk/code/repo_private/genpercept_from_marigold/weights/main_paper/sd21_train_genpercept_exr_1card_ensure_disparity_bs4_per_accu_768_pixel_mse_ssi_grad_loss', subfolder="unet", use_safetensors=True).to(dtype)
|
851 |
+
# unet_seg_v2 = CustomUNet2DConditionModel.from_pretrained('/mnt/nas/share/home/xugk/code/repo_private/genpercept_from_marigold/weights/main_paper/sd21_train_genpercept_exr_1card_ensure_seg_bs4_per_accu_768_pixel_mse_loss', subfolder="unet", use_safetensors=True).to(dtype)
|
852 |
|
853 |
scheduler = DDIMSchedulerCustomized.from_pretrained("hf_configs/scheduler_beta_1.0_1.0", subfolder='scheduler')
|
854 |
genpercept_pipeline = True
|
|
|
861 |
)
|
862 |
|
863 |
pipe_depth = GenPerceptPipeline.from_pretrained(
|
864 |
+
sd21_repo, unet=unet_depth_v2, **pre_loaded_dict,
|
865 |
)
|
866 |
|
867 |
pipe_normal = GenPerceptPipeline.from_pretrained(
|
868 |
+
sd21_repo, unet=unet_normal_v2, **pre_loaded_dict,
|
869 |
)
|
870 |
|
871 |
pipe_dis = GenPerceptPipeline.from_pretrained(
|
872 |
+
sd21_repo, unet=unet_dis_v1, **pre_loaded_dict,
|
873 |
)
|
874 |
|
875 |
pipe_matting = GenPerceptPipeline.from_pretrained(
|
876 |
+
sd21_repo, unet=unet_matting_v1, **pre_loaded_dict,
|
877 |
)
|
878 |
|
879 |
pipe_seg = GenPerceptPipeline.from_pretrained(
|
880 |
+
sd21_repo, unet=unet_seg_v2, **pre_loaded_dict,
|
881 |
)
|
882 |
|
883 |
pipe_disparity = GenPerceptPipeline.from_pretrained(
|
884 |
+
sd21_repo, unet=unet_disparity_v2, **pre_loaded_dict,
|
885 |
)
|
886 |
|
887 |
+
# try:
|
888 |
+
# import xformers
|
889 |
+
# pipe_depth.enable_xformers_memory_efficient_attention()
|
890 |
+
# pipe_normal.enable_xformers_memory_efficient_attention()
|
891 |
+
# pipe_dis.enable_xformers_memory_efficient_attention()
|
892 |
+
# pipe_matting.enable_xformers_memory_efficient_attention()
|
893 |
+
# pipe_seg.enable_xformers_memory_efficient_attention()
|
894 |
+
# pipe_disparity.enable_xformers_memory_efficient_attention()
|
895 |
+
# except:
|
896 |
+
# pass # run without xformers
|
897 |
|
898 |
pipe_depth = pipe_depth.to(device)
|
899 |
pipe_normal = pipe_normal.to(device)
|
depth_images/depth_1.jpg
ADDED
Git LFS Details
|
depth_images/depth_2.jpg
ADDED
Git LFS Details
|
depth_images/depth_3.jpg
ADDED
Git LFS Details
|
depth_images/depth_4.jpg
ADDED
Git LFS Details
|
depth_images/depth_5.jpg
ADDED
Git LFS Details
|
depth_images/depth_6.jpg
ADDED
Git LFS Details
|
depth_images/depth_7.jpg
ADDED
Git LFS Details
|
depth_images/depth_8.jpg
ADDED
Git LFS Details
|
depth_images/depth_anime_1.jpg
DELETED
Binary file (466 kB)
|
|
depth_images/depth_anime_2.jpg
DELETED
Binary file (432 kB)
|
|
depth_images/depth_anime_3.jpg
DELETED
Binary file (456 kB)
|
|
depth_images/depth_anime_4.jpg
DELETED
Binary file (49.1 kB)
|
|
depth_images/depth_anime_5.jpg
DELETED
Binary file (54.7 kB)
|
|
depth_images/depth_anime_6.jpg
DELETED
Binary file (445 kB)
|
|
depth_images/depth_anime_7.jpg
DELETED
Binary file (67.9 kB)
|
|
depth_images/depth_line_1.jpg
DELETED
Binary file (26.1 kB)
|
|
depth_images/depth_line_2.jpg
DELETED
Binary file (63 kB)
|
|
depth_images/depth_line_3.jpg
DELETED
Binary file (44.8 kB)
|
|
depth_images/depth_line_4.jpg
DELETED
Binary file (662 kB)
|
|
depth_images/depth_line_5.jpg
DELETED
Binary file (417 kB)
|
|
depth_images/depth_line_6.jpg
DELETED
Binary file (79.4 kB)
|
|
depth_images/depth_real_1.jpg
DELETED
Binary file (596 kB)
|
|
depth_images/depth_real_10.jpg
DELETED
Binary file (750 kB)
|
|
depth_images/depth_real_11.jpg
DELETED
Binary file (193 kB)
|
|
depth_images/depth_real_12.jpg
DELETED
Binary file (387 kB)
|
|
depth_images/depth_real_13.jpg
DELETED
Binary file (73.6 kB)
|
|
depth_images/depth_real_14.jpg
DELETED
Binary file (281 kB)
|
|
depth_images/depth_real_15.jpg
DELETED
Binary file (54.2 kB)
|
|
depth_images/depth_real_16.jpg
DELETED
Binary file (487 kB)
|
|
depth_images/depth_real_17.jpg
DELETED
Binary file (411 kB)
|
|
depth_images/depth_real_18.jpg
DELETED
Binary file (450 kB)
|
|
depth_images/depth_real_19.jpg
DELETED
Binary file (434 kB)
|
|
depth_images/depth_real_2.jpg
DELETED
Binary file (48.1 kB)
|
|
depth_images/depth_real_20.jpg
DELETED
Binary file (106 kB)
|
|
depth_images/depth_real_21.jpg
DELETED
Binary file (104 kB)
|
|
depth_images/depth_real_22.jpg
DELETED
Binary file (444 kB)
|
|
depth_images/depth_real_23.jpg
DELETED
Binary file (42.5 kB)
|
|
depth_images/depth_real_24.jpg
DELETED
Binary file (330 kB)
|
|
depth_images/depth_real_3.jpg
DELETED
Binary file (372 kB)
|
|
depth_images/depth_real_4.jpg
DELETED
Binary file (267 kB)
|
|
depth_images/depth_real_5.jpg
DELETED
Binary file (196 kB)
|
|
depth_images/depth_real_6.jpg
DELETED
Binary file (96 kB)
|
|
depth_images/depth_real_7.jpg
DELETED
Binary file (928 kB)
|
|
depth_images/depth_real_8.jpg
DELETED
Binary file (257 kB)
|
|
depth_images/depth_real_9.jpg
DELETED
Binary file (232 kB)
|
|
dis_images/dis_10.jpg
CHANGED
Git LFS Details
|
dis_images/dis_2.jpg
CHANGED
Git LFS Details
|
dis_images/dis_3.jpg
CHANGED
Git LFS Details
|