Update bg.py
Browse files
bg.py
CHANGED
@@ -14,6 +14,8 @@ import tempfile
|
|
14 |
|
15 |
warnings.filterwarnings("ignore")
|
16 |
|
|
|
|
|
17 |
|
18 |
# project imports
|
19 |
from data_loader_cache import normalize, im_reader, im_preprocess
|
@@ -22,6 +24,11 @@ from models import *
|
|
22 |
#Helpers
|
23 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
24 |
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
class GOSNormalize(object):
|
27 |
'''
|
|
|
14 |
|
15 |
warnings.filterwarnings("ignore")
|
16 |
|
17 |
+
os.system("git clone https://github.com/xuebinqin/DIS")
|
18 |
+
os.system("mv DIS/IS-Net/* .")
|
19 |
|
20 |
# project imports
|
21 |
from data_loader_cache import normalize, im_reader, im_preprocess
|
|
|
24 |
#Helpers
|
25 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
26 |
|
27 |
+
# Download official weights
|
28 |
+
if not os.path.exists("saved_models"):
|
29 |
+
os.mkdir("saved_models")
|
30 |
+
MODEL_PATH_URL = "https://drive.google.com/uc?id=1KyMpRjewZdyYfxHPYcd-ZbanIXtin0Sn"
|
31 |
+
gdown.download(MODEL_PATH_URL, "saved_models/isnet.pth", use_cookies=False)
|
32 |
|
33 |
class GOSNormalize(object):
|
34 |
'''
|