def __init__(self, encoder, dropout_rate=0.5) -> None:
     super().__init__()
     self.encoder = encoder_params[encoder]["init_op"]()
     self.avg_pool = AdaptiveAvgPool2d((1, 1))
     self.srm_conv = setup_srm_layer(3)
     self.dropout = Dropout(dropout_rate)
     self.fc = Linear(encoder_params[encoder]["features"], 1)
Exemple #2
0
 def __init__(self, encoder, dropout_rate=0.0,out_dim=56) -> None:
     super().__init__()
     self.encoder = encoder_params[encoder]["init_op"]()
     self.avg_pool = AdaptiveAvgPool2d((1, 1))
     self.dropout = Dropout(dropout_rate)
     self.out_dim = out_dim
     self.fc = Linear(encoder_params[encoder]["features"], out_dim)
Exemple #3
0
 def __init__(self, encoder, name='', dropout_rate=0.0) -> None:
     super().__init__()
     self.name = name
     self.encoder = encoder_params[encoder]["init_op"]()
     self.avg_pool = AdaptiveAvgPool2d((1, 1))
     self.dropout = Dropout(dropout_rate)
     self.fc = Linear(encoder_params[encoder]["features"], 1)
Exemple #4
0
 def __init__(self, encoder, nclasses, dropout_rate=0.0, infer = False) -> None:
     super().__init__()
     self.encoder = encoder_params[encoder]["init_op"]()
     self.avg_pool = AdaptiveAvgPool2d((1, 1))
     self.dropout = Dropout(dropout_rate)
     self.fc = Linear(encoder_params[encoder]["features"], nclasses)
     self.infer = infer 
Exemple #5
0
 def __init__(self, encoder, dropout_rate=0.5) -> None:
     super().__init__()
     self.decoder = Decoder(decoder_filters=encoder_params[encoder]["decoder_filters"],
                            filters=encoder_params[encoder]["filters"])
     self.avg_pool = AdaptiveAvgPool2d((1, 1))
     self.dropout = Dropout(dropout_rate)
     self.fc = Linear(encoder_params[encoder]["features"], 1)
     self.final = Conv2d(encoder_params[encoder]["decoder_filters"][0], out_channels=1, kernel_size=1, bias=False)
     _initialize_weights(self)
     self.encoder = encoder_params[encoder]["init_op"]()
Exemple #6
0
    def __init__(self, encoder, sample_rate, window_size, hop_size, mel_bins,
                 fmin, fmax, classes_num):
        super().__init__()

        window = 'hann'
        center = True
        pad_mode = 'reflect'
        ref = 1.0
        amin = 1e-10
        top_db = None

        # Spectrogram extractor
        self.spectrogram_extractor = Spectrogram(n_fft=window_size,
                                                 hop_length=hop_size,
                                                 win_length=window_size,
                                                 window=window,
                                                 center=center,
                                                 pad_mode=pad_mode,
                                                 freeze_parameters=True)

        # Logmel feature extractor
        self.logmel_extractor = LogmelFilterBank(sr=sample_rate,
                                                 n_fft=window_size,
                                                 n_mels=mel_bins,
                                                 fmin=fmin,
                                                 fmax=fmax,
                                                 ref=ref,
                                                 amin=amin,
                                                 top_db=top_db,
                                                 freeze_parameters=True)

        # Spec augmenter
        self.spec_augmenter = SpecAugmentation(time_drop_width=64,
                                               time_stripes_num=2,
                                               freq_drop_width=8,
                                               freq_stripes_num=2)

        self.encoder = encoder_params[encoder]["init_op"]()
        self.avg_pool = AdaptiveAvgPool2d((1, 1))
        #self.max_pool = AdaptiveMaxPool2d((1, 1))
        self.dropout = Dropout(0.3)
        self.fc = Linear(encoder_params[encoder]['features'], classes_num)
 def __init__(self, encoder, dropout_rate=0.0):
     super().__init__()
     self.encoder = encoder_params[encoder]["base_net"]()
     self.avg_pool = AdaptiveAvgPool2d((1, 1))
     self.dropout = Dropout(dropout_rate)
     self.fc = Linear(encoder_params[encoder]["features"], 1)
 def __init__(self, encoder, encoder_features, dropout_rate=0.0):
     super().__init__()
     self.encoder = encoder
     self.avg_pool = AdaptiveAvgPool2d((1, 1))
     self.dropout = Dropout(dropout_rate)
     self.fc = Linear(encoder_features, 1)