Spaces:
Sleeping
Sleeping
Commit
·
5e54341
1
Parent(s):
e4a2983
Fix: file path
Browse files
yolov5.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
|
2 |
import torch
|
3 |
import cv2
|
|
|
4 |
import warnings
|
5 |
warnings.filterwarnings('ignore')
|
6 |
import numpy as np
|
@@ -118,7 +119,7 @@ def get_image_from_url(url, device):
|
|
118 |
and returns a numpy image and a preprocessed
|
119 |
torch tensor ready to pass to the model"""
|
120 |
|
121 |
-
img = np.array(Image.open("
|
122 |
img = cv2.resize(img, (640, 640))
|
123 |
rgb_img_float = np.float32(img) /255.0
|
124 |
input_tensor = torch.from_numpy(rgb_img_float).permute(2, 0, 1).unsqueeze(0).to(device)
|
|
|
1 |
|
2 |
import torch
|
3 |
import cv2
|
4 |
+
import os
|
5 |
import warnings
|
6 |
warnings.filterwarnings('ignore')
|
7 |
import numpy as np
|
|
|
119 |
and returns a numpy image and a preprocessed
|
120 |
torch tensor ready to pass to the model"""
|
121 |
|
122 |
+
img = np.array(Image.open(os.path.join(os.getcwd(), "data/xai/sample1.jpeg")))
|
123 |
img = cv2.resize(img, (640, 640))
|
124 |
rgb_img_float = np.float32(img) /255.0
|
125 |
input_tensor = torch.from_numpy(rgb_img_float).permute(2, 0, 1).unsqueeze(0).to(device)
|