Hamidreza-Hashemp commited on
Commit
936fbe2
·
1 Parent(s): 582482e

Update kernel_utils.py

Browse files
Files changed (1) hide show
  1. kernel_utils.py +2 -1
kernel_utils.py CHANGED
@@ -325,7 +325,7 @@ def predict_on_video(face_extractor, video_path, batch_size, input_size, models,
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.
@@ -333,6 +333,7 @@ def predict_on_video(face_extractor, video_path, batch_size, input_size, models,
333
  preds = []
334
  for model in models:
335
  # with torch.cuda.amp.autocast():
 
336
  y_pred = model(x[:n].float())
337
  y_pred = torch.sigmoid(y_pred.squeeze())
338
  bpred = y_pred[:n].cpu().numpy()
 
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.
 
333
  preds = []
334
  for model in models:
335
  # with torch.cuda.amp.autocast():
336
+ model = model.float()
337
  y_pred = model(x[:n].float())
338
  y_pred = torch.sigmoid(y_pred.squeeze())
339
  bpred = y_pred[:n].cpu().numpy()