ObjectiveDiabetic macular edema (DME) is the leading cause of visual impairment in patients with diabetes mellitus (DM). The goal of early detection has not yet achieved due to a lack of fast and convenient methods. Therefore, we aim to develop and validate a prediction model to identify DME in patients with type 2 diabetes mellitus (T2DM) using easily accessible systemic variables, which can be applied to an ophthalmologist-independent scenario.MethodsIn this four-center, observational study, a total of 1994 T2DM patients who underwent routine diabetic retinopathy screening were enrolled, and their information on ophthalmic and systemic conditions was collected. Forward stepwise multivariable logistic regression was performed to identify risk factors of DME. Machine learning and MLR (multivariable logistic regression) were both used to establish prediction models. The prediction models were trained with 1300 patients and prospectively validated with 104 patients from Guangdong Provincial People’s Hospital (GDPH). A total of 175 patients from Zhujiang Hospital (ZJH), 115 patients from the First Affiliated Hospital of Kunming Medical University (FAHKMU), and 100 patients from People’s Hospital of JiangMen (PHJM) were used as external validation sets. Area under the receiver operating characteristic curve (AUC), accuracy (ACC), sensitivity, and specificity were used to evaluate the performance in DME prediction.ResultsThe risk of DME was significantly associated with duration of DM, diastolic blood pressure, hematocrit, glycosylated hemoglobin, and urine albumin-to-creatinine ratio stage. The MLR model using these five risk factors was selected as the final prediction model due to its better performance than the machine learning models using all variables. The AUC, ACC, sensitivity, and specificity were 0.80, 0.69, 0.80, and 0.67 in the internal validation, and 0.82, 0.54, 1.00, and 0.48 in prospective validation, respectively. In external validation, the AUC, ACC, sensitivity and specificity were 0.84, 0.68, 0.90 and 0.60 in ZJH, 0.89, 0.77, 1.00 and 0.72 in FAHKMU, and 0.80, 0.67, 0.75, and 0.65 in PHJM, respectively.ConclusionThe MLR model is a simple, rapid, and reliable tool for early detection of DME in individuals with T2DM without the needs of specialized ophthalmologic examinations.