Highly excited eigenstates of quantum many-body systems are typically featureless thermal states. Some systems, however, possess a small number of special, low-entanglement eigenstates known as quantum scars. We introduce a quantum-inspired machine-learning platform based on a quantum variational autoencoder (QVAE) that detects families of scar states in spectra of many-body systems. Unlike a classical autoencoder, QVAE performs a parametrized unitary operation, allowing us to compress a single eigenstate into a smaller number of qubits. We demonstrate that the autoencoder trained on a scar state is able to detect the whole family of scar states sharing common features with the input state. We identify families of quantum many-body scars in the PXP model beyond the
Z2 and
Z3 families and find dynamically decoupled subspaces in the Hilbert space of disordered, interacting spin-ladder model. The possibility of an automatic detection of subspaces of scar states opens new pathways in studies of models with a weak breakdown of ergodicity and fragmented Hilbert spaces.