This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_model_cnn(): | |
| nclass = 5 | |
| seq_input = Input(shape=(None, WINDOW_SIZE*30, 1)) | |
| base_model = get_base_model() | |
| # for layer in base_model.layers: | |
| # layer.trainable = False | |
| encoded_sequence = TimeDistributed(base_model)(seq_input) | |
| encoded_sequence = SpatialDropout1D(rate=0.01)(Convolution1D(128, | |
| kernel_size=3, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_base_model(): | |
| inp = Input(shape=(WINDOW_SIZE*30, 1)) | |
| img_1 = Convolution1D(16, kernel_size=5, activation=activations.relu, padding="valid")(inp) | |
| img_1 = Convolution1D(16, kernel_size=5, activation=activations.relu, padding="valid")(img_1) | |
| img_1 = MaxPool1D(pool_size=2)(img_1) | |
| img_1 = SpatialDropout1D(rate=0.01)(img_1) | |
| img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid")(img_1) | |
| img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid")(img_1) | |
| img_1 = MaxPool1D(pool_size=2)(img_1) | |
| img_1 = SpatialDropout1D(rate=0.01)(img_1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_unet(do=0, activation=ReLU): | |
| inputs = Input(input_shape+(3,)) | |
| conv1 = Dropout(do)(activation()(Conv2D(32, (3, 3), padding='same')(inputs))) | |
| conv1 = Dropout(do)(activation()(Conv2D(32, (3, 3), padding='same')(conv1))) | |
| pool1 = MaxPooling2D(pool_size=(2, 2))(conv1) | |
| conv2 = Dropout(do)(activation()(Conv2D(64, (3, 3), padding='same')(pool1))) | |
| conv2 = Dropout(do)(activation()(Conv2D(64, (3, 3), padding='same')(conv2))) | |
| pool2 = MaxPooling2D(pool_size=(2, 2))(conv2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_model(): | |
| nclass = 5 | |
| inp = Input(shape=(187, 1)) | |
| img_1 = Convolution1D(16, kernel_size=5, activation=activations.relu, padding="valid")(inp) | |
| img_1 = Convolution1D(16, kernel_size=5, activation=activations.relu, padding="valid")(img_1) | |
| img_1 = MaxPool1D(pool_size=2)(img_1) | |
| img_1 = Dropout(rate=0.1)(img_1) | |
| img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid")(img_1) | |
| img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid")(img_1) | |
| img_1 = MaxPool1D(pool_size=2)(img_1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_model_1(max_work, max_user): | |
| dim_embedddings = 30 | |
| bias = 3 | |
| # inputs | |
| w_inputs = Input(shape=(1,), dtype='int32') | |
| w = Embedding(max_work+1, dim_embedddings, name="work")(w_inputs) | |
| # context | |
| u_inputs = Input(shape=(1,), dtype='int32') | |
| u = Embedding(max_user+1, dim_embedddings, name="user")(u_inputs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_model(n_classes=1): | |
| base_model = ResNet50(weights='imagenet', include_top=False) | |
| #for layer in base_model.layers: | |
| # layer.trainable = False | |
| x = base_model.output | |
| x = GlobalMaxPooling2D()(x) | |
| x = Dropout(0.5)(x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_model_mel(): | |
| nclass = len(list_labels) | |
| inp = Input(shape=(157, 320, 1)) | |
| incep_res = InceptionResNetV2(input_shape=(157, 320, 1), weights=None, include_top=False) | |
| x = incep_res(inp) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_model(): | |
| nclass = len(list_labels) | |
| inp = Input(shape=(input_length, 1)) | |
| img_1 = Convolution1D(16, kernel_size=9, activation=activations.relu, padding="valid")(inp) | |
| img_1 = Convolution1D(16, kernel_size=9, activation=activations.relu, padding="valid")(img_1) | |
| img_1 = MaxPool1D(pool_size=16)(img_1) | |
| img_1 = Dropout(rate=0.1)(img_1) | |
| img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid")(img_1) | |
| img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid")(img_1) | |
| img_1 = MaxPool1D(pool_size=4)(img_1) |
NewerOlder