ducha-aiki
commited on
Commit
•
2db4e66
1
Parent(s):
d4f1655
Update app.py
Browse files
app.py
CHANGED
@@ -18,8 +18,8 @@ def geometry_transform(images: list,
|
|
18 |
scale = torch.tensor(scale).repeat(len(image_list), 2)
|
19 |
angle = torch.tensor(angle).repeat(len(image_list))
|
20 |
affine_matrix: torch.Tensor = KG.get_affine_matrix2d(translation, center, scale, angle)
|
21 |
-
|
22 |
-
|
23 |
concat_images: list = torch.cat(transformed, dim=-1)
|
24 |
final_images: np.ndarray = K.tensor_to_image(concat_images*255).astype(np.uint8)
|
25 |
|
|
|
18 |
scale = torch.tensor(scale).repeat(len(image_list), 2)
|
19 |
angle = torch.tensor(angle).repeat(len(image_list))
|
20 |
affine_matrix: torch.Tensor = KG.get_affine_matrix2d(translation, center, scale, angle)
|
21 |
+
with torch.inference_mode():
|
22 |
+
transformed: torch.Tensor = KG.transform.warp_affine(image_batch, affine_matrix[:, :2], dsize=image_batch.shape[2:])
|
23 |
concat_images: list = torch.cat(transformed, dim=-1)
|
24 |
final_images: np.ndarray = K.tensor_to_image(concat_images*255).astype(np.uint8)
|
25 |
|