mirror of
https://git.mirrors.martin98.com/https://github.com/xuebinqin/U-2-Net
synced 2025-08-15 01:26:11 +08:00
Update u2net_portrait_test.py
This commit is contained in:
parent
c92b64ba0e
commit
6b2d7be4fd
@ -84,10 +84,7 @@ def main():
|
|||||||
print("...load U2NET---173.6 MB")
|
print("...load U2NET---173.6 MB")
|
||||||
net = U2NET(3,1)
|
net = U2NET(3,1)
|
||||||
|
|
||||||
if torch.cuda.is_available():
|
net.load_state_dict(torch.load(model_dir))
|
||||||
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():
|
if torch.cuda.is_available():
|
||||||
net.cuda()
|
net.cuda()
|
||||||
net.eval()
|
net.eval()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user