Overview
Built around the PH2 dermoscopic image dataset, created to support research on skin lesion segmentation and classification, and motivated by the rising occurrence of melanoma and the need for computer-aided diagnosis. The dataset holds 200 images across three classes: 80 common nevi, 80 atypical nevi, and 40 melanomas, each with a lesion mask.
Rather than training a neural network, the classifier relies on handcrafted features, color, symmetry, irregularity, and average phase, computed directly from each image, then classifies by a voting mechanism across those features.
How it works
Steps
- Get file details: read
PH2_dataset.txtto build a dictionary of{class: [files in that class]}. - Choose the parameters: started from a large set of candidate parameters, judged each by classification quality, and kept only the useful ones.
- Calculate average class parameters: a nested loop applies the feature functions to every image and averages the results per class. The split between atypical and common nevi turned out weak.
- Classification: settled on 16 parameters for the final code (others produced errors), using a voting mechanism rather than distance-based classification, so each parameter's contribution could be checked individually.
Feature functions
Symmetry splits the image along its vertical and horizontal center lines, mirrors one half onto the other, and XORs them. The resulting white pixel count captures the asymmetry and curvature of the mole.
Colors splits the image into BGR channels and computes the histogram average, mode, and standard deviation for each.
Irregularity and phase: irregularity applies a threshold and counts white pixels to capture the overall gray distribution. Phase applies horizontal and vertical Sobel operators and returns the magnitude and average phase of the image.
Output
Accuracy ranged from 58 to 75% depending on the train/test split, since the result is sensitive to the chosen parameters. Final accuracy across the whole dataset was 63.3%.
Assigned as coursework by Dr Usman Akram.
← Back to all projects