#Why my accuracy always has same value

45 messages · Page 1 of 1 (latest)

willow tartan
#

I trained a model and I took same accuracy values.

sudden plume
#

Okay your going to need to give us more than that lol. What data are you working with? How have you organised you data? What type of model did you train? Do you have a CFM that we could see?

tropic frost
#

CFM = confusion matrix
And also seeing your code would be helpful

willow tartan
#

I am working on BI-RADS and breast composition classification so its multi label classification. I categorized my data by giving 0 and 1. My loss func is "categorical_crossentropy" and optimizer is Adam. Unfortunately I have not a CFM. My code is very complicated. But I can show you if you want to see it. Thank you very much in advance

willow tartan
tropic frost
#

Yes, please show us a CFM at the beginning of training and at the end of 5 epochs

#

And what framework are you using?

willow tartan
#

Sir, I am sorry for writing late but I have an error.

#

ValueError: Classification metrics can't handle a mix of multiclass and unknown targets

#

And this is my code:

#

pred = model.predict(x_train, batch_size = 32)
pred = np.argmax(pred, axis=1)
y_train = np.argmax(y_train, axis=1)
print(classification_report(y_train, pred))

#

what can ı do?

willow tartan
willow tartan
#

Finally

#

CFM:

willow tartan
tropic frost
#

What are the rows and what are the columns?

willow tartan
#

x = actual labels and y = predicted labels

#

according to 3 class

willow tartan
#

Sir, I guess I solved problem

#

My loss is not always same

#

but

#

my accuracy very low

willow tartan
tropic frost
#

Based on the confusion matrix your accuracy on whatever amount of data this matrix was generated from should be 790/837 which is pretty high, so I think you have to revisit your code cause there are bugs

#

*847

willow tartan
tropic frost
#

@willow tartan Please provide more detail. You are asking people who know nothing about what you are doing or how you are doing it or for what purpose, so can you please provide some code snippets or something

willow tartan
#

Sorry for my inexperience

#

########### A2 bloack ###############
block_arg0 = {'kernel_size':3,'strides':2,'expand_ratio':6,'num_repeat':1,'input_filters':16,'se_ratio':0.25,
'output_filters':24,'id_skip':0}
block_arg = pd.Series(data = block_arg0)
"""Mobile Inverted Residual block along with Squeeze and Excitation block."""
kernel_size = block_arg.kernel_size
num_repeat= block_arg.num_repeat
input_filters= block_arg.input_filters
output_filters= block_arg.output_filters
expand_ratio= block_arg.expand_ratio
id_skip= block_arg.id_skip
strides= block_arg.strides
se_ratio= block_arg.se_ratio

Genişleme Evresi

expanded_filters = input_filters*expand_ratio

x = (Conv2D(expanded_filters, 1, padding='same', use_bias=False))(x)
x = (BatchNormalization())(x)
x = (Activation(swish_act))(x)

Depthwise Evrişim Evresi

x = (DepthwiseConv2D(int(kernel_size) * int(kernel_size), int(strides) * int(strides), padding='same', use_bias=False))(x)
x = (BatchNormalization())(x)
x = (Activation(swish_act))(x)

Sıkıştırma ve Çıkarma Evresi

se = GlobalAveragePooling2D()(x)
se = (Reshape((1, 1, int(expanded_filters) )))(se)
squeezed_filters = max (1, int(input_filters * se_ratio))
se = (Conv2D(squeezed_filters , 1, activation=swish_act, padding='same'))(se)
se = (Conv2D(expanded_filters, 1, activation='sigmoid', padding='same'))(se)
x = (multiply([x, se]))

Çıkış

x = Conv2D(output_filters, 1, padding='same', use_bias=False)(x)
x = BatchNormalization()(x)

tropic frost
#

is this your code or code you found elsewhere?

willow tartan
#

The block before this block produces output of size 112, 112, 16 and I expect output from this block with size 56,56,24

tropic frost
#

okay, lets turn this into a learning experience for you
In a CNN, what changes the size of your input/output/feature maps?

willow tartan
willow tartan
#

or padding?

tropic frost
#

and?

willow tartan
#

maybe pooling

tropic frost
#

not "maybe pooling", it is pooling
so

  1. your actual input size that you choose
  2. your convolution filters and amount of padding
    and
  3. Your pooling or upsampling operations
#

so now
go through your model and trace out how the size changes from input to output on a sheet of paper and then figure out what you can do to get the output size that you want

willow tartan
#

ok

#

Nice to meet you

#

And respect to you from Turkey.

willow tartan
# tropic frost so now go through your model and trace out how the size changes from input to ou...

Sir I need your helps. I worked hard on model architecture and fixed bugs. I used dropout and data augmentation(to 16k imageset) to reduce overfitting. I used binary crossentropy loss func and adam optimizer(lr = 0.001). I trained the model for 50(batch_size=128) epoch but metrics(loss,acc,,val_loss,val_acc) haven't changed much and I trained to model again but this time for 250 epoch(batch_size). But again metrics haven't changed much.