Diffusers
Safetensors
PixCellPipeline
srikarym commited on
Commit
0af40e2
·
verified ·
1 Parent(s): 462ac0e

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. README.md +5 -21
  3. test_image.png +3 -0
.gitattributes CHANGED
@@ -34,3 +34,4 @@ saved_model/**/* 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
  test_image.jpg 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
  test_image.jpg filter=lfs diff=lfs merge=lfs -text
37
+ test_image.png filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -66,30 +66,14 @@ from PIL import Image
66
  from huggingface_hub import hf_hub_download
67
 
68
  # This is an example image we provide
69
- path = hf_hub_download(repo_id="StonyBrook-CVLab/PixCell-256", filename="test_image.jpg")
70
  image = Image.open(path)
71
 
72
- # Extract UNI from random patches in the image
73
- n_patches = 8
74
- patches = []
75
- uni_emb = []
76
- for k in range(n_patches):
77
- # Extract random crop
78
- sz = pipeline.transformer.config.sample_size * pipeline.vae_scale_factor
79
 
80
- x1 = np.random.randint(0, image.size[0] - sz+1)
81
- y1 = np.random.randint(0, image.size[1] - sz+1)
82
- image_patch = image.crop((x1, y1, x1+sz, y1+sz))
83
- patches.append(image_patch)
84
- print("Extracted patch:", patches[-1].size)
85
-
86
- # For 256x256 directly pass through UNI
87
- uni_image = transform(image_patch).unsqueeze(dim=0)
88
- with torch.inference_mode():
89
- feature_emb = uni_model(uni_image.to(device))
90
- uni_emb.append(feature_emb)
91
-
92
- uni_emb = torch.stack(uni_emb, dim=0)
93
  print("Extracted UNI:", uni_emb.shape)
94
 
95
  # Get unconditional embedding for classifier-free guidance
 
66
  from huggingface_hub import hf_hub_download
67
 
68
  # This is an example image we provide
69
+ path = hf_hub_download(repo_id="StonyBrook-CVLab/PixCell-256", filename="test_image.png")
70
  image = Image.open(path)
71
 
72
+ # Extract UNI embedding from the image
73
+ uni_inp = transform(image).unsqueeze(dim=0)
74
+ with torch.inference_mode():
75
+ uni_emb = uni_model(uni_inp.to(device)).unsqueeze(dim=0)
 
 
 
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  print("Extracted UNI:", uni_emb.shape)
78
 
79
  # Get unconditional embedding for classifier-free guidance
test_image.png ADDED

Git LFS Details

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