File size: 1,047 Bytes
91a7a12 b4123b8 dd1d7f5 b4123b8 91a7a12 b4123b8 dd1d7f5 b4123b8 dd1d7f5 b4123b8 91a7a12 b4123b8 dd1d7f5 91a7a12 b4123b8 91a7a12 b4123b8 91a7a12 dd1d7f5 91a7a12 dd1d7f5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
"""Minimal configuration."""
import os
from dataclasses import dataclass
@dataclass
class Paths:
"""File paths."""
input_folder: str
output_folder: str
boundingbox_dir: str = ""
def __post_init__(self):
self.input_folder = os.path.abspath(self.input_folder)
self.output_folder = os.path.abspath(self.output_folder)
@dataclass
class OutputSettings:
"""Output settings."""
save_images: bool = True
plot_dpi: int = 100
class Config:
"""Minimal config."""
def __init__(self):
self.paths = Paths(input_folder="", output_folder="")
self.output = OutputSettings()
def get_device(self) -> str:
"""Get device."""
import torch
return "cuda" if torch.cuda.is_available() else "cpu"
def validate(self) -> bool:
"""Validate."""
if self.paths.input_folder and not os.path.exists(self.paths.input_folder):
raise FileNotFoundError(f"Input folder not found: {self.paths.input_folder}")
return True |