forked from kornia/kornia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa707a5
commit 1dfaf1a
Showing
21 changed files
with
111 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
color, | ||
contrib, | ||
core, | ||
config, | ||
enhance, | ||
feature, | ||
io, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from enum import Enum | ||
from dataclasses import dataclass, field | ||
|
||
__all__ = ["config", "InstallationMode"] | ||
|
||
|
||
class InstallationMode(str, Enum): | ||
# Ask the user if to install the dependencies | ||
ASK = "ASK" | ||
# Install the dependencies | ||
AUTO = "AUTO" | ||
# Raise an error if the dependencies are not installed | ||
RAISE = "RAISE" | ||
|
||
def __eq__(self, other): | ||
if isinstance(other, str): | ||
return self.value.lower() == other.lower() # Case-insensitive comparison | ||
return super().__eq__(other) | ||
|
||
|
||
class LazyLoaderConfig: | ||
_installation_mode: InstallationMode = InstallationMode.ASK | ||
|
||
@property | ||
def installation_mode(self) -> InstallationMode: | ||
return self._installation_mode | ||
|
||
@installation_mode.setter | ||
def installation_mode(self, value: str): | ||
# Allow setting via string by converting to the Enum | ||
if isinstance(value, str): | ||
try: | ||
self._installation_mode = InstallationMode(value.upper()) | ||
except ValueError: | ||
raise ValueError(f"{value} is not a valid InstallationMode. Choose from: {list(InstallationMode)}") | ||
elif isinstance(value, InstallationMode): | ||
self._installation_mode = value | ||
else: | ||
raise TypeError("installation_mode must be a string or InstallationMode Enum.") | ||
|
||
|
||
@dataclass | ||
class KorniaConfig: | ||
output_dir: str = "kornia_outputs" | ||
hub_cache_dir: str = ".kornia_hub" | ||
hub_models_dir: str = ".kornia_hub/models" | ||
hub_onnx_dir: str = ".kornia_hub/onnx_models" | ||
lazyloader: LazyLoaderConfig = field(default_factory=LazyLoaderConfig) | ||
|
||
|
||
kornia_config = KorniaConfig() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from . import detector, segmentor, tracker | ||
from . import detection, segmentation, tracking |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters