Commit 590cd6dd authored by mac's avatar mac

c

parent 46f0ec13
Pipeline #348 canceled with stages
...@@ -76,6 +76,7 @@ def img2Comix(args,net,device,image): ...@@ -76,6 +76,7 @@ def img2Comix(args,net,device,image):
image = img_2_x32(image,args.x32) image = img_2_x32(image,args.x32)
with torch.no_grad(): with torch.no_grad():
print('----------torch.no_grad() handle')
image = to_tensor(image).unsqueeze(0) * 2 - 1 image = to_tensor(image).unsqueeze(0) * 2 - 1
out = net(image.to(device), args.upsample_align).cpu() out = net(image.to(device), args.upsample_align).cpu()
out = out.squeeze(0).clip(-1, 1) * 0.5 + 0.5 out = out.squeeze(0).clip(-1, 1) * 0.5 + 0.5
...@@ -145,12 +146,13 @@ def video2comix(args): ...@@ -145,12 +146,13 @@ def video2comix(args):
print('video2comix - read frame is none') print('video2comix - read frame is none')
break break
if su: if su:
save(frame, args.output_dir, imgname + str(i))
# transform frame 2 comix # transform frame 2 comix
# 风格化处理 # 风格化处理
style_frame = img2Comix(args,net,device,frame) style_frame = img2Comix(args,net,device,frame)
save(frame, args.output_dir, imgname + str(i))
if i == 0: if i == 0:
style_frame.save(os.path.join(args.output_dir, imgname + str(i) + "_c")) style_frame.save(os.path.join(args.output_dir, imgname + str(i) + "_c.jpg"))
#save(style_frame, args.output_dir, imgname + str(i) + "_c") #save(style_frame, args.output_dir, imgname + str(i) + "_c")
img = style_frame.astype('uint8') img = style_frame.astype('uint8')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment