## 1 Introduction  
Grains and nuts are vulnerable to fungi infection such as _Aspergillus flavus_ and _A. parasiticus_, which can create aflatoxin B1 in the secondary metabolism process [1]. Moreover, aflatoxin B1 contamination can occur in any step from harvesting to packaging. Also, aflatoxin B1 is highly carcinogenic and the continuous consumption of its contaminated food causes serious health problems including liver disease, kidney failures, etc., for both humans and animals [2]. With the changing global climate, the likelihood of aflatoxin contamination has significantly increased over the years. In response to this threat, various countries have implemented distinct regulatory measures aimed at mitigating potential health and economic losses [3]. Hyperspectral imaging stands out as a promising method for food quality estimation applications. Short wave near infrared (SWIR) hyperspectral imaging (HSI) covers spectral wavelengths from 900 to 2500 nm. This allows for the integration of spectral and spatial features [4; 5]. Additionally, HSI captures detailed spectral information across hundreds of narrow absorption bands, allowing for the identification of subtle spectral differences indicative of contamination, even at very low concentrations [6]. This detailed information increases the dimensionality of HSI data. Moreover, these data contain both relevant and irrelevant information. Analyzing and classifying high-dimensional data requires substantial computational resources and developed models struggle to perform effectively due to the abundance of spectral data [7]. Furthermore, the large number of spectral data increases the model's complexity. Spectral band selection techniques play a crucial role in addressing the challenge of high dimensionality and enhancing the effectiveness of HSI-based detection of aflatoxin B1-contaminated almonds. These techniques aim to identify a subset of the most relevant and informative spectra from the original high-dimensional dataset [8]. Selecting only the most discriminative feature spectra helps to process faster by analyzing fewer spectral data, improving accuracy by focusing on key information, and enhancing interpretability through a simpler model. Techniques like filter-based methods (e.g., Relief, Information Gain) leverage data statistics to rank and select relevant spectra [9; 10]. Wrapper-based methods employ learning algorithms to test different feature combinations and select the one leading to the best classification accuracy [7]. Embedded methods, like L1-regularized Support Vector Machines (SVMs), integrate feature selection within the learning process, favoring models with fewer features [11; 12]. Additionally, deep learning-based methods, especially Convolutional Neural Networks (CNNs), show potential by implicit learning feature representations through their convolutional layers, potentially surpassing traditional methods in classification performance [13]. To classify hyperspectral images using relevant feature spectra, [PERSON] developed a hybrid spectral band selection algorithm named Genetic Algorithm (GA)-SVM [11]. This method combines a GA for spectral subset selection with an SVM classifier. The author used the GA to efficiently search important feature spectra in high-dimensional space, while the SVM leveraged these selected spectra for accurate image classification. [PERSON] developed an Improved Grey Wolf Optimizer (IGWO) spectral band selection algorithm for HSI [14]. Unlike traditional feature selection methods that solely focus on maximizing classification accuracy, the developed algorithm incorporates a multi-objective function that additionally prioritizes spectral diversity. An autoencoder is a special type of unsupervised neural network that encodes by finding key aspects of the provided data. [PERSON] developed a Stochastic Gate-based Autoencoder (SGAE) spectral band selection algorithm for HSI [15]. The SGAE incorporated a stochastic gate layer that allowed the model to learn a subset of informative bands during training.