mirror of https://github.com/ZHKKKe/MODNet.git
fix the model forward bug caused by old PyTorch version
parent
60760cea59
commit
fea4e3a2ee
|
|
@ -90,7 +90,7 @@ if __name__ == '__main__':
|
|||
im = F.interpolate(im, size=(im_rh, im_rw), mode='area')
|
||||
|
||||
# inference
|
||||
_, _, matte = modnet(im.cuda(), inference=False)
|
||||
_, _, matte = modnet(im.cuda(), True)
|
||||
|
||||
# resize and save matte
|
||||
matte = F.interpolate(matte, size=(im_h, im_w), mode='area')
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ while(True):
|
|||
frame_tensor = frame_tensor.cuda()
|
||||
|
||||
with torch.no_grad():
|
||||
_, _, matte_tensor = modnet(frame_tensor, inference=True)
|
||||
_, _, matte_tensor = modnet(frame_tensor, True)
|
||||
|
||||
matte_tensor = matte_tensor.repeat(1, 3, 1, 1)
|
||||
matte_np = matte_tensor[0].data.cpu().numpy().transpose(1, 2, 0)
|
||||
|
|
|
|||
Loading…
Reference in New Issue