2026 · Artificial Intelligence class

Leukemia classification neural network

The goal of this project was to make a CNN to classify blood samples into 4 categories of acute lymphoblastic leukemia. The dataset contains 4000 images, 1000 for each category. As a experiment I trained 2 models, a big and small models, to compare how accurate both models can be.

View on GitHub

Built with

  • TenserFlow
  • Python
  • Vue
  • Colab

Working demo

Loading Model

Downloading weights...

1. Input Image

Drag photo here

or click to browse

No image selected

2. Classify

🧠

3. Prediction

Result

...

Confidence0 %

Making the model

TensorFlow in Python was used to train the models and TensorFlow.js to run the small model in the browser. The starting layers pre-trained optimized for image classification EfficientNetB0 and B7. They were fine tuned during the training proces.

Before even starting to train the model you need to:

  1. Make a list of all training images and there labels.
  2. Make a dataset for training, validation and testing.
  3. Perform transformations on the training and validation datasets in order to get more accurate training

Classification report small model

Precision Recall F1-Score Support
Benign 1.00 1.00 1.00 36
Early 1.00 1.00 1.00 90
Pre 0.52 1.00 0.69 68
Pro 1.00 0.07 0.14 67
Accuracy 0.76 261
Macro Avg 0.88 0.77 0.71 261
Weighted Avg 0.88 0.76 0.70 261

model_small = tf.keras.applications.EfficientNetB0(
    include_top=False,
    weights="imagenet",
    input_shape=img_shape
)

model_small = Sequential([
    base_model,
    GlobalAveragePooling2D(),
    Dense(128, activation='relu'),
    Dropout(0.2),
    Dense(class_count, activation='softmax')
])

model_small.compile(
    optimizer=Adam(learning_rate=0.001),
    loss='categorical_crossentropy',
    metrics=['accuracy']
)

Posable improvements

Besides EfficientNetB0 and B7 TenserFlow offers many other pre-trained modes to use. This application can posable replaced by one of the following models:

Jovica.me

Contact me:

hi@jovica.me