ABSTRACT Deep learning has achieved excellent performance in the field of computer vision and gained attention in the field of hyperspectral anomaly detection (HAD). Convolutional neural networks (CNN) based on pixel pairing features have achieved a certain detection effect, which is limited by background complexity in practical applications. This study proposes an adaptive weighted HAD algorithm that combines an autoencoder (AE) and CNN. Labelled hyperspectral images (HSIs) are used to train a CNN as a binary classifier for similarity discrimination in the data preparation stage, where morphological attribute filtering (MAF) is performed on images in the spatial dimension of the HSIs to highlight anomaly. The spectral angle is used as a measure of reconstruction error to train the AE, and the reconstruction error obtained using the AE is used as an adaptive weight to calculate the anomaly score, which considerably eliminates the blurring of the boundary between the background and anomalies. Through comparisons with some state-of-the-art methods, the effectiveness of the proposed method in improving detection accuracy and increasing background and anomaly discrimination is verified on three real datasets.