| import os |
| import torch |
| import platform |
|
|
| class Config: |
| |
| PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| DATA_DIR = os.path.join(PROJECT_ROOT, "data") |
| RESULTS_DIR = os.path.join(PROJECT_ROOT, "results") |
| |
| |
| IMAGE_SIZE = 256 |
| NUM_CLASSES = 1 |
| |
| |
| USE_RGB = True |
| USE_FREQ = True |
| USE_PATCH = True |
| USE_VIT = True |
| |
| |
| BATCH_SIZE = 32 |
| EPOCHS = 3 |
| LEARNING_RATE = 1e-4 |
| WEIGHT_DECAY = 1e-5 |
| NUM_WORKERS = 8 |
| |
| |
| DEVICE = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu" |
| |
| |
| if platform.system() == "Windows": |
| |
| DATA_DIR = r"C:\Users\kanna\Downloads\Dataset\Largest Dataset\Largest Dataset" |
| else: |
| |
| DATA_DIR = "/Users/harshvardhan/Developer/Deepfake Project /DataSet" |
| |
| |
| |
| TRAIN_DATA_PATH = DATA_DIR |
| TEST_DATA_PATH = DATA_DIR |
| CHECKPOINT_DIR = os.path.join(RESULTS_DIR, "checkpoints") |
| ACTIVE_MODEL_PATH = os.path.join(CHECKPOINT_DIR, "Mark-V.safetensors") |
|
|
| @classmethod |
| def setup(cls): |
| os.makedirs(cls.RESULTS_DIR, exist_ok=True) |
| os.makedirs(cls.CHECKPOINT_DIR, exist_ok=True) |
| os.makedirs(cls.DATA_DIR, exist_ok=True) |
| print(f"Project initialized at {cls.PROJECT_ROOT}") |
| print(f"Using device: {cls.DEVICE}") |
|
|
| if __name__ == "__main__": |
| Config.setup() |
|
|