Skin Cancer Detection using CNN with Swish Activation Function

Download Full-Text PDF Cite this Publication

Text Only Version

Skin Cancer Detection using CNN with Swish Activation Function

Mariam Fathima R

Dept: Computer Science Cambridge Institute of Technology

Misba Farheen

Dept: Computer Science Cambridge Institute of Technology

Manjushree M

Dept: Computer Science Cambridge Institute of Technology

Manish Kumar Pandit

Dept: Computer Science Cambridge Institute of Technology

Abstract: The irregular growth of skin cells develops on a person's skin when it is has been exposed to the sun. Although it can develop even in places where the skin is not been exposed to the sun. The main reason for melanoma is sun exposure, which has proven to be the cause of 65% of melanoma cases. Over the past years, we have seen Deep learning being a popularly used for medical diagnosis. We have built a deep learning model that detects melanoma and cases of skin cancer. After a thorough experiment, we have deduced that a convolutional neural network with Swish activation function performs well in detecting skin cancer and its types. Swish activation function was compared with Adaptive Piecewise Linear unit to get a broader understanding of the role of activation function and its importance in image classification. The dataset used Skin cancer MNIST: HAM10000.

KeywordsSwish, melanoma classifier, CNN, activation function


    Deep learning models mainly Convolutional Neural Networks (CNN) like Mask-R CNN, U-Net, VGG, have been extensively used to solve problems in computer vision technology. Deep learning has been used in medical diagnosis and classification widely. Most of the modern deep learning models are based on artificial neural networks like CNNs, although they can also incorporate propositional formulas that are included in a layer-wise deep network. Deep learning is a multilayered network, and due to this factor deep learning models can perform tasks of classification in medical diagnosis and also clustering patients based on their symptoms and medical backgrounds. Skin cancer is the most common type of cancer which is known to generally occur in people with lesser melanin count. There are two types of skin cancer, non-melanoma and melanoma. Melanoma is known to be rarer but it is all the more dangerous. The mortality rate of patients with melanoma has drastically increased in the past few years which has begun to pose as a problem and one-fifth of the patients develop metastatic disease which ultimately leads to death. Nevertheless, the prognosis can be deemed good when melanoma is identified in the early stages. It is been observed that early detection is key in this aspect and has been proven to have a 90% cure rate in low-risk patients. Since early detection of this disease is a key factor technology has advanced to aid physicians in helpful diagnosis. A CNN model trained on vast medical data can become a handy tool even for a physician with years of experience. Deep learning models

    have been used extensively in this area specifically because medical imaging and diagnosis require high precision and in most cases, early detection of a disease can prove vital, so, many physicians worldwide use these deep learning models as well for a thorough diagnosis.

    In our work, we have built a model that works predominantly on the Swish activation function and CNN. We have used a CNN model with Swish activation function as a layer and also another with Adaptive Piecewise Linear function for comparison. This model was built to detect skin lesions and classify the type of skin cancer, specifically melanoma. We have used an image dataset, Skin cancer MNSIT: HAM10000.


    CNN has proved to output tremendous results in ImageNet Challenge. This is considered as a significant segmentation and classification challenge in the image analysis field [1]. Deep neural networks which is CNN based have been comprehensively used in medical classification at the present. CNN is a magnificent feature extractor, henceforth using it can help to keep expensive feature engineering to a minimum. Qing built a customized CNN that used shallow convolution layers to classify lung disease. The authors noted that the model can be generalized to different medical image datasets. In other research, they also determined that CNN based models can be trained from large chest X-ray film datasets providing good accuracy and sensitivity results [3]. Using insufficient data makes it challenging to train a satisfactory model. Overall, with proper datasets and a good model, CNN can be used for medical diagnosis and classification tasks.


    Fig. 1 Architecture of CNN model with Swish and APL activation functions for classifying skin cancer. Model consists of twenty one layers: four, convolutional layers, max-pooling layers, batch normalization, swish activation function layer, dropout, flatten and three fully connected layers

    1. Image Data

      The data set used is skin cancer MNSIT: HAM10000.

      We are classifying seven different types of skin cancer as illustrated in the figure given below.

      (a) (b) (c) (d)

      (e) (f) (g)

      Fig. 2 a) Actinic Keratoses; b) Benign Keratoses ; c) Basal Cell Carcinoma; d) Dermatofiboma; e) Melanoma; f) Melanocytic Nevi;

      g) Vascular Lesions

    2. Proposed System

    The data set we are using here is skin cancer MNSIT: HAM10000. Here a custom CNN model is built which has 21 layers in total for a better understanding in the network. In our model we use Swish activation function as a separate layer in addition to this Dropout layers were also added to avoid overfitting of our model.

    Another model with Adaptive Piecewise Linear (APL) activation function is built for comparison against the Swish Activation Function.


    Dataset used is Skin cancer MNSIT: HAM10000. A CNN for melanoma detection using fully connected neural network model was built. The final model proposed has 21 layers. Instead of making Swish as an activation function we used it as a separate layer

    1. The Activation function

      f(x) = x. sigmoid(x)

      The above is the formula for Swish activation function. This is known to outperform relu activation function as the drawback of relu is that for lower derivation the x value becomes zero.

    2. Model with Different Activation Function

    In our experiment we used APL as the other activation function for comparison. We have compared the results of our customized CNN-based model with the one using APL function. The model is trained for 50 epochs on a total of 38,000 images of skin cancer which have been augmented from the 10,000 image dataset and validated on 1000 images. We have only changed the activation function of our model for comparison while other parameters remain the same. The accuracy we were able to achieve with our model with Swish is 76% on validation.

    While for Adaptive Piecewise Linear model the accuracy was 74.4% on validation. Since we used activation functions as layers rather than functions in the model we noticed a considerable increase in the accuracy and decrease in loss.

    The detailed process of training and categorical accuracy graph is shown in Figure 3.

    Fig. 3 X-axis number of Epochs, Y-axis categorical accuracy. The graph shows the training and validation curves of the CNN model.

    Along with categorical accuracy we even checked for the top_2 and to_3 categorical accuracy with respect to our model. The Figure 4 gives a brief understanding of the training and validation accuracy scores for the same 50 epochs.

    Fig..4 X-axis number of Epochs, Y-axis top_2categorical accuracy. Fig. 4 The training and validation curves of the CNN model showing top_2 categorical accuracy.


    In this paper, we show how Swish activation function can affect a convolution neural network model with respect to accuracy and processing time. Activation functions are vital components in the working of a deep learning model and its usage and effectiveness was noted during the building and training of the model. Although there is many areas for improvement in our model we could deduce that deep learning models can be vastly used to aid physicians in medical diagnosis and screening.


This work was supported by DR. Sashikumar D R of Cambridge Institute of Technology (HOD, Computer Science Dept).


  1. Krizhevsky, Alex, Ilya Sutskever, and Geoffrey E. Hinton. "Imagenet classification with deep convolutional neural networks." In Advances in neural information processing systems, pp. 1097-1105. 2012

  2. Zeiler, Matthew D., and Rob Fergus. "Visualizing and understanding convolutional networks." In European conference on computer vision, pp. 818-833. Springer, Cham, 2014.

  3. He, Kaiming, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. "Delving deep into rectifiers: Surpassing human-level performance on imagenet classification." In Proceedings of the IEEE international conference on computer vision, pp. 1026-1034. 2015

  4. He, Kaiming, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. "Deep residual learning for image recognition." In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770-778. 2016

  5. Lens, M. B., and M. Dawes. "Global perspectives of contemporary epidemiological trends of cutaneous malignant melanoma." British Journal of Dermatology 150, no. 2 (2004): 179-185.

  6. H.-P. Chan, S.-C. B. Lo, B. Sahiner, K. L. Lam, and M. A. Helvie, Computer-aided detection of mammographic microcalcifications: Pattern recognition with an artificial neural network,

  7. Vasconcelos, Cristina Nader, and Bárbara Nader Vasconcelos. "Convolutional Neural Network Committees for Melanoma Classification with Classical And Expert Knowledge Based Image Transforms Data Augmentation.

  8. Tschandl P., Rosendahl C. & Kittler H. The HAM10000 dataset, a large collection of multi-source dermatoscopic images of common.

  9. Noel C. F. Codella, David Gutman, M. Emre Celebi, Brian Helba, Michael A. Marchetti, Stephen W. Dusza, Aadi Kalloo, A Challenge at the 2017 International Symposium on Biomedical Imaging (ISBI),

    Hosted by the International Skin Imaging Collaboration (ISIC), 2017

  10. W. Zhang, K. Doi, M. L. Giger, Y. Wu, R. M. Nishikawa, and R. A. Schmidt computerized detection of cludtered micro classification in digital mammograms using a shift-invariant artificial neural.

  11. S. Prabu, V. Balamurugan, and K. Vengatesan, Design of cognitive image filters for suppression of noise level in medical images, Measurement, Vol. 141, pp. 296-301, 2019.

  12. B.D. Parameshachari, H.T. Panduranga, and S.K. Naveenkumar, Partial encryption of medical images by dual DNA addition using DNA encoding, In Proc. of international conference on recent innovations in signal processing and embedded systems (RISE), pp. 310-314, 2017.

Leave a Reply

Your email address will not be published. Required fields are marked *