In this study, classification results were compared using 2 different pre -trained models. These models are VGG-16 and Resnet-50. In addition, the hyperparameters used for the 2 pre-trained models are the same.

Hyperparameters of VGG-16 and Resnet-50 models

  • Batch Size: 128
  • Number of epochs: 15
  • Learning rate: 0.00001
  • Loss function: Binary Cross Entropy
  • Optimizer: Adam Optimizer

We used the pytorch library to create our model, and also used the ’cuda’ provided by pytorch, which helps us with time and accelerates computations because GPU uses it.

VGG-16

First of the Pre-Trained Models, we used the VGG-16. As described above, only ConvNet and ReLu were used twice in the first 2 blocks of the VGG-16 and ConvNet, Relu and maxpool were used 3 times in the next 3 consecutive blocks. Afterwards, linear, relu and dropout layers were used consecutively as fully connected layer. This was repeated 2 times. Finally, the linear layer was added to output the fully connected layer.

VGG-16 Training and Validation Loss

Initially, we used the negative log likelihood function as the loss function. And the loss values we obtained were very high. As the number of epochs increased, a decrease in training loss values was observed. Training loss decreased while validation loss increased. In addition, after the 6th epoch, the validation loss began to give constant values. We realized that the model was overfit so it doesn’t learn. The constant accuracy we obtained was approximately 76%.

Resnet-50 Training and Validation Loss

The best model was recorded with early stop technique. Weight was not recorded when the validation loss was in- creased and the previous model was saved. Since our problem is binary classification, we decided to use binary cross entropy loss function instead of NLL. We changed some parameters during the training and validation phase. The model worked smoothly and achieved approximately 87% accuracy.

Resnet-50

VGG-16 Training and Validation Accuracy

No changes were made to the Resnet-50 model. Because, as the epoch number increased during the training phase of the model, a continuous decrease in the loss value was observed.

Resnet-50 Training and Validation Accuracy

The best model was recorded in each epoch. Early stop technique was used but not needed. Validation accuracy be- gan with a considerable value. Thereafter, a continuous in- crease in validation accuracy was observed.

Results

n this study, two different pre-trained models were tested. One of them is VGG-16 and the other is Resnet- 50. VGG-16 model had a validation accuracy of 86.7% at the end of 15 epoch and a validation accuracy of 93.8% at the end of 15 epoch of Resnet-50.

When we compared results for two architecture we selected RESNET-50 as best model. Resnet-50 pre-train model was more successful than VGG-16. Obtained very high accuracy .

Accuracy Formula
Resnet-50 Confusion Matrix

When we look at the confusion matrix, the number of image that is predicted as benign tumor, which is actually benign tumor, is 19596. The number of image that is predicted as malignant tumor, which is actually malignant tu- mor, is 12871. When we add these two values, it will give us the correct classified images. This will give us accuracy when we divide these correctly classified images by the total number of validation images. The classification accuracy of Resnet-50 is approximately 94%.

Conclusion

As a result, we have written our last block in this project where we tried 2 different pre-trained models. Further studies on this project, if we increase the data augmentationtechniques, the model will give better results. Only normalization and resizing were used in this project. If scaling ,translation, rotation and flipping techniques are used, accu-racy of the model will increase. Because these techniques,in a way, increase the number of features used in the dataset,the model will learn much better. Take care!

--

--