Abhinav Krishna N / gargoyle-keywords Public

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 training processor option

Augmentation settings

Advanced training settings

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, AveragePooling2D, GlobalAveragePooling2D, BatchNormalization, Permute, ReLU, Softmax, Activation from tensorflow.keras.optimizers.legacy import Adam EPOCHS = args.epochs or 90 LEARNING_RATE = args.learning_rate or 0.003 ENSURE_DETERMINISM = args.ensure_determinism BATCH_SIZE = args.batch_size or 64 if not ENSURE_DETERMINISM: train_dataset = train_dataset.shuffle(buffer_size=BATCH_SIZE*4) train_dataset=train_dataset.batch(BATCH_SIZE, drop_remainder=False) validation_dataset = validation_dataset.batch(BATCH_SIZE, drop_remainder=False) model = Sequential() W = tf.constant([0.63, 0.60, 0.39, 0.65, 0.65, 0.49, 0.60, 0.26]) # Studio order candle mirror noise pumpkin scarecrow shadow spider unknown; 900/count, unknown 1350/count (v5 train: candle 1437 mirror 1492 noise 2300 pumpkin 1382 scarecrow 1376 shadow 1844 spider 1490 unknown 5180) def wloss(y, p): return tf.keras.losses.categorical_crossentropy(y, p, label_smoothing=0.1) * tf.reduce_sum(y * W, -1) T = int(input_length / 13) def aug(x, y): b = tf.shape(x)[0]; f = tf.reshape(x, (b, T, 13)) r = tf.range(T)[None, :, None]; t0 = tf.random.uniform((b, 1, 1), 0, T, tf.int32); w = tf.random.uniform((b, 1, 1), 0, 12, tf.int32) q = tf.range(13)[None, None, :]; c0 = tf.random.uniform((b, 1, 1), 1, 13, tf.int32); cw = tf.random.uniform((b, 1, 1), 0, 3, tf.int32) m = tf.cast((r < t0) | (r >= t0 + w), f.dtype) * tf.cast((q < c0) | (q >= c0 + cw), f.dtype) t1 = tf.random.uniform((b, 1, 1), 0, T, tf.int32); m = m * tf.cast((r < t1) | (r >= t1 + w), f.dtype) # second time mask s = tf.random.uniform((b, 1, 1), -6, 7, tf.int32); f = tf.roll(f * m, s[0, 0, 0], axis=1) # time mask, coefficient mask, small time shift return tf.reshape(f, (b, T * 13)), y train_dataset = train_dataset.map(aug) model.add(InputLayer(input_shape=(input_length, ), name='x_input')) model.add(Reshape((T, 13))) for f in (32, 64, 64): model.add(Conv1D(f, kernel_size=3, padding='same', use_bias=False)) model.add(BatchNormalization()) model.add(ReLU()) model.add(MaxPooling1D(pool_size=2, strides=2, padding='same')) model.add(Dropout(0.3)) model.add(Flatten()) model.add(Dense(64, activation='relu')) model.add(Dropout(0.3)) model.add(Dense(classes, name='y_pred', activation='softmax')) opt = Adam(learning_rate=LEARNING_RATE, beta_1=0.9, beta_2=0.999) callbacks.append(BatchLoggerCallback(BATCH_SIZE, train_sample_count, epochs=EPOCHS, ensure_determinism=ENSURE_DETERMINISM)) model.compile(loss=wloss, optimizer=opt, metrics=['accuracy']) model.fit(train_dataset, epochs=EPOCHS, validation_data=validation_dataset, verbose=2, callbacks=callbacks) disable_per_channel_quantization = False
Input layer (1,274 features)
Select a backbone
Select a scoring function
Reshape layer (13 columns)
1D conv / pool layer (8 filters, 3 kernel size, 1 layer)
Dropout (rate 0.25)
1D conv / pool layer (16 filters, 3 kernel size, 1 layer)
Dropout (rate 0.25)
Flatten layer
Output layer (8 classes)

Model

Model version: