Thomas Garcia / keywordspotter_demo Public
EON Tuner Primary
Primary version

Training settings

Please provide a valid number of training cycles (numeric only)
Please provide a valid number for the learning rate (between 0 and 1)
Please provide a valid number for the train/validate split (between 0 and 1)
%

Audio training options

Neural network architecture

import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, InputLayer, Dropout, Conv1D, Conv2D, Flatten, Reshape, MaxPooling1D, MaxPooling2D, BatchNormalization, TimeDistributed, ReLU, Softmax from tensorflow.keras.optimizers import Adam # Data augmentation for spectrograms, which can be configured in visual mode. # To learn what these arguments mean, see the SpecAugment paper: # https://arxiv.org/abs/1904.08779 sa = SpecAugment(spectrogram_shape=[int(input_length / 40), 40], mF_num_freq_masks=0, F_freq_mask_max_consecutive=0, mT_num_time_masks=0, T_time_mask_max_consecutive=0, enable_time_warp=False, W_time_warp_max_distance=6, mask_with_mean=False) train_dataset = train_dataset.map(sa.mapper(), num_parallel_calls=tf.data.AUTOTUNE) EPOCHS = args.epochs or 100 LEARNING_RATE = args.learning_rate or 0.005 # this controls the batch size, or you can manipulate the tf.data.Dataset objects yourself BATCH_SIZE = 32 train_dataset = train_dataset.batch(BATCH_SIZE, drop_remainder=False) validation_dataset = validation_dataset.batch(BATCH_SIZE, drop_remainder=False) # model architecture model = Sequential() # Data augmentation, which can be configured in visual mode model.add(tf.keras.layers.GaussianNoise(stddev=0.2)) channels = 1 columns = 40 rows = int(input_length / (columns * channels)) model.add(Reshape((rows, columns, channels), input_shape=(input_length, ))) model.add(Conv2D(8, kernel_size=3, kernel_constraint=tf.keras.constraints.MaxNorm(1), padding='same', activation='relu')) model.add(MaxPooling2D(pool_size=2, strides=2, padding='same')) model.add(Dropout(0.5)) model.add(Conv2D(16, kernel_size=3, kernel_constraint=tf.keras.constraints.MaxNorm(1), padding='same', activation='relu')) model.add(MaxPooling2D(pool_size=2, strides=2, padding='same')) model.add(Dropout(0.5)) model.add(Flatten()) model.add(Dense(classes, name='y_pred', activation='softmax')) # this controls the learning rate opt = Adam(learning_rate=LEARNING_RATE, beta_1=0.9, beta_2=0.999) callbacks.append(BatchLoggerCallback(BATCH_SIZE, train_sample_count, epochs=EPOCHS)) # train the neural network model.compile(loss='categorical_crossentropy', optimizer=opt, metrics=['accuracy']) model.fit(train_dataset, epochs=EPOCHS, validation_data=validation_dataset, verbose=2, callbacks=callbacks) # Use this flag to disable per-channel quantization for a model. # This can reduce RAM usage for convolutional models, but may have # an impact on accuracy. disable_per_channel_quantization = False
Input layer (1,240 features)
Output layer (4 classes)