An AI that Anyone Can Develop at Home
Artificial Intelligence (AI)
With the advent of tools such as ChatGPT and Stable Diffusion, artificial intelligence is becoming a larger part of our lives every day. But what is it? Artificial Intelligence, otherwise known as AI, is a program that can perform tasks that would otherwise require human intelligence. However, unlike humans, AI does not have a brain to think with - instead, they have a model that contains its functions. They cannot do anything outside of their predefined functions. While generative AIs such as ChatGPT are very difficult to build and require vast amounts of data, a simpler, more starting-level AI that anyone can build at home is a skin cancer detection AI.
AI + Skin Cancer Detection
Cancer is a real problem in today's world. So many people die from it daily. One of the most common types of cancer is Melanoma, which is a type of skin cancer. According to the BetterHealth Channel, melanoma can become life-threatening within 6 weeks, so if one thinks that he/she might have skin cancer, they should get it diagnosed as fast as possible. The problem is, doctors are not always available in the area one lives in, and sometimes, people don’t take it seriously enough to seek medical help. A quick diagnosis would ensure that one gets treated sooner, saving hundreds of thousands of lives. One of the best ways to do a quick diagnosis is by making a simple web app and using machine learning to provide results as to whether skin cancer has been identified in an image. This article will give an overview of AI, how we can use AI to detect Skin Cancer, and the practicality as well as ethics of doing so.
How can we use AI to Detect Skin Cancer?
There are many different types of AI out there. However, to detect skin cancer, we want to use one that works with images. In this case, we should use an image recognition AI that can locate patterns in images and tell if there is skin cancer or not. Then, we use a classifier to let the user know whether the results are positive or negative. To make our own AI, our steps will go something like this:
1. Import data and libraries
a. One thing AI needs is data, and especially in image recognition, a lot of data is needed.
b. One method to expand a dataset of images is to use data augmentation - rotating, flipping, inverting, and doing all sorts of other things to get more images.
2. Create a Neural Network and Model
a. Many different types of neural networks can be used. The one commonly used for this type of project is a Convolutional Neural Network (CNN).
b. CNNs do their job by extracting features of the image through a sliding window known as a kernel.
3. Train our model
a. When one says "epochs", it refers to the number of times a model will be trained. Usually, the more epochs, the better a model's accuracy will be (but it will take longer).
4. Evaluate the model's performance and change it accordingly
a. This is why you don't want to have a super high number of epochs - if you decide to edit your model, it will take forever to train again!
b. You can also do a sanity check - grab an image that is very clearly not skin cancer, as well as an image that is skin cancer, put both through the model, and see what the output is. If the output is not the output you were expecting, you may want to change your model! The result may also be a 1 or 0 (depending on your model), which is binary - 1 should be a positive result, while 0 is a negative result.
Now that we've made our AI model, we need to be able to use it in a live web app, otherwise, it won't be accessible for a quick diagnosis. To make a web app built on our AI, we can do something like this:
1. Save the model as a hierarchical data format (HDF), with the file extension ".h5". Just be sure to save it somewhere you can load it back in.
2. Install Streamlit to make a web app.
a. To create a web app, there will be specific things you have to write in Python.
b. You can customize the UI of the web app to your liking!
3. Deploy this web app online.
a. There are many different deployment tools - one example is Heroku.
Congratulations! If you have followed through with the article up until this point, you have successfully made your own Skin Cancer Diagnosis web app.
Practicality and Ethics of AI + Skin Cancer Diagnosis
Now that we've successfully gone through the process of making our own skin cancer detection web app, we should discuss its practicality and the reality of this. This tool would be extremely useful in real life, however, you may be wondering why someone hasn't already popularized this. The truth is, using AI to detect skin cancer is very risky. Even human doctors make mistakes (although very rarely). If the AI happens to make an incorrect diagnosis, this could potentially kill someone because they were given a false negative. If this does happen, who is to blame? The creator of the AI, even if the patient was warned to use it at their own risk? The patient him/herself? The patient's doctor? All these questions and more are part of the reason why this hasn't been put into use yet. Another thing is that these are human lives on the line - one mistake, and someone can die. These AIs need to have nearly 100% accuracy - and that is already hard enough to achieve. Another thought is whether these AIs will replace doctors that already exist. All these questions about the morality of using AI to diagnose skin cancer prevent it from becoming a reality today. As humans perfect the practice of making AIs, we will slowly put more and more trust in them. Will AI one day be able to diagnose diseases as well as doctors? Only time will tell.