Near infrared (NIR) spectroscopy is sensitive to physical conditions such as sample temperature, meaning that rapid detection methods based on NIR spectroscopy are significantly influenced by temperature. To address this challenge, symbolic regression was employed to mitigate the effects of temperature. The Weighted Windowed Adaptive Optimization algorithm was proposed and combined with the Sequential Projection Algorithm to extract temperature-related feature points and remove redundant data. Subsequent 3D modeling of these feature points revealed that absorbance alterations due to temperature comprised two distinct segments. Consequently, based on symbolic regression, the temperature standardization algorithm was devised to generate piecewise equations. This algorithm surpassed genetic programming and non-segmented methods in performance metrics. The piecewise function equations generated by the algorithm were used to regress the absorbance at different temperatures to the standard temperature. Non-dairy cream, with different indigo pigment contents, was temperature standardized using a piecewise function to obtain spectra at two standard temperatures; 18°C and 28°C. The r2 for the quantitative regression model improved from 0.71 to 0.95 at 18°C and from 0.63 to 0.85 at 28°C. The temperature standardization method offers interpretable equations for spectra that model the complex changes with temperature, factoring out the temperature variation, thereby facilitating the practical use of NIR spectroscopy in rapid detection applications.