To investigate gamma-ray bursts (GRBs) in depth, it is crucial to develop an effective method for identifying GRBs accurately. Current criteria, e.g., onboard blind search, ground blind search, and target search, are limited by manually set thresholds and perhaps miss GRBs, especially for subthreshold events. We proposed a novel approach that utilizes convolutional neural networks (CNNs) to distinguish GRBs and non-GRBs directly. We structured three CNN models, plain-CNN, ResNet, and ResNet-CBAM, and endeavored to exercise fusing strategy models. Count maps of NaI detectors on board Fermi/Gamma-ray Burst Monitor were employed, as the input samples of data sets and models were implemented to evaluate their performance on different timescale data. The ResNet-CBAM model trained on the 64 ms data set achieves high accuracy overall, which includes residual and attention mechanism modules. The visualization methods of Grad-CAM and t-SNE explicitly displayed that the optimal model focuses on the key features of GRBs precisely. The model was applied to analyze 1 yr data, accurately identifying approximately 98% of GRBs listed in the Fermi burst catalog, eight out of nine subthreshold GRBs, and five GRBs triggered by other satellites, which demonstrated that the deep- learning methods could effectively distinguish GRBs from observational data. Besides, thousands of unknown candidates were retrieved and compared with the bursts of SGR J1935+2154, for instance, which exemplified the potential scientific value of these candidates indeed. Detailed studies on integrating our model into real-time analysis pipelines thus may improve their accuracy of inspection and provide valuable guidance for rapid follow-up observations of multiband telescopes.