Search code examples
deep-learningconv-neural-networkresnetimage-classification

How can you increase the accuracy of ResNet50?


I'm using Resnet50 model to classify images into two classes: normal cells and cancer cells. so I want to to increase the accuracy but i don't know what to modify.

# we are using resnet50 for transfer learnin here. So we have imported it
from tensorflow.keras.applications import resnet50

# initializing model with weights='imagenet'i.e. we are carring its original weights
model_name='resnet50'
base_model=resnet50.ResNet50(include_top=False, weights="imagenet",input_shape=img_shape, pooling='max')
last_layer=base_model.output # we are taking last layer of the model

# Add flatten layer: we are extending Neural Network by adding flattn layer
flatten=layers.Flatten()(last_layer) 

# Add dense layer
dense1=layers.Dense(100,activation='relu')(flatten)

# Add dense layer to the final output layer
output_layer=layers.Dense(class_count,activation='softmax')(flatten)

# Creating modle with input and output layer
model=Model(inputs=base_model.inputs,outputs=output_layer)
model.compile(Adamax(learning_rate=.001), loss='categorical_crossentropy', metrics=['accuracy']) 

There were 48 errors in 534 test cases Model accuracy= 91.01 % Also what do you think about the results of the graph? enter image description here

this is the classification report

i got good results but is there a possibility to increase accuracy more than that?


Solution

  • This is a broad question as there are many ways one can attempt to generally improve the network's accuracy. some of which may be

    • Increase the dimension of the layers that are learned in transfer learning (make sure not to overfit)
    • Use transfer learning with Convolution layers and not MLP
    • let the optimization algorithm choose the learning rate on its own
    • Play with additional augmentations to the dataset

    and the list goes on.

    Also, if possible, I would suggest comparing your results to other publicly available benchmarks - by doing so you might understand the upper bounds of the accuracies better