top of page
Search

Dermato-learning

Writer: Om KumarOm Kumar

Imagine one day, you wake up with an itchy and burning sensation at the back of your neck. You try to feel for the menace there, and make out something rashy...bumpy umm...."infection" you say grimly and apply the same household lotion anti-rash ointment which works quite fine to mitigate the burning sensation, except that it is temporary. A couple of days later, the cycle repeats.


Now, In India, unless you have a plentiful supply of Vitamin M(Ahem!!), you would probably hesitate to visit the dermatologist. Oh the long queues at the government clinics/ chambers, so much obscurity sometimes before they actually figure out the disease and prescribe proper medication. I for one, remember being given two different names for the same rash from two different clinics....the experience was.....perplexing to say the least.


So the aim of deep learning practitioners like.......


HIM(don't know this guy??? Google Geff Hinton NOW!!)

is to create new algorithms/methods of using something known as deep learning(think Chat GPT) in domains like these and others.

Now of course the paper that we'll be discussing about here belongs with all due respect to V. B. Kumar, S. S. Kumar and V. Saboo.



And the aim of deep learning enthusiasts like.......


ME.... is to try and break down the complexities involved in that paper, resolve the mathematical jargon into something we all can LOVE...so let's jump right in....





Source: My Brain


DEEP LEARNING IN DERMATOLOGY

What is this "Deep" Learning? Does it mean going really deep into something to learn it....Nah! Deep learning simply uses...drumroll.....Mathematics to find out patterns in the existing data and use those patterns to extrapolate meaningful results.


The aim is to be able to use an arbitrary scan from any mobile camera and then feed it to an algorithm that would then circle in on the affected area and predict what that disease actually is. Sounds Sci-fi-ish? Yeah I know I know not anymore...Chat GPT has already taken away that sense of awe, but bear with me here, the implications of this could be enormous!!


So in order to better deal with any task in deep learning the DATA is a vital component. And for our task of recognition and classification, the image scans and their processing becomes crucial. Eight different image processing algorithms were used to make the feature extraction process efficient

Here's how the eight algorithms worked together:

1. In order to not lose data, the RGB values of the image were retained before converting it to grayscale.

2. Sharpening filter as the name suggests sharpens the part of the image containing the affected region.

3. Median filter is then applied to remove the noise from the image.

4. Next up we have the smoothing filter. The way this works is that each pixel is replaced by the mean of a certain number of pixels around it. This is not to be confused with a convolution where a cerain area around a pixel is multiplied by a matrix.

The result of the smoothing filter is that the it reduces noise, but a question that I had in my head was that wouldn't the smoothing filter reduce the level of detail present in the image?

Which would lead to the model missing out on key features in the data. But as we'll see later, the researchers had this covered, under the feature extraction part.

5. Now the images are converted into binary images. Note that the difference between binary and grayscale images is that while the pixel values in gray scale can be ANYTHING between 0 and 1 taking on different hues from black to white, in binary, the pixels can only have two values: 0 or 1 i.e. black or white.

6.For the final step, something known as a SOBEL operator is used to get the edges of the affected area in the binary image.


Now, when I first read the series of operations, I was utterly confused, I mean why remove the most important component here?-COLOR. I mean even though they could argue for the smoothening or the Sobel operator's role, 'Color' in any dermatological disease, forms the basis of categorization, it's useless to train a model that does not include that component of it.


But they had it all covered. These algorithms were a part of the image pre-processing stage, feature extraction was yet to begin.


FEATURE EXTRACTION

Features in data are simply the important aspects of it that help make the model/algorithms better. Suppose you are training a model to recognize cats and dogs, so what parts of a cat's image help you the most, probably the ears, the eyes, so THOSE FEATURES are gonna be the key components that we will need to focus on extracting.


For our purpose, they become even more important. Remember the previous section where we talked about how the algorithm is just throwing away the color data of the image, well's turns out that it is not the case.

The first and most important feature extracted was the color histogram of the image. A color histogram is the representation of the distribution of colors in the image by a way of representing the number of pixels that have a particular color in the image.



The Graph on the right represents the color histogram with the RGB values on the x-axis while the frequency being the y-axis.









Now, an important distinction to make here is that the values chosen for the color histogram in OUR feature extraction are not RGB(RED, GREEN, BLUE) but HSV(HUE, SATURATION, VALUE). The benefits of doing this are....

First, the HSV model is more...sort of Human, i.e. it's portrayal of colors matches with the way we perceive colors naturally.

Second, and the more important one, the HSV color space separates the Colors(HS) from the luminance component of it(V), which simply means that the model trained on those features would be less sensitive to the illuminance of the image, making it suitable for both brighter and dimer pictures.


The next set of features were extracted keeping in mind the various diseases that stood out, for instance, dermatitis and pityriasis rosea stand out with an unusual number of inflictions in/near the affected area, so the number of inflictions was an important feature. Again, the SOBEL operator can be used to detect the shape of the infliction.

Then there are diseases like pityriasis rubra pilaris which stand out due to the presence of bumps around the hair follicles. I found this part quite fascinating, as the paper noted: "To extract this feature, the presence of hair was detected using the DULL RAZOR algorithm, then the presence of oval shaped patches were detected to check for the presence of bumps.".... the names themselves are fascinating.

Some other extracted features worth mentioning were detecting whether the affected region was face, scalp or torso, whether there were patches in the nail bed, or the presence of pustules in the image using the color variation present in the image.


Now what are these features good for?? We can detect the following diseases using the information at our behest:

Identification of Diseases from the features

1) Psoriasis: It can be identified based on the occurrence of plaques on the face, torso, knees and elbows. The feature that is really helpful for it's classification is that it occurs near the nail beds as well.

2) Seborrheic Dermatitis: This condition is mainly seen on the head. Hence, the images corresponding with these features would likely correspond to this.

3) Lichen Planus: Being present on the face, it is harder to differentiate from other diseases, but it exhibits purple colored patches which turns on its respective feature function.

4) Pityriasis Rosea: This condition affects mainly the knees and elbows. The number of components becomes a distinguishing feature as the number of rashes is high.

5) Chronic Dermatitis (CD): Although this condition affects both face and torso, it can be distinguished with the presence of distinct flaking.

6) Pityriasis Rubra Pilaris: This condition is known to affect only the torso and lower body. The distinguishing feature is the presence of bumps around hair follicles.



Sample Image fed to the model....


SOBEL operator detecting the edges


Conversion into Binary to get a wider "cover" of the infected area.....





Images Source:[1]


Mathematical models Used:

Coming to the juicy part of the picture.....

1. So once we had the features extracted from the image data, we fed it to something known as a Maximum Entropy model. In our case, we have to be able to make predictions about the diseases using the partial information from the extracted features that we have. So we need to go with that Probability distribution which MAXIMISES THE ENTROPY OF THE DATA, now what the hell does that even mean??


Think about it this way: The entropy of variables/data is simply the average measure of how uncertain the data can be. So the principle of maximum entropy basically states that the probability with the highest level of surprise should be the one that actually depicts the required value. Meh! Still mathematical, let's move on.



2.Aritificial Neural Network: The second option used was an Artificial Neural Network, trust me here, the workings of this are way cooler than the name.

So here we have a set of LAYERS so to say, think of those layers as checkpoints in an Assembly line which processes data.

So first we have...obviously the input layer, where all the extracted features are fed. Then we have two hidden layers in our case which have some sort of ACTIVATION function which produce a particular OUTPUT only when the INPUT to it exceeds a certain value.


For the last layer we have something special, it's called SOFTMAX. Remember from above how we were trying to detect 6 diseases, so that task would have been impossible if we would only output 0 or 1 at the end of the network, we need 6 outputs, each one indicating the probability of "how much" does the network believe it to be that particular disease.





If you want to delve deeper into the workings of a neural network, I cannot recommend you the video series by 3b1b enough....Anyways moving on...


Image Source:https://www.3blue1brown.com/lessons/neural-networks

MACHINE LEARNING INTO THE PLAY:

The researchers also tried out some specific models from the arsenal of machine learning, we'll only scratch the surface here...lets go:


K-nearest Neighbor- Just when we thought things couldn't get simpler. The idea of this algorithm is to spread out the already available attributes/properties in a n-dimensional plane(think of it as a room for simplicity) and then whenever a new member enters the room, based on it's properties/attributes and those of it's 'K' nearest neighbors, we are able to allot it a position, thereby classifying it.


Decision Trees- Now while decision trees may feel more of a harwired approach than "Machines learning", they are not, they provide an effective method for making decisions because they lay out the problem and the possible outcomes involved, and as we keep feeding them more data, they can also be capable of making predictions into the future.


With the right algorithm and the right amount of feature extraction, We can effectively classify and predict the 6 diseases that we discussed above, although there are still some issues with the technique, like it cannot handle different skin tones, which is perplexing to say the least, so it still needs to be trained on those particular features which will help make it a better classifier. Rest assured, Deep Learning will keep on taking new avenues..





 
 
 

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating

Learn and Collaborate on:

  • Github
  • Twitter
  • Instagram

Information is everywhere, but it's meaning is created by the observer who interprets it.

                          - Naval Ravikant

bottom of page