kirad.constants¶
kirad.constants
¶
Global constants: sample rate, score ranges, label cutoffs, batch field names.
Stage: utils (used by data, model, loss and metrics). Cutoffs and MAX_SCORE define the ordinal tasks; change them if a new questionnaire or threshold is used.
EXPECTED_SAMPLE_RATE = 16000
module-attribute
¶
DEVICE = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
module-attribute
¶
CPU_DEVICE = torch.device('cpu')
module-attribute
¶
MAX_FINITE_FLOAT32 = float(np.finfo(np.float32).max)
module-attribute
¶
DEFAULT_VAD_MIN_SILENCE_DURATION_MS = 100
module-attribute
¶
DEFAULT_VAD_MIN_SPEECH_DURATION_MS = 250
module-attribute
¶
VAD_PARAMS = {'prompt': {'min_silence_duration_ms': 100, 'min_speech_duration_ms': 250}, 'conversational': {'min_silence_duration_ms': 1000, 'min_speech_duration_ms': 5000}, 'inference': {'min_silence_duration_ms': DEFAULT_VAD_MIN_SILENCE_DURATION_MS, 'min_speech_duration_ms': DEFAULT_VAD_MIN_SPEECH_DURATION_MS}}
module-attribute
¶
MAX_SCORE = {'phq9': 27, 'phq2': 6, 'scid': 1, 'gad7': 21, 'gad2': 6}
module-attribute
¶
METRIC_TARGET_CUTOFFS = {'depression': (9, 14), 'anxiety': (4, 9, 14), 'real': (0,)}
module-attribute
¶
LOSS_TARGET_CUTOFFS = {'real': {'exact2': (0,)}, 'depression': {'LvMH': (METRIC_TARGET_CUTOFFS['depression'][0],), 'LMvH': (METRIC_TARGET_CUTOFFS['depression'][1],), 'LvMvH': METRIC_TARGET_CUTOFFS['depression'], 'exact28': range(MAX_SCORE['phq9'])}, 'anxiety': {'{2,3}_vs_{0,1}': (METRIC_TARGET_CUTOFFS['anxiety'][1],), '{0}_vs_{1}_vs_{2}_vs_{3}': METRIC_TARGET_CUTOFFS['anxiety'], 'exact22': range(MAX_SCORE['gad7'])}}
module-attribute
¶
DatasetVersion = Literal['v1', 'v1.0.1', 'v2.0', 'v2.0.1', 'v2.1', 'v2.1.1', 'v2.2', 'v2.2.1', 'v2.3.1', 'v2.4.1', 'v2.5.1', 'v2.6.1', 'v2.7.1', 'v2.8.1', 'v2.9.1', 'v2.9.2', 'v2.9.3', 'v2.9.4', 'v2.9.5', 'v2.10.1', 'v2.10.4', 'v2.11.1', 'v2.11.4']
module-attribute
¶
DataSource = Literal['phonic', 'sonar', 'sonar_general_pop', 'sonar_senior_pop', 'sonar_elderly_and_latino_pop', 'general_pop', 'fda', 'app', 'all']
module-attribute
¶
DatasetSplit = Literal['train', 'val', 'test', 'all']
module-attribute
¶
FeatureStoreBucket = Literal['raw', 'resampled', 'resampled_and_cut_audio_with_conversational_vad_params', 'resampled_and_trimmed_audio_with_conversational_vad_params', 'resampled_and_cut_audio_with_prompt_vad_params', 'resampled_and_trimmed_audio_with_prompt_vad_params']
module-attribute
¶
DATASET_VERSION_METADATA = {'v1': {'n_folds': 5, 'uri': None}, 'v1.0.1': {'n_folds': 5, 'uri': None}, 'v2.0': {'n_folds': 5, 'uri': None}, 'v2.0.1': {'n_folds': 5, 'uri': None}, 'v2.1': {'n_folds': 5, 'uri': None}, 'v2.1.1': {'n_folds': 5, 'uri': None}, 'v2.2': {'n_folds': 5, 'uri': None}, 'v2.2.1': {'n_folds': 5, 'uri': None}, 'v2.3.1': {'n_folds': 5, 'uri': None}, 'v2.4.1': {'n_folds': 5, 'uri': None}, 'v2.5.1': {'n_folds': 5, 'uri': None}, 'v2.6.1': {'n_folds': 5, 'uri': None}, 'v2.7.1': {'n_folds': 5, 'uri': None}, 'v2.8.1': {'n_folds': 5, 'uri': None}, 'v2.9.1': {'n_folds': 5, 'uri': None}, 'v2.9.2': {'n_folds': 5, 'uri': None}, 'v2.9.3': {'n_folds': 5, 'uri': None}, 'v2.9.4': {'n_folds': 5, 'uri': None}, 'v2.9.5': {'n_folds': 5, 'uri': None}, 'v2.10.1': {'n_folds': 5, 'uri': None}, 'v2.10.4': {'n_folds': 5, 'uri': None}, 'v2.11.1': {'n_folds': 5, 'uri': None}, 'v2.11.4': {'n_folds': 5, 'uri': None}}
module-attribute
¶
FEATURE_STORE_URI = None
module-attribute
¶
RAW_AUDIO_URI = None
module-attribute
¶
CACHE_DIR = Path.home() / '.kintsugi'
module-attribute
¶
AUDIO_DIR = CACHE_DIR / 'audio'
module-attribute
¶
METADATA_DIR = CACHE_DIR / 'metadata'
module-attribute
¶
USER_CACHE_DIR_KINTSUGI = Path.home() / '.cache' / 'kintsugi'
module-attribute
¶
IDEAL_LOGMEL_ENERGIES = np.array([0.34912264, 0.58558977, 0.7912451, 0.92767584, 0.98273695, 0.98439455, 0.9603633, 0.93906444, 0.9366281, 0.93200225, 0.916437, 0.8928787, 0.8637211, 0.83265126, 0.79977655, 0.7778334, 0.7561299, 0.72997606, 0.70391226, 0.6800474, 0.65755, 0.63536274, 0.61355984, 0.5923383, 0.5720056, 0.55244887, 0.53684795, 0.5221597, 0.5098636, 0.49923953, 0.48908615, 0.47840047, 0.46758702, 0.47343993, 0.46268672, 0.4475126, 0.46747103, 0.45131385, 0.4635319, 0.44889897, 0.45491976, 0.4373785, 0.43154317, 0.42194438, 0.41158468, 0.40096927, 0.3933149, 0.38795966, 0.38441542, 0.38454026, 0.3815766, 0.3768835, 0.3719921, 0.3654539, 0.35399568, 0.3425986, 0.32823247, 0.31404305, 0.30564603, 0.29617435, 0.29273877, 0.28560263, 0.27459458, 0.26876706, 0.25825337, 0.24759005, 0.24090728, 0.2344712, 0.22529823, 0.20880115, 0.193578, 0.18290243, 0.17621627, 0.17087021, 0.16641389, 0.15932252, 0.14312662, 0.11790597, 0.08030523, 0.03747071], dtype=np.float32)
module-attribute
¶
DatasetFields
¶
Key names of a batch dict: uuid, features, label.
Source code in kirad/constants.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
UUID = 'uuid'
class-attribute
instance-attribute
¶
FEATURES = 'features'
class-attribute
instance-attribute
¶
LABEL = 'label'
class-attribute
instance-attribute
¶
LENGTH = 'length'
class-attribute
instance-attribute
¶
LOSS = 'loss'
class-attribute
instance-attribute
¶
LabelFields
¶
Sub-keys under label.
Source code in kirad/constants.py
163 164 165 166 167 | |