A Mini Project Report on Skin Cancer Detection using CNN By Aparna Agnihotri (A-703) Amreen Khan (A-752) Vaishnav Kanekar (A-780) Under the guidance of Dr. Jyoti Deshmukh Department of Computer Engineering University of Mumbai November – 2021 Juhu-Versova Link Road Versova, Andheri(W), Mumbai-53 Certificate Department of Computer Engineering This is to certify that Aparna Agnihotri Amreen Khan Vaishnav Kanekar Have satisfactorily completed this synopsis entitled Skin Cancer Detection using CNN Towards the partial fulfilment of the BACHELORS OF ENGINEERING IN (COMPUTER ENGINEERING) As laid by university of Mumbai Dr. Jyoti Deshmukh Guide Prof. S. P Kachane Head of Department Dr. Sanjay Bokade Principal ii INDEX Sr.no Title Page no 1. Introduction 4 2. Methodology 5 3. Code 7 4. Result 12 5. Conclusion 13 3 Introduction Skin is the most exposed part of the body given the fact that it is the outermost part hence inevitably gets exposed to pollution, harmful UV rays, dust, micro-organisms. This can lead to a number of diseases, and in worst case scenario, to skin cancer. It is a depressing fact, as stated by World Health Organisation (WHO), that one in every three cancers identified is a skin cancer. As its correctly said absolute power corrupts absolutely, it is because of human’s exponential increase in power over nature and subsequent global warming that the ozone layer is getting depleted, inversely leading to increase in the harmful UV radiations reaching Earth’s surface because of loss of the protective filter. An additional 4,500 melanoma and 3,00,00 non-melanoma skin cancer cases will be resulting in case of a 10% decrease in ozone levels. Other causes of skin cancer include modernizing diets, smoking and alcohol. Abnormal changes in skin colour appearance, shape, size, itching, bleeding are the cautionary signs of skin cancer. Due to negligence, lack of facilities, or simply unavailability of crucial time the disease rushes to become fatal, by spreading to other body parts. To curb this global incidence of skin cancer from reaching massive heights there is an urgent need of reliable and accurate systems to not only help the expert dermatologists in the field but also individuals to detect skin lesion types as early as possible. Melanoma develops when melanocytes undergo malignant transformation, become abnormal, grow uncontrollably and aggressively invade surrounding tissues. Melanoma may affect only the skin, or it may spread through the blood or lymph system to other organs and bones. Melanoma is the most serious form of skin cancer. Melanoma may be cured if caught and treated early, but, if left untreated, the majority of melanomas eventually spread to other parts of the body. Early detection and surgery to remove the melanoma are successful in curing most cases of melanoma; however, it is rarely curable in its later stages. Accurate recognition of melanoma in early stage can significantly increase the survival rate of patients. However, the manual detection of melanoma produces huge demand of well- trained specialists, and suffers from inter-observer variations. A reliable automatic system for melanoma recognition increasing the accuracy and efficiency of pathologists is worthwhile to develop. As scary and horrendous it sounds, the only remedy, the only elixir, lies in early detection, the sooner the better it will be if one gets detected in early stages, doesn’t neglect even mild symptoms and puts up a brave face to fight on this health issue. In an attempt, with best intentions, this project aims to build a CNN based model using image processing and hence try to assist the patients in getting early and easy attention and care in their journey to treat Melanoma. 4 METHODOLOGY Problem Statement The objective of the skin cancer detection project is to develop a framework to analyze and assess the risk of melanoma using dermatological photographs taken with a standard consumergrade camera. Melanoma is one of the most lethal forms of skin cancer. The overall aim of the proposed skin lesion analysis system is to fortify efforts to reduce melanoma cognate deaths and dispensable biopsies by ameliorating the precision and efficiency of early melanoma detection. Image analysis implements enable the automated diagnosis of melanoma from dermoscopic images. Objectives: • • • • Early detection, the sooner the better. Easy reach to medical facility to detect skin cancer. Strengthen our efforts to reduce number of skin cancer casualties Pave way for future endeavours and thought in this domain Analysis/Framework/Algorithm: Skin cancer detection using CNN and image processing is basically defined as the process of detecting the presence of cancerous cells in image. Input image: Input to proposed system is dermoscopic images, dermoscopic images are images taken by consumer grade camera. Pre processing: Goal of pre-processing is an improvement of image data that reduces unwanted distortions and enhances some image features important for further image processing. Image pre-processing involves gray scale conversion Grayscale conversion: Grayscale image contains only brightness information. Each pixel value in grayscale image corresponds to an amount or quantity of light. The brightness graduation can be differentiated in grayscale image. Grayscale image measures only light intensity. 8 bit image will have brightness variation from 0 to 255 where ‘0’ represents black and ‘255’ represents white. In grayscale conversion colour image is converted into grayscale image.Grayscale images are more easy and more faster to process than coloured images. In our proposed system coloured or RBG image is converted into grayscale image by using weighted sum method by using following equations Grayscale intensity= 0.299 R + 0.587 G + 0.114 B (1) 5 System flow/ System architecture Our model is designed in phases as follows: Phase1 – the first model involves collection of dataset, the images are collected from Kaggle Phase 1 dataset provide the collection of images for melanoma skin cancer. This dataset contains approximately 23,000 images of which we have collected 1000-1500 images and trained and tested over these images. a) Basal cell carcinoma b) Actinic Keratoses c) Benign Keratosis e) Vascular Lesions f) Melanoma g) Melanocytic nevi Detailed design 6 d) Dermatofibroma Also involves the pre-processing of the images where hair removal, glare removal and shading removal are done Removal of these parameters helps us to identify the texture, color, size and shape like parameters in an efficient way. Phase 2- This is the most important phase of our model, this phase involves designing of the model and training. Our model is trained for CNN (Convolutional Neural Networks) on the dataset that will be collected in the phase1, the model after training is tested for the accurate output. CODE & RESULTS Step 1: Import necessary libraries such as matplotlib,numpy,pandas etc 7 step 2: visualise the dataset distribution as the following figure shows into piecharts and bar graphs. There are seven type of skin cancer : 1. 2. 3. 4. 5. 6. 7. Akiec Nv Vasc Mel Df Bcc bkl 8 Step 3: Upon careful observation we find that there is a heavy imbalance in distribution of dataset of “nv” skin cancer type so we use a method called resampling wherein we resample the images of all skin cancer to 500 images of each type. Therefore we now have 700 images in total . Step 4: Now after aligning the data frame with image path we start building the CNN model with : Batchsize: 16 Num_classes: 7 Epochs : 15 Activation function: softmax Layers: Conv2D, max pooling 9 Step 5: the traning and validation loss and accuracy are as follows 10 Step 6:The following are the metrics such as accuracy, F1 score, recall, precision 11 step 7: the following are the classification : 12 CONCLUSION Malignant melanoma even if has the occurrence in only 4% population, it accounts for 75% of deaths caused due to skin cancer. In this project we have done extensive survey of existing systems and came to the conclusion that CNN based model will help to dermatologists in early detection of cancer in skin and give them more time to perfect their future steps in curing the patients, because time plays an extremely important role in providing cure for this deadly disease. 13