This project aims to classify skin lesions into two categories: normal and melanoma. The classification is based on four features extracted from images of skin lesions using image processing techniques. The four features are asymmetry, border, color, and diameter.
Asymmetry is a measure of the difference in shape between the left and right halves of a skin lesion. The feature is calculated by dividing the lesion into four quadrants, and then computing the entropy of the pixel intensity distribution in each quadrant.
Border is a measure of the irregularity of the border of a skin lesion. The feature is calculated by eroding the grayscale image of the lesion and then computing the circularity of the difference between the original grayscale image and the eroded image.
Color is a measure of the variation in color of a skin lesion. The feature is calculated by converting the lesion image to the YUV color space and then computing the standard deviation of the mean Y, U, and V values of the lesion.
Diameter is a measure of the size of a skin lesion. The feature is calculated by finding the maximum and minimum pixel values in the lesion image, and then computing the Euclidean distance between these points.
The dataset used for this project is the PH2 Dataset, which consists of 200 skin lesion images. The dataset is divided into two classes: normal and melanoma.
Usage
The main.py
file contains the implementation of the feature extraction and classification pipeline. To run the pipeline, simply run the following command:
python main.py
The pipeline first extracts the four features from the images in the dataset, and then uses a random forest classifier to classify the images into normal or melanoma. The classification results are then printed to the console.
The following libraries are required to run the code:
numpy
pandas
matplotlib
opencv-python
You can install these dependencies using pip:
pip install numpy pandas matplotlib opencv-python
The classification results achieved by the pipeline are as follows:
Accuracy: 0.83