WomanLife: Deep Learning for the detection and classification of breast cancer

Breast cancer is the most common type of cancer in women and is also one of the main causes of death according to the WHO (WHO, 2020).

Deep Learning

Description of the problem

Our project consists of the detection and classification of breast cancer in women between 25 and 75 years old. This is possible from the development of an AI model trained with images obtained using ultrasound scanners that result in the segmentation of the type of cancer that could be suffered.


Allow women suffering from breast cancer to be automatically diagnosed using a deep learning model so that they can start treatment early and safely, reducing costs and the mortality rate. To meet this objective, we have proposed a tool that uses artificial intelligence to provide greater agility to the process through self-diagnosis with ultrasound images.

Model selection

The breast cancer detection and classification project works with ultrasound images of three types, labeled as benignmalignant and neutral, so the model selected for its execution is convolutional networks with TensorFlow Keras.


The dataset was collected from Baheya Hospital for Early Detection and Treatment of Women’s Cancer, Cairo, Egypt. It contains 780 breast ultrasound images, in women between 25 and 75 years old (133 normal, 437 benign and 210 malignant) with an average image size of 500 x 500 pixels, some of which are seen below,

Fig. 1. Samples of images

The images from the original dataset contain mask images that do not provide meaningful information to the model we developed, for this reason Shell statements were used to remove them from the dataset we are using.

Implemented techniques

We must emphasize that until now there is a shortage of public data sets of breast cancer ultrasound images and it prevents the good performance of the algorithms. Because of this, the authors who made public the dataset we used, recommend augmenting data using GANs.


Source: Compiled by authors using Matplotlib

Fig. 3. BENIGN

Deep Learning

Source: Compiled by authors using Matplotlib

Deep Learning


Source: Compiled by authors using Matplotlib

Network definition

Within the possible design patterns in Keras, subclassing has been implemented to use the low-level APIs of Keras. You can consult more information about this in the following article:


  • Conv2D: 32 filters, 4 strides, ‘same’ padding and ReLU activation
  • MaxPooling2D: pool_size of (3,3), ‘same’ padding and 2 strides
  • Flatten
  • Dense: 512 neurons and ReLU activation
  • Dropout (0.4)
  • Dense: 3 neurons and SoftMax activation

Fig. 5. Model summary — Source: Compiled by authors


TensorBoard was used to observe the real-time behavior of the accuracy and loss values, which provides useful graphs to analyze results and many controls for their manipulation.

Fig. 6. Dashboard TensorBoard — Source: Compiled by authors

Conclusions and future works

WomanLife is intended to be an easy-to-access, low-cost medical diagnostic tool.

Fig. 7. Sample of the operation of the application prototype — Source: Own elaboration

Deep Learning

Fig. 8. Conversion from TensorFlow to TensorFlow Lite architecture — Source: Own elaboration


You can access to notebook and mobile application through my GitHub repositories bellow:

Here, you will can find more projects related to Data Science and Machine Learning. In summary, it contains all my work so far. Any reply or comment is always welcome.

About the authors

Erick Calderin Morales

Systems engineer with experience in software development, master’s student in systems engineering and master’s degree in data science with an affinity for artificial intelligence.

Sharon Maygua Mendiola

Mechatronics engineering student with a degree in physics.


¡Más inteligencia artificial!

La misión de Saturdays.ai es hacer la inteligencia artificial más accesible (#ai4all) a la vez que se realizan proyectos de impacto social (#ai4good). Si quieres aprender más sobre este proyecto (y otros) únete a nuestra comunidad en o aprende a crear los tuyos en nuestro programa AI Saturdays.

Add a Comment

You must be logged in to post a comment