Among the coded aperture compressed spectral imaging reconstruction algorithms, the end-to-end reconstruction method is a straightforward and effective reconstruction method. However, the presence of a large number of identical pixel points in the measured image, mapped to different a priori spectral information, makes the end-to-end reconstruction algorithm difficult to solve accurately. In order to enhance the mapping characterization of pixel information in the end-to-end reconstruction process and improve the reconstruction quality, we propose a model optimization solving method for encoding feature vector enhancement. Using the wavelength and position of each pixel in the a priori spectral image, we design the computational rules of coded information by nonlinear functions, label each pixel point in the measured image separately, and perform vectorization to enhance the semantic representation among pixel information. The labeled data is used as the feature set and the a priori spectral information is used as the label set, and the end-to-end compressed spectral reconstruction model is established by the random forest algorithm. The simulation experiments of hyperspectral images of multiple scenes show that the scalar features of the measured images are transformed into vector features by adding wavelength and pixel location information encoding, which effectively enhances the feature representation of each pixel point; the proposed encoded reconstruction method obtains better reconstruction quality and shows superior algorithmic performance compared with traditional reconstruction methods and depth image a priori reconstruction methods.