Background: Long term electrocardiogram (ECG) monitoring is a standard clinical routine in cryptogenic stroke survivors to assess the presence of atrial fibrillation (AF). However, manual evaluation of such records is time consuming even for experienced cardiologist. Computer-based detectors of AF have shown to be helpful in diagnostic procedures to avoid further lifethreatening conditions. The electrocardiomatrix (ECM) technique allows compact and bidimensional representation of the ECG preserving morphology and rhythm characteristics, thus facilitating its analysis. In this study, we present a convolutional neural network (CNN) approach for automatic detection of AF based on ECM images. Methods: ECG segments of ten heartbeats were converted into ECM images. A CNN – composed of 3 convolutional layers, 3 batch normalization, 3 ReLu activation, 2 max pooling, 1 fully connected, 1 softmax, and 1 classification layer – was implemented to classify the ECMs between non-AF and AF. Using the MIT-BIH-AFDB and considering an overlapping of 50%, 239880 and 215920 images were generated for non-AF and AF, respectively; 80% were used for training and 20% for validation. Three-fold cross-validation was performed with datasets selected manually, such that validation sets were always taken from different records than training data. An average accuracy of 87.71%±7.03 was achieved during validation. An independent database consisting of 38 ECG signals with manual annotations on AF and non-AF was used for testing; 7397 and 22455 non overlapping images were generated for non-AF and AF, respectively, and classified with an accuracy of 86.08%. Results: The proposed methodology for AF detection suggest that automatic analysis of ECM images is a potential way to classify AF episodes, even as brief as ten heartbeats.