Spaces:
Sleeping
Sleeping
minor fixes
Browse files
app.py
CHANGED
|
@@ -135,13 +135,14 @@ def create_scene(mesh, img, focal_length=500, camera_center=250, img_res=500):
|
|
| 135 |
IMG.thumbnail((3000, 3000))
|
| 136 |
return IMG
|
| 137 |
|
| 138 |
-
def main(
|
| 139 |
deco_model = initiate_model(model_path)
|
| 140 |
|
| 141 |
smpl_path = os.path.join(constants.SMPL_MODEL_DIR, 'smpl_neutral_tpose.ply')
|
| 142 |
|
| 143 |
-
img =
|
| 144 |
img = cv2.resize(img, (256, 256), cv2.INTER_CUBIC)
|
|
|
|
| 145 |
img = img.transpose(2,0,1)/255.0
|
| 146 |
img = img[np.newaxis,:,:,:]
|
| 147 |
img = torch.tensor(img, dtype = torch.float32).to(device)
|
|
|
|
| 135 |
IMG.thumbnail((3000, 3000))
|
| 136 |
return IMG
|
| 137 |
|
| 138 |
+
def main(pil_img, out_dir='demo_out', model_path='checkpoint/deco_best.pth', mesh_colour=[130, 130, 130, 255], annot_colour=[0, 255, 0, 255]):
|
| 139 |
deco_model = initiate_model(model_path)
|
| 140 |
|
| 141 |
smpl_path = os.path.join(constants.SMPL_MODEL_DIR, 'smpl_neutral_tpose.ply')
|
| 142 |
|
| 143 |
+
img = np.array(pil_img)
|
| 144 |
img = cv2.resize(img, (256, 256), cv2.INTER_CUBIC)
|
| 145 |
+
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
| 146 |
img = img.transpose(2,0,1)/255.0
|
| 147 |
img = img[np.newaxis,:,:,:]
|
| 148 |
img = torch.tensor(img, dtype = torch.float32).to(device)
|