Skip to content

Commit

Permalink
Add missing testing file
Browse files Browse the repository at this point in the history
  • Loading branch information
mmattamala committed Feb 3, 2024
1 parent afb5eff commit 2dc8509
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions wild_visual_navigation/utils/testing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import os
import cv2
import torch
from torchvision import transforms as T
from wild_visual_navigation import WVN_ROOT_DIR


def load_test_image():
np_img = cv2.imread(os.path.join(WVN_ROOT_DIR, "assets/images/forest_clean.png"))
img = torch.from_numpy(cv2.cvtColor(np_img, cv2.COLOR_BGR2RGB))
img = img.permute(2, 0, 1)
img = (img.type(torch.float32) / 255)[None]
return img


def get_dino_transform():
transform = T.Compose(
[
T.Resize(448, T.InterpolationMode.NEAREST),
T.CenterCrop(448),
]
)
return transform


def make_results_folder(name):
path = os.path.join(WVN_ROOT_DIR, "results", name)
os.makedirs(path, exist_ok=True)
return path

0 comments on commit 2dc8509

Please sign in to comment.