mirror of
https://github.com/hzwer/ECCV2022-RIFE.git
synced 2026-02-24 04:19:41 +01:00
Speed up by transport byte
This commit is contained in:
@@ -44,4 +44,4 @@ for i in range(args.exp):
|
||||
if not os.path.exists('output'):
|
||||
os.mkdir('output')
|
||||
for i in range(len(img_list)):
|
||||
cv2.imwrite('output/img{}.png'.format(i), img_list[i][0].cpu().numpy().transpose(1, 2, 0)[:h, :w] * 255)
|
||||
cv2.imwrite('output/img{}.png'.format(i), (img_list[i][0] * 255).byte().cpu().numpy().transpose(1, 2, 0)[:h, :w])
|
||||
|
||||
@@ -92,10 +92,10 @@ while success:
|
||||
mid1 = model.inference(I0, I1)
|
||||
if args.exp == 4:
|
||||
mid = model.inference(torch.cat((I0, mid1), 0), torch.cat((mid1, I1), 0))
|
||||
mid1 = (((mid1[0] * 255.).cpu().detach().numpy().transpose(1, 2, 0))).astype('uint8')
|
||||
mid1 = (((mid1[0] * 255.).byte().cpu().detach().numpy().transpose(1, 2, 0)))
|
||||
if args.exp == 4:
|
||||
mid0 = (((mid[0] * 255.).cpu().detach().numpy().transpose(1, 2, 0))).astype('uint8')
|
||||
mid2 = (((mid[1]* 255.).cpu().detach().numpy().transpose(1, 2, 0))).astype('uint8')
|
||||
mid0 = (((mid[0] * 255.).byte().cpu().detach().numpy().transpose(1, 2, 0)))
|
||||
mid2 = (((mid[1] * 255.).byte().cpu().detach().numpy().transpose(1, 2, 0)))
|
||||
if args.montage:
|
||||
writeframe(np.concatenate((lastframe, lastframe), 1))
|
||||
if args.exp == 4:
|
||||
|
||||
@@ -112,9 +112,9 @@ while success:
|
||||
I1 = F.pad(I1, padding)
|
||||
inferences = make_inference(model, I0, I1, exp=args.exp)
|
||||
|
||||
I0 = ((I0[:, :, :h, :w] * 255.).cpu().detach().numpy().transpose(0, 2, 3, 1)).astype('uint8')
|
||||
I1 = ((I1[:, :, :h, :w] * 255.).cpu().detach().numpy().transpose(0, 2, 3, 1)).astype('uint8')
|
||||
inferences = list(map(lambda x: ((x[:, :, :h, :w] * 255.).cpu().detach().numpy().transpose(0, 2, 3, 1)).astype('uint8'), inferences))
|
||||
I0 = ((I0[:, :, :h, :w] * 255.).byte().cpu().detach().numpy().transpose(0, 2, 3, 1))
|
||||
I1 = ((I1[:, :, :h, :w] * 255.).byte().cpu().detach().numpy().transpose(0, 2, 3, 1))
|
||||
inferences = list(map(lambda x: ((x[:, :, :h, :w] * 255.).byte().cpu().detach().numpy().transpose(0, 2, 3, 1)), inferences))
|
||||
|
||||
write_frame(vid_out, I0, inferences, I1, p.mean(3).mean(2).mean(1), args)
|
||||
pbar.update(4)
|
||||
|
||||
Reference in New Issue
Block a user