Article Text

Download PDFPDF

Digital solution for detection of undiagnosed diabetes using machine learning-based retinal image analysis
  1. Benny Zee1,2,
  2. Jack Lee1,
  3. Maria Lai1,
  4. Peter Chee3,
  5. James Rafferty4,
  6. Rebecca Thomas5,
  7. David Owens5
  1. 1Centre for Clinical Research and Biostatistics, Jockey Club School of Public Health and Primary Care, Faculty of Medicine, The Chinese University of Hong Kong, Hong Kong, People's Republic of China
  2. 2Clinical Trials and Biostatistics Lab, CUHK Shenzhen Research Institute, Shenzhen, People's Republic of China
  3. 3St. John Hospital, Hospital Authority of Hong Kong, Hong Kong, People's Republic of China
  4. 4Centre for Biomathematics, Swansea University, Swansea, Wales, UK
  5. 5Biomedical Science, Swansea University, Swansea, Wales, UK
  1. Correspondence to Dr Benny Zee; bzee{at}


Introduction Undiagnosed diabetes is a global health issue. Previous studies have estimated that about 24.1%–75.1% of all diabetes cases are undiagnosed, leading to more diabetic complications and inducing huge healthcare costs. Many current methods for diabetes diagnosis rely on metabolic indices and are subject to considerable variability. In contrast, a digital approach based on retinal image represents a stable marker of overall glycemic status.

Research design and methods Our study involves 2221 subjects for developing a classification model, with 945 subjects with diabetes and 1276 controls. The training data included 70% and the testing data 30% of the subjects. All subjects had their retinal images taken using a non-mydriatic fundus camera. Two separate data sets were used for external validation. The Hong Kong testing data contain 734 controls without diabetes and 660 subjects with diabetes, and the UK testing data have 1682 subjects with diabetes.

Results The 10-fold cross-validation using the support vector machine approach has a sensitivity of 92% and a specificity of 96.2%. The separate testing data from Hong Kong provided a sensitivity of 99.5% and a specificity of 91.1%. For the UK testing data, the sensitivity is 98.0%. The accuracy of the Caucasian retinal images is comparable with that of the Asian data. It implies that the digital method can be applied globally. Those with diabetes complications in both Hong Kong and UK data have a higher probability of risk of diabetes compared with diabetes subjects without complications.

Conclusions A digital machine learning-based method to estimate the risk of diabetes based on retinal images has been developed and validated using both Asian and Caucasian data. Retinal image analysis is a fast, convenient, and non-invasive technique for community health applications. In addition, it is an ideal solution for undiagnosed diabetes prescreening.

  • public health
  • retina
  • prediabetic state
  • primary health care

Data availability statement

Data are available upon reasonable request.

This is an open access article distributed in accordance with the Creative Commons Attribution Non Commercial (CC BY-NC 4.0) license, which permits others to distribute, remix, adapt, build upon this work non-commercially, and license their derivative works on different terms, provided the original work is properly cited, appropriate credit is given, any changes made indicated, and the use is non-commercial. See:

Statistics from

Request Permissions

If you wish to reuse any or all of this article please use the link below which will take you to the Copyright Clearance Center’s RightsLink service. You will be able to get a quick price and instant permission to reuse the content in many different ways.


  • The slow onset of type 2 diabetes symptoms explains why so many cases of diabetes were undetected for many years, resulting in severe, life-threatening complications.


  • We have shown that a digital approach based on a machine learning technique on retinal images to assess the risk of undiagnosed diabetes is efficient and has high accuracy.


  • This fast, convenient, and non-invasive digital method is ideal for population-based screening to identify undiagnosed diabetes in the community.

  • This method contributes to the overall reduction of diabetic complications in the society and significantly reduces healthcare costs.


Type 2 diabetes is one of the most common non-communicable diseases globally. According to the 10th edition of the International Diabetes Federation’s (IDF) Diabetes Atlas, the estimated number of people with diabetes worldwide in 2021 is around 537 million, which is predicted to rise to 783 million in 2045.1 The global prevalence of diabetes among adults is approximately 10%, with an anticipated increase of 46% during the next quarter of a century, which is twice the expected increase in the total population. The majority have type 2 diabetes (80%–90%), with the remainder predominantly type 1 diabetes. Changes in lifestyle and urbanization contribute to this high increase in type 2 diabetes, compounded by the low awareness among the general public and even health professionals. The slow onset of symptoms or progression of type 2 diabetes, with the condition remaining undetected for many years, results in severe, life-threatening complications.2 Therefore, this global pandemic of diabetes has significant public health consequences. People with diabetes are at high risk of major life-threatening complications, including cardiovascular disease (coronary, cerebrovascular disease), loss of vision, lower-extremity amputation, neuropathy, and kidney disease.3 4 They account for 80% of the total cost of diabetes care and are estimated to be about 10% of the overall healthcare costs. Worryingly, it is estimated that almost half the people living with diabetes worldwide are undiagnosed. The majority (88%) live in low-income and middle-income countries, with almost a third of residents in high-income countries. Presently, at least 600 000 persons are living with diabetes in Hong Kong alone and more than 110 million in mainland China.

Population-based screening for diabetes is currently being done using fasting or random blood glucose, oral glucose tolerance test (OGTT), or glycosylated hemoglobin concentration. However, these approaches differ in terms of accuracy, convenience, and cost. In addition, glucose load can vary, and the absorption rate of glucose from the gastrointestinal tract is also variable. Therefore, such tests are inherently subject to considerable variability, presenting a problem in diagnosing diabetes and pre-diabetes for those near threshold values. In contrast, a retinal image represents a very stable marker and is therefore a more accurate index of overall glycemic status of an individual. In addition, the prolonged asymptomatic phase of type 2 diabetes may last for years with unmanaged elevated blood glucose.

Consequently, it would lead to severe and irreversible microvascular or macrovascular complications.3 4 Rates of complications are high in people with undiagnosed diabetes, with approximately 40% of adults in the USA, with previously undiagnosed diabetes having chronic kidney disease.5 It is also recognized that people with impaired glucose tolerance (pre-diabetes) have a higher prevalence of complications,6 with evidence of risk of heart disease as early as 15 years before the diagnosis of diabetes. In contrast, early interventions to improve metabolic control can yield better cardiovascular outcomes in patients with dysglycemia. Also, the prevalence of some levels of diabetic retinopathy (DR) among individuals with undiagnosed diabetes in China is over 30%.7

Undiagnosed diabetes, therefore, presents a serious global health issue, with previous studies indicating that approximately 50% (range 24.1%–75.1%) of all people with diabetes globally are undiagnosed.8 Hence, there is an urgent need to develop a reliable and inexpensive method to screen for diabetes and pre-diabetes, and furthermore to introduce lifestyle or behavioral changes as early as possible to prevent the onset or progression of diabetes and revert to normoglycemia, thereby reducing the society’s considerable personal, medical, and financial burden.

In this study, we present a novel and efficient approach based on a machine learning technique on retinal images to assess the risk of diabetes. We intend to apply this to detect undiagnosed diabetes in the community. A classification model was constructed and validated using internal and external testing samples.


We carried out a retrospective study with a total of 2221 participants, with 945 subjects with diabetes and 1276 control subjects. Of the participants, 1555 (70%) were used as training samples for the classification model. They included 662 people with type 2 diabetes obtained from an outpatient clinic in Hong Kong and 893 controls not known to have diabetes from a Hong Kong local community. There were 666 people (30%) used as internal testing samples, including 283 with diabetes and 383 controls. All participants had their retinal images taken using a non-mydriatic fundus camera (Canon CR2). A fully automatic retinal image analysis (ARIA) program was developed to estimate retinal microvascular characteristics and incorporate a machine learning technique to derive an overall estimation of diabetes risk. In addition to developing the classification model and the internal validation process, two separate data sets were used to validate the results. They include Hong Kong testing data with 660 subjects with diabetes and 734 controls, and UK testing data with 1682 individuals with diabetes.

Data source

Adult people (aged ≥18 years) with diabetes with retinal images were obtained from St John Hospital (Hospital Authority of Hong Kong) and the Diabetic Eye Screening Wales (DESW) in the UK from 2008 to 2018. Normal control subjects were recruited from a Hong Kong community. The control data came from a community study of healthy individuals who claimed no known chronic disease, including diabetes. The Hospital Authority of Hong Kong provides secondary care to people with diabetes in the public healthcare system. Electronic patient records capture every clinical consultation’s demographic details, clinical information, and laboratory investigation results. For the UK data, we have extracted retinal images from the DESW and linked them with clinical data using the Secure Anonymised Information Linkage Databank of Wales, UK.

Study procedure

An optometrist or trained medical officer took retinal images of both eyes using a non-mydriatic digital fundus camera (Canon CR2). Retinal photographs of 45° were centered on the optic disc and the fovea, including the upper and lower temporal arcades and the area nasal to the optic disc. The size of each retinal image was ≥768×576 pixels, approximately 1.4 Mb. In Wales, we employed Canon CR2 non-mydriatic camera with pupillary dilation (1% tropicamide) to obtain good-quality 2×45° degree images from each eye.

Statistical methods

The ARIA method includes fractal, high-order spectra, and statistical texture analysis. Each of these methods targeted specific characteristics of the retinal image.9 We have developed the segmentation approach for exudate detection in an early DR study.10 The methodology for detecting neovascularization is based on fractal and texture analysis for late DR.11 Their 95% CIs were used in the sensitivity, specificity, positive predictive value, and negative predictive value analysis. We used two-sample independent t-tests to compare continuous data and χ2 tests for the univariate analysis of clinical and retinal characteristics for categorical data. P values <0.05 were considered statistically significant.

A transfer net ‘inceptionResNet’ convolutional neural network from Matlab was used with retinal images as input to develop the classification models. The method was discussed in a previous study by Lai et al.12 First, features based on pixels associated with diabetes status were generated. We also extracted the texture-related features, fractal-related features such as fractal dimension, and spectrum-related features such as high-order spectra associated with diabetes using the ARIA algorithm. Next, the glmnet approach was used to select the most critical subset of features based on the penalized maximum likelihood method. Finally, we used the selected machine learning features to estimate the commonly used retinal characteristics. We have previous experience developing the methodology and validating the results in other disease cohorts, including stroke, coronary heart disease, cerebral small vessel disease, and autism spectrum disorder.12–16 After the classification model was developed, we used a 10-fold cross-validation method based on a support vector machine (SVM) algorithm to evaluate the performance of the model and to minimize potential bias in the modeling process. We first partitioned the data set and used a subset with 90% data to train the algorithm and the remaining 10% data for testing. Each time we ran the cross-validation analysis, we used 10% of the data for testing that were not used in the training data. The advantage of this method is that the data used for testing in each validation run were excluded from the training models to reduce overfitting and overestimating the sensitivity and specificity. Because cross-validation does not use all data to build a model, it is a commonly used method to prevent overfitting during training. Figure 1 shows the flow chart of the described methodology.

Figure 1

Flow chart of the method for the development of the classification model. ARIA, automatic retinal image analysis; DM, diabetes mellitus; Glmnet, Generalized linear model via penalised maximum likelihood; HK, Hong Kong; inceptionresnetv2, Pretained inception-ResNet-v2 convolutional neural network; RGB, Red, Green and Blue; RF, Random forest; SVM, Support vector machine.

The description of the retinal characteristics can be found in a previous publication.13 The measurements related to retinal vessels included central retinal artery equivalent (CRAE) and central retinal vein equivalent (CRVE). The arteriole to venule ratio was defined as the ratio of CRAE to CRVE. All retina images were resized and adjusted into JPG format with 1365×1024 pixels to make the parameters compatible. Arteriole–venous nicking was represented as the narrowing of the venule at the crossing point of the arteriole. Arteriole occlusions were presented as thread-like arterioles when the blood inside the arterioles was stopped by emboli. Hemorrhage and exudates were either present or absent. They were key determinants of the severity of DR as they were associated with stroke in other studies. Tortuosity was assessed by visually grading each image. The grading of tortuosity was either straight or mild to severe tortuosity with at least one inflection of at least one major artery. The bifurcation coefficient (BC) or ‘area ratio’ is the ratio of the sum of the cross-sectional areas of the daughter vessels of a bifurcation to that of the parent stem. Usually, the three largest branching points were selected, and the image software drew lines perpendicular to the vessel walls. Calculation was the same in the arterioles and the venules. The means of the bifurcation coefficient of arterioles and venules were used. Asymmetry index (AI) is the ratio of diameters of two daughter branches. The AI was calculated as: AI=D1/D2, where D1 and D2 were smaller and larger branches, respectively. The mean of the three sets of AI of arterioles (Aasymmetry) and venules (Vasymmetry) was used. The angle between two daughter branches of the same branches studied in the BC was measured. The centerline of two branches was drawn, and the angle was calculated to represent the branching angle. The mean of the bifurcation angles of arterioles (Aangle) and the mean of bifurcation angles of venules (Vangle) from the three sets of vessels in one retinal image were used for the analysis.

Table 1 shows a summary of the retinal characteristics.

Table 1

Retinal characteristics*

Patient involvement

Patients were involved in the design and conduct of this research. During the study, control groups were recruited from the community with ethical approval and an informed consent process. Once the study is published, participants will be informed of the results through the study group and local publicity for a non-specialist audience.


Participant characteristics for overall data are shown in table 2. Age, body mass index, systolic and diastolic blood pressure, and hypertension status were significantly higher in the diabetes group. On the other hand, the hemoglobin level and the proportion of smokers were significantly lower in the diabetes group.

Table 2

Participant characteristics

Many retinal characteristics of subjects with diabetes were significantly different from those of the controls, including the diameters of the arteries and veins, the ratio of the diameters, BCs, bifurcation angles, asymmetry, tortuosity, nipping, hemorrhage, occlusion, and exudates (table 3).

Table 3

Retinal characteristics of people with diabetes and the controls

The internal testing results (ie, using 30% of the overall data) showed a sensitivity of 94.3% and a specificity of 97.4% (table 4). The 10-fold cross-validation using the SVM approach on overall data had a sensitivity of 92% (95% CI 90.2% to 93.7%) and a specificity of 96.2% (95% CI 95.2% to 97.3%) (table 4, figure 2). In addition to the internal 10-fold cross-validation testing, we have used two separate testing data sets to validate the classification model. The Hong Kong testing data have 734 controls and 660 people with diabetes, and the UK testing data have 1682 people with diabetes. The mean ages among the three groups were 37.47, 60.32, and 68.83, respectively, with the following male gender proportions: 194 of 734 (26.4%), 381 of 660 (57.7%), and 985 of 1682 (58.7%), respectively. Comparing the subjects with diabetes between Hong Kong and UK data, the UK subjects were significantly older and had more diabetes-related complications, with 89 of 660 (13.5%) and 366 of 1682 (21.8%), respectively. We have examined the classification using logistic regression with and without age and gender. The sensitivity for diabetes detection without age and gender adjustment was 98.4% and the specificity without age and gender adjustment was 91.1%. In comparison, the sensitivity with age adjustment was 98.6% and the specificity with age adjustment was 95.0%. As for gender, the sensitivity and specificity after gender adjustment were precisely the same as no adjustment, with a sensitivity and a specificity of 98.4% and 91.1%, respectively. This analysis illustrated that the classification without age and gender adjustment already achieves high accuracy. Simply using the retinal images without needing demographic information will enhance the efficiency during application.

Table 4

Classification results of internal testing (30%) and the 10-fold cross-validation (SVM approach)

Figure 2

The 10-fold cross-validation analysis (SVM approach). DM, diabetes mellitus; SVM, support vector machine.

As shown in table 5, the specificity of the Hong Kong external testing data was 91.1% (95% CI 89.1% to 93.2%), with the mean probability of presence of diabetes in the control group being 0.257 (95% CI 0.246 to 0.268, n=734). The sensitivity of the Hong Kong external testing data was 99.5% (95% CI 99.0% to 100%). The mean probability of diabetes for Hong Kong people with diabetes without evidence of complications was 0.834 (95% CI 0.826 to 0.841, n=571) and for those with diabetes-related complications was 0.860 (95% CI 0.840 to 0.879, n=89). The sensitivity of the UK testing data was 98.0%. The mean probability for UK people with diabetes without complications was 0.769 (95% CI 0.764 to 0.775, n=1316) and with diabetic complications (mainly stroke and coronary heart disease) was 0.787 (95% CI 0.778 to 0.797, n=366) (figure 3). Those with diabetes complications have a significantly higher probability of risk of diabetes and this is true for both Asian and Caucasian populations. For the validation test using both Hong Kong and UK testing data, the area under the Receiver Operator Characteristic (ROC) curve was 0.993 (95% CI 0.990 to 0.995).

Table 5

Classification results of the external validation

Figure 3

Testing results for both HK and UK. DM, diabetes mellitus; HK, Hong Kong.


The anticipated global increase in the prevalence of diabetes in the adult population (20–79 years) is almost 50% between 2021 and 2045. When the world population grows by only 20%, it will have significant socioeconomic consequences, especially in IDF regions where the increase is expected to exceed 50%, such as in South-East Asia (+68%), the Middle East and North Africa (+87%), and Africa (+134%).17 On the contrary, a much lower increased prevalence is forecast for Europe (+13%), North America and the Caribbean (24%), and the Western Pacific (27%) IDF regions. These phenomena mean that 94% of the increase in diabetes in 2045 will occur in low-income and middle-income countries. Disturbingly, almost half of the adult population living with diabetes are unaware of their condition. The vast majority (87.5%) are in low-income and middle-income countries, and a third of people with diabetes in high-income countries remain undiagnosed. Another worrying global trend has been the emergence of type 2 diabetes in children and adolescents. There are also other specific types of diabetes, including monogenic diabetes (1.5%–2.0% of all cases of type 2 diabetes), which is amenable to specific treatments, and ‘secondary diabetes’ resulting from other diseases, the toxic impact of specific therapies, infections, or immune and genetic disorders.

Since early 2020, we have also observed the adverse impact of the COVID-19 pandemic on people with diabetes, increasing the risk of infection and poorer clinical outcomes with more significant hospitalization and mortality. People diagnosed late in the course of the disease are at a much greater likelihood of diabetes complications and are therefore more likely to use more healthcare services, placing an added burden on healthcare systems already under pressure. Therefore, people with diabetes and pre-diabetes must be diagnosed as early as possible to prevent or delay severe long-term complications, improve quality of life, and avoid premature death. It is essential to be aware of the different syndromes of glucose intolerance early in the disease, as lifestyle changes and certain medications are most effective during the early stages. In addition, dietary and nutritional approaches have been demonstrated to be capable of preventing type 2 diabetes,18 with primary care weight management procedures able to achieve short-term19 and long-term remission of type 2 diabetes.20 Future interventions to prevent type 1 diabetes will also require an earlier than later diagnosis to introduce immune-modulating agents to halt the otherwise relentless progress to type 1 diabetes.21 22

Low rates of clinical diagnosis of diabetes are often due to insufficient access to healthcare services or low capacity in the existing healthcare systems to conduct the necessary tests, which can include OGTT, estimation of fasting blood glucose, and hemoglobin A1c (HbA1c). Risk scores based on questionnaires have been used.23 24 However, more amenable screening strategies are urgently needed to identify people with pre-diabetes and diabetes early and achieve the necessary coverage.

Several retinal microvascular biomarkers have been identified to predict the development of DR25 26 and cardiovascular outcomes in people with diabetes.27 28 Also, recently, it was demonstrated that trained deep learning models and retinal fundus photographs could predict HbA1c in people with diabetes,29 suggesting that such an approach may be capable of identifying individuals with diabetes even before experiencing clinical symptomatology.

This study presents a novel and efficient approach based on a machine learning technique on retinal images to assess the risk of diabetes, which will be applied to detect undiagnosed diabetes in the community. A classification model was constructed based on a data set with 2221 subjects, with a sensitivity of 92% and a specificity of 96.2% based on a 10-fold cross-validation approach. We have shown differences between diabetes and control groups for several clinical and retinal variables. A separate data set from Hong Kong with 1394 subjects was used to validate this classification model. The Hong Kong testing data’s sensitivity and specificity were 99.5% and 91.1%, respectively. These results demonstrate that screening for undiagnosed diabetes can be generally implemented in Hong Kong. We further tested the classification using UK data, and the sensitivity was 98.0%. These results suggest that the classification model can be applied to Caucasian as well as Asian populations.

The ability to predict the presence of diabetes mellitus based on retinal images, which can be obtained during a routine eye examination, offers a real opportunity to detect the disease. Otherwise, it would remain unknown and place the individual at risk of long-term, severe, life-changing complications. The photographic procedure is inexpensive and straightforward and capable of providing the results on the same occasion, facilitating referral to healthcare professionals for further management. The encouraging findings were obtained across different population groups compared with other screening/diagnostic procedures. Screening, leading to the implementation of preventive measures on a national, regional, and global scale, is the only way to obtund the predicted increase in diabetes and its socioeconomic burden for the coming years.

Data availability statement

Data are available upon reasonable request.

Ethics statements

Patient consent for publication

Ethics approval

This study involves human participants and was approved by the Joint CUHK-NTEC Clinical Research Ethics Committee (reference: CRE2019.184). Participants gave informed consent to participate in the study before taking part.



  • Presented at Presented as an oral presentation (#289) at the 57th Annual Meeting of the European Association for the Study of Diabetes (EASD), October 1, 2021, 11:30–11:45: Session SO 04, Prediction Models and Precision Medicine (Thomas RL, Lee J, Chee P, Zhuo Y, Lai M, Rafferty JM, Owens DR, Zee B, Estimation and validation of machine-learning-based retinal image analysis for detection of the risk of undiagnosed diabetes).

  • Contributors BZ and DO wrote the initial draft of the manuscript. ML, PC, and JR were involved in data collection and data extraction. PC, RT, and DO provided data and their interpretation. DO and PC provided clinical advice. JL and BZ carried out methodological development. JL provided statistical analysis and prepared the figures. All authors reviewed the manuscript. BZ is responsible for the overall content as guarantor.

  • Funding This study was supported by the Hong Kong Innovation and Technology Fund - Midstream Research Programme (MRP/037/17X).

  • Competing interests BZ and JL have a patent 'Method and device for retinal image analysis' licensed to Health View Bioanalytic, which received royalties through The Chinese University of Hong Kong. BZ and JL are founders and shareholders of Health View Bioanalytic, Bioanalytic Holdings, and Bioanalytic International Holdings. ML is the director of Bioanalytic Holdings and Bioanalytic International Holdings.

  • Provenance and peer review Not commissioned; externally peer reviewed.