Skip to content

Commit

Permalink
fix the model forward bug caused by old PyTorch version
Browse files Browse the repository at this point in the history
  • Loading branch information
ZHKKKe committed Dec 17, 2020
1 parent 60760ce commit fea4e3a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion demo/image_matting/colab/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
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')
Expand Down
2 changes: 1 addition & 1 deletion demo/video_matting/webcam/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
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)
Expand Down

0 comments on commit fea4e3a

Please sign in to comment.