Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

docs: fix generate_examples crash after kornia.utils namespace removal (#3902)

Dmytro Mishkin3890cef7ede9
diff --git a/docs/generate_examples.py b/docs/generate_examples.py
index b9cda522d..6c0e5bef5 100644
--- a/docs/generate_examples.py
+++ b/docs/generate_examples.py
@@ -89,7 +89,7 @@ def draw_bbox_kpts(imgs: torch.Tensor, bboxes: torch.Tensor, keypoints: torch.Te
rectangle2[..., n, 2] = keypoints[..., n, 0] + 2
rectangle2[..., n, 3] = keypoints[..., n, 1] + 2
color = torch.tensor([0, 0, 1]).repeat(imgs.shape[0], imgs.shape[1], 1)
- imgs_draw = K.utils.draw_rectangle(imgs_draw, rectangle2, color=color, fill=True)
+ imgs_draw = K.image.draw_rectangle(imgs_draw, rectangle2, color=color, fill=True)
return imgs_draw
@@ -242,7 +242,7 @@ def main():
output = torch.cat([img_in[0], img_in[1], img_aug], dim=-1)
# save the output image
- out_np = K.utils.tensor_to_image((output * 255.0).byte())
+ out_np = K.image.tensor_to_image((output * 255.0).byte())
cv2.imwrite(str(OUTPUT_PATH / f"{aug_name}.png"), out_np)
sig = f"{aug_name}({', '.join([str(a) for a in args])}, p=1.0)"
print(f"Generated image example for {aug_name}. {sig}")
@@ -263,7 +263,7 @@ def main():
output = torch.cat([img_in[0], img_in[1], img_aug[0]], dim=-1)
# save the output image
- out_np = K.utils.tensor_to_image((output * 255.0).byte())
+ out_np = K.image.tensor_to_image((output * 255.0).byte())
cv2.imwrite(str(OUTPUT_PATH / f"{aug_name}.png"), out_np)
sig = f"{aug_name}({', '.join([str(a) for a in args])}, p=1.0)"
print(f"Generated image example for {aug_name}. {sig}")
@@ -323,7 +323,7 @@ def main():
output = torch.cat([inp[0], *(out[i] for i in range(out.size(0)))], dim=-1)
# save the output image
- out_np = K.utils.tensor_to_image((output * 255.0).byte())
+ out_np = K.image.tensor_to_image((output * 255.0).byte())
cv2.imwrite(str(OUTPUT_PATH / f"{aug_name}.png"), out_np)
sig = f"{aug_name}({', '.join([str(a) for a in args])}, p=1.0)"
print(f"Generated image example for {aug_name}. {sig}")