The identification of karst caves in seismic imaging profiles is a key step for reservoir interpretation, especially for carbonate reservoirs with extensive cavities. In traditional methods, karst caves are usually detected by looking for the string of beadlike reflections (SBRs) in seismic images, which are extremely time-consuming and highly subjective. We propose an end-to-end convolutional neural network (CNN) to automatically and effectively detect karst caves from 2D seismic images. The identification of karst caves is considered as an image recognition problem of labeling a 2D seismic image with ones on caves and zeros elsewhere. The synthetic training data set including the seismic imaging profiles and corresponding labels of karst caves are automatically generated through our self-defined modeling and data augmentation method. Considering the extreme imbalance between the caves (ones) and non-caves (zeros) in the labels, we adopt a class-balanced loss function to maintain good convergence during the training process. The synthetic tests demonstrate the capability and stability of our proposed network, which is capable of detecting the karst caves from the seismic images contaminated with severe random noise. The physical simulation data example also confirms the effectiveness of our method. To overcome the generalization problem of training the neural network with only synthetic data, we introduce the transfer learning strategy and obtain good results on the seismic images of the field data.