guangkaixu commited on
Commit
421cb45
1 Parent(s): d2c1576
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +2 -7
  2. app.py +36 -31
  3. depth_images/depth_1.jpg +3 -0
  4. depth_images/depth_2.jpg +3 -0
  5. depth_images/depth_3.jpg +3 -0
  6. depth_images/depth_4.jpg +3 -0
  7. depth_images/depth_5.jpg +3 -0
  8. depth_images/depth_6.jpg +3 -0
  9. depth_images/depth_7.jpg +3 -0
  10. depth_images/depth_8.jpg +3 -0
  11. depth_images/depth_anime_1.jpg +0 -0
  12. depth_images/depth_anime_2.jpg +0 -0
  13. depth_images/depth_anime_3.jpg +0 -0
  14. depth_images/depth_anime_4.jpg +0 -0
  15. depth_images/depth_anime_5.jpg +0 -0
  16. depth_images/depth_anime_6.jpg +0 -0
  17. depth_images/depth_anime_7.jpg +0 -0
  18. depth_images/depth_line_1.jpg +0 -0
  19. depth_images/depth_line_2.jpg +0 -0
  20. depth_images/depth_line_3.jpg +0 -0
  21. depth_images/depth_line_4.jpg +0 -0
  22. depth_images/depth_line_5.jpg +0 -0
  23. depth_images/depth_line_6.jpg +0 -0
  24. depth_images/depth_real_1.jpg +0 -0
  25. depth_images/depth_real_10.jpg +0 -0
  26. depth_images/depth_real_11.jpg +0 -0
  27. depth_images/depth_real_12.jpg +0 -0
  28. depth_images/depth_real_13.jpg +0 -0
  29. depth_images/depth_real_14.jpg +0 -0
  30. depth_images/depth_real_15.jpg +0 -0
  31. depth_images/depth_real_16.jpg +0 -0
  32. depth_images/depth_real_17.jpg +0 -0
  33. depth_images/depth_real_18.jpg +0 -0
  34. depth_images/depth_real_19.jpg +0 -0
  35. depth_images/depth_real_2.jpg +0 -0
  36. depth_images/depth_real_20.jpg +0 -0
  37. depth_images/depth_real_21.jpg +0 -0
  38. depth_images/depth_real_22.jpg +0 -0
  39. depth_images/depth_real_23.jpg +0 -0
  40. depth_images/depth_real_24.jpg +0 -0
  41. depth_images/depth_real_3.jpg +0 -0
  42. depth_images/depth_real_4.jpg +0 -0
  43. depth_images/depth_real_5.jpg +0 -0
  44. depth_images/depth_real_6.jpg +0 -0
  45. depth_images/depth_real_7.jpg +0 -0
  46. depth_images/depth_real_8.jpg +0 -0
  47. depth_images/depth_real_9.jpg +0 -0
  48. dis_images/dis_10.jpg +0 -0
  49. dis_images/dis_2.jpg +0 -0
  50. 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
- images filter=lfs diff=lfs merge=lfs -text
37
- normal_images/normal_3.jpg filter=lfs diff=lfs merge=lfs -text
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(["depth_anime_%d.jpg" %(i+1) for i in range(7)])
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(10)])
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(5)])
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(["depth_anime_%d.jpg" %(i+1) for i in range(7)])
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
- unet_depth_v2 = CustomUNet2DConditionModel.from_pretrained('guangkaixu/GenPercept-models', subfolder="unet_depth_v2", use_safetensors=True).to(dtype)
842
- unet_normal_v2 = CustomUNet2DConditionModel.from_pretrained('guangkaixu/GenPercept-models', subfolder="unet_normal_v2", use_safetensors=True).to(dtype)
843
- unet_dis_v2 = CustomUNet2DConditionModel.from_pretrained('guangkaixu/GenPercept-models', subfolder="unet_dis_v2", use_safetensors=True).to(dtype)
844
- unet_matting_v2 = CustomUNet2DConditionModel.from_pretrained('guangkaixu/GenPercept-models', subfolder="unet_matting_v2", use_safetensors=True).to(dtype)
845
- unet_disparity_v2 = CustomUNet2DConditionModel.from_pretrained('guangkaixu/GenPercept-models', subfolder="unet_disparity_v2", use_safetensors=True).to(dtype)
846
- unet_seg_v2 = CustomUNet2DConditionModel.from_pretrained('guangkaixu/GenPercept-models', subfolder="unet_seg_v2", use_safetensors=True).to(dtype)
 
 
 
 
 
 
 
 
 
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
- "stabilityai/stable-diffusion-2-1", unet=unet_depth_v2, **pre_loaded_dict,
860
  )
861
 
862
  pipe_normal = GenPerceptPipeline.from_pretrained(
863
- "stabilityai/stable-diffusion-2-1", unet=unet_normal_v2, **pre_loaded_dict,
864
  )
865
 
866
  pipe_dis = GenPerceptPipeline.from_pretrained(
867
- "stabilityai/stable-diffusion-2-1", unet=unet_dis_v2, **pre_loaded_dict,
868
  )
869
 
870
  pipe_matting = GenPerceptPipeline.from_pretrained(
871
- "stabilityai/stable-diffusion-2-1", unet=unet_matting_v2, **pre_loaded_dict,
872
  )
873
 
874
  pipe_seg = GenPerceptPipeline.from_pretrained(
875
- "stabilityai/stable-diffusion-2-1", unet=unet_seg_v2, **pre_loaded_dict,
876
  )
877
 
878
  pipe_disparity = GenPerceptPipeline.from_pretrained(
879
- "stabilityai/stable-diffusion-2-1", unet=unet_disparity_v2, **pre_loaded_dict,
880
  )
881
 
882
- try:
883
- import xformers
884
- pipe_depth.enable_xformers_memory_efficient_attention()
885
- pipe_normal.enable_xformers_memory_efficient_attention()
886
- pipe_dis.enable_xformers_memory_efficient_attention()
887
- pipe_matting.enable_xformers_memory_efficient_attention()
888
- pipe_seg.enable_xformers_memory_efficient_attention()
889
- pipe_disparity.enable_xformers_memory_efficient_attention()
890
- except:
891
- pass # run without xformers
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

  • SHA256: 4f527e7ad927546b28436a401ed99bdaa1433d98838d46963a490149f584c598
  • Pointer size: 131 Bytes
  • Size of remote file: 434 kB
depth_images/depth_2.jpg ADDED

Git LFS Details

  • SHA256: f271391863d34dd1fc06d6490721ea5723b677cc1088aaf50584588353fd8128
  • Pointer size: 130 Bytes
  • Size of remote file: 54.2 kB
depth_images/depth_3.jpg ADDED

Git LFS Details

  • SHA256: d45db37ad4ec593c2b1d0aab347850785d9d065f2b72a777f412c42b32a81943
  • Pointer size: 131 Bytes
  • Size of remote file: 417 kB
depth_images/depth_4.jpg ADDED

Git LFS Details

  • SHA256: 79fe38080cce958e20fd661dc29d69b115cbeffddccaf8a6a397f7b3e98f71e7
  • Pointer size: 130 Bytes
  • Size of remote file: 79.4 kB
depth_images/depth_5.jpg ADDED

Git LFS Details

  • SHA256: b3c52ac509ac4f32f83fb06b1d0f99f8e5a58e75ef5d0e6615416757befd8a23
  • Pointer size: 131 Bytes
  • Size of remote file: 292 kB
depth_images/depth_6.jpg ADDED

Git LFS Details

  • SHA256: 7da86be40e88f33249ce3d7e31b8e725cdc7c8a7daaf45f2c9349860bb6e5deb
  • Pointer size: 131 Bytes
  • Size of remote file: 131 kB
depth_images/depth_7.jpg ADDED

Git LFS Details

  • SHA256: 91672b78a0c7dd8ccd4f5ca91bceeb35a3420f4ee9b8f3d92800fb15d89978e2
  • Pointer size: 131 Bytes
  • Size of remote file: 759 kB
depth_images/depth_8.jpg ADDED

Git LFS Details

  • SHA256: b9f120dae6e73922c4fb24e9dc10c6ce8916a6cf9ca554a7ca4ba379d83f384e
  • Pointer size: 131 Bytes
  • Size of remote file: 665 kB
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

  • SHA256: 6f6eee015f6b2814b250a58cdce8135cd85d8565a0b783270b0954c6bfdc5556
  • Pointer size: 131 Bytes
  • Size of remote file: 426 kB
dis_images/dis_2.jpg CHANGED

Git LFS Details

  • SHA256: 4f2d9cc9c971875363e0a11a892d5710b67d5e299de7778b63758ca570dbd940
  • Pointer size: 131 Bytes
  • Size of remote file: 915 kB
dis_images/dis_3.jpg CHANGED

Git LFS Details

  • SHA256: a58ce229dba6db4c2e43d0acdd6a3edfa1452c154180294fac99996df47fd68b
  • Pointer size: 131 Bytes
  • Size of remote file: 454 kB