diff --git a/src/otx/algo/classification/backbones/efficientnet.py b/src/otx/algo/classification/backbones/efficientnet.py index 8c87d399255..639a4e15a29 100644 --- a/src/otx/algo/classification/backbones/efficientnet.py +++ b/src/otx/algo/classification/backbones/efficientnet.py @@ -5,6 +5,7 @@ import math import os +from pathlib import Path import torch import torch.nn.functional as F @@ -661,6 +662,6 @@ def init_weights(self, pretrained: bool | str | None = None): load_checkpoint_to_model(self, checkpoint) print(f"init weight - {pretrained}") elif pretrained is not None: - cache_dir = os.path.join("~", ".cache", "torch", "hub", "checkpoints") - download_model(net=self, model_name=self.model_name, local_model_store_dir_path=cache_dir) + cache_dir = Path.home() / ".cache" / "torch" / "hub" / "checkpoints" + download_model(net=self, model_name=self.model_name, local_model_store_dir_path=str(cache_dir)) print(f"init weight - {pretrained_urls[self.model_name]}")