Spaces:
Sleeping
Sleeping
hugohabicht01
commited on
Commit
·
cce3710
1
Parent(s):
53dd78d
make fix now?
Browse files- blurnonymize.py +13 -1
blurnonymize.py
CHANGED
@@ -152,7 +152,7 @@ class ImageBlurnonymizer:
|
|
152 |
self.model_cfg = None
|
153 |
|
154 |
self.checkpoint_name = "/data/sam2.1_hiera_small.pt"
|
155 |
-
self.model_cfg_name = "/data/sam2.1_hiera_s.yaml"
|
156 |
self.init_sam()
|
157 |
|
158 |
def init_sam(self, force=False):
|
@@ -168,9 +168,21 @@ class ImageBlurnonymizer:
|
|
168 |
def download_weights(self):
|
169 |
# TODO: check whether these files already exist, if not, download them
|
170 |
# files names are in self.checkpoint_name and self.model_cfg_name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
checkpoint_url = "https://dl.fbaipublicfiles.com/segment_anything_2/092824/sam2.1_hiera_small.pt"
|
172 |
cfg_url = "https://raw.githubusercontent.com/facebookresearch/sam2/refs/heads/main/sam2/configs/sam2.1/sam2.1_hiera_s.yaml"
|
173 |
|
|
|
|
|
|
|
|
|
|
|
174 |
if not os.path.exists(self.checkpoint_name):
|
175 |
print(
|
176 |
f"Downloading checkpoint from {checkpoint_url} to {self.checkpoint_name}"
|
|
|
152 |
self.model_cfg = None
|
153 |
|
154 |
self.checkpoint_name = "/data/sam2.1_hiera_small.pt"
|
155 |
+
self.model_cfg_name = "/data/configs/sam2.1/sam2.1_hiera_s.yaml"
|
156 |
self.init_sam()
|
157 |
|
158 |
def init_sam(self, force=False):
|
|
|
168 |
def download_weights(self):
|
169 |
# TODO: check whether these files already exist, if not, download them
|
170 |
# files names are in self.checkpoint_name and self.model_cfg_name
|
171 |
+
|
172 |
+
print(f"Current working directory: {os.getcwd()}")
|
173 |
+
print(f"Files in current dir: {os.listdir()}")
|
174 |
+
print(f"Files in root dir: {os.listdir('/')}")
|
175 |
+
|
176 |
+
print(f"Files in /data: {os.listdir('/data')}")
|
177 |
+
|
178 |
checkpoint_url = "https://dl.fbaipublicfiles.com/segment_anything_2/092824/sam2.1_hiera_small.pt"
|
179 |
cfg_url = "https://raw.githubusercontent.com/facebookresearch/sam2/refs/heads/main/sam2/configs/sam2.1/sam2.1_hiera_s.yaml"
|
180 |
|
181 |
+
config_dir = "/data/configs/sam2.1"
|
182 |
+
|
183 |
+
if not os.path.exists(config_dir):
|
184 |
+
os.makedirs(config_dir)
|
185 |
+
|
186 |
if not os.path.exists(self.checkpoint_name):
|
187 |
print(
|
188 |
f"Downloading checkpoint from {checkpoint_url} to {self.checkpoint_name}"
|