Objective: To develop and validate a deep learning model based on fundus photos for the identification of coronary heart disease (CHD) and associated risk factors. Methods: Subjects aged>18 years with complete clinical examination data from 149 hospitals and medical examination centers in China were included in this retrospective study. Two radiologists, who were not aware of the study design, independently evaluated the coronary angiography images of each subject to make CHD diagnosis. A deep learning model using convolutional neural networks (CNN) was used to label the fundus images according to the presence or absence of CHD, and the model was proportionally divided into training and test sets for model training. The prediction performance of the model was evaluated in the test set using monocular and binocular fundus images respectively. Prediction efficacy of the algorithm for cardiovascular risk factors (e.g., age, systolic blood pressure, gender) and coronary events were evaluated by regression analysis using the area under the receiver operating characteristic curve (AUC) and R2 correlation coefficient. Results: The study retrospectively collected 51 765 fundus images from 25 222 subjects, including 10 255 patients with CHD, and there were 14 419 male subjects in this cohort. Of these, 46 603 fundus images from 22 701 subjects were included in the training set and 5 162 fundus images from 2 521 subjects were included in the test set. In the test set, the deep learning model could accurately predict patients' age with an R2 value of 0.931 (95%CI 0.929-0.933) for monocular photos and 0.938 (95%CI 0.936-0.940) for binocular photos. The AUC values for sex identification from single eye and binocular retinal fundus images were 0.983 (95%CI 0.982-0.984) and 0.988 (95%CI 0.987-0.989), respectively. The AUC value of the model was 0.876 (95%CI 0.874-0.877) with either monocular fundus photographs and AUC value was 0.885 (95%CI 0.884-0.888) with binocular fundus photographs to predict CHD, the sensitivity of the model was 0.894 and specificity was 0.755 with accuracy of 0.714 using binocular fundus photographs for the prediction of CHD. Conclusion: The deep learning model based on fundus photographs performs well in identifying coronary heart disease and assessing related risk factors such as age and sex.