AItool commited on
Commit
12bd70f
·
verified ·
1 Parent(s): fe6f504

Update inference_img.py

Browse files
Files changed (1) hide show
  1. inference_img.py +7 -3
inference_img.py CHANGED
@@ -30,16 +30,17 @@ import warnings
30
  model = Model()
31
  model.load_model(args.modelDir, -1)
32
  print("Loaded RIFE_HDv3 model.")
 
33
  except:
34
  from train_log.IFNet_HDv3 import Model
35
  model = Model()
36
  model.load_model(args.modelDir, -1)
37
  print("Loaded IFNet_HDv3 model.")
 
38
 
39
  model.eval()
40
  model.device()
41
 
42
-
43
  if args.img[0].endswith('.exr') and args.img[1].endswith('.exr'):
44
  img0 = cv2.imread(args.img[0], cv2.IMREAD_COLOR | cv2.IMREAD_ANYDEPTH)
45
  img1 = cv2.imread(args.img[1], cv2.IMREAD_COLOR | cv2.IMREAD_ANYDEPTH)
@@ -59,7 +60,6 @@ import warnings
59
  img0 = F.pad(img0, padding)
60
  img1 = F.pad(img1, padding)
61
 
62
-
63
  if args.ratio:
64
  img_list = [img0]
65
  img0_ratio = 0.0
@@ -97,6 +97,9 @@ import warnings
97
 
98
  if not os.path.exists('output'):
99
  os.mkdir('output')
 
 
 
100
  for i in range(len(img_list)):
101
  if args.img[0].endswith('.exr') and args.img[1].endswith('.exr'):
102
  cv2.imwrite('output/img{}.exr'.format(i), (img_list[i][0]).cpu().numpy().transpose(1, 2, 0)[:h, :w], [cv2.IMWRITE_EXR_TYPE, cv2.IMWRITE_EXR_TYPE_HALF])
@@ -113,5 +116,6 @@ import warnings
113
  save_path = 'output/img{}.png'.format(i)
114
  success = cv2.imwrite(save_path, (img_list[i][0] * 255).byte().cpu().numpy().transpose(1, 2, 0)[:h, :w])
115
  print(f"Saving to {save_path} → success: {success}")
116
-
 
117
 
 
30
  model = Model()
31
  model.load_model(args.modelDir, -1)
32
  print("Loaded RIFE_HDv3 model.")
33
+ print("Checkpoint reached!")
34
  except:
35
  from train_log.IFNet_HDv3 import Model
36
  model = Model()
37
  model.load_model(args.modelDir, -1)
38
  print("Loaded IFNet_HDv3 model.")
39
+ print("Checkpoint reached!")
40
 
41
  model.eval()
42
  model.device()
43
 
 
44
  if args.img[0].endswith('.exr') and args.img[1].endswith('.exr'):
45
  img0 = cv2.imread(args.img[0], cv2.IMREAD_COLOR | cv2.IMREAD_ANYDEPTH)
46
  img1 = cv2.imread(args.img[1], cv2.IMREAD_COLOR | cv2.IMREAD_ANYDEPTH)
 
60
  img0 = F.pad(img0, padding)
61
  img1 = F.pad(img1, padding)
62
 
 
63
  if args.ratio:
64
  img_list = [img0]
65
  img0_ratio = 0.0
 
97
 
98
  if not os.path.exists('output'):
99
  os.mkdir('output')
100
+
101
+ print("Checkpoint reached!")
102
+
103
  for i in range(len(img_list)):
104
  if args.img[0].endswith('.exr') and args.img[1].endswith('.exr'):
105
  cv2.imwrite('output/img{}.exr'.format(i), (img_list[i][0]).cpu().numpy().transpose(1, 2, 0)[:h, :w], [cv2.IMWRITE_EXR_TYPE, cv2.IMWRITE_EXR_TYPE_HALF])
 
116
  save_path = 'output/img{}.png'.format(i)
117
  success = cv2.imwrite(save_path, (img_list[i][0] * 255).byte().cpu().numpy().transpose(1, 2, 0)[:h, :w])
118
  print(f"Saving to {save_path} → success: {success}")
119
+
120
+ print("Checkpoint reached!")
121