mirror of
https://git.mirrors.martin98.com/https://github.com/xuebinqin/U-2-Net
synced 2025-08-06 05:39:57 +08:00
Update u2net_portrait_demo.py
This commit is contained in:
parent
db4815f38d
commit
21bc4de1f3
@ -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')))
|
||||
net.load_state_dict(torch.load(model_dir))
|
||||
if torch.cuda.is_available():
|
||||
net.cuda()
|
||||
net.eval()
|
||||
|
Loading…
x
Reference in New Issue
Block a user