Time sequence data automatic labeling method and system based on target detection
Through the improved Yolov5 network structure and Focal-EIOU loss function, the efficiency and accuracy problems in stock timing data management are solved, efficient automatic labeling and storage are achieved, and the data management capabilities of financial institutions are improved.
Patent Information
- Application Number
- CN202510486620.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-17
- Publication Date
- 2025-07-18
AI Technical Summary
In the stock timing data management, the existing technology has problems such as low data storage and retrieval efficiency, high manual labeling costs and insufficient accuracy, high risk of security vulnerabilities in semi-automated tools, and poor adaptability of pre-trained models.
Using the Yolov5 network structure improved based on the attention mechanism, by constructing a time series data set and an improved Focal-EIOU loss function, automatic labeling of stock time series data is realized, box features are identified and high-quality labeling results are generated.
It improves the accuracy and efficiency of stock timing data identification, realizes efficient classification and storage, reduces manual intervention and security risks, and improves the data management capabilities of financial institutions.
Smart Images

Figure CN120336820A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of time series data analysis, and particularly to an automatic annotation method and system for time series data based on object detection. Background Art
[0002] With the development of the financial market and the promotion of digital transformation, financial institutions have accumulated a large amount of stock time series data, including not only basic information such as historical prices and trading volumes of stocks, but also multi-dimensional contents such as company financial statements, industry dynamics, and macroeconomic data. Therefore, how to effectively manage these stock time series data plays a crucial role in monitoring the occurrence of market abnormal behaviors, academic research in the economic field, and corporate credit assessment. However, in the face of such a huge and complex data volume, traditional data management methods often have problems of low storage and retrieval efficiency of data, making it difficult to meet the rapidly changing market demands.
[0003] For the management and analysis of stock time series data, the importance of data annotation technology has become increasingly prominent. By annotating stock time series data and classifying the complex stock time series data into a structured form according to the annotated box features, including price features, time features, and trading volume features, etc., the stock time series data can be classified and stored, realizing the efficient management and rapid retrieval of stock time series data, and improving the service efficiency of financial institutions.
[0004] Manual annotation is a traditional data annotation method, where professional annotators classify, label, and annotate stock time series data. Although manual annotation can ensure high accuracy, it has low efficiency and high costs. Semi-automated tools that combine artificial intelligence and manual annotation have been widely used in the data annotation field. The data is initially annotated by a pre-trained machine learning model and then corrected and optimized by humans. However, this method still has certain limitations. For example, there are still certain errors in the annotation results of artificial intelligence, especially in complex scenarios or edge cases, which require a large amount of manual correction; and there may be security vulnerabilities in the data transmission and storage processes of semi-automated tools, resulting in the risk of data leakage. The automated annotation technology based on deep learning directly annotates stock time series data, reducing human intervention. For example, using a pre-trained semantic segmentation model to classify and label stock time series data can quickly generate high-quality annotation results; but semantic segmentation models usually require a large amount of annotated data for training, and the box features of stock time series data, such as prices, trading volumes, and time series, are quite different from the features of traditional image segmentation tasks. The pre-trained model may be difficult to directly adapt to the complexity and dynamics of stock time series data, resulting in inaccurate annotation results. Summary of the Invention
[0005] Aiming at the deficiencies of the above-mentioned existing technologies, the present invention improves the Yolov5 model based on the combined attention mechanism algorithm, and proposes an automatic annotation method and system for time series data based on object detection, aiming to efficiently identify the box features of stock time series data, improve the accuracy of model annotation, and then use the annotated box features to achieve efficient classification and storage of stock time series data, so as to effectively manage a large amount of stock time series data by financial institutions.
[0006] In the first aspect of the present invention, an automatic annotation method for time series data based on object detection is proposed, and this method includes the following processes:
[0007] Obtain stock time series data, and construct a time series data set by processing the stock time series data;
[0008] Construct a data annotation model based on the improved Yolov5 network structure;
[0009] Use the time series data set to train, validate and test the data annotation model based on the improved Yolov5 network structure, and obtain a trained data annotation model based on the improved Yolov5 network structure;
[0010] Obtain the stock time series data to be marked, perform data cleaning and format conversion, and input the stock time series data after format conversion into the trained data annotation model based on the improved Yolov5 network structure to obtain a K-line chart containing all K-line entity prediction bounding boxes;
[0011] Generate and mark the box features of each K-line entity according to the K-line chart containing all K-line entity prediction bounding boxes, so as to convert the K-line chart containing all K-line entity prediction bounding boxes into stock time series data with box feature annotations of K-line entities.
[0012] Further, the specific content of constructing the time series data set by processing the stock time series data is as follows:
[0013] Perform data cleaning on the obtained stock time series data, including removing missing values, outlier processing and normalization, to obtain the cleaned stock time series data, convert the cleaned stock time series data into the K-line chart format, mark the bounding boxes of each K-line entity in the obtained K-line chart, and generate the labels of each bounding box at the same time; then use the marked K-line chart to construct a stock time series data set; divide the stock time series data set into a training set, a validation set and a test set according to a predetermined ratio.
[0014] Further, the specific content of marking the bounding boxes of each K-line entity in the obtained K-line chart is as follows:
[0015] Measure and record the geometric features of a candlestick chart containing several candlestick entities, including: the origin pixel coordinates, the pixel interval between the origin pixel and the first candlestick entity, the width of the candlestick entity, and the interval between adjacent candlestick entities;
[0016] Measure and record the geometric features of a candlestick chart with a number of candlestick entities that is a multiple of ten, and use the method of linear interpolation to obtain the geometric features of a candlestick chart with a number of candlestick entities that is not a multiple of ten;
[0017] Initialize the pixel interval between the origin pixel and the first candlestick entity, the width of the candlestick entity, and the interval between adjacent candlestick entities in the candlestick chart;
[0018] Based on the pixel interval between the origin pixel and the first candlestick entity, the width of the candlestick entity, and the interval between adjacent candlestick entities in the initialized candlestick chart, calculate the bounding box of each candlestick entity in the candlestick chart.
[0019] Furthermore, the label of each bounding box is used to represent the box characteristics of the candlestick entity corresponding to the bounding box;
[0020] The box characteristics include: price characteristics, time characteristics, trading volume characteristics, and trend characteristics; among which the price characteristics include: opening price, closing price, highest price, and lowest price; the time characteristics include: trading date and timestamp; the trading volume characteristics include: trading volume and turnover; the trend characteristics include: upward trend, downward trend, and oscillating trend;
[0021] The label of the bounding box includes: the upper boundary of the bounding box, the lower boundary of the bounding box, the center point coordinates of the bounding box, the width of the bounding box, the boundary of the candlestick entity, and the category of the bounding box; among which the upper boundary of the bounding box is used to represent the highest price; the lower boundary of the bounding box is used to represent the lowest price; the center point coordinates of the bounding box are used to represent the position of the candlestick entity in the candlestick chart; the width of the bounding box is used to represent the time characteristics; the boundary of the candlestick entity is used to represent the opening price and the closing price; the category of the bounding box is used to represent the trend characteristics.
[0022] Furthermore, the construction method of the data annotation model based on the improved Yolov5 network structure is as follows: The Yolov5 network structure uses CSPDarknet53 as the backbone network, and improves the Yolov5 network structure by replacing the C3 module in CSPDarknet53 with the C3CBAM module to obtain the improved Yolov5 network structure;
[0023] The improved Yolov5 network structure includes: an improved Backbone layer, Neck layer, and Head layer;
[0024] The improved Backbone layer is used to extract features from the input K-line chart and input the extracted feature map into the Neck layer; the improved Backbone layer includes, connected in sequence: an input layer, an initial convolutional layer, and four convolutional blocks; the four convolutional blocks are each composed of a convolutional layer and a C3CBAM module;
[0025] The Neck layer uses FPN to perform multi-scale feature extraction and feature fusion on the feature map output by the improved Backbone layer, obtains a multi-scale feature map and transmits it to the Head layer;
[0026] The Head layer is used to perform object detection based on the multi-scale feature map, and uses the method of bounding box regression to adjust the obtained object detection results, and outputs the predicted bounding boxes of each K-line entity in the K-line chart, the category of each predicted bounding box, and the confidence of each predicted bounding box;
[0027] The loss function of the improved Yolov5 network structure is the improved Focal-EIOU loss function;
[0028] An improved Yolov5 network structure and a post-processing module are used to construct a data annotation model based on the improved Yolov5 network structure;
[0029] The post-processing module is used to screen all the predicted bounding boxes output by the improved Yolov5 network structure to generate a K-line chart containing the predicted bounding boxes of all K-line entities.
[0030] Further, the C3CBAM module is an improved module that introduces the CBAM attention mechanism into the C3 module, and specifically includes: a main branch, a residual branch, a splicing layer, and an output layer;
[0031] The main branch is used to perform multi-layer feature extraction on the input feature map and refine the processed feature map to obtain a main branch feature map;
[0032] The residual branch is used to perform a single convolutional process on the input feature map to obtain a residual branch feature map;
[0033] The splicing layer is used to splice the main branch feature map and the residual branch feature map in the channel dimension to obtain a spliced feature map;
[0034] The output layer is used to restore the spliced feature map to the original number of channels through convolutional operations.
[0035] Further, the main branch includes, in series: a first convolutional block, a second convolutional block, a third convolutional block, and a CBAM module; wherein the first convolutional block, the second convolutional block, and the third convolutional block are used to perform multi-layer feature extraction on the input feature map in sequence, and input the feature map extracted by the third convolutional block into the CBAM module; the CBAM module is used to refine the input feature map through a channel attention mechanism and a spatial attention mechanism to generate a main branch feature map;
[0036] The CBAM module includes: a feature input layer, a channel attention sub-module, a spatial attention sub-module, and a feature output layer;
[0037] The feature input layer receives the feature map output from the third convolutional block as the original input feature of the CBAM module;
[0038] The channel attention sub-module respectively calculates the global average pooling feature and the global maximum pooling feature of the original input feature, then uses a fully connected layer to process the obtained global average pooling feature and global maximum pooling feature to generate a channel attention feature map, uses a Sigmoid activation function to generate a channel attention weight, and multiplies the channel attention feature map by the original input feature using the channel attention weight to obtain a channel attention weighted feature map;
[0039] The spatial attention sub-module respectively calculates the average pooling feature and the maximum pooling feature of the channel attention weighted feature map, concatenates the obtained average pooling feature and maximum pooling feature along the channel dimension, then uses a convolutional layer to process the concatenated feature to generate a spatial attention feature map, uses a Sigmoid activation function to generate a spatial attention weight, and multiplies the spatial attention feature map by the original input feature using the spatial attention weight to obtain a spatial attention weighted feature map;
[0040] The feature output layer outputs the spatial attention weighted feature map as the main branch feature map.
[0041] Further, the specific content of screening all the predicted bounding boxes output by the improved Yolov5 network structure is as follows:
[0042] Sort all the predicted bounding boxes output by the improved Yolov5 network structure in descending order of confidence to generate a candidate list of predicted bounding boxes, and sequentially traverse all the predicted bounding boxes according to the arrangement order of the candidate list;
[0043] The process of each traversal is as follows: Use the predicted bounding box being traversed as the reference box, calculate the intersection over union (IoU) between the reference box and other predicted bounding boxes respectively, and compare it with a preset confidence threshold. If the IoU between the reference box and a certain predicted bounding box exceeds the confidence threshold, it is considered that the predicted bounding box overlaps with the reference box, and the reference box is deleted; otherwise, the reference box is retained. After completing all traversal processes, the filtered predicted bounding boxes are obtained.
[0044] Then, use the filtered predicted bounding boxes to generate a K-line chart containing all the predicted bounding boxes of K-line entities.
[0045] Furthermore, the specific content of training, validating, and testing the data annotation model based on the improved Yolov5 network structure using the time series dataset is as follows:
[0046] Input the training set into the improved Yolov5 network structure to obtain predicted bounding boxes, calculate the IoU between the labeled bounding boxes and the predicted bounding boxes in the training set, and then calculate the EIOU loss using the calculated IoU.
[0047] Calculate the Focal L1 Loss using the labeled bounding boxes and the predicted bounding boxes in the training set.
[0048] Construct an improved Focal-EIOU loss function using the EIOU loss and the Focal L1 Loss, expressed as:
[0049]
[0050] where Loss Focal-EIOU represents the improved Focal-EIOU loss function; IOU represents the intersection over union; ρ represents the smoothing parameter; (b, b gt ) represents the distance between the center point coordinates of the predicted bounding box and the center point coordinates of the labeled bounding box; (w, w gt ) represents the difference between the width of the predicted bounding box and the width of the labeled bounding box; (h, h gt ) represents the difference between the height of the predicted bounding box and the height of the labeled bounding box; c, c w and c h are all normalization constants; γ represents the focusing parameter.
[0051] Calculate the difference between the labeled bounding boxes and the predicted bounding boxes in the training set using the improved Focal-EIOU loss function, and update the gradient of the improved Yolov5 network structure according to the calculated difference. Iteratively train the improved Yolov5 network structure by minimizing the improved Focal-EIOU loss function to obtain the trained improved Yolov5 network structure.
[0052] The hyperparameters of the trained improved Yolov5 network structure are adjusted using the validation set to obtain the verified improved Yolov5 network structure;
[0053] The verified improved Yolov5 network structure and the post-processing module are combined and evaluated using the test set to obtain the trained data annotation model based on the improved Yolov5 network structure.
[0054] In the second aspect of the present invention, a time-series data automatic annotation system based on object detection is proposed for implementing the above-mentioned time-series data automatic annotation method based on object detection. The system includes: a data acquisition module, a data processing module, a data annotation module, and a data conversion module;
[0055] The data acquisition module is used to acquire stock time-series data and transmit it to the data processing module;
[0056] The data processing module is used to clean the stock time-series data, convert the cleaned stock time-series data into the K-line chart format, obtain a K-line chart containing several K-line entities, and transmit it to the data annotation module;
[0057] The data annotation module is used to input the received K-line chart containing several K-line entities into the data annotation model based on the improved Yolov5 network structure for automatic annotation, and transmit the K-line chart containing the predicted bounding boxes of all K-line entities to the data conversion module;
[0058] The data conversion module is used to generate the box features of each K-line entity according to the K-line chart containing the predicted bounding boxes of all K-line entities and perform marking, and then convert the K-line chart containing the predicted bounding boxes of all K-line entities into stock time-series data marked with the box features of the K-line entities.
[0059] The beneficial effects produced by adopting the above technical solutions are as follows:
[0060] The method of the present invention combines the object detection technology with the attention mechanism, improves the existing Yolov5 network structure by introducing the attention mechanism, constructs a data annotation model based on the improved Yolov5 network structure, enables the model to pay more attention to the key box features of the stock time-series data, thereby improving the recognition accuracy and efficiency. At the same time, the method of the present invention uses the improved Focal-EIOU loss function to optimize the data annotation model based on the improved Yolov5 network structure, and improves the training efficiency of the model.
[0061] Financial institutions can use the method of the present invention to assist or directly annotate the box features of stock time-series data, and then classify and store the stock time-series data efficiently according to the annotated box features to achieve fast retrieval of data and improve the service quality of financial institutions. Brief Description of the Drawings
[0062] Figure 1 is a flowchart of an automatic annotation method for time-series data based on object detection in this embodiment;
[0063] Figure 2 is a schematic diagram of a time-series data annotation model based on an improved Yolov5 network structure in this embodiment;
[0064] Figure 3 is a structural diagram of the C3CBAM module in this embodiment;
[0065] Figure 4 is a schematic diagram of the CBAM attention mechanism in this embodiment;
[0066] Figure 5 is a schematic diagram of the spatial attention module in the CBAM module in this embodiment;
[0067] Figure 6 is a structural diagram of an automatic annotation system for time-series data based on object detection in this embodiment. Detailed Embodiment
[0068] To facilitate the understanding of this application, the following further describes in detail the specific embodiments of the present invention in conjunction with the drawings and embodiments. The following embodiments are used to illustrate the present invention, but are not used to limit the scope of the present invention. On the contrary, the purpose of providing these embodiments is to make the disclosure content of this application more thoroughly and comprehensively understood.
[0069] An automatic annotation method for time-series data based on object detection in this embodiment, as Figure 1 shown, the method includes the following processes:
[0070] Obtain stock time-series data, and construct a time-series data set by processing the stock time-series data.
[0071] The specific content of constructing the time-series data set by processing the stock time-series data is:
[0072] Perform data cleaning on the obtained stock time-series data, including removing missing values, outlier processing, and normalization, to obtain the cleaned stock time-series data. Convert the cleaned stock time-series data into the K-line chart format, and mark the bounding boxes of each K-line entity in the obtained K-line chart. At the same time, use the manual marking method to generate the labels of each bounding box; then use the marked K-line chart to construct a stock time-series data set; divide the stock time-series data set into a training set, a validation set, and a test set according to a predetermined ratio.
[0073] In this embodiment, historical time series data of a specific stock is collected from a stock exchange or a financial data provider. Then, data cleaning techniques are used for preprocessing, including removing missing values, handling outliers, and normalization. After that, the preprocessed stock time series data is uniformly converted into a customized K-line chart format to prepare for subsequent feature extraction and model training. Box features are annotated on the K-line chart, and these annotations will serve as the supervision signals for model training. The K-line charts containing bounding boxes and bounding box labels are divided into three parts: a training set, a validation set, and a test set.
[0074] The specific content of marking the bounding box of each K-line entity in the obtained K-line chart is as follows:
[0075] Manually measure and record the geometric features of a K-line chart containing several K-line entities, including: the origin pixel coordinates, the pixel interval between the origin pixel and the first K-line entity, the width of the K-line entity, and the interval between adjacent K-line entities.
[0076] In this embodiment, manually measure and record the geometric features of K-line charts containing different numbers of K-line entities, including the origin pixel coordinates originPixel, the pixel interval blank between the origin pixel and the first K-line entity, the width width of the K-line entity, and the interval spacing between K-line entities.
[0077] Manually measure and record the geometric features of K-line charts with the number of K-line entities being multiples of ten, and use the method of linear interpolation to obtain the geometric features of K-line charts with the number of K-line entities not being multiples of ten.
[0078] In this embodiment, record the geometric features of K-line charts with the number of K-line entities being multiples of ten, and obtain the geometric features of K-line charts with the number of K-line entities not being multiples of ten through linear interpolation, aiming to ensure that complete geometric feature data can be obtained for any number of K-line entities.
[0079] Initialize the pixel interval between the origin pixel and the first K-line entity, the width of the K-line entity, and the interval between adjacent K-line entities in the K-line chart.
[0080] In this embodiment, initialize three variables: the size of the blank area, i.e., the pixel interval blank between the origin and the first K-line entity, the width of each cell, i.e., the width width of the K-line entity, and the spacing between cells, i.e., the interval spacing between K-line entities.
[0081] Based on the pixel interval between the origin pixel and the first K-line entity, the width of the K-line entity, and the interval between adjacent K-line entities in the initialized K-line chart, calculate the bounding box of each K-line entity in the K-line chart.
[0082] In this embodiment, by looping through all the K-line entities in the K-line chart from 0 to nums - 1 and calculating the left boundary left and right boundary right of each K-line entity, the bounding box of each K-line entity is generated.
[0083] The specific content of calculating the bounding box of each K-line entity in the K-line chart is as follows:
[0084] Establish an index from 1 to nums for several K-line entities in the K-line chart, where nums represents the number of K-line entities.
[0085] For any pixel in the K-line chart, if the lateral parameter value of the pixel is left, it means that the pixel is the left boundary of a certain K-line entity; if the lateral parameter value of the pixel is right, it means that the pixel is the right boundary of a certain K-line entity; if the pixel belongs to neither the left boundary nor the right boundary of a certain K-line entity, the pixel is ignored.
[0086] When the pixel is the left boundary of a certain K-line entity, obtain the interval pixels between the pixel and the origin pixel. If the interval pixel is equal to the interval pixel between the initialized origin pixel and the first K-line entity, it means that the pixel is the left boundary of the first K-line entity; if not, define a variable i to represent the i-th K-line entity in the K-line chart, and i is a positive integer within the interval (1, nums), and calculate the left boundary of the i-th K-line entity. By comparing the coordinates of the pixel with the left boundary of the i-th K-line entity, determine the K-line entity to which the pixel belongs.
[0087] The left boundary of the i-th K-line entity is expressed as:
[0088] left_boundary_i = originPixel + blank + i * (width + spacing)(1)
[0089] Where left_boundary_i represents the left boundary coordinates of the i-th K-line entity; originPixel represents the origin pixel coordinates; blank represents the interval pixel between the initialized origin pixel and the first K-line entity; width represents the initialized K-line entity width; spacing represents the interval between the initialized adjacent K-line entities.
[0090] In this embodiment, if the lateral parameter is "left", special processing is performed when the pixel is on the left edge. First, check whether the pixel is within the leftmost boundary. If so, return 1. Then, for nums - 1 iterations, calculate the new boundaries of each K-line entity and check whether the pixel is within these boundaries. If so, return i + 2.
[0091] When the pixel is the right boundary of a certain K-line entity, obtain the interval pixels between this pixel and the origin pixel. If the interval pixels are equal to the sum of the interval pixels between the initialized origin pixel and the first K-line entity and the initialized K-line entity width, it indicates that this pixel is the right boundary of the first K-line entity; if not, define a variable i to represent the i-th K-line entity in the K-line chart, and i is a positive integer within the interval (1, nums), and calculate the right boundary of the i-th K-line entity. By comparing the coordinates of this pixel with the right boundary of the i-th K-line entity, determine the K-line entity to which this pixel belongs.
[0092] The right boundary of the i-th K-line entity is expressed as:
[0093]
[0094] where represents the right boundary coordinates of the i-th K-line entity.
[0095] In this embodiment, if the lateral parameter is "right", special processing is performed when the pixel is located at the right edge. Traverse the cells, calculate the right boundary of each cell, and check if the pixel is within these boundaries. If so, return i + 1. For pixels outside the rightmost boundary, if the pixel value is greater than or equal to the right boundary of the last cell, return i + 1.
[0096] In this embodiment, if the pixel is neither at the left edge nor at the right edge and does not meet the previous conditions, the function will return -1, indicating that the pixel is not within any bounding box, thus ending the execution of the function.
[0097] Traverse all the pixels in the K-line chart to identify the left and right boundaries of all the K-line entities in the K-line chart, thereby generating the bounding box of each K-line entity.
[0098] The label of each bounding box is used to represent the box characteristics of the K-line entity corresponding to this bounding box.
[0099] The box characteristics include: price characteristics, time characteristics, trading volume characteristics, and trend characteristics; where the price characteristics include: opening price, closing price, highest price, and lowest price; the time characteristics include: trading date and timestamp; the trading volume characteristics include: trading volume and turnover; the trend characteristics include: upward trend, downward trend, and oscillating trend.
[0100] The labels of the bounding box include: the upper boundary of the bounding box, the lower boundary of the bounding box, the coordinates of the center point of the bounding box, the width of the bounding box, the boundary of the K-line entity, and the category of the bounding box; wherein the upper boundary of the bounding box is used to represent the highest price; the lower boundary of the bounding box is used to represent the lowest price; the coordinates of the center point of the bounding box are used to represent the position of the K-line entity in the K-line chart; the width of the bounding box is used to represent the time feature; the boundary of the K-line entity is used to represent the opening price and the closing price; the category of the bounding box is used to represent the trend feature.
[0101] In this embodiment, an upward trend is usually that the closing price is higher than the opening price; a downward trend is usually that the closing price is lower than the opening price; a volatile trend is usually that the closing price is close to the opening price and the price fluctuation range is limited.
[0102] Construct a data annotation model based on the improved Yolov5 network structure.
[0103] In this embodiment, as Figure 2 shown, the data annotation model based on the improved Yolov5 network structure is mainly divided into two processes: training and detection. In the training process, the stock time series data is first uniformly transformed to generate the corresponding K-line chart, and the improved Yolov5 network structure is used for training. The Backbone layer containing the C3CBAM module is used for feature extraction, and the data is further processed through the neck structure and the head structure. After that, the improved Focal-EIOU is used as the loss function to optimize the parameters of the improved Yolov5 network structure, and a data annotation model based on the improved Yolov5 network structure is obtained. This model can map the results to the stock time series with box features. In the testing process, the converted K-line chart is used to detect the trained improved Yolov5 network structure, and post-processing is performed according to the detection results. Finally, the corresponding model and the stock time series data with stock box features are obtained.
[0104] The construction method of the data annotation model based on the improved Yolov5 network structure is as follows: The Yolov5 network structure uses CSPDarknet53 as the backbone network, and the C3 module in CSPDarknet53 is replaced with the C3CBAM module to improve the Yolov5 network structure, obtaining the improved Yolov5 network structure.
[0105] The C3CBAM module is an improved module that introduces the CBAM attention mechanism into the C3 module, specifically including: the main branch, the residual branch, the splicing layer, and the output layer.
[0106] In this embodiment, the improved Yolov5 uses the CSPDarknet53 architecture containing the C3CBAM module, multiple convolutional layers, and the Backbone layer with a residual structure to extract features from the K-line chart. The C3CBAM module is an improved module after introducing the CBAM attention mechanism into the C3 module. The attention mechanism is widely used in the fields of artificial intelligence and machine learning and is used to imitate an important way of the human brain when processing information. The basic idea of the attention mechanism is that when processing sequential data, instead of simply treating the entire sequence equally, it selectively focuses on a part of it at each step or at each period of time, so that the model can process information more effectively and improve performance.
[0107] The main branch is used to perform multi-layer feature extraction on the input feature map and refine the processed feature map to obtain the main branch feature map.
[0108] The residual branch is used to perform a single convolution process on the input feature map to obtain the residual branch feature map.
[0109] The splicing layer is used to splice the main branch feature map and the residual branch feature map in the channel dimension to obtain the spliced feature map.
[0110] The output layer is used to restore the spliced feature map to the original number of channels through a convolution operation.
[0111] The main branch includes, in series: a first convolution block, a second convolution block, a third convolution block, and a CBAM module.
[0112] In this embodiment, as Figure 3 shown, the CBAM attention mechanism is introduced into the traditional C3 module to construct the C3CBAM module. The convolution kernels of the first convolution block and the second convolution block are 1x1, the stride is 1, and the number of output channels is half of the number of input channels, which is used to reduce the number of channels, reduce the computational complexity, and at the same time keep the width and height of the feature map unchanged. The convolution kernel of the third convolution block is 3×3, the stride is 1, and the padding size is 1 to keep the feature map size unchanged, and the number of output channels is half of the number of input channels, which is used to extract local features and enhance the expression ability of the feature map. The convolution process in the residual branch uses a convolution block with a convolution kernel size of 1x1, a stride of 1, and the number of output channels being half of the number of input channels. The convolution block with a convolution kernel size of 1×1, a stride of 1, and the number of output channels being twice the number of input channels is used in the output layer to restore the original number of channels.
[0113] The first convolution block, the second convolution block, and the third convolution block are used to perform multi-layer feature extraction on the input feature map in sequence, and input the feature map extracted by the third convolution block into the CBAM module.
[0114] The CBAM module is used to refine the input feature map through the channel attention mechanism and the spatial attention mechanism to generate the main branch feature map.
[0115] The CBAM module includes: a feature input layer, a channel attention sub-module, a spatial attention sub-module, and a feature output layer.
[0116] The feature input layer receives the feature map output from the third convolutional block as the original input feature of the CBAM module.
[0117] The channel attention sub-module calculates the global average pooling feature and the global maximum pooling feature of the original input feature respectively, then uses a fully connected layer to process the obtained global average pooling feature and global maximum pooling feature to generate a channel attention feature map, uses the Sigmoid activation function to generate the channel attention weight, and multiplies the channel attention feature map by the original input feature using the channel attention weight to obtain the channel attention weighted feature map.
[0118] The spatial attention sub-module calculates the average pooling feature and the maximum pooling feature of the channel attention weighted feature map respectively, concatenates the obtained average pooling feature and maximum pooling feature along the channel dimension, then uses a convolutional layer to process the concatenated feature to generate a spatial attention feature map, uses the Sigmoid activation function to generate the spatial attention weight, and multiplies the spatial attention feature map by the original input feature using the spatial attention weight to obtain the spatial attention weighted feature map.
[0119] The feature output layer outputs the spatial attention weighted feature map as the main branch feature map.
[0120] In this embodiment, as Figure 4 shown, the CBAM attention mechanism first processes the input feature map through the channel attention module, and then further processes it through the spatial attention module to finally obtain the refined feature map. The CBAM module calculates the global average pooling feature and the global maximum pooling feature of the input feature; sends the pooling results into a shared fully connected layer for non-linear interaction between channels, generates a channel attention feature map by recombining and adding the two pooling features; then scales it through the sigmoid activation function to finally determine the importance of each channel. The channel attention weighted feature map is processed using average and maximum joint pooling to merge the channel information to obtain two feature maps that focus on the average value and the maximum value respectively; the two feature maps obtained by average pooling and maximum pooling are merged in the channel dimension and then further processed using a convolutional layer, and finally the spatial attention weighted feature map is generated through the sigmoid activation function, as Figure 5As shown, the spatial attention module uses max pooling, average pooling, convolutional layers, and the Sigmoid activation function to finally generate a spatially attention-weighted feature map.
[0121] The improved Yolov5 network structure includes: an improved Backbone layer, a Neck layer, and a Head layer.
[0122] The improved Backbone layer is used to extract features from the input K-line chart and input the extracted feature map into the Neck layer; the improved Backbone layer includes, connected in sequence: an input layer, an initial convolutional layer, and four convolutional blocks; the four convolutional blocks are each composed of a convolutional layer and a C3CBAM module.
[0123] The Neck layer uses FPN to perform multi-scale feature extraction on the feature map output by the improved Backbone layer and perform feature fusion to obtain a multi-scale feature map and transmit it to the Head layer.
[0124] The Head layer is used to perform object detection based on the multi-scale feature map and use the method of bounding box regression to adjust the obtained object detection results, and output the predicted bounding boxes of each K-line entity in the K-line chart, the category of each predicted bounding box, and the confidence of each predicted bounding box.
[0125] In this embodiment, the four key layers of YOLOv5 are the Backbone layer, the Neck layer, the Head layer, and the LossFunction layer. Among them, the Backbone layer is responsible for extracting the features of the input image; the Neck layer further extracts high-level features and fuses features at different levels to support multi-scale bounding box recognition; the Head layer generates a set of bounding boxes at each position on the feature maps of different scales. These bounding boxes have different sizes and aspect ratios to adapt to K-line entities of different sizes; the classification branch is used to perform classification predictions on each bounding box on the feature maps of each scale to generate the predicted bounding boxes of K-line entities, and the regression branch is used to perform bounding box regression predictions on each bounding box; in the prediction stage, it is used to remove redundant bounding boxes and only retain the best prediction results to avoid detecting overlapping bounding boxes. The final output object detection results include: the category, bounding box coordinates, and confidence score of each predicted bounding box. Therefore, the Head layer realizes object detection and bounding box regression by identifying the bounding box features of K-line entities in the K-line chart. The Loss Function layer is only used to calculate the prediction error during model training, optimize the model parameters. In this embodiment, the Focal-EIOU algorithm is used to calculate the loss function and perform backpropagation and parameter update of model training. The detection box formula of YOLOv5 is the key to converting the relative offset output by the model into the predicted bounding box. Through specific mathematical transformations, accurate object localization and size measurement are achieved, thus ensuring the efficient completion of the detection task.
[0126] The loss function of the improved Yolov5 network structure is the improved Focal-EIOU loss function.
[0127] In this embodiment, the Focal-EIOU algorithm is a loss function for object detection tasks. By combining the advantages of Focal Loss and EIOU (Enhanced Intersection over Union) Loss, it aims to solve two main problems in object detection: class imbalance and inaccurate bounding box localization.
[0128] Build a data annotation model based on the improved Yolov5 network structure by using the improved Yolov5 network structure and the post-processing module.
[0129] Among them, the post-processing module is used to screen all the predicted bounding boxes output by the improved Yolov5 network structure to generate a K-line chart containing all the predicted bounding boxes of K-line entities.
[0130] The specific content of screening all the predicted bounding boxes output by the improved Yolov5 network structure is as follows:
[0131] Sort all the predicted bounding boxes output by the improved Yolov5 network structure in descending order of confidence to generate a candidate list of predicted bounding boxes, and traverse all the predicted bounding boxes in sequence according to the arrangement order of the candidate list.
[0132] The process of each traversal is as follows: Take the currently traversed predicted bounding box as the reference box, calculate the intersection over union (IoU) between the reference box and other predicted bounding boxes respectively, and compare it with a preset confidence threshold. If the IoU between the reference box and a certain predicted bounding box exceeds the confidence threshold, it is considered that the predicted bounding box overlaps with the reference box, and the reference box is deleted; otherwise, the reference box is retained. After completing all traversal processes, the filtered predicted bounding boxes are obtained.
[0133] Then use the filtered predicted bounding boxes to generate a K-line chart containing all the predicted bounding boxes of K-line entities.
[0134] Use the time-series dataset to train, validate, and test the data annotation model based on the improved Yolov5 network structure to obtain the trained data annotation model based on the improved Yolov5 network structure.
[0135] The specific content of using the time-series dataset to train, validate, and test the data annotation model based on the improved Yolov5 network structure is as follows:
[0136] Input the training set into the improved Yolov5 network structure to obtain predicted bounding boxes, and calculate the intersection over union (IoU) between the labeled bounding boxes in the training set and the predicted bounding boxes, which is expressed as:
[0137]
[0138] Among them, IOU(A,B) represents the intersection over union between the labeled bounding box and the predicted bounding box; A represents the labeled bounding box; B represents the predicted bounding box; Intersection(A,B) represents the intersection between the labeled bounding box and the predicted bounding box; Union(A,B) represents the union between the labeled bounding box and the predicted bounding box.
[0139] In this embodiment, IOU is used to measure the overlap degree between the labeled bounding box and the predicted bounding box.
[0140] Then calculate the EIOU loss using the calculated intersection over union, which is expressed as:
[0141]
[0142] Among them, EIOU represents the EIOU loss; IOU represents the intersection over union; ρ represents the smoothing parameter; (b,b gt ) represents the distance between the center point coordinates of the predicted bounding box and the center point coordinates of the labeled bounding box; (w,w gt) represents the difference between the width of the predicted bounding box and the width of the labeled bounding box; (h, h gt ) represents the difference between the height of the predicted bounding box and the height of the labeled bounding box; c, c w and c h are all normalization constants.
[0143] Calculate the FocalL1Loss using the labeled bounding boxes and predicted bounding boxes of the training set, which is expressed as:
[0144] FL1(x) = α(1 - L1(x)) γ ·L1(x)(5)
[0145] where FL1(x) represents the FocalL1Loss; L1(x) represents the absolute difference between the coordinates of the labeled bounding box and the coordinates of the predicted bounding box; x represents the input variable; α represents the balance factor; γ represents the focusing parameter.
[0146] Construct an improved Focal-EIOU loss function using the EIOU loss and FocalL1Loss.
[0147]
[0148] where Loss Focal-EIOU represents the Focal-EIOU loss function.
[0149] In this embodiment, an improved Focal-EIOU loss function is obtained by integrating FocalL1Loss and EIOULoss, which is used to measure the difference between the predicted box of the stock box and the true stock box instance box.
[0150] Calculate the difference between the labeled bounding box and the predicted bounding box in the training set using the improved Focal-EIOU loss function, and update the gradient of the improved Yolov5 network structure according to the calculated difference. Iteratively train the improved Yolov5 network structure by minimizing the improved Focal-EIOU loss function to obtain a trained improved Yolov5 network structure.
[0151] Adjust the hyperparameters of the trained improved Yolov5 network structure using the validation set to obtain a validated improved Yolov5 network structure.
[0152] In this embodiment, the validation set is used to adjust the hyperparameters of the model to avoid overfitting.
[0153] Combine the validated improved Yolov5 network structure and the post-processing module and evaluate using the test set to obtain a trained data annotation model based on the improved Yolov5 network structure.
[0154] In this embodiment, metrics such as IOU and TP are used to evaluate the combined, verified, and improved Yolov5 network structure and post-processing module. Since the test set data is not used during model training, an accurate assessment of the model's generalization ability can be provided.
[0155] The specific content of combining the verified and improved Yolov5 network structure and post-processing module and using the test set for evaluation is as follows:
[0156] The test set is sequentially input into the verified and improved Yolov5 network structure and post-processing module to obtain a K-line chart containing all the predicted bounding boxes of K-line entities. The intersection over union (IoU) between the marked bounding boxes and the predicted bounding boxes in the test set is calculated respectively, and the true positives (TP), false negatives (FN), and false positives (FP) of the test set are calculated using the obtained IoU. Then, the precision, recall, F1-score, average precision (AP), and mAP50 metrics of the test set are calculated respectively. The verified and improved Yolov5 network structure and post-processing module are evaluated using the precision, recall, F1-score, average precision, and mAP50 metrics of the test set. When the preset evaluation criteria are met, a trained data annotation model based on the improved Yolov5 network structure is obtained.
[0157] In this embodiment, the true positive (TP) is used to calculate the situation where the data annotation model correctly identifies the marked bounding boxes in the K-line chart as target detection objects. The calculation formula is as follows:
[0158]
[0159] where p represents the target detection object identified in the K-line chart; Prediction represents the set of all target detection objects identified in the K-line chart; box represents the marked bounding box in the K-line chart; Boxdb represents the set of marked bounding boxes in the K-line chart; IOU(p, box) represents the intersection over union between the target detection object identified in the K-line chart and the marked bounding box; τ IOU represents the set IoU threshold.
[0160] The false negative (FN) is used to calculate the situation where the data annotation model fails to identify the bounding boxes in the K-line chart. The false positive (FP) is used to calculate the situation where the data annotation model incorrectly identifies a bounding box that is not in the K-line chart as a target detection object.
[0161] Precision is an indicator that measures how many of the bounding boxes recognized by the data annotation model in the K-line chart are the truly marked bounding boxes in the K-line chart. Its value ranges from 0 to 1, and the calculation formula is as follows:
[0162]
[0163] Recall refers to the proportion of the target detection objects detected by the data annotation model among all the truly marked bounding boxes in the K-line chart. The calculation formula is as follows:
[0164]
[0165] F1-Score comprehensively considers Precision and Recall to evaluate the performance of the data annotation model in balancing accuracy and integrity. Its value ranges from 0 to 1, and the calculation formula is as follows:
[0166]
[0167] Average Precision (AP) is used to represent the detection accuracy of the data annotation model on different categories. The prediction results of the data annotation model are sorted in descending order of confidence. According to the confidence threshold, Precision and Recall are calculated to obtain the Precision-Recall curve, and the area under the Precision-Recall curve is taken as the AP of the data annotation model.
[0168] mAP50 is the average precision of the data annotation model when using the IOU threshold, which measures the detection performance of the data annotation model. Its value ranges from 0 to 1, and the closer it is to 1, the better the performance of the data annotation model. The calculation formula is as follows:
[0169]
[0170] Among them, mAP50 represents the average precision when the IOU threshold is 0.5; AP i represents the average precision of the i-th category; N represents the total number of categories.
[0171] By post-processing the output results of the improved Yolov5 network structure, the recognition accuracy is improved to obtain an optimized model. Then, the data annotation model is evaluated according to the above indicators to verify its applicability.
[0172] Obtain the stock time series data to be marked, perform data cleaning and format conversion, and input the formatted stock time series data into the trained data annotation model based on the improved Yolov5 network structure to obtain a K-line chart containing all the predicted bounding boxes of K-line entities.
[0173] In this embodiment, the stock time series data to be marked is subjected to data cleaning, and the cleaned stock time series data is converted into the format of a K-line chart, obtaining a K-line chart containing a number of K-line entities.
[0174] According to the K-line chart containing the predicted bounding boxes of all K-line entities, the box features of each K-line entity are generated and marked, thereby converting the K-line chart containing the predicted bounding boxes of all K-line entities into stock time series data with the box feature annotations of K-line entities.
[0175] Thus, the entire process from the stock time series data to the training model, adjustment, and finally use is completed.
[0176] An automatic annotation system for time series data based on object detection in this embodiment is used to implement the automatic annotation method for time series data based on object detection, as Figure 6 shown. This system includes: a data acquisition module, a data processing module, a data annotation module, and a data conversion module.
[0177] The data acquisition module is used to acquire stock time series data and transmit it to the data processing module.
[0178] The data processing module is used to perform data cleaning on the stock time series data, convert the cleaned stock time series data into the format of a K-line chart, obtain a K-line chart containing a number of K-line entities, and transmit it to the data annotation module.
[0179] The data annotation module is used to input the received K-line chart containing a number of K-line entities into a data annotation model based on an improved Yolov5 network structure for automatic annotation, and transmit the K-line chart containing the predicted bounding boxes of all K-line entities to the data conversion module.
[0180] The data conversion module is used to generate the box features of each K-line entity according to the K-line chart containing the predicted bounding boxes of all K-line entities and perform marking, and then convert the K-line chart containing the predicted bounding boxes of all K-line entities into stock time series data with the box feature annotations of K-line entities.
[0181] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope defined by the claims of the present invention.
Claims
1. An automatic annotation method for time series data based on object detection, characterized in that, The method includes the following processes: Obtain stock time series data and construct a time series data set by processing the stock time series data; Construct a data annotation model based on the improved Yolov5 network structure; Use the time series data set to train, validate and test the data annotation model based on the improved Yolov5 network structure to obtain a trained data annotation model based on the improved Yolov5 network structure; Obtain the stock time series data to be labeled, perform data cleaning and format conversion, and input the stock time series data after format conversion into the trained data annotation model based on the improved Yolov5 network structure to obtain a K-line chart containing the predicted bounding boxes of all K-line entities; Generate the box features of each K-line entity according to the K-line chart containing the predicted bounding boxes of all K-line entities and perform labeling, so as to convert the K-line chart containing the predicted bounding boxes of all K-line entities into stock time series data labeled with the box features of K-line entities.
2. The automatic annotation method for time series data based on object detection according to claim 1, characterized in that, The specific content of constructing the time series data set by processing the stock time series data is as follows: Perform data cleaning on the obtained stock time series data, including removing missing values, outlier processing and normalization, to obtain the cleaned stock time series data, convert the cleaned stock time series data into the K-line chart format, mark the bounding boxes of each K-line entity in the obtained K-line chart, and generate the labels of each bounding box at the same time; then use the labeled K-line chart to construct a stock time series data set; divide the stock time series data set into a training set, a validation set and a test set according to a predetermined ratio.
3. The automatic annotation method for time series data based on object detection according to claim 2, wherein The specific content of marking the bounding boxes of each K-line entity in the obtained K-line chart is as follows: Measure and record the geometric features of the K-line chart containing several K-line entities, including: the origin pixel coordinates, the pixel interval between the origin pixel and the first K-line entity, the width of the K-line entity, and the interval between adjacent K-line entities; Measure and record the geometric features of the K-line chart with a number of K-line entities that is an integer multiple of ten, and use the method of linear interpolation to obtain the geometric features of the K-line chart with a number of K-line entities that is not an integer multiple of ten; Initialize the pixel interval between the origin pixel and the first K-line entity, the width of the K-line entity, and the interval between adjacent K-line entities in the K-line chart; Based on the pixel interval between the origin pixel and the first K-line entity, the width of the K-line entity, and the interval between adjacent K-line entities in the initialized K-line chart, calculate the bounding boxes of each K-line entity in the K-line chart.
4. The automatic annotation method for time series data based on object detection according to claim 3, characterized in that, The label of each bounding box is used to represent the box features of the K-line entity corresponding to the bounding box; The box features include: price features, time features, trading volume features and trend features; among them, the price features include: opening price, closing price, highest price and lowest price; the time features include: trading date and timestamp; the trading volume features include: trading volume and turnover; the trend features include: upward trend, downward trend and oscillating trend; The labels of the bounding box include: the upper boundary of the bounding box, the lower boundary of the bounding box, the coordinates of the center point of the bounding box, the width of the bounding box, the boundary of the K-line entity, and the category of the bounding box; where the upper boundary of the bounding box is used to represent the highest price; the lower boundary of the bounding box is used to represent the lowest price; the coordinates of the center point of the bounding box are used to represent the position of the K-line entity in the K-line chart; the width of the bounding box is used to represent the time feature; the boundary of the K-line entity is used to represent the opening price and the closing price; the category of the bounding box is used to represent the trend feature.
5. The automatic annotation method for time series data based on object detection according to claim 4, wherein The construction method of the data annotation model based on the improved Yolov5 network structure is as follows: The Yolov5 network structure uses CSPDarknet53 as the backbone network, and the C3 module in CSPDarknet53 is replaced with the C3CBAM module to improve the Yolov5 network structure, resulting in an improved Yolov5 network structure; The improved Yolov5 network structure includes: an improved Backbone layer, a Neck layer, and a Head layer; The improved Backbone layer is used to extract features from the input K-line chart and input the extracted feature map into the Neck layer; where the improved Backbone layer includes, connected in sequence: an input layer, an initial convolutional layer, and four convolutional blocks; where the four convolutional blocks are each composed of a convolutional layer and a C3CBAM module; The Neck layer uses FPN to perform multi-scale feature extraction and feature fusion on the feature map output by the improved Backbone layer to obtain a multi-scale feature map and transmit it to the Head layer; The Head layer is used to perform object detection based on the multi-scale feature map and adjust the obtained object detection results using the method of bounding box regression, and output the predicted bounding boxes of each K-line entity in the K-line chart, the category of each predicted bounding box, and the confidence of each predicted bounding box; The loss function of the improved Yolov5 network structure is the improved Focal-EIOU loss function; An improved Yolov5 network structure and a post-processing module are used to construct a data annotation model based on the improved Yolov5 network structure; Where the post-processing module is used to screen all the predicted bounding boxes output by the improved Yolov5 network structure to generate a K-line chart containing the predicted bounding boxes of all K-line entities.
6. The automatic annotation method for time series data based on object detection according to claim 5, wherein The C3CBAM module is an improved module that introduces the CBAM attention mechanism into the C3 module, and specifically includes: a main branch, a residual branch, a splicing layer, and an output layer; The main branch is used to perform multi-layer feature extraction on the input feature map and refine the processed feature map to obtain the main branch feature map; The residual branch is used to perform a single convolutional process on the input feature map to obtain the residual branch feature map; The splicing layer is used to splice the main branch feature map and the residual branch feature map in the channel dimension to obtain the spliced feature map; The output layer is used to restore the spliced feature map to the original number of channels through convolutional operations.
7. The automatic annotation method for time series data based on object detection according to claim 6, characterized in that, The main branch includes, in series: a first convolutional block, a second convolutional block, a third convolutional block, and a CBAM module; wherein the first convolutional block, the second convolutional block, and the third convolutional block are used to perform multi-layer feature extraction on the input feature map in sequence, and input the feature map extracted by the third convolutional block into the CBAM module; the CBAM module is used to refine the features of the input feature map through the channel attention mechanism and the spatial attention mechanism to generate the main branch feature map; The CBAM module includes: a feature input layer, a channel attention sub-module, a spatial attention sub-module, and a feature output layer; The feature input layer receives the feature map output from the third convolutional block as the original input feature of the CBAM module; The channel attention sub-module respectively calculates the global average pooling feature and the global maximum pooling feature of the original input feature, then uses a fully connected layer to process the obtained global average pooling feature and global maximum pooling feature to generate a channel attention feature map, uses a Sigmoid activation function to generate a channel attention weight, and multiplies the channel attention feature map by the original input feature using the channel attention weight to obtain a channel attention weighted feature map; The spatial attention sub-module respectively calculates the average pooling feature and the maximum pooling feature of the channel attention weighted feature map, concatenates the obtained average pooling feature and maximum pooling feature along the channel dimension, then uses a convolutional layer to process the concatenated feature to generate a spatial attention feature map, uses a Sigmoid activation function to generate a spatial attention weight, and multiplies the spatial attention feature map by the original input feature using the spatial attention weight to obtain a spatial attention weighted feature map; The feature output layer outputs the spatial attention weighted feature map as the main branch feature map.
8. The automatic annotation method for time series data based on object detection according to claim 7, wherein, The specific content of screening all the predicted bounding boxes output by the improved Yolov5 network structure is as follows: Sort all the predicted bounding boxes output by the improved Yolov5 network structure from high to low according to the confidence level to generate a candidate list of predicted bounding boxes, and sequentially traverse all the predicted bounding boxes according to the arrangement order of the candidate list; Wherein the process of each traversal is: taking the currently traversed predicted bounding box as a reference box, calculating the intersection over union of the reference box and other predicted bounding boxes respectively and comparing it with a preset confidence threshold. If the intersection over union of the reference box and a certain predicted bounding box exceeds the confidence threshold, it is considered that the predicted bounding box overlaps with the reference box, and the reference box is deleted; On the contrary, the reference box is retained; after all traversal processes are completed, the screened predicted bounding boxes are obtained; Then use the screened predicted bounding boxes to generate a K-line chart containing all the predicted bounding boxes of K-line entities.
9. The automatic annotation method for time series data based on object detection according to claim 8, characterized in that The specific content of training, validating, and testing the data annotation model based on the improved Yolov5 network structure using the time series dataset is as follows: Input the training set into the improved Yolov5 network structure to obtain predicted bounding boxes, calculate the intersection over union of the labeled bounding boxes and the predicted bounding boxes in the training set, and then calculate the EIOU loss using the calculated intersection over union; Calculate the Focal L1 Loss using the labeled bounding boxes and predicted bounding boxes in the training set; Construct an improved Focal-EIOU loss function using the EIOU loss and the Focal L1 Loss, expressed as: Among them, Loss Focal-EIOU represents the improved Focal-EIOU loss function; IOU represents the intersection over union; ρ represents the smoothing parameter; (b, b gt ) represents the distance between the center point coordinates of the predicted bounding box and the center point coordinates of the labeled bounding box; (w, w gt ) represents the difference between the width of the predicted bounding box and the width of the labeled bounding box; (h, h gt ) represents the difference between the height of the predicted bounding box and the height of the labeled bounding box; c, c w and c h are all normalization constants; γ represents the focusing parameter; Calculate the difference between the labeled bounding boxes and the predicted bounding boxes in the training set using the improved Focal-EIOU loss function, and update the gradients of the improved Yolov5 network structure according to the calculated difference. Iteratively train the improved Yolov5 network structure by minimizing the improved Focal-EIOU loss function to obtain a trained improved Yolov5 network structure; Adjust the hyperparameters of the trained improved Yolov5 network structure using the validation set to obtain a validated improved Yolov5 network structure; Combine the validated improved Yolov5 network structure and the post-processing module and evaluate using the test set to obtain a trained data annotation model based on the improved Yolov5 network structure.
10. A temporal data automatic annotation system based on object detection, which is used to implement the above-mentioned temporal data automatic annotation method based on object detection, and is characterized in that, The system includes: a data acquisition module, a data processing module, a data annotation module, and a data conversion module; The data acquisition module is used to acquire stock time series data and transmit it to the data processing module; The data processing module is used to clean the stock time series data, convert the cleaned stock time series data into a K-line chart format, obtain a K-line chart containing several K-line entities, and transmit it to the data annotation module; The data annotation module is used to input the received K-line chart containing several K-line entities into the data annotation model based on the improved Yolov5 network structure for automatic annotation, and transmit the K-line chart containing the predicted bounding boxes of all K-line entities to the data conversion module; The data conversion module is used to generate and mark the box features of each K-line entity according to the K-line chart containing the predicted bounding boxes of all K-line entities, and then convert the K-line chart containing the predicted bounding boxes of all K-line entities into stock time series data with box feature annotations of K-line entities.