Character Fonts Classification - low accuracy [on hold]Low accuracy using Multi Layer perceptron network on CIFAR10 dataset?Accuracy drops if more layers trainable - weirdNeural network accuracy for simple classificationTraining Accuracy stuck in KerasToo low accuracy on MNIST dataset using a neural networkValue error in Merging two different models in kerasWhy is my Keras model not learning image segmentation?Value of loss and accuracy does not change over EpochsSteps taking too long to completeUsing deep learning to classify similar images
Is there a name for this algorithm to calculate the concentration of a mixture of two solutions containing the same solute?
What was the exact wording from Ivanhoe of this advice on how to free yourself from slavery?
Pre-mixing cryogenic fuels and using only one fuel tank
Can I use Seifert-van Kampen theorem infinite times
By means of an example, show that P(A) + P(B) = 1 does not mean that B is the complement of A.
I am looking for the correct translation of love for the phrase "in this sign love"
what is different between Do you interest vs interested in something?
The IT department bottlenecks progress. How should I handle this?
Could the E-bike drivetrain wear down till needing replacement after 400 km?
Does a 'pending' US visa application constitute a denial?
Yosemite Fire Rings - What to Expect?
why `nmap 192.168.1.97` returns less services than `nmap 127.0.0.1`?
Strong empirical falsification of quantum mechanics based on vacuum energy density
Argument list too long when zipping large list of certain files in a folder
Customize circled numbers
What is this called? Old film camera viewer?
Will the technology I first learn determine the direction of my future career?
The Staircase of Paint
Has any country ever had 2 former presidents in jail simultaneously?
Is there an efficient solution to the travelling salesman problem with binary edge weights?
Redundant comparison & "if" before assignment
What should you do when eye contact makes your subordinate uncomfortable?
Why do we read the Megillah by night and by day?
Is the U.S. Code copyrighted by the Government?
Character Fonts Classification - low accuracy [on hold]
Low accuracy using Multi Layer perceptron network on CIFAR10 dataset?Accuracy drops if more layers trainable - weirdNeural network accuracy for simple classificationTraining Accuracy stuck in KerasToo low accuracy on MNIST dataset using a neural networkValue error in Merging two different models in kerasWhy is my Keras model not learning image segmentation?Value of loss and accuracy does not change over EpochsSteps taking too long to completeUsing deep learning to classify similar images
$begingroup$
I am trying to develop a multi-class classification model with keras. The task is similar to MNIST but applied to this character font image dataset. I have 153 classes and around 900k entries. I am using the following model and achieving ~0.24
accuracy. The input data is shaped 20,20,1, and normalized so the values range between 0 and 1. Targets are on the one-hot vector format.
X_input = Input(shape=(20,20,1,))
conv = Conv2D(32, (3, 3), activation='relu', padding='same', kernel_regularizer=l2(0.01))(X_input)
pool = MaxPooling2D(pool_size=(2, 2))(conv)
dropout = Dropout(0.5)(pool)
flat = Flatten()(dropout)
dense1 = Dense(512, activation='relu', kernel_constraint=maxnorm(3), kernel_regularizer=l2(0.01))(flat)
dropout = Dropout(0.5)(dense1)
dense2 = Dense(target_shape, activation='softmax', kernel_regularizer=l2(0.01))(dropout)
model = Model(inputs=X_input, outputs=dense2)
model.compile(loss = 'categorical_crossentropy', optimizer=SGD(lr=0.1), metrics=['accuracy'])
model.fit(X_train, Y_train, epochs=10, batch_size=32)
model.save(model_name)
What can I do to increase my accuracy?
Update
Following Shubham Panchal's suggestions, I've redefined my model to this:
X_input = Input(shape=(20,20,1,))
conv = Conv2D(64, (8, 8), activation='relu', padding='same', kernel_regularizer=l2(0.01))(X_input)
pool = MaxPooling2D(pool_size=(2, 2))(conv)
conv2 = Conv2D(128, (4, 4), activation='relu', padding='same', kernel_regularizer=l2(0.01))(pool)
pool2 = MaxPooling2D(pool_size=(2, 2))(conv2)
flat = Flatten()(pool2)
dense1 = Dense(512, activation='relu', kernel_constraint=maxnorm(3), kernel_regularizer=l2(0.01))(flat)
dropout = Dropout(0.5)(dense1)
dense2 = Dense(target_shape, activation='softmax', kernel_regularizer=l2(0.01))(dropout)
model = Model(inputs=X_input, outputs=dense2)
model.compile(loss = 'categorical_crossentropy', optimizer=Adagrad(lr=0.001, epsilon=None, decay=0.0), metrics=['accuracy'])
model.fit(X_train, Y_train, epochs=10, batch_size=32)
model.save(model_name)
The accuracy increased to ~0.35
which is good but clearly not sufficient. Any other suggestions?
keras cnn image-classification multilabel-classification mnist
New contributor
$endgroup$
put on hold as too broad by oW_, Siong Thye Goh, Toros91, Simon Larsson, Sean Owen♦ Mar 20 at 17:21
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
$begingroup$
I am trying to develop a multi-class classification model with keras. The task is similar to MNIST but applied to this character font image dataset. I have 153 classes and around 900k entries. I am using the following model and achieving ~0.24
accuracy. The input data is shaped 20,20,1, and normalized so the values range between 0 and 1. Targets are on the one-hot vector format.
X_input = Input(shape=(20,20,1,))
conv = Conv2D(32, (3, 3), activation='relu', padding='same', kernel_regularizer=l2(0.01))(X_input)
pool = MaxPooling2D(pool_size=(2, 2))(conv)
dropout = Dropout(0.5)(pool)
flat = Flatten()(dropout)
dense1 = Dense(512, activation='relu', kernel_constraint=maxnorm(3), kernel_regularizer=l2(0.01))(flat)
dropout = Dropout(0.5)(dense1)
dense2 = Dense(target_shape, activation='softmax', kernel_regularizer=l2(0.01))(dropout)
model = Model(inputs=X_input, outputs=dense2)
model.compile(loss = 'categorical_crossentropy', optimizer=SGD(lr=0.1), metrics=['accuracy'])
model.fit(X_train, Y_train, epochs=10, batch_size=32)
model.save(model_name)
What can I do to increase my accuracy?
Update
Following Shubham Panchal's suggestions, I've redefined my model to this:
X_input = Input(shape=(20,20,1,))
conv = Conv2D(64, (8, 8), activation='relu', padding='same', kernel_regularizer=l2(0.01))(X_input)
pool = MaxPooling2D(pool_size=(2, 2))(conv)
conv2 = Conv2D(128, (4, 4), activation='relu', padding='same', kernel_regularizer=l2(0.01))(pool)
pool2 = MaxPooling2D(pool_size=(2, 2))(conv2)
flat = Flatten()(pool2)
dense1 = Dense(512, activation='relu', kernel_constraint=maxnorm(3), kernel_regularizer=l2(0.01))(flat)
dropout = Dropout(0.5)(dense1)
dense2 = Dense(target_shape, activation='softmax', kernel_regularizer=l2(0.01))(dropout)
model = Model(inputs=X_input, outputs=dense2)
model.compile(loss = 'categorical_crossentropy', optimizer=Adagrad(lr=0.001, epsilon=None, decay=0.0), metrics=['accuracy'])
model.fit(X_train, Y_train, epochs=10, batch_size=32)
model.save(model_name)
The accuracy increased to ~0.35
which is good but clearly not sufficient. Any other suggestions?
keras cnn image-classification multilabel-classification mnist
New contributor
$endgroup$
put on hold as too broad by oW_, Siong Thye Goh, Toros91, Simon Larsson, Sean Owen♦ Mar 20 at 17:21
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
$begingroup$
I am trying to develop a multi-class classification model with keras. The task is similar to MNIST but applied to this character font image dataset. I have 153 classes and around 900k entries. I am using the following model and achieving ~0.24
accuracy. The input data is shaped 20,20,1, and normalized so the values range between 0 and 1. Targets are on the one-hot vector format.
X_input = Input(shape=(20,20,1,))
conv = Conv2D(32, (3, 3), activation='relu', padding='same', kernel_regularizer=l2(0.01))(X_input)
pool = MaxPooling2D(pool_size=(2, 2))(conv)
dropout = Dropout(0.5)(pool)
flat = Flatten()(dropout)
dense1 = Dense(512, activation='relu', kernel_constraint=maxnorm(3), kernel_regularizer=l2(0.01))(flat)
dropout = Dropout(0.5)(dense1)
dense2 = Dense(target_shape, activation='softmax', kernel_regularizer=l2(0.01))(dropout)
model = Model(inputs=X_input, outputs=dense2)
model.compile(loss = 'categorical_crossentropy', optimizer=SGD(lr=0.1), metrics=['accuracy'])
model.fit(X_train, Y_train, epochs=10, batch_size=32)
model.save(model_name)
What can I do to increase my accuracy?
Update
Following Shubham Panchal's suggestions, I've redefined my model to this:
X_input = Input(shape=(20,20,1,))
conv = Conv2D(64, (8, 8), activation='relu', padding='same', kernel_regularizer=l2(0.01))(X_input)
pool = MaxPooling2D(pool_size=(2, 2))(conv)
conv2 = Conv2D(128, (4, 4), activation='relu', padding='same', kernel_regularizer=l2(0.01))(pool)
pool2 = MaxPooling2D(pool_size=(2, 2))(conv2)
flat = Flatten()(pool2)
dense1 = Dense(512, activation='relu', kernel_constraint=maxnorm(3), kernel_regularizer=l2(0.01))(flat)
dropout = Dropout(0.5)(dense1)
dense2 = Dense(target_shape, activation='softmax', kernel_regularizer=l2(0.01))(dropout)
model = Model(inputs=X_input, outputs=dense2)
model.compile(loss = 'categorical_crossentropy', optimizer=Adagrad(lr=0.001, epsilon=None, decay=0.0), metrics=['accuracy'])
model.fit(X_train, Y_train, epochs=10, batch_size=32)
model.save(model_name)
The accuracy increased to ~0.35
which is good but clearly not sufficient. Any other suggestions?
keras cnn image-classification multilabel-classification mnist
New contributor
$endgroup$
I am trying to develop a multi-class classification model with keras. The task is similar to MNIST but applied to this character font image dataset. I have 153 classes and around 900k entries. I am using the following model and achieving ~0.24
accuracy. The input data is shaped 20,20,1, and normalized so the values range between 0 and 1. Targets are on the one-hot vector format.
X_input = Input(shape=(20,20,1,))
conv = Conv2D(32, (3, 3), activation='relu', padding='same', kernel_regularizer=l2(0.01))(X_input)
pool = MaxPooling2D(pool_size=(2, 2))(conv)
dropout = Dropout(0.5)(pool)
flat = Flatten()(dropout)
dense1 = Dense(512, activation='relu', kernel_constraint=maxnorm(3), kernel_regularizer=l2(0.01))(flat)
dropout = Dropout(0.5)(dense1)
dense2 = Dense(target_shape, activation='softmax', kernel_regularizer=l2(0.01))(dropout)
model = Model(inputs=X_input, outputs=dense2)
model.compile(loss = 'categorical_crossentropy', optimizer=SGD(lr=0.1), metrics=['accuracy'])
model.fit(X_train, Y_train, epochs=10, batch_size=32)
model.save(model_name)
What can I do to increase my accuracy?
Update
Following Shubham Panchal's suggestions, I've redefined my model to this:
X_input = Input(shape=(20,20,1,))
conv = Conv2D(64, (8, 8), activation='relu', padding='same', kernel_regularizer=l2(0.01))(X_input)
pool = MaxPooling2D(pool_size=(2, 2))(conv)
conv2 = Conv2D(128, (4, 4), activation='relu', padding='same', kernel_regularizer=l2(0.01))(pool)
pool2 = MaxPooling2D(pool_size=(2, 2))(conv2)
flat = Flatten()(pool2)
dense1 = Dense(512, activation='relu', kernel_constraint=maxnorm(3), kernel_regularizer=l2(0.01))(flat)
dropout = Dropout(0.5)(dense1)
dense2 = Dense(target_shape, activation='softmax', kernel_regularizer=l2(0.01))(dropout)
model = Model(inputs=X_input, outputs=dense2)
model.compile(loss = 'categorical_crossentropy', optimizer=Adagrad(lr=0.001, epsilon=None, decay=0.0), metrics=['accuracy'])
model.fit(X_train, Y_train, epochs=10, batch_size=32)
model.save(model_name)
The accuracy increased to ~0.35
which is good but clearly not sufficient. Any other suggestions?
keras cnn image-classification multilabel-classification mnist
keras cnn image-classification multilabel-classification mnist
New contributor
New contributor
edited Mar 20 at 16:28
Lucas Azevedo
New contributor
asked Mar 19 at 14:54
Lucas AzevedoLucas Azevedo
12
12
New contributor
New contributor
put on hold as too broad by oW_, Siong Thye Goh, Toros91, Simon Larsson, Sean Owen♦ Mar 20 at 17:21
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as too broad by oW_, Siong Thye Goh, Toros91, Simon Larsson, Sean Owen♦ Mar 20 at 17:21
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
You can implement these measures which work in most use cases :
- Reduce the SGD learning rate. You can reduce it to 0.001 or 0.0001.
- Use AdamOptimizer if necessary.
- Don't use Dropout in the Convolutional layers. It should be used only in the Dense layers.
- Use more Conv2D layers. Using more such layers would help the model generalise better and interpret spatial data.
- If ReLU doesn't work and you get lesser accuracy means your CNN may be suffering from dying neurons problem. To overcome this you can use LeakyReLU activation. You will not find it in
tf.keras.activations
module, you need to implement it manually and set alpha ( slope of line in negative side ) to 0.2. You can subsequently decrease the kernel size in Conv2D layers. For example in this case :
Conv2D( 32, kernel_size=( 4 , 4 ) , strides=strides , activation=activation_func),
MaxPooling2D(pool_size=pool_size, strides=strides ),
Conv2D( 64, kernel_size=( 3 , 3 ) , strides=strides , activation=activation_func),
MaxPooling2D(pool_size=pool_size , strides=strides),
Other than these, you can also experiment with BatchNormalization layer or Data Augmentation.
$endgroup$
$begingroup$
Thank you very much. Will test the modifications you've proposed and try again. If that increases my accuracy, I'll give you the answer :)
$endgroup$
– Lucas Azevedo
Mar 20 at 11:49
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
You can implement these measures which work in most use cases :
- Reduce the SGD learning rate. You can reduce it to 0.001 or 0.0001.
- Use AdamOptimizer if necessary.
- Don't use Dropout in the Convolutional layers. It should be used only in the Dense layers.
- Use more Conv2D layers. Using more such layers would help the model generalise better and interpret spatial data.
- If ReLU doesn't work and you get lesser accuracy means your CNN may be suffering from dying neurons problem. To overcome this you can use LeakyReLU activation. You will not find it in
tf.keras.activations
module, you need to implement it manually and set alpha ( slope of line in negative side ) to 0.2. You can subsequently decrease the kernel size in Conv2D layers. For example in this case :
Conv2D( 32, kernel_size=( 4 , 4 ) , strides=strides , activation=activation_func),
MaxPooling2D(pool_size=pool_size, strides=strides ),
Conv2D( 64, kernel_size=( 3 , 3 ) , strides=strides , activation=activation_func),
MaxPooling2D(pool_size=pool_size , strides=strides),
Other than these, you can also experiment with BatchNormalization layer or Data Augmentation.
$endgroup$
$begingroup$
Thank you very much. Will test the modifications you've proposed and try again. If that increases my accuracy, I'll give you the answer :)
$endgroup$
– Lucas Azevedo
Mar 20 at 11:49
add a comment |
$begingroup$
You can implement these measures which work in most use cases :
- Reduce the SGD learning rate. You can reduce it to 0.001 or 0.0001.
- Use AdamOptimizer if necessary.
- Don't use Dropout in the Convolutional layers. It should be used only in the Dense layers.
- Use more Conv2D layers. Using more such layers would help the model generalise better and interpret spatial data.
- If ReLU doesn't work and you get lesser accuracy means your CNN may be suffering from dying neurons problem. To overcome this you can use LeakyReLU activation. You will not find it in
tf.keras.activations
module, you need to implement it manually and set alpha ( slope of line in negative side ) to 0.2. You can subsequently decrease the kernel size in Conv2D layers. For example in this case :
Conv2D( 32, kernel_size=( 4 , 4 ) , strides=strides , activation=activation_func),
MaxPooling2D(pool_size=pool_size, strides=strides ),
Conv2D( 64, kernel_size=( 3 , 3 ) , strides=strides , activation=activation_func),
MaxPooling2D(pool_size=pool_size , strides=strides),
Other than these, you can also experiment with BatchNormalization layer or Data Augmentation.
$endgroup$
$begingroup$
Thank you very much. Will test the modifications you've proposed and try again. If that increases my accuracy, I'll give you the answer :)
$endgroup$
– Lucas Azevedo
Mar 20 at 11:49
add a comment |
$begingroup$
You can implement these measures which work in most use cases :
- Reduce the SGD learning rate. You can reduce it to 0.001 or 0.0001.
- Use AdamOptimizer if necessary.
- Don't use Dropout in the Convolutional layers. It should be used only in the Dense layers.
- Use more Conv2D layers. Using more such layers would help the model generalise better and interpret spatial data.
- If ReLU doesn't work and you get lesser accuracy means your CNN may be suffering from dying neurons problem. To overcome this you can use LeakyReLU activation. You will not find it in
tf.keras.activations
module, you need to implement it manually and set alpha ( slope of line in negative side ) to 0.2. You can subsequently decrease the kernel size in Conv2D layers. For example in this case :
Conv2D( 32, kernel_size=( 4 , 4 ) , strides=strides , activation=activation_func),
MaxPooling2D(pool_size=pool_size, strides=strides ),
Conv2D( 64, kernel_size=( 3 , 3 ) , strides=strides , activation=activation_func),
MaxPooling2D(pool_size=pool_size , strides=strides),
Other than these, you can also experiment with BatchNormalization layer or Data Augmentation.
$endgroup$
You can implement these measures which work in most use cases :
- Reduce the SGD learning rate. You can reduce it to 0.001 or 0.0001.
- Use AdamOptimizer if necessary.
- Don't use Dropout in the Convolutional layers. It should be used only in the Dense layers.
- Use more Conv2D layers. Using more such layers would help the model generalise better and interpret spatial data.
- If ReLU doesn't work and you get lesser accuracy means your CNN may be suffering from dying neurons problem. To overcome this you can use LeakyReLU activation. You will not find it in
tf.keras.activations
module, you need to implement it manually and set alpha ( slope of line in negative side ) to 0.2. You can subsequently decrease the kernel size in Conv2D layers. For example in this case :
Conv2D( 32, kernel_size=( 4 , 4 ) , strides=strides , activation=activation_func),
MaxPooling2D(pool_size=pool_size, strides=strides ),
Conv2D( 64, kernel_size=( 3 , 3 ) , strides=strides , activation=activation_func),
MaxPooling2D(pool_size=pool_size , strides=strides),
Other than these, you can also experiment with BatchNormalization layer or Data Augmentation.
answered Mar 20 at 1:58
Shubham PanchalShubham Panchal
35117
35117
$begingroup$
Thank you very much. Will test the modifications you've proposed and try again. If that increases my accuracy, I'll give you the answer :)
$endgroup$
– Lucas Azevedo
Mar 20 at 11:49
add a comment |
$begingroup$
Thank you very much. Will test the modifications you've proposed and try again. If that increases my accuracy, I'll give you the answer :)
$endgroup$
– Lucas Azevedo
Mar 20 at 11:49
$begingroup$
Thank you very much. Will test the modifications you've proposed and try again. If that increases my accuracy, I'll give you the answer :)
$endgroup$
– Lucas Azevedo
Mar 20 at 11:49
$begingroup$
Thank you very much. Will test the modifications you've proposed and try again. If that increases my accuracy, I'll give you the answer :)
$endgroup$
– Lucas Azevedo
Mar 20 at 11:49
add a comment |