Diabetic retinopathy (DR) is the result of a complication of diabetes affecting the retina. It can cause blindness if left undiagnosed and untreated. The ophthalmologist performs the diagnosis by screening each patient and detecting in ocular imaging the lesions caused by DR, namely, microaneurisms, hemorrhages, cotton wool spots, venous beading and neovascularization. However, the analysis of ocular findings is cumbersome, time-consuming, and demanding. Due to the insufficient amount of trained specialists to diagnose the illness, and the actual growing population with DR, it is important to develop a method to assist the DR diagnosis. This thesis presents two approaches for the automatic classification of DR using eye fundus images. The first one utilizes convolutional neural networks, transfer learning and shallow machine learning classifiers to identify the main ocular lesions related to DR and then use them to diagnose the illness. The second one is a multitask model which predicts simultaneously ocular lesions and DR. These approaches follow a similar workflow to that of clinicians, providing information that can be interpreted clinically to support the prediction. To achieve this goal a subset of the kaggle EyePACS and the Messidor-2 datasets, are labeled with ocular lesions by a certified opthalmologist. The kaggle EyePACS subset is used as training set and the Messidor-2 dataset is used as test set for both, the lesions and DR classification models. The results indicate that both methods achieve results comparable with state-of-the-art performances. The best results are obtained using the first approach with a multi layer perceptron as classifier for the automatic detection of DR, however, the multitask approach lead to similar results and has a simpler architecture.