keras-2

Keras network can never classify the last class

核能气质少年 提交于 2021-02-18 10:50:29
问题 I have been working on my project Deep Learning Language Detection which is a network with these layers to recognise from 16 programming languages: And this is the code to produce the network: # Setting up the model graph_in = Input(shape=(sequence_length, number_of_quantised_characters)) convs = [] for i in range(0, len(filter_sizes)): conv = Conv1D(filters=num_filters, kernel_size=filter_sizes[i], padding='valid', activation='relu', strides=1)(graph_in) pool = MaxPooling1D(pool_size=pooling

Keras: weighted binary crossentropy

旧时模样 提交于 2021-02-05 13:13:28
问题 I tried to implement a weighted binary crossentropy with Keras, but I am not sure if the code is correct. The training output seems to be a bit confusing. After a few epochs I just get an accuracy of ~0.15. I think thats much too less (even for a random guess). There are in general about 11% ones in the output and 89% zeros, therefore the weights are w_zero=0.89 and w_one=0.11. My code: def create_weighted_binary_crossentropy(zero_weight, one_weight): def weighted_binary_crossentropy(y_true,

Keras: weighted binary crossentropy

╄→гoц情女王★ 提交于 2021-02-05 13:12:08
问题 I tried to implement a weighted binary crossentropy with Keras, but I am not sure if the code is correct. The training output seems to be a bit confusing. After a few epochs I just get an accuracy of ~0.15. I think thats much too less (even for a random guess). There are in general about 11% ones in the output and 89% zeros, therefore the weights are w_zero=0.89 and w_one=0.11. My code: def create_weighted_binary_crossentropy(zero_weight, one_weight): def weighted_binary_crossentropy(y_true,

AttributeError: module 'tensorflow' has no attribute 'get_default_graph'

与世无争的帅哥 提交于 2020-12-25 04:12:21
问题 I am doing some task related to image captioning and I have loaded the weights of inception model like this model = InceptionV3(weights='imagenet') But I am getting error like this: AttributeError: module 'tensorflow' has no attribute 'get_default_graph' What should I do? Please help. Here is the full output of above code. 1 . --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) in () 1 # Load the inception v3 model ---->

AttributeError: module 'tensorflow' has no attribute 'get_default_graph'

扶醉桌前 提交于 2020-12-25 04:09:42
问题 I am doing some task related to image captioning and I have loaded the weights of inception model like this model = InceptionV3(weights='imagenet') But I am getting error like this: AttributeError: module 'tensorflow' has no attribute 'get_default_graph' What should I do? Please help. Here is the full output of above code. 1 . --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) in () 1 # Load the inception v3 model ---->

Shape of image after MaxPooling2D with padding ='same' --calculating layer-by-layer shape in convolution autoencoder

时光总嘲笑我的痴心妄想 提交于 2020-12-06 18:46:32
问题 Very briefly my question relates to image-size not remaining the same as the input image size after a maxpool layer when I use padding = 'same' in Keras code. I am going through the Keras blog: Building Autoencoders in Keras. I am building Convolution autoencoder. The autoencoder code is as follows: input_layer = Input(shape=(28, 28, 1)) x = Conv2D(16, (3, 3), activation='relu', padding='same')(input_layer) x = MaxPooling2D((2, 2), padding='same')(x) x = Conv2D(8, (3, 3), activation='relu',

Shape of image after MaxPooling2D with padding ='same' --calculating layer-by-layer shape in convolution autoencoder

£可爱£侵袭症+ 提交于 2020-12-06 18:40:30
问题 Very briefly my question relates to image-size not remaining the same as the input image size after a maxpool layer when I use padding = 'same' in Keras code. I am going through the Keras blog: Building Autoencoders in Keras. I am building Convolution autoencoder. The autoencoder code is as follows: input_layer = Input(shape=(28, 28, 1)) x = Conv2D(16, (3, 3), activation='relu', padding='same')(input_layer) x = MaxPooling2D((2, 2), padding='same')(x) x = Conv2D(8, (3, 3), activation='relu',

Removing layers from a pretrained keras model gives the same output as original model

允我心安 提交于 2020-12-02 07:12:40
问题 During some feature extraction experiments, I noticed that the 'model.pop()' functionality is not working as expected. For a pretrained model like vgg16, after using 'model.pop()' , model.summary() shows that the layer has been removed (expected 4096 features), however on passing an image through the new model, it results in the same number of features (1000) as the original model. No matter how many layers are removed including a completely empty model, it generates the same output. Looking

Removing layers from a pretrained keras model gives the same output as original model

懵懂的女人 提交于 2020-12-02 07:09:21
问题 During some feature extraction experiments, I noticed that the 'model.pop()' functionality is not working as expected. For a pretrained model like vgg16, after using 'model.pop()' , model.summary() shows that the layer has been removed (expected 4096 features), however on passing an image through the new model, it results in the same number of features (1000) as the original model. No matter how many layers are removed including a completely empty model, it generates the same output. Looking