Atrial fibrillation (AF) increases risk of embolic stroke, and in postoperative patients, increases cost of care. Consequently, ECG screening for AF in high-risk patients is important but labor-intensive. Artificial intelligence (AI) may reduce AF detection workload, but AI development presents challenges. We used a novel approach to AI development for AF detection using both surface ECG recordings and atrial epicardial electrograms obtained in postoperative cardiac patients. Atrial electrograms were used only to facilitate establishing true AF for AI development; this permitted the establishment of an AI-based tool for subsequent AF detection using ECG records alone. A total of 5 million 30-second epochs from 329 patients were annotated as AF or non-AF by expert ECG readers for AI training and validation, while 5 million 30-second epochs from 330 different patients were used for AI testing. AI performance was assessed at the epoch level as well as AF burden at the patient level. AI achieved an area under the receiver operating characteristic curve of 0.932 on validation and 0.953 on testing. At the epoch level, testing results showed means of AF detection sensitivity, specificity, negative predictive value, positive predictive value, and F1 (harmonic mean of positive predictive value and sensitivity) as 0.970, 0.814, 0.976, 0.776, and 0.862, respectively, while the intraclass correlation coefficient for AF burden detection was 0.952. At the patient level, AF burden sensitivity and positive predictivity were 96.2% and 94.5%, respectively. Use of both atrial electrograms and surface ECG permitted development of a robust AI-based approach to postoperative AF recognition and AF burden assessment. This novel tool may enhance detection and management of AF, particularly in patients following operative cardiac surgery.