Update u2net_portrait_demo.py

This commit is contained in:
adakoda 2020-12-24 11:03:29 +09:00 committed by GitHub
parent db4815f38d
commit 21bc4de1f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -151,10 +151,7 @@ def main():
# load u2net_portrait model
net = U2NET(3,1)
if torch.cuda.is_available():
net.load_state_dict(torch.load(model_dir))
else:
net.load_state_dict(torch.load(model_dir, map_location=torch.device('cpu')))
if torch.cuda.is_available():
net.cuda()
net.eval()