RootYuan commited on
Commit
0c2b9b7
1 Parent(s): a864e93

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +18 -1
README.md CHANGED
@@ -2,6 +2,8 @@
2
  license: apache-2.0
3
  ---
4
 
 
 
5
  # PaintMind
6
 
7
  ## Install
@@ -15,6 +17,19 @@ import paintmind as pm
15
  ````
16
 
17
  ## Reconstruction
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  #### 1.
19
  ````
20
  pm.reconstruction(img_url='https://cdn.pixabay.com/photo/2014/10/22/15/47/squirrel-498139_960_720.jpg')
@@ -55,4 +70,6 @@ pm.reconstruction(img_url='https://cdn.pixabay.com/photo/2017/10/28/07/47/woman-
55
  <img src="https://github.com/Qiyuan-Ge/PaintMind/blob/main/assets/rec_5.png?raw=true">
56
  </div>
57
 
58
- ````
 
 
 
2
  license: apache-2.0
3
  ---
4
 
5
+ More detail in: https://github.com/Qiyuan-Ge/PaintMind
6
+
7
  # PaintMind
8
 
9
  ## Install
 
17
  ````
18
 
19
  ## Reconstruction
20
+ ````
21
+ img = Image.open(img_path).convert('RGB')
22
+ img = pm.stage1_transform(is_train=False)(img)
23
+ # load pretrained vit-vqgan
24
+ model = pm.create_model(arch='vqgan', version='vit-s-vqgan', pretrained=True)
25
+ # encode image to latent
26
+ z, _, _ = model.encode(img.unsqueeze(0))
27
+ # decode latent to image
28
+ rec = model.decode(z).squeeze(0)
29
+ rec = torch.clamp(rec, -1., 1.)
30
+ ````
31
+
32
+
33
  #### 1.
34
  ````
35
  pm.reconstruction(img_url='https://cdn.pixabay.com/photo/2014/10/22/15/47/squirrel-498139_960_720.jpg')
 
70
  <img src="https://github.com/Qiyuan-Ge/PaintMind/blob/main/assets/rec_5.png?raw=true">
71
  </div>
72
 
73
+ ## Text2Image
74
+ Not finish yet~~
75
+