Method of histopathological diagnosis of mammary nodules through deep learning algorithm

Método de diagnóstico histopatológico de nódulos mamários por meio do algoritmo de aprendizagem profunda

Victor Antônio Kuiava1; Eliseu Luiz Kuiava2; Rubens Rodriguez1,3; Adriana Eli Beck3; João Pedro M. Rodriguez4; Eduardo O. Chielle5

1. Universidade de Passo Fundo, Passo Fundo, Rio Grande do Sul, Brazil
2. Centro Universitário Internacional, São Miguel do Oeste, Santa Catarina, Brazil
3. Instituto de Patologia de Passo Fundo, Passo Fundo, Rio Grande do Sul, Brazil
4. Instituto de Ciências Exatas e Geociências, Passo Fundo, Rio Grande do Sul, Brazil
5. Universidade do Oeste de Santa Catarina, São Miguel do Oeste, Santa Catarina, Brazil


Corresponding author

Eduardo Ottobelli Chielle
ORCID 0000-0003-3566-1258

First Submission on 2/20/2019

Last Submission on 3/13/2019
Accepted for publication on 6/14/2019
Published on 12/20/2019


INTRODUCTION: Artificial intelligence systems are promising health care technologies, mainly in medical subareas such as pathology, and can be used as support methods for the histological diagnosis of mammary nodules.
OBJECTIVE: This study describes the method and results of the development of artificial intelligence software for the histopathological analysis of mammary nodules.
METHODS: The software was developed by using two neural networks – Inception and MobileNet. The database used for learning the conditions analyzed (histologically normal breast, fibroadenoma, fibrocystic changes, in situ ductal carcinoma, invasive carcinoma of no special type and invasive lobular carcinoma) was obtained after authorization of the Path Presenter site with 5,298 images. The 2,740 images used for the validation of the system were obtained from the Pathology Institute of Passo Fundo.
RESULTS: The present software had sensitivity of 80.5% [95% confidence interval (CI), 71.9%-89.1%] and specificity of 96.1% (95% CI, 94.3%-97.8%) for MobileNet and sensitivity of 73.8% (95% CI, 52.6%-115%) and specificity of 94.7% (CI 95%, 91.7%-97.7%) for Inception. For the differentiation of malignant conditions, it obtained a maximum sensitivity of 78.7% and specificity of 95.8%; for differentiation of benign conditions, the maximum sensitivity was 82.6% and the specificity was 97.4%.
CONCLUSION: The present software presented promising results in the histopathological analysis of mammary nodules. It reinforced the idea that in the future the presence of diagnostic support systems in breast pathologies may play a crucial role in health care.

Keywords: breast cancer; artificial intelligence; diagnosiscáncer de mama; inteligencia artificial; diagnóstico.


INTRODUCCIÓN: Los sistemas de inteligencia artificial son tecnologías prometedoras en asistencia en salud, principalmente en áreas médicas como la patología; pueden ser usados para el diagnóstico histopatológico de nódulos mamarios.
OBJETIVO: Este estudio presenta el método y los resultados de la construcción de un software de inteligencia artificial para análisis histopatológico de nódulos mamarios.
MÉTODOS: El software fue desarrollado usando dos redes neurales. Se obtuvo la base de datos para el aprendizaje de las condicionas analizadas (mama histológicamente normal, fibroadenoma, cambios fibroquísticos de la mama, carcinoma ductal in situ, carcinoma invasivo de tipo no especial y carcinoma lobular invasivo) después de la aprobación de la página Path Presenter, con 5.298 imágenes. Las imágenes utilizadas para validación del sistema se obtuvieron del Instituto de Patología de Passo Fundo, totalizando 2.740 imágenes.
RESULTADOS: El software presentó sensibilidad del 80,5% [intervalo de confianza (IC) 95%, 71,9%-89,1%] y especificidad de 96,1% (95% IC, 94,3%-97,8%) para MobileNet y sensibilidad de 73,8% (95% IC, 52,6%- 115%) y especificidad de 94,7% (95% IC, 91,7%-97,7%) para Inception. Para diferenciación de condiciones malignas, obtuvo-se sensibilidad máxima de 78,7% y especificidad de 95,8%; para diferenciación de condiciones benignas, la sensibilidad máxima fue de 82,6% y la especificidad, de 97,4%.
CONCLUSIÓN: El software presentó resultados prometedores en el análisis histopatológico de nódulos mamarios, reforzando la idea de que, en el futuro, la presencia de sistemas de soporte diagnóstico de enfermedades mamarias puede desempeñar un papel crucial en la rutina del sistema de salud.

Palabras-clave: cáncer de mama; inteligencia artificial; diagnóstico.


INTRODUÇÃO: Sistemas de inteligência artificial são tecnologias promissoras de assistência em saúde, principalmente em subáreas médicas, como a patologia; podem ser utilizados como métodos de suporte para o diagnóstico histopatológico de nódulos mamários.
OBJETIVO: Este estudo apresenta a metodologia e os resultados da construção de um software de inteligência artificial para análise histopatológica de nódulos mamários.
MÉTODOS: O software foi desenvolvido utilizando duas redes neurais para a sua construção: Inception e MobileNet. O banco de dados utilizado para a aprendizagem das condições analisadas (mama histologicamente normal, fibroadenoma, alteração fibrocística, carcinoma ductal in situ, carcinoma invasivo do tipo não especial e carcinoma lobular invasivo) foi obtido após autorização do site Path Presenter, com 5.298 imagens. As imagens utilizadas para a validação do sistema foram obtidas do Instituto de Patologia de Passo Fundo, totalizando 2.740 imagens.
RESULTADOS: O software apresentou sensibilidade de 80,5% [intervalo de confiança (IC) 95%, 71,9%-89,1%] e especificidade de 96,1% (95% IC, 94,3%-97,8%) para o MobileNet e sensibilidade de 73,8% (95% IC, 52,6%-115%) e especificidade de 94,7% (95% IC, 91,7%-97,7%) para o Inception. Para a diferenciação de condições malignas, obteve-se sensibilidade máxima de 78,7% e especificidade de 95,8%; para diferenciação de condições benignas, a sensibilidade máxima foi de 82,6% e a especificidade, de 97,4%.
CONCLUSÃO: O software apresentou resultados promissores na análise histopatológica de nódulos mamários, reforçando que, no futuro, a presença de sistemas de suporte de diagnóstico das patologias mamárias pode se fazer presente na rotina do sistema saúde.

Palavras-chave: câncer de mama; inteligência artificial; diagnóstico.


Health care systems face multiple challenges across the world: increased disease burden, multimorbidity, and disability caused by aging and epidemiological transition, increased demand for health services, increased societal expectations and increased health spending(1,2). Another challenge is inefficiency, with low productivity(3). These health system challenges exist in a scenario of fiscal conservatism, with misguided economic austerity policies restricting investment in health care. The profound transformation of health systems is essential to overcoming these challenges and achieving universal health coverage (UHC) by 2030(4).

Machine learning, the most tangible manifestation of artificial intelligence (AI) – and the newest area of growth in digital technology – promises to achieve more with less, and can be the catalyst for such a transformation(5).

AI consists of a set of computational technologies that are inspired by human reasoning ability for the purpose of feeling, learning, reacting and creating action. It differs from humans in speed, autonomy, and generality(6-10. In the health setting, the use of AI systems has made great progress, being seen as one of the main areas of AI and assisting medical diagnoses, procedures and operations(4).

On this matter, an important segment of AI performance would be the aid of anatomical pathology diagnosis. Once the visual recognition system and the AI deep learning software are well structured, developing a system that could help pathologists with diagnoses, especially in cases of neoplasms(11) would be considered valuable.

Some studies have used AI to assist the diagnosis of neoplasms, such as the evaluation of intestinal polyps(6), detection of lymph node metastasis in breast câncer(9), prognosis in colorectal cancer(11), lung cancer(8) and gastric cancer(7).

Regarding such context, AI could aid in the diagnosis of breast nodules. They are extremely common conditions in women, being more frequent as the population ages. Breast cancer has the highest incidence rate and the second highest mortality rate in women. Early and accurate diagnosis is a fundamental strategy used to minimize breast morbidity and mortality(12,13). Nodules can be subclassified into two large subgroups: benign or malignant(14,15).

The leading representatives of the first subgroup are fibroadenoma and fibrocystic changes, which are characterized as benign conditions with a lower rate of complications arising from them. The malignant ones are mostly represented by in situ ductal carcinoma, non-special invasive carcinoma, and invasive lobular carcinoma. These nodules are extremely frequent in one out of eight women(12,16).

There has been a recent increase in the number of biopsies and breast surgical specimens for the evaluation of suspicious nodules. Nevertheless, there was no proportional increase of pathologists to supply the labor demand. On the contrary, there was a decrease in professionals and an overload of work, putting at risk the differentiation of benign from malignant diseases(17,18).

In this study, AI software was developed based on deep learning that enabled the histopathological recognition of breast nodules with high sensitivity and specificity. It can be used by pathologists to accelerate and increase diagnoses of those neoplasms, both in the distinction of normal from pathological and in the differentiation of type and degree.


Software development

The AI software was developed using the deep learning technique. This software was structured in a set of algorithms that model high-level abstractions of data using a deep graph with several processing layers, composed of several linear and nonlinear transformations. A communication interface was established of characteristics of mammary histopathological images organized under a chain of analysis that defined a logical pattern of image classification with and without breast neoplastic lesions.

The programming language Python version 3 was adopted. This language promotes a systematic method of programming based on the concept of software structured in blocks, thus facilitating the identification of the characteristics in the database. It is a dynamic, interpreted, robust, multiplatform, multiparadigm language (object orientation, functional, reflective and imperative). The PHP programming language version 5 and JavaScript enabled to create an interface of easy manipulation, favoring options of tools, buttons and scroll bars to choose alternatives and the necessary commands. The software has been named KAi (Kuiava artificial intelligence).

Database development and histopathological slides selection

Histopathological slides of the breast tissue removed from the Path Presenter site with different resolutions and classified as normal, fibrocystic alterations, fibroadenomas, invasive of no special type and invasive lobular in situ carcinomas, were used for image bank training.

For the development of the software database, 110 slides from the Path Presenter site were used, of which 5,298 images were captured. A total of 759 breast images were obtained without pathological changes; 316 with fibrocystic changes; 633 with fibroadenomas; 930 with carcinomas in situ; 1,350 with invasive carcinoma of no special type; 1,310 with invasive lobular carcinoma (Figure 1).

FIGURE 1 – Image model used for the development of the software database A) invasive lobular carcinoma; B) carcinoma in situ; C) fibroadenoma; D) invasive carcinoma of no special type; E) fibrocystic changes; F) normal breast.

All these images were reassessed and confirmed by two experienced pathologists. All selected images were analyzed by AI software to create a recognition pattern. The image resolution of the system is 224 x 224 pixels for the MobileNet and 299 x 299 for the Inception. Image analysis with three channels (R, G and B) was used.

The AI algorithm training

The deep learning technique with convolutional neural network training was applied through the open source TensorFlow library. Two pre-trained neural network models, MobileNet version 1.0 and Inception version 3, were used for training the classification of images. Both models were architected from a set of pre-analyzed general purpose images available by Google Inc.

The AI algorithm training used the 5,298 images provided by the Path Presenter site on the MobileNet and Inception pre-trained neural network models. Ten percent (530) of the images were used as a set of data for the internal validation of the system itself to enable the calculations of the reliability levels.

The configurations used to calibrate MobileNet and get the best performance were a number of interactions of 1,200, with a learning rate of 0.001, and the reliability level offered by the system was 84%.

For Inception, the best configuration found was a number of interactions of 5,000, with a learning rate of 0.1, and the reliability level offered by the system was 82.4%.

Software validation

After the software training, it underwent an efficiency test, which occurred in three stages:

• first – we selected 120 histopathological slides with different diagnoses, which generated 685 images of different microscopic magnifications of 40× and 100× (432 breast images without pathological alterations, 268 with fibrocystic alterations, 520 with fibroadenomas, 412 carcinomas in situ, 540 invasive carcinomas of no special type, 568 invasive lobular carcinomas). The slides were assigned by the Pathology Institute of Passo Fundo, Brazil;

• second – the diagnosis of the slides was confirmed by two pathologists, and the 685 images were converted into JPEG format and inserted into the program. These 685 images provided by the institute went through rotations of 90, 180 and 270 degrees to increase the number of the database of images that would be tested by the software. Thus, 2,740 images were used to externally validate the system;

• third – the images in JPEG format were analyzed in the Kai software, which released the diagnosis in a notepad typed file that was later transferred to Microsoft Excel 2013.

Statistical analysis

The software made batches of notepads typed into a Microsoft Excel worksheet, creating a Database. For the calculations of sensitivity and specificity, the following formulas were used: sensitivity = true positive/positive; specificity = true negative/negative. The non-parametric Wilcoxon and Mann-Whitney tests were used to evaluate the software correctness. Results were considered significant when p < 0.05 and, the SSPS 10.0 software was used for the analyses.


The software was developed to verify breast histopathological images and was trained to perform the diagnoses. The structure of the software is shown in Figure 2.


FIGURE 2 – KAi functional structure A) homepage; B) JPEG image insertion page; C) result report page.
KAi: Kuiava artificial intelligence.

The sensitivity and specificity of the software were verified by testing 2,740 images provided by the Pathology Institute of Passo Fundo (432 images of breasts without pathological changes, 268 with fibrocystic alterations, 520 with fibroadenomas, 412 carcinomas in situ, 540 invasive carcinomas of no special type, 568 invasive lobular carcinomas).

The overall results presented sensitivity of 80.5% [95% confidence interval (CI), 71.9%-89.1%] and specificity of 96.1% (95% CI, 94.3%-97.8%) for the MobileNet, and sensitivity of 73.8% (95% CI, 52.6%-115%) and specificity of 94.7% (CI 95%, 91.7%-97.7%) for Inception (Table).


For the differentiation between benign (normal breast, fibrocystic alteration, and fibroadenoma) and malignant conditions (in situ, invasive no special type and invasive lobular type carcinomas) the system obtained maximum sensitivity of 78.7% and specificity of 95.8% for differentiation of malignant conditions. For benign conditions, the maximum sensitivity was 82.6% and the specificity was 97.4%. There was no statistical difference in sensitivity and specificity between MobileNet and Inception (p = 0.74).


World estimates show an upward trend over the decades in the incidence and prevalence of neoplasms(1). Therefore, the complex processes of early detection and the correct diagnosis of cancer depend, among other factors, on the reasoning and experience of the medical professionals. In this context, the use of computational techniques in the structured diagnosis with AI becomes an important tool that will assist health professionals and especially patients, improving and accelerating the diagnosis of neoplasms(3,4,19). Thus, this work proposed the development of software that would assist the histopathological diagnosis of breast neoplasms.

The results obtained showed that the KAi system collected promising data, presenting sensitivity of 76% and specificity of 94.5%, associated with a high negative predictive index in the differentiation of benign nodules from malignant ones, with promising characteristics to be incorporated, in the future, in pathology laboratories as a screening method.

Studies have shown that AI systems outperform physicians in diagnosing pathologies. A study published in the Annals of Oncology Scientific Journal, led by Holger Haenssler, a professor in the department of dermatology at the University of Heidelberg in Germany and with the participation of scientists from France and the United States, showed that doctors accurately detected 86.6% of melanomas and the AI system managed to correct 95% of the cases(20). Stone et al. (2016)(4) describe that in the health area, the use of AI systems has had great progress, being seen as one of the main areas of AI that may be able to assist medical diagnoses.

The decision support systems are software that proposes to help clinicians in the diagnostic and therapeutic decisions related to the patient. They simplify the access to accurate data in the scientific literature, propaedeutic possibilities, the establishment of differential diagnosis, besides highlighting specific characteristics in new clinical patterns(7,19).

The reading and identification system proposed by this project facilitates the reading and diagnosis of breast neoplasms, allowing laboratories and professionals to diagnose neoplasms at long distances, such as towns, villages and riverside regions that do not have diagnosis-enabled professionals. They can rapidly prepare histology, photograph and perform a previous screening, that is, a prior diagnosis, and/or later send the images to distant sites, larger and specialized centers that present this technology and professionals capable of confirming the diagnosis, without the need to refer anatomical specimens to formaldehyde, avoiding degeneration, delayed transport, loss or exchange of samples(21,22).

Such a procedure would significantly reduce the costs of transporting materials, avoid missing samples, and especially making diagnosis much faster and more assertive. In addition, medical surgeons could have immediate results, even before patients are discharged, what would facilitate and improve therapeutic behavior(2,4). Through a database, this system of reading and diagnosis would make stronger recommendations for each case of cancer in a few minutes, showing even the best treatment for each patient.

In addition, the present system has potentialities because it uses two databases from different institutions, thus potentializing the validation of data. This feature ensures more security of results, having better external validation. Once this work is the result of a primary study, some limitations exist, such as the use of only two neural network models for software development and capture of classic images from the conditions analyzed. Regions of transitions between pathological and healthy conditions were not included in the study this time. We observed an unbalance in the number of images used for each pathological condition analyzed – this characteristic can influence the system correctness and validation. However, we emphasize that it is a practical, inexpensive and effective method that only needs improvement to increase specificity and sensitivity.

We highlight the fact that is unlikely that a machine will entirely replace human professionals, although these AI systems may assist the diagnosis of neoplasms, and this system of interpretation and diagnosis based on AI is able to read, interpret, differentiate and diagnose histopathological images of neoplasms, making diagnosis more accurate, efficient and faster, especially in places where there is a poor and fragile medical and hospital structure(5,6).


AI systems are technologies that have been emerging and can have an exponential role in the ways health professionals provide care and reach diagnosis. They are ways of complementing the structural weaknesses of the health system, such as the unavailability of professionals and geographical limitations. The developed system obtained promising results that favor similar systems and that can be used as a screening method for the diagnosis of breast neoplasms because even in the embryonic stage it was able to obtain a maximum sensitivity of 78.7% and specificity of 95.8 % for differentiation of malignant conditions, and a maximum sensitivity of 82.6% and specificity of 97.4% for differentiation of benign conditions. We highlight the importance of the system as an inexpensive tool easy to operate.


The authors declare that there is no conflict of interest regarding the publication of this article.


1. Siegel RL, Miller KD, Jemal A. Cancer statistics. Ca Cancer J Clin. 2018; 68(1): 7-30. PubMed PMID: 29313949.

2. Atun R. Transitioning health systems for multimorbidity. Lancet [Internet]. 2015; 6736(14): 8-9. Available at:

3. Kocher R, Sahni NR. Rethinking Health Care Labor. N Engl J Med. 2011; 365(15): 1370-2. PubMed PMID: 21995383.

4. Stone P, Brooks R, Brynjolfsson E, et al. Artificial intelligence and life in 2030. One hundred year study on artificial intelligence: report of the 2015-2016 study panel. 2016. p. 52. Available at:

5. Badawi O, Brennan T, Celi LA, et al. Making big data useful for health care: a summary of the inaugural MIT critical data conference. 2014; 2: 1-11. PubMed PMID: 25600172.

6. Yoshida H, Yamashita Y, Shimazu T, et al. Automated histological classification of whole slide images of colorectal biopsy specimens. Oncotarget. 2017; 8(53): 90719-29. PubMed PMID: 29207599.

7. Sharma H, Zerbe N, Klempert I, Hellwich O, Hufnagl P. Deep convolutional neural networks for automatic classification of gastric carcinoma using whole slide images in digital histopathology. Comput Med Imaging Graph [Internet]. 2017; 61: 2-13. Available at: https://doi. org/10.1016/j.compmedimag.2017.06.001.

8. Yu K-H, Zhang C, Berry GJ, et al. Predicting non-small cell lung cancer prognosis by fully automated microscopic pathology image features. Nat Commun. 2016; 7: 1-10. PubMed PMID: 27527408.

9. Golden JA. Deep learning algorithms for detection of lymph node metastases from breast cancer helping artificial intelligence be seen. JAMA. 2017; 318(22): 12-4. PubMed PMID: 29234791.

10. Esteva A, Kuprel B, Novoa RA, et al. Dermatologist-level classification of skin cancer with deep neural networks. Nature [Internet]. 2017; 542: 115-8. Available at:

11. Bychkov D, Linder N, Turkki R, et al. Deep learning based tissue analysis predicts outcome in colorectal cancer. Sci Rep [Internet]. 2018; 8(August 2017): 1-11. Available at:

12. Ghoncheh M, Pournamdar Z, Salehiniya H. Incidence and mortality and epidemiology of breast cancer in the world. Asian Pacific J Cancer Prev. 2016; 17: 43-6. PubMed PMID: 27165206.

13. Gebrim LH. A detecção precoce do câncer de mama no Brasil [Internet]. 1 ed. Vol. 32. Cadernos de Saúde Pública. Rio de Janeiro; 2016. Available at:

14. Nazário ACP, Rego MF, Oliveira VM. Nódulos benignos da mama: uma revisão dos diagnósticos diferenciais e conduta. Rev Bras Ginecol Obstetr. 2007; 29(4): 211-9.

15. Gobbi H. Classificação dos tumores da mama: atualização baseada na nova classificação da Organização Mundial da Saúde de 2012. J Bras Patol Med Lab [Internet]. 2012; 48(6): 463-74. Available at:

16. Lotti RCB, Barra ADA, Dias RC, Makluf ASD. Impacto do tratamento de câncer de mama na qualidade de vida. Rev Bras Cancerol. 2008; 54(4): 367-71.

17. Pereira PF, Souza CTV, Hora DL, Possas CA, Menezes RC. Influence of pathology teaching on the performance of pathologists and infectious diseases specialists in Rio de Janeiro. Rev Bras Educ Med. 2018; 42(1): 214-23.

18. Soares MFS, Athanazio DA. The new curriculum and the end of pathology. Rev Bras Edu Med. 2016; 40(3): 528-34.

19. Panch T, Szolovits P, Atun R. Artificial intelligence, machine learning and health systems. J Glob Heal. 2018; 8(2): 1-8. PubMed PMID: 30405904.

20. Mar VJ, Soyer HP Artificial intelligence for melanoma diagnosis: how can we deliver on the promise? Ann Oncol. 2018. PubMed PMID: 29790922.

21. Krizhevsky A, Hinton GE. ImageNet classification with deep convolutional neural networks [Internet]. NIPS. 2012; 1-9. Available at:

22. Gunkel DJ. Comunicação e inteligência artificial: novos desafios e oportunidades para a pesquisa em comunicação. Galáxia (São Paulo). 2017; 34. Available at: