Skip to content

Commit 421ab05

Browse files
fix download error
Signed-off-by: Sachidanand Alle <[email protected]>
1 parent d3696a6 commit 421ab05

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

sample-apps/endoscopy/lib/configs/deepedit.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ def init(self, name: str, model_dir: str, conf: Dict[str, str], planner: Any, **
4545
# Download PreTrained Model
4646
if strtobool(self.conf.get("use_pretrained_model", "true")):
4747
url = f"{self.conf.get('pretrained_path', self.PRE_TRAINED_PATH)}/endoscopy_deepedit_tooltracking.pt"
48-
download_file(url, self.path[0])
48+
try:
49+
download_file(url, self.path[0])
50+
except:
51+
logger.warning(f"Failed to download pre-trained model from {url}; Ignoring the same...")
4952

5053
# Network
5154
f = (32, 64, 128, 256, 512, 32)

sample-apps/endoscopy/lib/configs/deid.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ def init(self, name: str, model_dir: str, conf: Dict[str, str], planner: Any, **
4545
# Download PreTrained Model
4646
if strtobool(self.conf.get("use_pretrained_model", "true")):
4747
url = f"{self.conf.get('pretrained_path', self.PRE_TRAINED_PATH)}/endoscopy_deid.pt"
48-
download_file(url, self.path[0])
48+
try:
49+
download_file(url, self.path[0])
50+
except:
51+
logger.warning(f"Failed to download pre-trained model from {url}; Ignoring the same...")
4952

5053
# Network
5154
self.network = SEResNet50(spatial_dims=2, in_channels=3, num_classes=2)

sample-apps/endoscopy/lib/configs/tooltracking.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ def init(self, name: str, model_dir: str, conf: Dict[str, str], planner: Any, **
4646
# Download PreTrained Model
4747
if strtobool(self.conf.get("use_pretrained_model", "true")):
4848
url = f"{self.conf.get('pretrained_path', self.PRE_TRAINED_PATH)}/endoscopy_tooltracking.pt"
49-
download_file(url, self.path[0])
49+
try:
50+
download_file(url, self.path[0])
51+
except:
52+
logger.warning(f"Failed to download pre-trained model from {url}; Ignoring the same...")
5053

5154
# Network
5255
self.network = FlexibleUNet(

sample-apps/endoscopy/lib/trainers/tooltracking.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ def train_post_transforms(self, context: Context):
7979
AsDiscreted(
8080
keys=("pred", "label"),
8181
argmax=(True, False),
82-
to_onehot=True,
83-
n_classes=2,
82+
to_onehot=(2, 2),
8483
),
8584
]
8685

0 commit comments

Comments
 (0)