forked from Toshiba-China-RDC/dcase20_task4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
67 lines (59 loc) · 2.26 KB
/
config.py
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import logging
import math
import os
import pandas as pd
mode = "_TbS"
workspace = ".."
# DESED Paths
weak = os.path.join(workspace, 'dataset/metadata/train'+mode+'/weak.tsv')
unlabel = os.path.join(workspace, 'dataset/metadata/train'+mode+'/unlabel_in_domain.tsv')
synthetic = os.path.join(workspace, 'dataset/metadata/train'+mode+'/synthetic20/soundscapes.tsv')
validation = os.path.join(workspace, 'dataset/metadata/validation/validation.tsv')
test2018 = os.path.join(workspace, 'dataset/metadata/validation/test_dcase2018.tsv')
eval2018 = os.path.join(workspace, 'dataset/metadata/validation/eval_dcase2018.tsv')
eval_desed = os.path.join(workspace, "dataset/metadata/eval/public.tsv")
# Useful because does not correspond to the tsv file path (metadata replace by audio), (due to subsets test/eval2018)
audio_validation_dir = os.path.join(workspace, 'dataset/audio/validation')
# Separated data
weak_ss = os.path.join(workspace, 'dataset/audio/train'+mode+'/weak_ss/separated_sources')
unlabel_ss = os.path.join(workspace, 'dataset/audio/train'+mode+'/unlabel_in_domain_ss/separated_sources')
synthetic_ss = os.path.join(workspace, 'dataset/audio/train'+mode+'/synthetic20/separated_sources')
validation_ss = os.path.join(workspace, 'dataset/audio/validation_ss/separated_sources')
eval_desed_ss = os.path.join(workspace, "dataset/audio/eval/public_ss/separated_sources")
# Scaling data
scaler_type = "dataset"
# Data preparation
ref_db = -55
sample_rate = 16000
max_len_seconds = 10.
# features
n_window = 2048
hop_size = 255
n_mels = 128
max_frames = math.ceil(max_len_seconds * sample_rate / hop_size)
mel_f_min = 0.
mel_f_max = 8000.
# Model
max_consistency_cost = 2
# Training
in_memory = True
in_memory_unlab = False
num_workers = 8
batch_size = 24
noise_snr = 30
n_epoch = 200
n_epoch_rampup = 50
checkpoint_epochs = 1
save_best = True
early_stopping = None
es_init_wait = 50 # es for early stopping
adjust_lr = True
max_learning_rate = 0.001 # Used if adjust_lr is True
default_learning_rate = 0.001 # Used if adjust_lr is False
# Post processing
median_window_s = 0.45
# Classes
file_path = os.path.abspath(os.path.dirname(__file__))
classes = pd.read_csv(os.path.join(file_path, validation), sep="\t").event_label.dropna().sort_values().unique()
# Logger
terminal_level = logging.INFO