Time series to imaging-based deep learning model for detecting abnormal fluctuation in agriculture product price

In the analysis of agricultural product price time series, the detection of abnormal fluctuations is the primary task. Accurately judging the abnormal fluctuations of agricultural product prices can help farmers avoid potential economic losses in a timely manner and improve the circulation efficiency of agricultural products. This paper introduces a convolutional neural network (CNN) classification model based on time series images (TSI), and identifies abnormal fluctuations in agricultural product prices using improved standard deviation–slope judgment. First, a standard deviation–slope (SDS) time series abnormal fluctuation criterion is proposed. Second, the Markov Transfer Field (MTF) method is used to convert the sparse one-dimensional time series of agricultural product prices into a two-dimensional dense image. Third, the CNN model is used to automatically extract features from time series images containing abnormal fluctuations, and they are divided into two categories: “normal” and “abnormal”; Finally, the performance of the proposed model was evaluated using China’s corn and wheat price dataset. Comparing with other abnormal fluctuation judgment methods, the accuracy of the proposed algorithm is about 20% higher on average. This confirms the applicability of the standard deviation–slope time series Image-Resnet-34 (SDS-TSI-Resnet34) model in practical scenarios. At the end of the paper, some feasible suggestions for the efficient development of agricultural economy are proposed based on the abnormal fluctuation judgment method.


Introduction
Agricultural products are crucial to people's daily life. As a basic price, the price of agricultural products is related to the development of agriculture itself and the stability of B College of Mathematics and Informatics, South China Agricultural University, Guangzhou, China the entire economic order. Abnormal fluctuations in agricultural product prices will have a negative impact on society. For consumers, excessive price increases will place a huge burden on people's food spending. For agricultural producers, significant price fluctuations (Tüysüz and Yldz 2020) can increase production uncertainty and increase unnecessary risks. Therefore, timely prediction and early warning of abnormal fluctuations in agricultural product prices are one of the important issues that governments need to address urgently (Zhao 2020).
The prices of agricultural products are often random because natural disasters, such as droughts, floods, and pests, are highly unpredictable. This leads to considerable risks and uncertainties in the modeling and forecasting process of detecting abnormal price fluctuations, especially in the price changes of major food crops. As food prices are an important component of eradicating hunger, policymakers need to reliably predict expected food prices in order to manage food security. Before liberalization and globalization began, governments began to control food prices, making food price forecasting a low value-added activity (Davenport et al. 2021). But as the world becomes more open, food prices are determined by domestic and international market forces. This can cause price fluctuations to intensify, so reliable price anomaly detection techniques become important.
Corn and wheat, as the main food crops in China, play an important role in China's economic and social development (Zhang et al. 2018). It is not only a major source of fuel power in the industrial sector, but also an important civilian food and has become an important export commodity. Currently, corn, and wheat account for about 70% of China's total grain output and 75% of total grain consumption. In the long run, corn and wheat will still be the backbone of Chinese food. It will occupy an important strategic position in the national economy. In the past few decades, the prices of major grains in China have fluctuated greatly. Especially in recent years, the price fluctuations of corn and wheat have aroused widespread concern in society. As basic foodstuffs, the drastic fluctuations in prices of both will inevitably affect the stability and development of society This article collects data on corn prices in the past 40 years and wheat prices in the past 20 years, and analyzes their abnormal fluctuations. The analysis of corn and wheat price time series in this paper can be divided into three different levels (Mutavdžić et al. 2016): 1. Long-term analysis (with a timeframe of years) 2. Medium-term analysis (with a timeframe of months) 3. Short-term analysis (with a timeframe of weeks) The purpose of this paper is to analyze univariate time series agriculture price data in the third layer (i.e., short-term analysis) to detect abnormal changes in agricultural prices. At present, the most commonly used strategy to deal with massive data is to extract the features of price fluctuations based on expert knowledge. Experts do a lot of empirical research to elicit useful features for a particular context. However, domain experts cannot provide an optimal feature set because the environment can become very complex when the socioeconomic characteristics of price fluctuations (e.g., policies, climate, etc.) are different.
Based on the above issues, inspired by computer vision, the author recombines time series data into images to perform classification tasks more accurately. In this paper, a Markov transfer field is used to transform a one-dimensional agricultural price time series into a two-dimensional image. The generated image has a temporal correlation with a one-dimensional time series. In the classification task, the Resnet-34 network to train time series images was selected, and the softMax classifier to classify them was used. The reasons for choosing a deep learning model in this article are as follows: -Avoid the complicated manual feature selection process and automatically extract time series features.
-Deep learning has a high classification rate for data sets of image types.
This article has made three contributions: (1) The SDS abnormal fluctuation judgment is proposed, which can not only identify abnormal fluctuation points outside the standard deviation, but also identify those inside the standard deviation, improving the accuracy of abnormal fluctuation judgment.
(2) Applying Markov transfer functions to convert onedimensional agricultural product price time series into two-dimensional images, a CNN mechanism was designed to automatically extract descriptive and representative features from time series images. In addition, the new agricultural product price time series does not need to calculate any new abnormal fluctuation standard judgment (standard deviation and slope between a large number of extreme points), but can be directly input into the abnormal fluctuation classifier trained in this article, which greatly saves time and labor costs. (3) SDS-TSI-ResNet34 has better performance compared to the most advanced methods, such as existing shortterm and short-term memory (LSTM), support vector machine (SVM), K-nearest neighbor (KNN), and SD-TSI-ResNet34, under traditional standard deviation judgment standards.
Therefore, in this article, we choose to detect and analyze abnormal fluctuations in agricultural product prices as policy analysis for agricultural development. The rest of the paper is organized as follows: The related methods are described in Sect. 2. The SDS-TSI-Resnet34 model is described in detail in Sect. 3. In Sect. 4, the experimental results are presented and then compare them to show our improvements. Finally, the Sect. 5 gives conclusions. The flow chart of this paper is shown in Fig. 1.

Methods
Abnormal fluctuations can be defined as "such a significant difference from other observations that people suspect that they are caused by different mechanisms", or "patterns in the data do not conform to well-defined concepts of normal behavior.". The main purpose of abnormal fluctuation detection is to identify objects that are significantly different from other data (Lyon 2016;Wang et al. 2019). In recent decades, the research on abnormal fluctuation detection has Fig. 1 The flow chart of this paper attracted widespread attention in the fields of statistical analysis, machine learning, and artificial intelligence Currently, a popular method for detecting abnormal fluctuations in time series is based on dynamic intervention models. Dynamic intervention model is an iterative method that requires iteration between abnormal fluctuation detection and model parameter estimation. Tsay (1988) first proposed the importance of abnormal fluctuations in horizontal displacement and the dynamics that lead to changes in sequence variance. In the same year, Chang and Chen (1988) introduced two new types of abnormal fluctuations based on Tsay, namely additive abnormal values (AO) and innovative abnormal values (IO). Subsequently, Chen and Liu (1993) introduced temporary change (TC) and horizontal displacement (HD) abnormal fluctuations into time series and discussed their roles in modeling and estimating time series parameters. They further demonstrate that the sensitivity of the prediction interval is mainly caused by AO, and discuss the prediction problem when outliers appear near abnormal fluctuations or at the prediction starting point. Battaglia and Orfei (2005) discussed the problem of identifying outlier positions and estimating amplitude in nonlinear time series in their study. Molinares et al. (2009) introduced another semi-parametric estimate of fractional difference parameters in the autoregressive fractional integral moving average (ARIMA) model, which is robust to additive outliers. In their study, Leduca et al. (2011) considered the implementation of self-covariance functions that are robust to additive outliers. Loperfido (2020) discusses a method based on maximum kurtosis for abnormal fluctuation detection in multivariate and univariate time series models. However, the estimation process is based on the assumption that the model parameters are known, which may not always be the case, especially in the case of actual data.
Another common abnormal fluctuation detection method is based on forecasting models (Nguyen et al. 2021;Rong et al. 2019;Mostavi et al. 2020). This method first builds prediction models from historical values, which are then used to predict values. If the difference between the predicted and observed values exceeds a certain threshold, the abnormal fluctuation is displayed. The definition of abnormal fluctuation detection threshold is the main problem of abnormal fluctuation detection based on prediction. The difficulty of abnormal fluctuation detection based on prediction prompted people to propose the abnormal fluctuation detection technology based on similarity measure calculation between subsequences (Li et al. 2019). Keogh et al. (2005) proposed to use a nearest neighbor method to detect the most different subsequences in a long sequence (called inconsistency). Using various methods, such as heuristic reordering of candidate subsequences (Zhan et al. 2021), locally sensitive hashing (Charyyev and Gunes 2020), Haar wavelet (Chakraborty and Nandy 2020), intelligent ordering of subsequence comparisons, can be performed for effective pruning. In 2012, Zhang developed an average method based on time series analysis and geostatistics, and achieved satisfactory detection results in short snapshots (Voort and Havinga 2012). However, if the abnormal fluctuations are closely clustered in the same short time period, they will fail. Therefore, the research in recent years mainly focuses on non-parametric abnormal fluctuation detection methods, such as Bayesian method and discrete wavelet transform (DWT). Frieda proposed a Bayesian method for modeling abnormal fluctuations by applying the component Metropolis-Hastings algorithm (Frieda et al. 2012) to approximate the posterior distribution of model parameters. In addition to the Bayesian method, Graneand and Veiga (2010) identified abnormal fluctuations as observed values in the original sequence based on wavelet transform detail coefficients greater than a certain threshold. They iterate through DWT and abnormal fluctuation correction until all detail coefficients are below the threshold. Based on the financial time series in the real world, their method obtained a lower average false abnormal fluctuation than Bilen and Huzurbazar's Bilen and Huzurbazar (2002).
Abnormal fluctuation detection is also widely used in agricultural product price time series. Lovish Madaan et al. Madaan (2019) evaluated a random forest binary classifier to operate on different feature sets built over a 43-day event window and proposed an anomaly detection model that reduces information asymmetry and finds anomalies that help regulate agricultural markets to operate more fairly. In 2013, Girish K. Jha A and Kanchan Sinha Jha and Sinha (2013) proposed an artificial neural network (ANN) modeling method to predict the abnormal fluctuation of agricultural prices by taking the monthly wholesale price sequence of Soybeans and mustard in India as an example and taking into account the availability of data in developing economies, and proved the feasibility of this technology. In 2020, Yan Ge et al. Ge and Wu (2019) analyzed the changing trend of corn price and the factors affecting corn price, and established univariate nonlinear and multiple linear regression models respectively using data and regression analysis to predict abnormal fluctuations of corn price. Subsequently, XU Shi-Wei et al. (2020) determined the early warning threshold of agricultural production, consumption and price using a variety of statistical methods based on the data of the National Bureau of Statistics and survey data. Combined with Delphi expert judgment modification method, agricultural product information warning thresholds at multiple time points were finally determined, and early warning analysis was conducted on the fluctuation of agricultural product monitoring information in 2018. In 2021, I Vorotnikov et al. (2021) introduced standard deviation in abnormal fluctuation detection of agricultural price time series to improve the reliability of data processing results of dynamic automatic monitoring of time series in agricultural activities.
In recent years, standard deviation is the most commonly used method to judge the abnormal fluctuation of agricultural price time series. However, standard deviation test often has some disadvantages. The reason is that the standard deviation method can only find abnormal fluctuations whose distance from the average value of the time series is beyond the standard deviation area, but cannot find the location where the price time series fluctuates violently within the standard deviation.
Therefore, based on standard deviation, this paper proposes a standard deviation + slope abnormal fluctuation discrimination method. The experimental results show that this method can effectively identify abnormal fluctuation within the standard deviation and improve the accuracy of abnormal fluctuation recognition. Subsequently, the agricultural product price time series is segmented according to a period of 15 days, and each time series is converted into images using MTF, and then input into a CNN model for training to obtain an abnormal fluctuation classifier. When a new agricultural product price time series needs to determine abnormal fluctuations, it can be directly input into our trained classifier.

Proposed model
The block diagram of abnormal fluctuation detection model of agricultural product price in

Data preprocessing
In this paper, the daily data of corn and wheat are used to verify the proposed algorithm. The sampling period of this series is about 15 days (half a month). A non-overlapping window is defined with a length of 15 to segment continuous time series data. This is a well proven method that is often used in the event of abnormal energy consumption. Figure 2, using corn data as an example, shows corn price data segmented in a 15-day window, with the average retained for further processing. At the same time, we divide the segmented time series of corn prices into training sets, verification sets, and test sets in a 6:2:2 ratio.
In this paper, we use the corn price time series to train an abnormal fluctuation detector completely. Due to the similar types of corn and wheat, their price time series can be classified into one category. In this paper, the wheat price time series segmented by a period of 15 days is used as the test data for this trained abnormal fluctuation detection model. This data preprocessing method is similar to migration learning, using corn price data as a database for migration learning. Therefore, when using the abnormal fluctuation detection model trained in this article to determine the abnormal fluctuation of similar agricultural product price time series, there is no need to recalculate the overall standard deviation or manually select the extreme point with large fluctuation to find the slope, reducing workload and improving efficiency.
As can be seen from Fig. 2, the identification of outliers in agricultural prices is not a direct process. For example, it is not possible to set a threshold to classify segmented Windows as normal or abnormal. Meaningful representations are required to extract this information, as described in the next section.

Imaging
In order to obtain the spatial snapshot of time series, we formulated the imaging process by mapping the onedimensional space of time series to the image, as shown in Fig. 3: We get inspiration from Campanharo et al. (2011), time series X determine Q quantile bins, and assign each x i to the corresponding storage unit q i ( j ∈ [1, Q]). Thus, we construct a Q × Q weighted adjacency matrix W by counting transitions among quantile bins in the manner of a first-order Markov chain based on the time axis. w i, j is given by the transition probability of a point in quantile q j is followed by a point in quantile q i .After normalization by j ω i, j = 1 W is the Markov transition matrix. It is irrelevant to the distribution of X and temporal dependency on time steps t i .However, our experimental results on W demonstrate that getting rid of the temporal dependency results in too much information loss in matrix W. In order to overcome this disadvantage, the mathematical formula of Markov transfer field (MTF) is as follows:  Fig. 3 The SS-TSI-Resnet34 algorithm is presented in this paper Fig. 4 Illustration of the proposed encoding map of Markov Transition Fields. X is a sequence of time series in the M3 dataset. X is first discretized into Q quantile bins. In this image, we take Q = 4. Then we calculate its Markov Transition Matrix W and finally build its MTF with Eq. (1) A Q × Q Markov transition matrix is established by dividing the data into Q quantile bins. M i, j in the MTF denotes the transition probability of q i → q j .That is, by considering the time and location, the matrix W is extended to an MTF matrix containing the transition probability on the magnitude axis. By forming the probability of quantiles from time step i to time step j at each pixel M i j , the essence of MTF is the multispan transition probability of coded time series. M i, j|i− j|=k represents the transition probability of two points with time interval k. For example, M i, j|i− j|=1 illustrates the transition process along the time axis with a skip step. The main diagonal M ii , which is a special case when k = 0 captures the probability from each quantile to itself (the self-transition probability) at time step i.To make the image size manageable and computation more efficient, we reduce the MTF size by averaging the pixels in each non-overlapping m × m which is a special case when k = 0 captures the probability from each quantile to itself (the self-transition probability) at time step i. To make the image size manageable and computation more efficient, we reduce the MTF size by averaging the pixels in each non-overlapping 1 m 2 m×m .That is, we aggregate the transition probabilities in each subsequence of length m together. Figure 3 shows the procedure to encode time series to MTF. Figure 4 shows the procedure to encode time series to MTF.

Convolutional neural networks
Convolutional neural networks(CNNs) have made remarkable achievements in image classification (Jiang et al. 2022), natural language processing (Qiu et al. 2020), and reinforce-ment learning (Jiang et al. 2023). For time series forecasting, CNNs can reflect the subtle differences of underlying datasets and customize the corresponding architecture (Dey et al. 2021) and complex data representation (Sanchez-Gonzalez et al. 2020) to reduce the work of manual feature engineering and model design Fig. 5. Basic idea of residual learning He et al. (2016) put forward an improved CNN model for image classification, which is called deep residual network Fig. 6 . The main difference between residual network and traditional CNN is that they have different network structures and information transmission modes, as shown in Fig. 7. For the traditional CNN model, the input layer, convolution layer, pooling layer and output layer are combined in a cascade manner. But for the rest of the network, it has a shortcut that connects input and output directly together. Mathematically speaking, different from the direct approximation of basic function H (x), residual learning emphasizes the fitting of The special mapping of residual network block is F(x) + x, which is the output of a traditional CNN, namely H (x). However, as He et al. pointed, compared with the original mapping H (x), the fitting residual mapping F(x) is more effective, especially when H (x) is an identity or approximate identity mapping. The characteristics of the residual network will increase the depth greatly, but will not reduce the classification accuracy of the network.

Baseline algorithm
This article uses the control variable method to conduct comparative experiments, applying three benchmark comparison models under the same abnormal fluctuation evaluation criteria, namely, support vector machine (

Datasets
The experiments are performed over the agricultural future product price time series datasets. The datasets include corn daily price data for nearly four decades from 1980 to 2020 and wheat daily price data for nearly two decades from 2000 to 2020. As we can see in Tables 1, 2.

Abnormal fluctuation judgment
This paper improves the original abnormal fluctuation judgment criterion of agricultural price time series. The algorithm combines the original standard deviation with the abnormal fluctuation criterion based on the highest slope. The original standard deviation method calculates the standard score is  also called the Z score which can reflect the relative position of the detection points in the overall distribution. Normalized values reflect the relative distance between the first I variable value and the average value of the sample. Let z for the relative standard distance of the mean value and the detection point, x as the detection point, σ as the standard deviation, then z scores can be expressed as Among the formula,σ = 0 and μ = E(x), so the arithmetic mean can be expressed as The variance can be expressed as σ 2 = V ar(x), and so the standard deviation can be expressed as If the standard value is 1, it means that the value of the ith sampling point is equal to the value of the standard deviation. If the normalized value is 2, then the value representing the ith sample point is twice the standard deviation value, i.e., the relative distance between the ith sample and the sample standard deviation is 2. According to the Pauta criterion, abnormal data is the mean and the distance between the mean is three times the standard deviation of the sample. Elevation anomaly data are those in which the distance between sample mean and standard deviation is greater than three times. However, in the practical application of time series of agricultural prices, whether the data should be deleted depends on the actual situation (Zhou et al. 2015). Standard deviation is used to judge abnormal fluctuations from the price time series as a whole, and the price point whose distance from the average value is greater than standard deviation is defined as outliers. One drawback of this approach is that it is impossible to judge the sharp fluctuation points within the standard deviation, as shown in the Fig. 6.
The judgment criterion for outliers based on the highest slope belongs to statistical data determined outliers (Boukerche et al. 2020), and usually the number of outliers does not exceed 5% of the total data. The highest slope-based outlier criterion can be selected based on the outlier factor distribution of all data in the data set, without the number of outliers or any other parameter. In order to verify the feasibility of outlier judgment based on the highest slope, a small data set containing three dispersed outliers and a normal cluster was created in Dai et al. (2020). The results show that the criterion can adapt to the changing data flow, and the criterion based on the highest slope of outliers provides a novel method for accurately determining abnormal fluctuations.
Therefore, slope k is added in this paper on the basis of the standard deviation, so that the outliers with violent fluctuations inside the threshold can be judged. In this paper, about 40 extreme points are selected to calculate the absolute value of slopes of two adjacent extreme points, and the minimum, average and maximum values of the slopes of the 20 extreme points are taken as the thresholds of the algorithm in this paper. If k > k 0 (k 0 represents the maximum, average or minimum value of the slope of the extreme point), it is selected as outlier point. That is, the abnormal value judgment criterion proposed in this paper needs to meet one of two conditions: We calculate the slope between two adjacent extreme points(the difference of Price /the difference of time) and select the three most representative k0, which are maximum, minimum and average. Therefore, the threshold k0 can be taken k max = 28.3, k ave = 21.1, k min = 18.3. Since the method of judging abnormal fluctuation based on slope is applied to the time series of agricultural prices for the first time, this paper carries out experiments on three different k 0 and compares the results. Therefore, slope k is added in this paper on the basis of standard deviation, so that the outliers with violent fluctuations inside the threshold can be judged. We choose the k 0 = k ave for example, The improved abnormal fluctuation evaluation criteria are shown in Fig. 7. Figure 8 shows the time series images of corn prices generated by two different abnormal fluctuation judgment methods. On the left is a time series image of agricultural product prices labeled "abnormal" under the standard deviation-slope abnormal fluctuation index proposed in this article. On the right is a time series image of agricultural product prices labeled "abnormal" under the standard deviation evaluation index. The image on the left has a clearer outline and clearer boundary than the image on the right. The clear outline indicates that the image on the left has richer and more specific features, which is helpful for judging abnormal Fig. 8 The image of corn s price time series generated by two different abnormal fluctuationr judgment methods(The left is the SDS-TSI proposed in this paper, and the right is the original SD-TSI) fluctuations in the classifier. It can be seen that the time series images generated under the judgment of abnormal fluctuations in the standard deviation-slope are more suitable for the training and classification of deep convolutional neural networks.
IIn this paper, the judgment criterion for abnormal fluctuations of price time series images every 15 days is that there are abnormal fluctuations within 15 days, that is, the time series images are abnormal, otherwise they are normal.

Performance measures
Evaluating the model has entailed using three standard metrics Precision, Recall, and F1 score are applied as performance measures. In anomaly detection system, high Precision and high Recall are desired to build a good system. In such a situation, F-measure is used to give an equal importance to precision and recall.

Parameter setting
In our experiment, we used Python 3.7 and Matlab 2018b. The size of four kinds of single pictures is 32 × 32, The parameters for pre-trained CNN models are set as follows: Both input layers contain 32 feature maps, 3×3 Convolution (32×3×3), MaxPooling size is 2×2, Dropout=0.25. The fully connected neural layer contains 128 hidden neurons and c output neurons, with a Dropout of 0.5. Output size of pretrained resnet-34 is 512. The learning rate is 0.001, the batch size is 16, and the epoch is 50. This experiment uses the "category cross entropy" loss function of the "Adam" optimizer. Since finding the optimal CNN parameters is still an open issue, this chapter follows a rule of thumb to select the parameters.

Results analysis
Through the analysis of the results, we can draw the following conclusions: 1. The Precision, Recall, and F1 Score of abnormal fluctuation detection under three slope judgment criteria are compared in this paper. As can be seen from Tables 2, 3, 4 when the slope threshold k 0 = k ave , the result are the best. The reason may be that when the slope is set to the maximum value k max , a large number of qualified abnormal fluctuations will be discarded without reaching the threshold value kmax, resulting in the loss of abnormal fluctuations, thus reducing the number of abnormal fluctuation data sets and causing the emergence of deep learning overfitting. On the contrary, when the slope is k min , a large number of non-abnormal fluctuations that do not meet the conditions will be included in the abnormal fluctuation data set, resulting in confusion of classification labels, thus reducing the accuracy of abnormal fluctuation classification by deep learning. Table 2, in the time series of corn price, the precision of SDS-TSI-Resnet34 method is 0.0096 higher than that of SD-TSI-Resnet34, as we can see in Fig . 19. F1 score and Recall of SDS-TSI-Resnet34 are also 0.0271 and 0.0486 higher than SD-TSI-Resnet34, respectively. At the same time, the experimental results show that the SDS-TSI-Resnet34 methods have been  The results show that the error rate of SDS-TSI-Resnet34 proposed in this paper is significantly lower than that of other methods, which proves the effectiveness of this algorithm. 3. As shown in Table 5, the SDS-TSI-Resnet34 algorithm proposed in this paper still has a good result on the time series of where price, which is greatly improved compared with baseline algorithms. Therefore, the SDS-TSI-Resnet34 algorithm proposed in this paper has strong generalization ability and can be widely used to judge the abnormal fluctuation of the most of time series of agricultural prices. In the same way, Figs. 14,15,16,17,18 show the accuracy of SDS-TSI-Resnet34 judgment in wheat price time series, and the results also prove the point of this paper. 4. The contrast Tables 2 and 5, we found that the same algorithms used in wheat price time series are better than that of corn price time series, the reason may lie in nearly 20 years of domestic agricultural policy is relatively stable, the state of wheat prices of important agricultural and sideline products such as the reasonable intervention, resulting in abnormal volatility is reduced, more conducive to demonstrate the superiority of the algorithm.

SDS-TSI-Res SD-TSI-Res SDS-TSI-SVM SDS-LSTM SDS-KNN
The practical guiding significance of the agricultural product price abnormal fluctuation detection algorithm proposed in this paper is as follows: 1. Strengthen agro-business cooperation and reduce circulation links. It is suggested that the government takes the lead and establish sales channels from production to purchase, wholesale, and retail. According to the algorithm, to judge the outliers and abnormal fluctuations of agricultural prices to make a reasonable production planning, it effectively avoids the problem of oversupply, which is conducive to the stability of agricultural prices to a certain extent. 2. Strengthen monitoring and early warning of agricultural prices. The algorithm proposed in this paper can help relevant departments strengthen the monitoring of agricultural product prices, improve the timeliness of detection, carefully analyze the market price dynamics, accurately analyze the market price trend, be impatient, do a good job in market price analysis and early warning, and provide basic data and information services for the scientific decision-making of the government.

Conclusion
Timely control of agricultural product price fluctuations is an important indicator related to the national economy and people's livelihood. This paper proposes a CNN model based on the standard deviation-slope criterion for abnormal fluctuations (SDS-TSI-CNN). The advantages of this model lie in two aspects: The first point is to add a slope criterion to the original standard deviation, which can identify the location of abnormal fluctuations within the standard deviation and improve the accuracy of anomaly detection. The second point is that this method combines time series image method and deep learning model to automatically extract features from the time series of agricultural product prices and detect abnormal fluctuations. Experiments were conducted on two agricultural price datasets, and good results were obtained, demonstrating the applicability of the SDS-TSI-Resnet34 model. In the experimental results, our method obtained an average F1 score of about 90%, which is higher than the average F1 score of other methods by 25 In future work, the author mainly has two perspectives: 1. Utilize other imaging methods for time series images, and conduct experiments using the SDS-TSI-CNN model, and explore the relationship between different time series imaging methods. 2. Optimize the CNN model, try to use more CNN models with different depths and structures as classifiers, and use more data sets to verify the generalization ability of the algorithm.

Declarations
Conflict of interest All authors declare that they have no conflict of interest.
Ethical approval This article does not contain any studies with human participants or animals performed by any of the authors.