Spaces:
Runtime error
Runtime error
Commit ·
582482e
1
Parent(s): 4ca43b0
Update kernel_utils.py
Browse files- kernel_utils.py +3 -3
kernel_utils.py
CHANGED
|
@@ -199,7 +199,7 @@ class VideoReader:
|
|
| 199 |
class FaceExtractor:
|
| 200 |
def __init__(self, video_read_fn):
|
| 201 |
self.video_read_fn = video_read_fn
|
| 202 |
-
self.detector = MTCNN(margin=0, thresholds=[0.7, 0.8, 0.8], device='
|
| 203 |
|
| 204 |
def process_videos(self, input_dir, filenames, video_idxs):
|
| 205 |
videos_read = []
|
|
@@ -322,10 +322,10 @@ def predict_on_video(face_extractor, video_path, batch_size, input_size, models,
|
|
| 322 |
else:
|
| 323 |
pass
|
| 324 |
if n > 0:
|
| 325 |
-
x = torch.tensor(x, device="
|
| 326 |
# Preprocess the images.
|
| 327 |
x = x.permute((0, 3, 1, 2))
|
| 328 |
-
|
| 329 |
for i in range(len(x)):
|
| 330 |
x[i] = normalize_transform(x[i] / 255.)
|
| 331 |
# Make a prediction, then take the average.
|
|
|
|
| 199 |
class FaceExtractor:
|
| 200 |
def __init__(self, video_read_fn):
|
| 201 |
self.video_read_fn = video_read_fn
|
| 202 |
+
self.detector = MTCNN(margin=0, thresholds=[0.7, 0.8, 0.8], device='cpu')
|
| 203 |
|
| 204 |
def process_videos(self, input_dir, filenames, video_idxs):
|
| 205 |
videos_read = []
|
|
|
|
| 322 |
else:
|
| 323 |
pass
|
| 324 |
if n > 0:
|
| 325 |
+
x = torch.tensor(x, device="cpu").float()
|
| 326 |
# Preprocess the images.
|
| 327 |
x = x.permute((0, 3, 1, 2))
|
| 328 |
+
x = x.to('cpu')
|
| 329 |
for i in range(len(x)):
|
| 330 |
x[i] = normalize_transform(x[i] / 255.)
|
| 331 |
# Make a prediction, then take the average.
|