This project builds a deep learning model to classify skin lesions as benign or malignant using transfer learning with ResNet50 and custom convolutional layers.
The goal is to evaluate whether smartphone-quality images can support early detection of melanoma.
I contributed to:
This project folder contains:
training_code.py โ clean, portfolio-ready training scriptSkin cancer affects millions worldwide, and early detection dramatically improves survival rates.
This project explores whether deep learning can help classify skin lesions using dermatoscopic images.
Using the ISIC 2018 & 2024 datasets, a transfer-learning pipeline was built using:
๐ Final performance:
Images were gathered from:
Preprocessing steps included:
import tensorflow as tf
height, width = 224, 224
train_set = tf.keras.preprocessing.image_dataset_from_directory(
"content/image_data/xs_train",
validation_split=0.2,
subset="training",
seed=42,
image_size=(height, width),
batch_size=10
)
validation_set = tf.keras.preprocessing.image_dataset_from_directory(
"content/image_data/xs_train",
validation_split=0.2,
subset="validation",
seed=42,
image_size=(height, width),
batch_size=4
)
# ------------------ Model Architecture ------------------
base_model = tf.keras.applications.ResNet50(
include_top=False,
input_shape=(224, 224, 3),
weights="imagenet",
pooling="avg"
)
for layer in base_model.layers:
layer.trainable = False
from tensorflow.keras.layers import Dense, Flatten
model = tf.keras.Sequential([
base_model,
Flatten(),
Dense(64, activation="relu"),
Dense(2, activation="softmax")
])
# ------------------ Training Configuration ------------------
from tensorflow.keras.optimizers import AdamW
from tensorflow.keras import callbacks
model.compile(
optimizer=AdamW(learning_rate=0.0001),
loss="sparse_categorical_crossentropy",
metrics=["accuracy"]
)
earlystopping = callbacks.EarlyStopping(
monitor="val_loss",
patience=5,
restore_best_weights=True
)
history = model.fit(
train_set,
validation_data=validation_set,
epochs=100,
callbacks=[earlystopping]
)
Key observations:
The training logs show:
(Plots included in the project report.)
To enhance model performance:
skin_cancer_detection/
โโโ index.md # Project write-up (this page)
โโโ report.pdf # Final project report
โโโ training_code.py # Clean training script (ResNet50 training)
This project demonstrates the potential of deep learning to support dermatologists and mobile health apps by providing early classification of skin lesions.
While not a substitute for clinical diagnosis, the model shows promising accuracy and provides a foundation for future medical AI research.