joyjonesmark's picture
Initial deploy with models
e5abc2e
"""
Configuration settings for the Emotion Recognition System.
"""
import os
from pathlib import Path
# Project paths
PROJECT_ROOT = Path(__file__).parent.parent
DATA_DIR = PROJECT_ROOT / "data"
TRAIN_DIR = DATA_DIR / "train"
TEST_DIR = DATA_DIR / "test"
MODELS_DIR = PROJECT_ROOT / "models"
# Create models directory if it doesn't exist
MODELS_DIR.mkdir(exist_ok=True)
# Image settings
IMAGE_SIZE = (48, 48)
IMAGE_SIZE_TRANSFER = (96, 96) # For transfer learning models
NUM_CHANNELS = 1 # Grayscale
NUM_CHANNELS_RGB = 3 # For transfer learning
# Emotion classes (7 classes from FER dataset)
EMOTION_CLASSES = [
"angry",
"disgusted",
"fearful",
"happy",
"neutral",
"sad",
"surprised"
]
NUM_CLASSES = len(EMOTION_CLASSES)
# Emotion to index mapping
EMOTION_TO_IDX = {emotion: idx for idx, emotion in enumerate(EMOTION_CLASSES)}
IDX_TO_EMOTION = {idx: emotion for idx, emotion in enumerate(EMOTION_CLASSES)}
# Training hyperparameters
BATCH_SIZE = 64
EPOCHS = 50
LEARNING_RATE = 0.001
LEARNING_RATE_FINE_TUNE = 0.0001
VALIDATION_SPLIT = 0.2
# Data augmentation parameters
AUGMENTATION_CONFIG = {
"rotation_range": 15,
"width_shift_range": 0.1,
"height_shift_range": 0.1,
"horizontal_flip": True,
"zoom_range": 0.1,
"brightness_range": (0.9, 1.1),
"fill_mode": "nearest"
}
# Model save paths
CUSTOM_CNN_PATH = MODELS_DIR / "custom_cnn.h5"
MOBILENET_PATH = MODELS_DIR / "mobilenet_v2.h5"
VGG_PATH = MODELS_DIR / "vgg19.h5"
# Training callbacks
EARLY_STOPPING_PATIENCE = 10
REDUCE_LR_PATIENCE = 5
REDUCE_LR_FACTOR = 0.5
# Intensity thresholds
INTENSITY_HIGH_THRESHOLD = 0.8
INTENSITY_MEDIUM_THRESHOLD = 0.5
# API settings
API_HOST = "0.0.0.0"
API_PORT = 8000
# Streamlit settings
STREAMLIT_PORT = 8501