-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afb5eff
commit 2dc8509
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |