Model overview
The model is a Sequential architecture built with Keras and converted to TensorFlow.js format for web deployment. It accepts RGB images of size 75×100 pixels (3 channels) and outputs probability distributions across 7 classification categories.The model is distributed as a
model.json file along with 25 binary weight shards (group1-shard1of25.bin through group1-shard25of25.bin), totaling approximately 100MB.Input specifications
- Input shape:
[75, 100, 3](height × width × channels) - Data type:
float32 - Color space: RGB
- Preprocessing: Images are normalized to float32 values
Architecture layers
The network consists of 27 layers organized into three main stages: convolutional feature extraction, dimensionality reduction, and classification.Stage 1: Initial convolutional blocks
The first stage applies six consecutive 3×3 convolutional layers with 64 filters each, using same padding to preserve spatial dimensions.Layers 1-12: Feature extraction
Layers 1-12: Feature extraction
- Five convolutional layers use same padding to maintain spatial dimensions
- One convolutional layer uses valid padding to reduce dimensions before pooling
- All convolutions use 3×3 kernels with stride of 1
- ReLU activation functions introduce non-linearity after each convolution
Stage 2: Pooling and regularization
After the initial feature extraction, the model applies max pooling to reduce spatial dimensions and dropout for regularization.The first dropout layer uses a rate of 0.25, randomly dropping 25% of neurons during training to prevent overfitting.
Stage 3: Deeper feature learning
The second convolutional block increases filter depth to 128, capturing more complex patterns.Layers 15-20: Deep feature extraction
Layers 15-20: Deep feature extraction
- Doubling the filter count to 128 allows the network to learn more abstract features
- Second max pooling layer further reduces spatial dimensions
- Dropout maintains regularization consistency
Stage 4: Classification head
The final layers flatten the feature maps and apply fully connected layers for classification.Layers 21-26: Dense classification layers
Layers 21-26: Dense classification layers
- Flatten layer: Converts 2D feature maps into 1D vector
- Dense layer (512 units): Fully connected layer for high-level reasoning
- Dropout (0.5): Aggressive regularization before final prediction
- Output layer (7 units): One neuron per skin cancer category
- Softmax activation: Converts outputs to probability distribution
Training configuration
Optimizer
- Type: RMSprop
- Learning rate: 0.0001
- Decay: 1e-6
RMSprop (Root Mean Square Propagation) is particularly effective for CNNs as it adapts the learning rate for each parameter, helping the model converge more reliably.
Loss function
- Type: Categorical crossentropy
- Purpose: Measures the difference between predicted probability distributions and true labels
Initialization
- Kernel initializer: Glorot Uniform (also called Xavier initialization)
- Bias initializer: Zeros
Model capacity
Total parameters
The model contains millions of trainable parameters distributed across convolutional and dense layers:- Convolutional layers: Majority of parameters from 64-filter and 128-filter Conv2D layers
- Dense layers: 512-unit fully connected layer contributes significant parameter count
- Model size: Approximately 100MB across 25 binary shards
Architecture benefits
Deep feature hierarchy
Multiple convolutional layers learn increasingly abstract features, from edges and textures to complex lesion patterns.
Regularization
Dropout layers (0.25 and 0.5) and validation splits prevent overfitting on medical imagery.
Spatial efficiency
Max pooling reduces dimensions while preserving important features, making the model computationally efficient.
Web-ready
TensorFlow.js format enables browser-based inference without server dependencies.
Activation functions
ReLU (Rectified Linear Unit)
Used throughout the network for hidden layers:- Computationally efficient
- Reduces vanishing gradient problem
- Introduces non-linearity for complex pattern learning
Softmax
Used in the final output layer:- Converts raw scores to probabilities
- Ensures output sums to 1.0
- Enables multi-class classification interpretation
Architecture comparison
This architecture is inspired by VGG-16 but adapted for smaller dermatological images:| Aspect | VGG-16 Standard | This Model |
|---|---|---|
| Input size | 224×224×3 | 75×100×3 |
| Convolutional blocks | 5 blocks | 2 blocks |
| Max pooling layers | 5 | 2 |
| Dense layers | 3 | 2 |
| Output classes | 1000 (ImageNet) | 7 (skin lesions) |
| Dropout | Minimal | 0.25, 0.25, 0.5 |
The reduced input size and simplified architecture make this model more suitable for web deployment while maintaining strong classification performance on skin cancer images.
Next steps
Training process
Learn about the dataset and training methodology
Classifications
Understand the 7 skin cancer categories the model detects