Automatic atrial fibrillation (AF) detection is essential for preventing stroke due to silent heart diseases. In this paper, we propose an automatic AF detection by using electrocardiogram (ECG) signals and convolutional neural network. The proposed method is tested by using the ECG signals from Physionet. On the benchmark performance metrics, the proposed method achieved an average accuracy of 98.26% for detecting AF events. The proposed method can achieve the AF event detection with a processing time of 0.77±0.037 ms with the selection of optimal hyperparameters. The method has great potential in detection of AF events in ECG signal. © 2022 IEEE.