Newer
Older
import json
from dataclasses import asdict, dataclass
from pathlib import Path
class BaseArgs:
def __post_init__(self):
self._validate()
def _validate(self):
"""Override this method to add argument validation."""
pass
def dict(self):
return json.loads(json.dumps(asdict(self), default=str))
dataset_name (str): Name of the dataset being created
output_dir (Path): Where the data should be generated
cache_dir (Path): Cache directory where to save the full size downloaded images.
log_parameters (bool): Save every parameters to a JSON file.
"""
dataset_name: str
output_dir: Path
cache_dir: Path = Path(".cache")
def __post_init__(self):
super().__post_init__()
self.output_dir.mkdir(exist_ok=True, parents=True)
self.cache_dir.mkdir(exist_ok=True, parents=True)