The study of jet-inflated X-ray cavities provides a powerful insight into the energetics of hot galactic atmospheres and radio-mechanical AGN feedback. By estimating the volumes of X-ray cavities, the total energy and thus also the corresponding mechanical jet power required for their inflation can be derived. Properly estimating their total extent is, however, non-trivial, prone to biases, nearly impossible for poor-quality data, and so far has been done manually by scientists. We present a novel machine-learning pipeline called Cavity Detection Tool (CADET), developed as an assistive tool that detects and estimates the sizes of X-ray cavities from raw Chandra images. The pipeline consists of a convolutional neural network trained for producing pixel-wise cavity predictions and a DBSCAN clustering algorithm, which decomposes the predictions into individual cavities. The convolutional network was trained using mock observations of early-type galaxies simulated to resemble real noisy Chandra-like images. The network’s performance has been tested on simulated data obtaining an average cavity volume error of 14 per cent at an 89 per cent true-positive rate. For simulated images without any X-ray cavities inserted, we obtain a 5 per cent false-positive rate. When applied to real Chandra images, the pipeline recovered 93 out of 97 previously known X-ray cavities in nearby early-type galaxies and all 14 cavities in chosen galaxy clusters. Besides that, the CADET pipeline discovered seven new cavity pairs in atmospheres of early-type galaxies (IC 4765, NGC 533, NGC 2300, NGC 3091, NGC 4073, NGC 4125, and NGC 5129) and a number of potential cavity candidates.