Lazaro Martull

Skin Cancer Detection Using Deep Learning (ResNet50)

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.


๐Ÿงฉ My Role

I contributed to:


๐Ÿ›  Tools & Technologies


๐Ÿ“„ Full Report & Code

This project folder contains:


๐Ÿ” Project Overview

Skin 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:


๐Ÿ“ Dataset

Images were gathered from:

Preprocessing steps included:


๐Ÿงช Preprocessing, Architecture & Training Code

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]
)

๐Ÿ“Š Results & Evaluation

Key observations:


๐Ÿ“ˆ Accuracy & Loss Curves

The training logs show:

(Plots included in the project report.)


๐Ÿš€ Future Improvements

To enhance model performance:


๐Ÿ“ฆ Folder Structure

skin_cancer_detection/
โ”‚โ”€โ”€ index.md            # Project write-up (this page)
โ”‚โ”€โ”€ report.pdf          # Final project report
โ”‚โ”€โ”€ training_code.py    # Clean training script (ResNet50 training)

๐ŸŽฏ Summary

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.