AI-Powered Skin Cancer Monitoring System
Amber Gupta
STEM Innovation Academy Jr. High N.W. Campus
Grade 8
Presentation
No video provided
Problem
Main problem: How can we use ML to develop an application that can accurately predict skin cancer, and have continuous monitoring of potential skin cancer?
Skin cancer is the most common type of cancer throughout the world, it generally is harmless but can rapidly turn into a potentially fatal cancerous growth. If left untreated for a prolonged time, the cancerous cells can penetrate blood vestales and spread throughout the body, attacking vital organs, lowering survival chances for the patient.
When ultraviolet light, specifically medium to low frequency, hits any form of exposed and unprotected skin, the light passes through the cells, going past the cellular membrane and interfering with genetic material. During this interference, genetic information and the overall Deoxyribonucleic acid (DNA) structure can become damaged. As a result of this, the cell can start to go under mitosis at an abnormal rate, causing an influx of cells. This abondance of cells forms a clump which keeps growing and mutating. If not treated, it can start to become harmful for the patient.
There are a total of 3 different types of skin cancer, they are as follows:
- Basal Cell Carcinoma
- Squamous Cell Carcinoma
- Melanoma
Many people are not educated on this topic, they do not know that a simple inconvenience of applying sunscreen and wearing UPF protective and approved protection negates the risk of skin cancer by a significant amount. Many people find this an inconvenience, hence they skip the procedure entirely, not knowing the risks. A lot of people who wear protective equipment when traveling in the sun, do not wear the proper equipment. People use any cheap sunscreen they can find, this is not good. There are certainly good cheap sunscreens, but finding them is difficult and often requires background research, people do not do this, they find which ever sunscreen they can find that is both affordable and is by brand they know or have seen. Slowly, overtime this cause skin cancer. Due to how skin cancer is formed, it can happen anytime proper PPE is not worn. The general public also does not have enough education on skin cancer to know what it looks like, and what to do. Due to this, the growth is often left unknown and untreated, making it worse. Evidently, when it is found, it is either too late and the growth has spread to such a point where it is no longer a general case, or that the growth has not yet developed enough for general people to be able to distinguish between normal skin lesions and skin cancer. Furthermore, when it is made clear that a growth is present, due to the lack of training, people generally dodge it as "normal" growth like a scab or a mole, not a cancerous growth. Eventually, the case would grow in severity so much that the patient would be able to tell that the growth is abnormal and book an appointment with a dermatologist, but not until it is too late.
The goal of my project was to bridge this gap and offer a quick and convenient way for a general person in society to be able to predict whether a growth is cancerous or not by using an AI powered application on their devices.
There are publicly available skin cancer "detection" AI models on google, but they usually are not the best and do not have a proper Graphical User Interface (GUI) for an average person to use them. My project will have a GUI for the user that is simple and easy to understand/follow. My application would also offer a "continuous" monitoring feature that can monitor the condition of the growth over the course of multiple days. Since proper continuous monitoring is not feasible with the functionality of an application, I will have the user take multiple images across multiple days, the AI will predict the outcome of each image, and the outcome that has been repeated the most would be displayed as the answer to the user.
This application is being made to create a convenient way for general people to be able to predict the harmfulness of a growth without needing to go see a dermatologist.
All in all, the main problem that my project is trying to solve is that people are not educated on skin cancer and cannot tell whether a growth is cancerous or not, and when it becomes visible, it is too late.
Method
Before I could start building my model, I had to do some background research. I started by researching skin cancer, helping me get a proper understanding on the topic. Understanding skin cancer would be helpful to me because I would be able to find the proper datasets and information to train my ML model on. Afterwards I moved into some basic AI research. This would allow me to understand an overview of what I am coding and help me understand what sources I need to find to build my AI. Only after these two sections are done, will I be able to start making my model. After I have made my model, I would make the GUI that goes with the model. Then I would do AI research that goes more in depth and finally end with making my model better based on what I learned from the research. My overall method to making my AI (List): Skin Cancer Research Basic AI Research Building AI Model Making GUI for application Depth AI Research Model Improvements Skin Cancer Research: Based on some research conducted before starting the project, I was able to get a general understanding of skin cancer before I started my depth research. From this research I found that Skin Cancer is formed when ultraviolet light damages and changes the DNA structure of the skin cell. I also found that there are a total of 3 different types of skin cancer, they are as follows: Basal Cell Carcinoma Squamous Cell Carcinoma Melanoma Basal Cell Carcinoma (BCC): Basal Cell Carcinoma is the least deadly and most common form of skin cancer. This type of skin cancer begins in the basal cells located in the skin’s epidermis (outermost layer of skin). In a regular environment, basal cells replicate and divide through mitosis to provide for and form the epidermis. When a new basal cell is formed, the old cell is pushed up closer to the surface where it dies and eventually is shedded. Fact: Most of the dust floating inside a conventional house is actually made up of dead skin cells The area affected by BCC can look transparent, pearly, dark, and/or bumpy. Sometimes it can form to be scaly and flat, but the overall look is heavily dependent on numerous factors like skin colour, type of skin, the stage/severity, and even the overall time the area has been in direct contact with ultraviolet light. Basal Cell Carcinoma can spread throughout the body when not treated but is rare due to growth pace. Unlike the other forms of skin cancer, BCC goes deeper into the skin but replicates much slower. This slow expansion gives the patient time to notice and doctors time to mend the growth. However, certain mutations can cause more rapid growth instead. When this rapid growth happens, it can spread faster than the other forms. Typically, patients notice the growth before it spreads too much, hence the huge success rate. Basal Cell Carcinoma can become a part of anyone's life, some find success in treatments, others do not. Though it is important to mention that there are groups of people that have a higher chance of developing any form of BCC. It is found that if there is any past history with BCC, whether direct or through family, chances of development of BCC increase by some degree. Additionally, people with fair skin, people that are taking immune system suppressors, people 50 years of age or older, and people with high sun/ultraviolet light exposure tend to have increased chances of developing skin cancer. When someone unfortunately develops skin cancer, the growth can be one of the four different types of skin cancer. Nodular Superficial spreading Sclerosing Pigmental Nodular is the most common form of BCC, it looks like a rounded pimple with visible blood vessels surrounding it. Then comes Superficial spreading, it looks like a small shallow marks and dots on the skin, usually forming on the torso, arms and legs. Sclerosing looks like scars that keep spreading, this type of BCC is most commonly found on the face, usually looking like a red dot. Pigmented BCC is very rare, it causes hyperpigmentation, this means that the area of the skin looks darker compared to the area surrounding the growth. To treat Basal Cell Carcinoma, for most cases, general surgical removal is preferred. It is low risk and has high success rate. For larger growth or for sensitive regions, Mohs surgery can be advised but is generally not required. As last resorts, radiation based therapy can be used but typically has higher chances to harm the patient in other ways. It is still safe, but compared to general surgical removal or Mohs surgery, it possesses higher risks. Additionally, photodynamic and drug therapy may also be used, but are only used for extreme complications. Squamous Cell Carcinoma (SCC): Squamous Cell Carcinoma is extremely similar to Basal Cell Carcinoma, hence the relation in name. In science, things that are named alike are similar in many ways, but there will be some differences. In terms of SCC and BCC, the main difference is that SCC begins in Squamous cells instead of Basal cells. Squamous cells tend to be bigger and are in fewer quantities. This makes it so that SCC spreads more rapidly than BCC, but it goes shallower into the skin. Everything from the treatments to the signs and symptoms are the same for both, the only difference being the origin and appearance. Squamous Cell Carcinoma can look different. The most common appearance is a red scaly bump that can crust over or bleed, wart like growths, a growth higher than the surrounding skin that sinks down in the middle (like a well), and a wound that won’t heal. Melanoma: Melanoma is the deadliest and least common form of skin cancer. Melanoma is dangerous; it attacks the patient more harmfully that the other types. Melanoma replicates fast, tearing through the skin of the patient. This makes it so that Melanoma spreads deep and fast, making it that much deadlier. When it eventually breaks through blood vessels, it will enter the body and spread faster. Melanoma forms in Melanocytes, which are found much less in number than Squamous Cells and are bigger in size than Squamous Cells. Melanocytes contains Melanin, a pigment that forms the colour of the skin. When cancer develops in Melanocytes, it causes abnormal levels of replication. When an abundance of these cells is created, an influx of Melanin is also created, changing the colour of the skin in the affected area. This makes the growth stand out as its colour is distinctively different. These Melanocytes are found across the body. It gives the colour of the organs and/or mucous membranes. Due to these made up of the same cells, when a cancerous Melanocyte enters the bloodstream and attaches to an area where more Melanocytes are found, it makes it easier for the cancerous cell to replicate and cause cancer in that region as well. Altogether, Melanoma replicates quickly, goes deep into the skin, and when it enters the body, it can spread cancer to healthy regions, thus making it the deadliest form of skin cancer. Fact: Melanoma is higher in women before the age of 50 years. Afterwards, Melanoma rates in men increase significantly. Since Melanocytes contain Melanin, doctors can tell a lot by the colour of the growth since it directly links to the amount of Melanin and Melanocytes. Since the colour is dependent on the amount of Melanin present, there can be many abstract and unique colours that define Melanoma. An example of this would be for the growth to appear pink, red, or even purple, it just depends on multiple factors. According to studies conducted, 30% of Melanoma starts in pre-existing moles, and the rest can start from regular skin. Due to the high percentile of Melanoma cases starting from regular skin, it becomes hard to tell when an area is infected or not to the regular human, especially if the patient is trying to alter the appearance of their skin. This increases the chance if there is Melanoma present to be left unnoticed and untreated. Due to the abstract look of Melanoma, most cases are found early, but many are not. When they are not noticed and thus not treated, the cancer can slowly grow and start to harm the patient. This makes early detection extremely important, especially with Melanoma. From studies conducted, it is found that the success rate of surgery increases drastically when the growth is detected early. Based on current findings, approximately a success rate of 95% is average with early detection. With Melanoma being able to replicate fast, tear through the skin, and spread over the body while going deep into the skin makes Melanoma the deadliest form of skin cancer.
Due to the different appearances of Melanoma and the other forms of skin cancer, there are many ways to distinguish between the two. However, dermatologists have narrowed those down to five biomarkers. A – Asymmetry B – Border C – Colour D – Diameter E – Evolving Asymmetry is when one half of an axis is different than the other half of the same axis. Intentional things in nature are generally symmetrical. We can take a mole for example, it is a skin lesion, but it still follows symmetry. Unintentional and unpredictable things is nature are generally asymmetrical. Skin cancer for example, it grows unpredictably as the cells replicate abnormally, causing an asymmetrical growth. Dermatologists use this as their first check to see if the growth is cancerous or not. Border is the appearance of the edges of the affected area. The border can be smooth, jagged, scaly, bumpy, or any appearance. Border recognizes this appearance. Dermatologists use this as evidence for whether the area is skin cancer or not. Colour is the visual appearance of the affected area. The colour of the area can tell a lot, it can tell what type of cancer it is, if it is not cancer than what is it, and many other questions. The colour does not need to be uniform; it could be irregular. Dermatologists use this to answer the same questions, but they additionally also use it to identity whether a growth is Melanoma or not. Diameter is the size of affected area. Since the size of the growth on the surface, directly connects to the depth of the growth, diameter can tell the severity of the case. Dermatologists use diameter for the same purpose, to get an approximate estimation of how severe and urgent the case is. It has also been found that typically a growth of 6.00 mm is considered the border-line between urgent and not urgent. Evolving is the changing of the affected growth. Skin cancer is made when cells replicate abnormally, this would cause the area to change in some way to accommodate for the extra cells. Dermatologists use it as the final evidence to tell whether a growth is cancerous or not. There are multiple treatments for Melanoma, the two most common ones are surgery and radiation therapy. For early Melanoma, doctors typically recommend surgery, while for more severe cases, they recommend radiation therapy. Basic AI Research: Before I could start building my AI, I needed to know some information. Based on my background knowledge, I knew that AI is a general term and that there are multiple divisions of it that work well with different things. I did not know which division was the best, so fist I had to research and find that, and then I needed to know whether my laptop is powerful enough or not to make the AI. Which division of AI is better (LLM/ML): First, I started by finding the best division of AI, but I was running low on time, therefore I chose the most known divisions to research from; LLMs and ML models. LLM: Large Language Models (LLMs) is a type of AI that lets us work with human text and writing. It focuses on literacy and is not the best at other tasks. LLMs also train on lots of data, potentially terabytes, I did not have this much data. This form of AI is only good for generating and understanding human text and not comparing something to another unless it’s specifically characterised as “text”. All this would mean that LLMs would not work with my usage. Considering what I had learned about LLMs from this research, I knew that they would not work well with my usage, therefore I decided to move on the next division of AI to research on. ML: Machine Learning (ML) is when a model is comparing and learning from a set of pregiven data. The model is not just using mathematical calculations but instead is training from the set of data given and is learning from that. ML is the ability of a model to come up with predictions of something using a variety of information. ML is a more generalized version of LLMs, this means that every LLM is a ML model, but not all the ML models are LLMs. Since LLMs follow the basic structure of an ML model, LLMs are just a division of ML. ML is different than programing, while programming involves directly changing aspects, ML involves a model to use information to “Learn” and make the changes in its prediction system. From this much research, I was able to tell that I needed an ML model for my usage. I then researched a little deeper into different ways to train an ML model. I decided that I would first use supervised learning to train the model, then would train it using semi-supervised learning in the model improvements section. Supervised learning is when the model is given pre-labeled data to train from. This is when the programmer tells the model that a set of information belongs to which category. This generally leads to a better result for most models, assuming that sufficient data is provided. Semi-supervised learning is when the model is given some pre-labeled data to train from, but the majority is not labeled. The model starts by using supervised learning to train from the data given, then it starts categorizing the data into the different categories by predicting what the data is (Sudo labeling). Output: Based on the research, I made the decision to use an ML model for my AI-powered application. I decided I would use a CNN ML model. Is my laptop good enough: Coming into the project, I knew that building an AI takes a lot of computational power and energy. This means that I would need a good specification for my laptop to train and build the model. So researched whether my laptop (M4 MacBook AIR) was powerful enough. Based on the research I found that my M4 CPU/GPU was create for building my model, the only issue would be that since I am using an AIR, my laptop would generate a lot of heat, due to this I would need to put a cooling pad underneath. This is important so that the laptop does not start to sacrifice performance to produce less heat. My RAM (16 GB) for this usage would be enough, but to run the model at better performance, or to run models with more parameters, I would need more RAM, but for now I was good. Building AI Model: I first started by importing all the images I would need for the dataset into my IDE (PyCharm). Using the Image Folder class from Torch Vision, I was able to make it so that the images were accessible through just code and were formatted in a way in which the model would be able to understand. Image Folder made a dataset for me in code that used the images and the names of the folders the images were kept in to create the dataset in an organized manner. Afterward, I started making a model class. This would be used as a blueprint to make the model itself and would allow me to call it in multiple places whenever I needed a model. How it works is that first I would train a model based on the datasets, then whenever I would need a trained model, I would create a new model and load this trained model on it. Now I had a blueprint of the model created, allowing me to call an untrained model whenever I required it. With this done, I moved onto training the model. To train the model, I had to make a train and validate dataset from my pre-existing dataset. The issue I had was that I did not have a lot of data to split it into a validate and training dataset. This is not good practice and would result in the model getting trained, but the testing of the model to not be accurate to real life. Still, I went with this because I did not need too much testing information, just needed to train the model. To train it, I first started by making a model object using my model class and loading this onto my GPU using PyTorch. The I started making the loop that would slowly train the AI. At the start I set the loop to run for 30 epochs (iterations). Then using the “Adam” optimizer, I declared the learning rate of the model. Then I started writing the code that would train the model. I started by making the model do a batch of predictions, then based on these predictions and the actual answers from the training dataset, the “Adam” optimizer would adjust the model to make it better by some amount. Then the model would test itself based on the validation dataset. Finaly, this loop would run again until this cycle has been repeated for the set number of epochs. This is how I trained my model using supervised learning. Making GUI For Application: With the model now done being trained, I moved on to making the GUI for the application. This was easy since all I required were basic elements for the GUI which I found for just a couple of walk-throughs. For my GUI I first started by making the prediction function and the function allowing the user to upload images. The prediction function would just call an untrained model layer, then it would load the trained model layer onto it, then using the new trained model and image given by user, the model would predict and give an output. To have the user be able to upload images, I used PYQT6 since that also was the library I would use to make the overall GUI. With these two things complete, I started by making the proper Graphical User Interface (GUI). To do this, I used a walk-through and the PYQT6 library. Since all I needed were basic elements like text, buttons, and some logic, it was straight forward. I started by making all the windows that would be needed and writing the text on each window. Next, I started by adding buttons, these would open the respective window when clicked or perform specific actions. Right now, they did nothing since no logic was added. Finaly, after adding in all the logic I had my GUI completed. Now I added the continuous monitoring feature. To do this, I just made the user enter multiple images of the growth across seven days, giving the model a sense of time. Then I made it so that the model would predict the image sent and upload the prediction along with the day number to a datalog that would be created under the name of the patient. Finaly, after the seven days, the user can choose to get a prediction or to continue to monitor. If they choose to get the prediction, the code will find the prediction that has been repeated for the greatest number of times and deliver that as the output. Now, the GUI and logic of my application was built. At this point I was theoretically done, but I did not understand the code for the model that well and did not know how to make it better. This is why I started in-depth research of AI and how it works and the different terminologies. Depth AI Research: I knew a little a about how my AI worked, but not enough to understand the code and improve it. Therefore, I started depth research to understand the terms the videos were talking about. Once I understood these terms, I could understand what each line of code was doing, allowing me to improve it. Neural Networks: A neural network is the basis of an ML model. A neural network is the most basic machine learning algorithm that is inspired by the human brain. When trained properly, this simple algorithm can solve complex problems that traditional algorithms cannot. Neural networks are inspired by the human brain, using connections and electrical signals to formulate an output. In the brain, when certain neurons are activated as a group, it represents a specific output, neural networks copy this design. Inside a neural network, there are three main layers, an input layer, hidden layers, and an output layer. Inside the input layer, there are a lot of nodes/neurons. When an input is given, all these nodes activate to a certain degree, often between 0 and 1. When each node’s activation passes a certain threshold, the node becomes activated. We call this threshold the activation point. For example, in a black and white image, these input layer nodes can just symbolize the brightness of a pixel, and the activation point can resemble the threshold at which we consider the pixel to be displaying white. The output layer is the final display, it shows the model’s overall output, hence the name. To give the prediction, the model checks which node/neuron in the output layer is the most activated, which ever neuron that is, its corresponding output is chosen as the overall output. In-between the input and output layer, resides the hidden layers. These layers ultimately are the ones that decide the output based on the input through connections. At the basis, these connections are made through weights and biases. The activation of the node/neuron is multiplied by the weight, which is different for each connection, then all the connections are added together and subtracted by the bias. The bias is the minimum value we want. As an example, if the minimum value we want is 10, then we subtract the number by 10, if the value is bigger, it will result in a positive number, if it is not, then the value will be a negative number. At last, we use the sigmoid function to get a value ranging from 0 to 1. This value is then used as the activation for the next node/neuron. Note that each of the nodes from the previous layer, are all liked to each node of the second layer. This means that each node from the previous layer, determines the activation for every neuron in the next. Additionally, each connection has its own weight, and each connection group has its own bias. This process is repeated for every neuron in a layer, once that has been done, the process starts over for the next layer, repeating again until it reaches the output layer. For a neural network to learn, it ultimately comes down to its ability to adjust the weights and biases until every input is correctly corresponded to its output. This ability breaks down to 4 main steps: 1st, forward pass (forward propagation) 2nd, error calculation 3rd, backward pass (backpropagation) 4th, weight updating There are numerous types of neural networks, but the type that I am using is called a Convolutional Neural Network (CNN). This type of neural network excels in image and pattern recognition; hence I used it. The structure of each type of neural network is different, but all follow the basis of neural networks, what I described above. Weights / Biases: Weights are just numerical values assigned to the connections between neurons. They determine the influence a connection has on the final output. The bigger the weight, the larger the influence, and vice versa. During the forward pass, the inputs are multiplied by their weight before being passed through the activation function, determining the effect of the connection to the output. When training, these weights are adjusted to get the favourable outcome. When these weights are “well-tuned”, the resulting model should have better predictions not only within the training dataset, but outside it as well. Biases are also numerical values that adjust the output of the neuron. However, instead of effecting individual connections, it directly effects the activation function to better fit the data. Biases allow the neuron to be activated, even if the overall weighted sum is not enough, letting the algorithm to recognize patterns outside the learning data. If biases were not present, the model would miss unseen patterns, essentially limiting its use. Like weights, during training, these biases are adjusted through the backward pass. Alongside the weights, they “fine-tune” the algorithm to achieve better performance. Loss: Loss is the calculation of the difference between the correct answer, to the model’s prediction. A lower loss signifies that the model is performing good, while a higher loss means that the model is not performing good. Simply, it tracks the degree of error in the model’s outputs. The goal is to make a model that is accurate, the loss lets us mathematically calculate whether a model is performing good or bad. The loss is not just a measurement meant for the programmer but can also be used to make the model perform better. In a process called backpropagation/backward pass, a series of steps take place. One of those steps is to take the loss, determine which neurons affected this, and tweak them based on this loss. There are different types of loss calculations, the two main categories being regression, and classification. Inside each category, there are multiple different ways to calculate loss, the one I am using is cross-entropy loss. Apart from the different ways to calculate loss, in ML, we use loss in two different places. One is called the training loss, while the other is called the validation loss. Training loss is a calculation of how accurate the model’s prediction is versus the right answer. But validation loss goes outside the training dataset. Validation loss measures how well the model performs outside the data it has already seen before. The backward pass uses both values to determine how the weights and biases should be updated. Forward pass / Forward Propagation: Forward pass or also denoted as forward propagation, is essentially the process of the model predicting the batch of data. At the basis, the numerical value/activation value from the input layer is multiplied by the weight of the connection, once all the calculations for all the connections that connect to the neuron have been made, they are added up and bias is subtracted from that resulting value. Lastly, a sigmoid function is used to get a value ranging from 0 to 1, this then becomes the numerical/activation value of the neuron all the connections were connected to. This happens repeatedly until we reach the output layer. In here, the neuron that is the most activated/has the biggest value, is then selected to be the output of the model, while the neuron’s activated value is the model’s confidence. lastly, this output is then used to calculate the loss. Backward pass / Backward Propagation: Backward pass/backpropagation uses gradient decent algorithms to update the weights, this how the neural network learns. The backward pass/backpropagation is what calculates how much the weights and biases needed to be changed to get a better output. At its basics, we first do a forward pass, once that has been accomplished, we use the loss function to see the difference between the output and the output we wanted. Now is where the backward pass/backpropagation begin. Now, using math, we calculate how much the weights leading to specific neuron need to be changed to get the optimal output. These weights then directly affect neuron they are connected to, but these changes will differ for each different class. To solve this issue, once all the adjustments that are needed for 1 specific class is calculated, we move to the next class. This repeats until we have done this for every class. Now, we have a list of changes that should be done to each neuron. Next, we average out these changes for each neuron, so essentially, if for one class, a neuron’s weight to another neuron needed to be increased by 2, but for a different class, it needed to be decreased by 1, then we would average the results and thus the result would mean that the neuron’s weight would be increased by 1.5. This would happen for every connection within the neural network. Once it has been decided how much each weight needs to be either increased or decreased, we update the weights. However, to update the weight, we do not just add or subtract that value, we first must multiply it by the learning rate. Once that has been done, we can add the previous weight to this new value. (we add it because it makes the code simpler, after all doing -2+3 or 3-2 results in the same value). Now the weights have been updated. This cycle of forward pass, error calculation, and backward pass/backpropagation happens repeatedly for the number of epochs. Training Loop: The training loop is this repeated pattern/cycle. It moves from the forward pass to the error calculation, to backpropagation, and weight updating. All this runs for a predefined value called the epoch number. Once the loop has finished, the model is trained and can be used to make predictions. Learning Rate: Learning rate, at its core, is just a parameter how much a model adjusts its weights and biases. Due to how backpropagation works, the learning rate is multiplied by how much the weight should change, resulting in a small value. This value is how much the weights change. The overall goal is to lower the loss as much as possible, but the model learning is determined by functions, thus a graph. In this graph, we want the loss to be at the lowest possible point. Due to how graphs work, once that point is reached, the graph again goes upwards. The learning rate defines how much we move the loss each time. If we change it by a lot, we will get to this minimum quicker but run the risk of overshooting it. Though, if we change it by a less amount, we will need to take more steps to get to the minimum, but we do not have the risk of overshooting, however this takes more computational power. Due to these reasons, we need to find the best learning rate for the model, but this is done mostly by trial and error. Apart from this, we could also use an adaptive learning rate. This is where we make large steps at the start but gradually decrease the steps as we get closer to the minimum. We can do this by using optimizers, just like “Adam” which I am currently using in my model. Overfitting: Overfitting is essentially when the model has “memorized” the training data. This could mean that the model is predicting from patterns that only exist within the training dataset. All this could result in the model performing exceptionally well on training data, meaning that training loss is low, but is performing significantly worse on unseen data, meaning that validation loss is high. To fix overfitting, the data scientist could increase the data present that the model is training from, remove bias from dataset, and do other things as well. Ultimately, for most models, including mine, overfitting generally is fixed by adding more data and/or removing lots of bias data. Underfitting: Underfitting is when the model has not been able to learn from the data. This can happen for a lot of reasons. One of these reasons could be that the model has not been run for long enough to recognize common patterns. When underfitting happens, the model does not only perform bad on unseen data, but also on its training data. At its core, underfitting is the opposite of overfitting, not being able to learn anything. Model Improvements: Now I had a full understanding of my code and exactly understood how I could improve my model by using semi-supervised learning. I first started by finding more data, whether that was not labeled or labeled. Then I made a simple program, the model would take a batch 0f 50 images from the unlabeled data and organize them, then it would train again. If the model predicted anyone of the 50 images to be non-skin cancer, the model would immediately start to train again. This is because none of the images from the dataset should be non-skin cancer; to increase the accuracy of the model, it would keep training until the image is sorted into a correct category. After a while, all the images from the dataset were now organized into the categories for the training dataset. Then using the new training dataset, I trained the model from scratch, this model was performing better, but I could not tell because of the non-accurate validate loss. To fix this, I made the model predict all the rest of the unlabeled images into the categories. This time I removed the training after 50 images but made it so that if the image was predicted to be non-skin cancer, it would train. I made these predictions go into the validation dataset. Finaly, I re-trained the model from scratch and got significantly better results. Then I started to optimize other variables, like the learning rate, the epoch number and even the backpropagation optimizer I was using. A disclaimer here: There are endless possibilities for each of these variables, but I do not have enough time and resources to try them all. So, what I did was, I use the help of Chat-GPT. I used it to brainstorm a list of potential settings for these variables that have worked in the past. This was important because it saved me a lot of time, some effort, and a lot of computational power. After some trials, I found the best learning rate to be “3e-5” and the best epoch number to be 30. For the optimizer, I did not want to change it since everything was working. I tried it once, but the code broke, so I let variable stay at “Adam”. Verdict: This was everything I did for the project, from the checklist to the research. Overall, this shows that my method for making my AI-Powered application at the basis was to research about skin cancer, do some basic research on AI, make the AI, make the GUI, do some depth research on AI, and finally to improve my model. All these steps helped me to understand the problem, formulate a solution, learn about the solution, and to make the solution a reality.
Analysis
For my project, I made 2 models. One had a lot of information, and the other was my baseline. The baseline model is my original build that I did not go back to and improve, it was trained on the original datasets. Then there is the improved model, this is the result of all the modification I made in attempt to make the model perform better. Baseline: After the training, I graphed the results on a line chart, allowing me to see the general trend. Using this line chart, I was able to tell the model was not performing that good. The training loss was low, but the validation loss was extremely high, showing a huge difference between the two. From this, I was able to infer that the model was overfitting. Based on my previous research I knew that when there is a huge gap or a trend where the validation loss increases, it shows overfitting. Additionally, the model was the most accurate, the majority of the time it was getting the right predictions, but the rest of the time, it was getting mixed even with images found inside the training dataset. At the end of the training, the training loss was low, but not by a lot, it stayed generally close to the same number across the entire run. In one of the trails, it jumped down at the second epoch but then stayed at the loss till the end. All this signified to me that to make the model better, I needed more data, I needed to replace the validation dataset with unique images, and I needed to optimize my learning rate, epoch number and optimizer to work the most efficiently. That is what I did to hopefully result in a better model. Improved Model: This was working significantly better than by baseline model. It was now getting accurate predictions in which some were incorrect, but even those were from new data, not pre-existing data. Just like the baseline, after the training, I graphed the results on a line chart. The line chart highlighted a significant issue, the model had gotten better at predicting, but it still was overfitting. Now with the validation dataset using unique data, I knew that this was accurate, my model was still overfitting. The training loss looked much better, each iteration it was changing, not by the most, but more than the baseline, showing it was learning. However, near the end, regardless of the epoch number, the training loss always jumped higher, not enough to cause issues, but by enough to be significant. This showed that there was some kind of issue, but the exact reason for which I do have the expertise to. The validation loss was high at the start, but soon it lowered down. From the graph, because of the way it was plotted, it looks like the loss is huge, but it just uses different scaling than the baseline. Comparing the actual numbers, validation loss was lower, but not by a lot. There also was a new trend with the loss, it was increasing as time went on. After each iteration it lowered, but after a certain number of epochs, it started to rise. Then again at another certain number, it balanced again but stayed high. This clearly shows me overfitting. As a result of my changes, the model started to perform much better, but the validation loss showed a clear trend of overfitting despite my attempts at removing this. Future Improvements: In the future, I could try making the model better by reducing this overfitting. By researching more about my datasets, and semi-supervised learning, the model can be made significantly better. In can also research more into the different types of ML models to better identify something that can work better than my CNN ML model. On the GUI portion, I have made it clear and easy to understand, but due to this and time restrictions, I was unable to add more detail into it. In the future I can try making my GUI look more like a proper medical application with lots of information to be found so the user is never left with any questions. Apart from that, I could also work on the aesthetics of the GUI and include different sections for each function. Right now, for each task the GUI does, a new window is created, I could make it so that it clears the previous window and loads the new things onto the same window. This would make the GUI look better, clean, modern, and help the user navigate better. This would also give me the functionality to add the different tabs where detailed information can be found. Overall, my project defiantly answers the overarching question while also delivering a potential solution to the overall problem. The Far Future: In the far future, assuming I made my AI better, I would like to partner with medical professionals. I believe that this project and my model can help a lot of people, but I would need the proper help to make this project a reality. In the future I would like to release this project to the public. I would want to start by releasing it as a “research” based project, with the feedback I get from the public, I would like to improve my project even more. After proper improvements, I would like to make this a real publicly available app that may or may not be medically certified. Assuming I find a way to get the app certified, I would like to partner with clinics, to add a functionality where patients could make dermatologist bookings straight from the app. The queuing system could also be optimized using this. Patients with more severe cases could be placed ahead while less severe cases can be placed accordingly in the line. This is far from the near future, but certainly a possibility that I would love to make real. How well was the problem solved: The problem was that people do not know what to look for when examining for skin cancer. They often miss it or are found clueless on whether to book an appointment or not. With my project, I aimed to solve this by developing an AI-powered application to predict skin cancer. I believe that my project solves this problem to an extent. It defiantly gives a quick and convenient solution to check whether a growth is cancerous or not and gives the type of skin cancer, if it is skin cancer, along with risk rating. Where my project does not solve the problem goes down to the inaccuracies in the model, and the publicity. Right now, my model is accurate, but it sometimes messes up when detecting non-skin cancer. It almost never says that an image of skin cancer is non-skin cancer, but it does sometimes say that an image of non-skin cancer is skin cancer. This is not the biggest problem as it is making mistakes on the lower risk side, but it certainly is not perfect. Another area where it does not give a proper solution is that the model is not public, it is right now private only found on my SSD. To properly solve the problem, it should be public. Those are the two areas where my model does not solve the problem, but for the majority, it does.
Conclusion
In conclusion, my model was able to somewhat accurately predict potential skin cancer. In solving the problem, for the majority it did, it answered the problem and accurately gave a solution to an existing problem in the world. However, the non-existing publicity and the inaccuracies in the model both make it so that it does not give a full solution to the problem. To develop an AI-powered application you first need to research a little about skin cancer to get a general idea of what it is and how we can solve it. Then do some basic research on AI and AI development to understand the type of model you will need to create and the limitation of your machine. Afterwards, you could start building the model using tutorials and walk-throughs. Then you should do in-depth research on AI to understand the code you have written and so that you could make improvements. Finaly, based on the research, improve the model to make it perform better. This is the conclusion of my project.
Citations
Alberta Health Services. “Aftercare Information — Conditions.” MyHealth Alberta, https://myhealth.alberta.ca/Health/aftercareinformation/pages/conditions.aspx?hwid=uf8117. Accessed 30/12/25. American Cancer Society. “How Does Melanoma Treatment Work?” YouTube, uploaded by American Cancer Society, NONE FOUND, https://www.youtube.com/watch?v=JbZzXrCnak8&t=284s. Accessed 11/11/25. American Academy of Dermatology. “Basal Cell Carcinoma — Pictures.” AAD, https://www.aad.org/public/diseases/skin-cancer/basal-cell-carcinoma/pictures. Accessed 30/12/25. AWS. “What Is Large Language Model (LLM)?” Amazon Web Services, https://aws.amazon.com/what-is/large-language-model/. Accessed 30/11/25. AWS. “What Is Machine Learning?” Amazon Web Services, https://aws.amazon.com/what-is/machine-learning/. Accessed 30/11/25. AWS Online Tech Talks. “Machine Learning | What Is Machine Learning?” YouTube, uploaded by AWS Online Tech Talks, NONE FOUND, https://www.youtube.com/watch?v=9gGnTQTYNaE. Accessed 30/11/25. Canadian Dermatology Association. “Basal Cell Carcinoma.” Canadian Dermatology Association, https://dermatology.ca/public-patients/diseases-conditions/skin-cancer/basal-cell-carcinoma/. Accessed 16/11/25. Canadian Dermatology Association. “Melanoma.” Canadian Dermatology Association, https://dermatology.ca/public-patients/diseases-conditions/skin-cancer/melanoma/. Accessed 11/11/25. Canadian Dermatology Association. “Squamous Cell Carcinoma.” Canadian Dermatology Association, https://dermatology.ca/public-patients/diseases-conditions/skin-cancer/squamous-cell-carcinoma/. Accessed 23/11/25. Cancer Society of Canada. “Melanoma Skin Cancer — Treatment.” Cancer.ca, https://cancer.ca/en/cancer-information/cancer-types/melanoma-skin/treatment. Accessed 11/11/25. Cancer Society of Canada. “Skin Cancer Image Gallery — Basal Cell Carcinoma.” Cancer.org, https://www.cancer.org/cancer/types/skin-cancer/skin-cancer-image-gallery.html?filter=Basal%20Cell%20Carcinoma. Accessed 30/12/25. Cancer Society of Canada. “Skin Cancer Image Gallery — Squamous Cell Carcinoma.” Cancer.org, https://www.cancer.org/cancer/types/skin-cancer/skin-cancer-image-gallery.html?filter=Squamous%20Cell%20Carcinoma. Accessed 30/12/25. Cancer Society of Canada. “Squamous Cell Carcinoma — Treatment.” Cancer.ca, https://cancer.ca/en/cancer-information/cancer-types/skin-non-melanoma/treatment/squamous-cell-carcinoma. Accessed 23/11/25. Cleveland Clinic. “Basal Cell Carcinoma.” Cleveland Clinic, https://my.clevelandclinic.org/health/diseases/4581-basal-cell-carcinoma. Accessed 16/11/25. Cleveland Clinic. “Melanoma.” Cleveland Clinic, https://my.clevelandclinic.org/health/diseases/14391-melanoma. Accessed 11/11/25. Cleveland Clinic. “Skin Cancer.” Cleveland Clinic, https://my.clevelandclinic.org/health/diseases/15818-skin-cancer. Accessed 11/11/25. Cleveland Clinic. “Squamous Cell Carcinoma.” Cleveland Clinic, https://my.clevelandclinic.org/health/diseases/17480-squamous-cell-carcinoma. Accessed 23/11/25. Cloudflare. “What Is a Large Language Model (LLM)?” Cloudflare Learning Center, https://www.cloudflare.com/learning/ai/what-is-large-language-model/. Accessed 30/11/25. DermNet NZ. “Benign Skin Lesions.” DermNet NZ, https://dermnetnz.org/topics/benign-skin-lesions. Accessed 30/12/25. GeeksforGeeks. “Backpropagation in Neural Network.” GeeksforGeeks, https://www.geeksforgeeks.org/machine-learning/backpropagation-in-neural-network/. Accessed 14/02/26. GeeksforGeeks. “Choosing the Right GPU for Your Machine Learning.” GeeksforGeeks, https://www.geeksforgeeks.org/machine-learning/choosing-the-right-gpu-for-your-machine-learning/. Accessed 24/12/25. GeeksforGeeks. “Impact of Learning Rate on a Model.” GeeksforGeeks, https://www.geeksforgeeks.org/machine-learning/impact-of-learning-rate-on-a-model/. Accessed 14/02/26. GeeksforGeeks. “Neural Networks — A Beginner’s Guide.” GeeksforGeeks, https://www.geeksforgeeks.org/deep-learning/neural-networks-a-beginners-guide/. Accessed 12/02/26. GeeksforGeeks. “The Role of Weights and Bias in Neural Networks.” GeeksforGeeks, https://www.geeksforgeeks.org/deep-learning/the-role-of-weights-and-bias-in-neural-networks/. Accessed 13/02/26. GeeksforGeeks. “Training and Validation Loss in Deep Learning.” GeeksforGeeks, https://www.geeksforgeeks.org/deep-learning/training-and-validation-loss-in-deep-learning/. Accessed 13/02/26. GeeksforGeeks. “Underfitting and Overfitting in Machine Learning.” GeeksforGeeks, https://www.geeksforgeeks.org/machine-learning/underfitting-and-overfitting-in-machine-learning/. Accessed 14/02/26. GeeksforGeeks. “What Is Forward Propagation in Neural Networks?” GeeksforGeeks, https://www.geeksforgeeks.org/deep-learning/what-is-forward-propagation-in-neural-networks/. Accessed 13/02/26. Google Cloud. “Artificial Intelligence vs. Machine Learning.” Google Cloud Learn, https://cloud.google.com/learn/artificial-intelligence-vs-machine-learning. Accessed 30/11/25. Google Cloud. “Large Language Models (LLMs).” Google Cloud AI, https://cloud.google.com/ai/llms. Accessed 30/11/25. Google Developers. “Backpropagation — Machine Learning Crash Course.” Google Developers, https://developers.google.com/machine-learning/crash-course/neural-networks/backpropagation. Accessed 14/02/26. Google Developers. “Loss — Machine Learning Crash Course.” Google Developers, https://developers.google.com/machine-learning/crash-course/linear-regression/loss. Accessed 13/02/26. Hopkins Medicine. “Basal Cell Cancer of the Head and Neck.” Johns Hopkins Medicine, https://www.hopkinsmedicine.org/health/conditions-and-diseases/basal-cell-cancer-of-the-head-and-neck. Accessed 16/11/25. IBM. “Backpropagation.” IBM THINK, https://www.ibm.com/think/topics/backpropagation. Accessed 14/02/26. IBM. “Large Language Models.” IBM THINK, https://www.ibm.com/think/topics/large-language-models. Accessed 30/11/25. IBM. “Loss Function.” IBM THINK, https://www.ibm.com/think/topics/loss-function. Accessed 13/02/26. IBM. “Learning Rate.” IBM THINK, https://www.ibm.com/think/topics/learning-rate. Accessed 14/02/26. IBM. “Neural Networks.” IBM THINK, https://www.ibm.com/think/topics/neural-networks#741977106. Accessed 12/02/26. IBM. “Overfitting.” IBM THINK, https://www.ibm.com/think/topics/overfitting. Accessed 14/02/26. IBM. “Underfitting.” IBM THINK, https://www.ibm.com/think/topics/underfitting. Accessed 14/02/26. Kaggle. “Melanoma Skin Cancer Dataset of 10,000 Images.” Kaggle, https://www.kaggle.com/datasets/hasnainjaved/melanoma-skin-cancer-dataset-of-10000-images. Accessed 27/12/25. Kaggle. “Skin Cancer Binary Classification Dataset.” Kaggle, https://www.kaggle.com/datasets/kylegraupe/skin-cancer-binary-classification-dataset. Accessed 15/02/26. Kaggle. “Skin Cancer Malignant vs. Benign.” Kaggle, https://www.kaggle.com/datasets/fanconic/skin-cancer-malignant-vs-benign?resource=download. Accessed 15/02/26. Kaggle. “Skin Cancer MNIST – HAM10000.” Kaggle, https://www.kaggle.com/datasets/kmader/skin-cancer-mnist-ham10000. Accessed 15/02/26.
Acknowledgement
AI Acknowledgement: In this project I tried keeping the use of Chat-GPT and other Artificial Intelligence chat-bots to a minimum, but there were some instances where it benefited me. While trying to make my model better, there were some variables, learning rate and epoch number that would take too long and too much computational power to optimize for. However, these were primarily one of the variables that would make a noticeable change to performance. In here I used Chat-GPT and Gemini to help me narrow down the possibilities of these. Both variables are numerical, meaning that they have endless possibilities. I used Chat-GPT and Gemini to help me find a list of possible inputs that would optimize these variables. I did NOT use them to give me the answer, but instead to know the benefits of each and narrow down to just a couple of possible solutions. I also used Chat-GPT to make the citations in MLA format. I gave it the access dates, and it helped me formulate links into proper MLA format. This could have been done by hand, but by doing so there was no sufficient benefit, it just took longer and used a lot of my time.
I also used Chat-GPT's image generator to generate the banner image for this project. The image looked good and was the best one I could find. These are the only areas where I used the help of any Artificial Intelligence chat-bots. General Acknowledgement: I would like to start my thanking everyone who has supported me throughout this project, from my coordinator to my parents, and even my friends. They have all supported me through this hardship and have helped me excel in this field while keeping me motivation. Special thanks to my coordinator, Ms. Bretner, who helped throughout the year and has given me advice on how to improve each step until the finish line. She has also helped me stay on the timeline, making sure I can get this project finished on time. Another special thanks to my parents who have supported me throughout this project, not just by helping me during hardships, but supporting me emotionally every single day. Thank you everyone for making this a fun and educational project/experience.
