Curve data extraction method, device, computer equipment, and storage medium
Through pre-trained semantic segmentation model and text recognition technology, the coordinate axes, scales and curve positions in the curve image are automatically extracted, solving the problem of low data extraction efficiency of curve image and achieving efficient and accurate data restoration.
Patent Information
- Application Number
- CN202211693222.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-28
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2042-12-28
AI Technical Summary
In the prior art, the data extraction efficiency of curved images is low and manual labeling is time-consuming and labor-intensive, making it difficult to accurately obtain data information of other pixel points except the highest point and the lowest point.
The pre-trained semantic segmentation model is used to segment the curve image, and the coordinate axis and curve position are determined through the semantic segmentation model, and the scale position is determined in combination with text recognition processing, a coordinate system is established and curve data is generated.
It improves the efficiency and accuracy of curve data extraction, simplifies segmentation operations, enhances robustness and anti-interference, and is suitable for a variety of curve categories.
Smart Images

Figure CN116152844B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of image data processing, and in particular to a curve data extraction method, apparatus, computer equipment, storage medium, and computer program product. Background Art
[0002] As a data representation format, curve charts have a wide range of applications. They allow users to clearly see data trends and the peak and trough data information of the curve, thereby determining the magnitude of the corresponding data change. However, for pixels other than the peak and trough in the curve, it is difficult for users to directly see the precise and complete pixel data information, making it difficult to further analyze the curve data.
[0003] In traditional technology, curve data can be obtained from curve images by manually annotating them. However, when using traditional curve data extraction methods, manual annotation is time-consuming and labor-intensive, which easily leads to low curve data extraction efficiency. Summary of the Invention
[0004] Based on this, it is necessary to provide a highly efficient curve data extraction method, apparatus, computer equipment, computer-readable storage medium and computer program product to address the above technical issues.
[0005] In a first aspect, the present application provides a method for extracting curve data. The method comprises:
[0006] Acquire a curve image to be processed, wherein the curve image includes a coordinate system and a target curve located in the coordinate system, wherein the coordinate system includes a coordinate axis and a scale text identifier;
[0007] Inputting the curve image into a pre-trained semantic segmentation model, determining a classification result of each pixel in the curve image through the semantic segmentation model, and clustering the plurality of pixels according to the classification result to obtain an axis position corresponding to the coordinate axis and a curve position corresponding to the target curve;
[0008] Performing text recognition processing on the curve image to determine the scale position and scale result of the scale text mark;
[0009] Matching the coordinate axis and the scale text identifier according to the axis position and the scale position to determine the coordinate system;
[0010] The relative position of the target curve in the coordinate system is determined according to the curve position, and curve data corresponding to the target curve is generated according to a target scale result corresponding to the relative position in the coordinate system.
[0011] In one embodiment, the step of inputting the curve image into a pre-trained semantic segmentation model, determining a classification result of each pixel in the curve image by the semantic segmentation model, and clustering a plurality of the pixels according to the classification result to obtain an axis position corresponding to the coordinate axis and a curve position corresponding to the target curve includes:
[0012] Inputting the curve image into the coordinate axis segmentation model, performing coordinate axis detection on the curve image through the coordinate axis segmentation model, and generating a coordinate axis classification result for each pixel point;
[0013] Determining a first pixel point belonging to a coordinate axis category from the curve image according to the coordinate axis classification result by using the coordinate axis segmentation model, and clustering the first pixel point to obtain an axis position corresponding to the coordinate axis;
[0014] Inputting the curve image into the curve segmentation model, performing curve detection on the curve image through the curve segmentation model, and generating a curve classification result for each pixel point;
[0015] The curve segmentation model is used to determine second pixel points belonging to the curve category from the curve image according to the curve classification result, and the second pixel points are clustered to obtain the curve position corresponding to the target curve.
[0016] In one embodiment, the target curve includes multiple curve categories;
[0017] Determining, from the curve image, second pixels belonging to a curve category according to the curve classification result using the curve segmentation model, and clustering the second pixels to obtain a curve position corresponding to the target curve includes:
[0018] The curve segmentation model is used to determine the second pixel points belonging to the same curve category from the curve image according to the curve classification result, and the second pixel points under the same curve category are clustered respectively to obtain the curve position of the target curve corresponding to each curve category.
[0019] In one embodiment, determining a first pixel belonging to a coordinate axis category from the curve image using the coordinate axis segmentation model according to the coordinate axis classification result, and clustering the first pixel to obtain an axis position corresponding to the coordinate axis includes:
[0020] Determining, from the curve image, a first horizontal-axis pixel point belonging to the horizontal-axis category and a first vertical-axis pixel point belonging to the vertical-axis category according to the coordinate-axis classification result by using the coordinate-axis segmentation model;
[0021] Clustering the first horizontal axis pixel points using the coordinate axis segmentation model to obtain a horizontal axis position corresponding to the horizontal axis, and clustering the first vertical axis pixel points to obtain a vertical axis position corresponding to the vertical axis;
[0022] The origin position of the coordinate system is determined according to the horizontal axis position and the vertical axis position through the coordinate axis segmentation model.
[0023] In one embodiment, matching the coordinate axis and the scale text identifier according to the axis position and the scale position to determine the coordinate system includes:
[0024] Determine a first distance between the scale text mark and the horizontal axis according to the scale position and the horizontal axis position, and determine a second distance between the scale text mark and the vertical axis according to the scale position and the vertical axis position;
[0025] In response to a comparison result that the first spacing is less than a preset spacing threshold, matching the scale text identifier with the horizontal axis to establish a first mapping relationship between the scale result and the horizontal axis scale; or
[0026] In response to a comparison result that the second spacing is smaller than the preset spacing threshold, matching the scale text identifier with the vertical axis, and establishing a second mapping relationship between the scale result and the vertical axis scale;
[0027] The coordinate system position of the coordinate system is determined according to the horizontal axis position, the origin position and the vertical axis position, the scale mapping relationship corresponding to the coordinate system is determined according to the first mapping relationship and the second mapping relationship, and the coordinate system is determined using the coordinate system position and the scale mapping relationship.
[0028] In one embodiment, determining the relative position of the target curve in the coordinate system according to the curve position, and generating curve data corresponding to the target curve according to a target scale result corresponding to the relative position in the coordinate system, includes:
[0029] Determining the relative position of the target curve in the coordinate system according to the curve position and the origin position;
[0030] The relative position is converted according to the scale mapping relationship to obtain a target scale result corresponding to the relative position in the coordinate system, and curve data corresponding to the target curve is generated using the target scale result.
[0031] In a second aspect, the present application further provides a device for extracting curve data. The device comprises:
[0032] An image acquisition module is used to acquire a curve image to be processed, wherein the curve image includes a coordinate system and a target curve located in the coordinate system, wherein the coordinate system includes a coordinate axis and a scale text identifier;
[0033] An image segmentation module is configured to input the curve image into a pre-trained semantic segmentation model, determine a classification result for each pixel in the curve image using the semantic segmentation model, and cluster the plurality of pixels according to the classification result to obtain an axis position corresponding to the coordinate axis and a curve position corresponding to the target curve;
[0034] A text recognition module is used to perform text recognition processing on the curve image to determine the scale position and scale result of the scale text mark;
[0035] A coordinate system establishing module, configured to match the coordinate axis and the scale text identifier according to the axis position and the scale position to determine the coordinate system;
[0036] A data generation module is used to determine the relative position of the target curve in the coordinate system according to the curve position, and generate curve data corresponding to the target curve according to the target scale result corresponding to the relative position in the coordinate system.
[0037] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it implements the curve data extraction method described in any embodiment of the first aspect.
[0038] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the curve data extraction method described in any one of the embodiments of the first aspect.
[0039] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the curve data extraction method described in any one of the embodiments of the first aspect.
[0040] The above-mentioned curve data extraction method, device, computer equipment, storage medium and computer program product obtain a curve image to be processed, the curve image includes a coordinate system and a target curve located in the coordinate system, and the coordinate system includes a coordinate axis and a scale text identifier; the curve image is input into a pre-trained semantic segmentation model, and the classification result of each pixel point in the curve image is determined by the semantic segmentation model, and multiple pixels are clustered according to the classification result to obtain the axis position corresponding to the coordinate axis and the curve position corresponding to the target curve; text recognition processing is performed on the curve image to determine the scale position and scale result of the scale text identifier; the coordinate axis and the scale text identifier are matched according to the axis position and the scale position to determine the coordinate system; the relative position of the target curve in the coordinate system is determined according to the curve position, and curve data corresponding to the target curve is generated according to the target scale result corresponding to the relative position in the coordinate system, which can restore the coordinate system in the curve image, thereby improving the data extraction efficiency and accuracy of the curve image.
[0041] In addition, since the curve data extraction method provided in this application only uses a semantic segmentation model to segment the curve image, it can simplify the segmentation operation of the curve image based on the neural network classification principle, so that the image segmentation is not limited to specific conditions such as the color or curvature of the curve, thereby improving the robustness and anti-interference ability of the curve image segmentation. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1A 1 is a flow chart of a method for extracting curve data in one embodiment;
[0043] Figure 1B is a schematic diagram of a curve image in one embodiment;
[0044] Figure 1C Schematic diagram of a text detection step in one embodiment;
[0045] Figure 1D is a schematic diagram of a text recognition step in one embodiment;
[0046] Figure 2A 1 is a flow chart of an image segmentation step in one embodiment;
[0047] Figure 2B Schematic diagram of output results of a coordinate axis segmentation model in one embodiment;
[0048] Figure 2C Schematic diagram of output results of a curve segmentation model in one embodiment;
[0049] Figure 3 1 is a flow chart of an image segmentation step in one embodiment;
[0050] Figure 4ASchematic diagram of a flow chart of a coordinate system determination step in one embodiment;
[0051] Figure 4B is a schematic diagram of a curve image in one embodiment;
[0052] Figure 4C is a schematic diagram of a curve image in one embodiment;
[0053] Figure 4D is a schematic diagram of a curve image in one embodiment;
[0054] Figure 5 Schematic diagram of a flow chart of a method for extracting curve data in another embodiment;
[0055] Figure 6 is a structural block diagram of a device for extracting curve data in one embodiment;
[0056] Figure 7 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0057] Currently, there are technical means in the prior art for classifying pixels in a curve image by using the color information (such as red, green, and blue RGB values) or waveform information (such as the spectrum of an electromagnetic test curve) of the curve image to extract curve data from the curve image.
[0058] However, the data extraction methods in the above-mentioned existing technologies have certain limitations and can only be used for specific application scenarios where color information or waveform information exists. Not only do they have high requirements on the image quality of the data extraction object, but they also have problems with poor robustness and anti-interference.
[0059] Therefore, the present application addresses the above-mentioned deficiencies in the prior art and provides a method for extracting curve data. To further clarify the objectives, technical solutions, and advantages of the present application, the present application is further described below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are intended only to illustrate the present application and are not intended to limit the present application.
[0060] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0061] In one embodiment, Figure 1AAs shown, a method for extracting curve data is provided. This embodiment uses the method applied to a server as an example for illustration. It is understandable that the method can also be applied to a terminal, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. Among them, the terminal can be, but is not limited to, various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart TVs, smart car devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server can be implemented as an independent server or a server cluster consisting of multiple servers.
[0062] In this embodiment, the method includes the following steps:
[0063] Step S102: Acquire the curve image to be processed.
[0064] The curve image may include a coordinate system and a target curve located in the coordinate system. The coordinate system may include a coordinate axis and a scale text mark located near the coordinate axis.
[0065] Specifically, the server can read the curve image to be processed from local storage or download it from the Internet in response to the curve data extraction request. It is understandable that the curve image to be processed can be a single frame image from video data, or it can also be an image generated by a curve drawing application.
[0066] In step S104 , the curve image is input into a pre-trained semantic segmentation model, and the axis position corresponding to the coordinate axis and the curve position corresponding to the target curve are obtained through the semantic segmentation model.
[0067] Among them, the classification result can be used to characterize the position of the pixel point in the curve image. For example, when the classification result of the pixel point is the coordinate axis category, it can be determined that the pixel point is located on the coordinate axis; when the classification result of the pixel point is the curve category, it can be determined that the pixel point is located on the curve.
[0068] The axis position can be used to represent the pixel coordinates of each pixel point on the coordinate axis.
[0069] The curve position can be used to represent the pixel coordinates of each pixel point on the target curve.
[0070] Specifically, a pre-trained semantic segmentation model can be pre-deployed in the server. The curve image to be processed is input into the pre-trained semantic segmentation model for image segmentation processing, and each pixel point in the curve image is classified by the pre-trained neural network in the semantic segmentation model to determine the classification result of each pixel point. According to the classification result, multiple pixel points in the curve image belonging to the same classification result are determined, and the multiple pixel points under the same classification result are clustered to obtain a pixel clustering result, that is, the coordinate axis area or the target curve area in the curve image. According to the pixel coordinates of each pixel point in the pixel clustering result, the axis position corresponding to the coordinate axis and the curve position corresponding to the target curve can be determined.
[0071] Optionally, in some embodiments, the semantic segmentation model may include but is not limited to a Pyramid Scene Parsing Network (PSPNet model), a semantic segmentation model based on an encoder-decoder structure (SegNet model), a fully convolutional network model (FCN model), etc.
[0072] Optionally, in some embodiments, the server may use labeled sample coordinate axis images and / or sample curves as training data, and use the labeling results corresponding to each pixel point in the training data as labels to train the initial semantic segmentation model to obtain a pre-trained semantic segmentation model.
[0073] Step S106 , performing text recognition processing on the curve image to determine the scale position and scale result of the scale text mark.
[0074] Specifically, the server may pre-store a text detection algorithm and a text recognition algorithm. The text detection algorithm is used to detect and process the curve image to determine the text box area where each scale text mark in the curve image is located. The scale position corresponding to each scale text mark is determined based on the position information of the text box area. For example, the lower left corner position of the text box area is used as the scale position corresponding to the scale text mark, or the upper right corner position of the text box area is used as the scale position corresponding to the scale text mark.
[0075] After obtaining the text box area, a text recognition algorithm can be used to detect the text box area, extract the text features of the scale text identifier within the text box area, and match the text features with the target text features in a preset dictionary to determine the text recognition content corresponding to the text box area, that is, the scale result corresponding to the scale text identifier. Optionally, in some embodiments, since the scale text identifier is mainly of digital type, the server can use an all-digital dictionary as the preset dictionary for the text recognition algorithm.
[0076] In an example, Figure 1B As shown in the figure, a schematic diagram of a curve image is provided. The server can Figure 1B The scale text mark in the text detection process is generated as follows Figure 1C The text box corresponding to each scale text mark in the curve image is shown. Figure 1C Perform text recognition on the text box area in Figure 1D The text recognition results are shown.
[0077] Step S108 : matching the coordinate axis and the scale text identifier according to the axis position and the scale position to determine the coordinate system.
[0078] Specifically, the server can determine the spacing between the scale text identifier and the coordinate axis based on the axis position of the coordinate axis in the curve image and the scale position corresponding to the scale text identifier. The scale text identifier and the coordinate axis are matched using the spacing. In response to a comparison result that the spacing is less than a preset spacing threshold, it is determined that the scale text identifier and the coordinate axis are successfully matched, and a mapping relationship between the scale result of the scale text identifier and the coordinate axis is established. The coordinate system is determined using the axis position of the coordinate axis and the mapping relationship between the coordinate axis and the scale result.
[0079] Step S110 , determining the relative position of the target curve in the coordinate system according to the curve position, and generating curve data corresponding to the target curve according to the target scale result corresponding to the relative position in the coordinate system.
[0080] Specifically, the server can perform calculations on the curve position corresponding to each pixel point in the target curve and the axis position of the coordinate axis to determine the axis position in the coordinate system that is closest to each pixel point in the target curve, thereby determining the relative position of each pixel point in the target curve in the coordinate system based on the axis position closest to the pixel point. Alternatively, the server can also determine the origin position of the coordinate system based on the axis position of the coordinate axis. Based on the curve position and the origin position, the pixel distance between each pixel point in the target curve and the origin of the coordinate system is directly calculated to determine the relative position of each pixel point in the target curve in the coordinate system. Based on the mapping relationship between the coordinate axis and the scale result, the target scale result corresponding to the relative position in the coordinate system is determined, and the target scale result is used as the curve data corresponding to the pixel point in the target curve, thereby generating curve data corresponding to the target curve.
[0081] The above-mentioned curve data extraction method, device, computer equipment, storage medium and computer program product obtain a curve image to be processed, the curve image includes a coordinate system and a target curve located in the coordinate system, and the coordinate system includes a coordinate axis and a scale text identifier; the curve image is input into a pre-trained semantic segmentation model, and the classification result of each pixel point in the curve image is determined by the semantic segmentation model, and multiple pixels are clustered according to the classification result to obtain the axis position corresponding to the coordinate axis and the curve position corresponding to the target curve; text recognition processing is performed on the curve image to determine the scale position and scale result of the scale text identifier; the coordinate axis and the scale text identifier are matched according to the axis position and the scale position to determine the coordinate system; the relative position of the target curve in the coordinate system is determined according to the curve position, and curve data corresponding to the target curve is generated according to the target scale result corresponding to the relative position in the coordinate system, which can restore the coordinate system in the curve image, thereby improving the data extraction efficiency and accuracy of the curve image.
[0082] In addition, since the curve data extraction method provided in this application only uses a semantic segmentation model to segment the curve image, it can simplify the segmentation operation of the curve image based on the neural network classification principle, so that the image segmentation is not limited to specific conditions such as the color or curvature of the curve, thereby improving the robustness and anti-interference ability of the curve image segmentation.
[0083] In one embodiment, the semantic segmentation model may include a coordinate axis segmentation model and a curve segmentation model. Figure 2A As shown, in step S104, the curve image is input into a pre-trained semantic segmentation model, and the classification result of each pixel in the curve image is determined by the semantic segmentation model. According to the classification result, multiple pixels are clustered to obtain the axis position corresponding to the coordinate axis and the curve position corresponding to the target curve, including:
[0084] In step S202 , the curve image is input into a coordinate axis segmentation model, and the coordinate axis segmentation model is used to perform coordinate axis detection on the curve image to generate a coordinate axis classification result for the pixel points.
[0085] Specifically, a pre-trained coordinate axis segmentation model can be deployed in the server, where the coordinate axis segmentation model can be obtained by iteratively training the initial coordinate axis segmentation model using labeled sample coordinate axis images as training data, and using the labeling results of the pixel points in the sample coordinate axis images (for example, belonging to the coordinate axis category or the non-coordinate axis category) as the labels of the training data.
[0086] The server can input the curve image into the coordinate axis segmentation model, perform coordinate axis detection on the curve image through the coordinate axis segmentation model, obtain the coordinate axis features of each pixel point in the curve image, match the sample category features corresponding to each label collected during the pre-training process of the coordinate axis segmentation model with the coordinate axis features of the currently acquired pixel point, determine the label corresponding to the pixel point, and thus generate the coordinate axis classification result for each pixel point in the curve image.
[0087] Step S204 : determining a first pixel point belonging to the coordinate axis category from the curve image according to the coordinate axis classification result by using the coordinate axis segmentation model, and clustering the first pixel point to obtain an axis position corresponding to the coordinate axis.
[0088] Specifically, the server can use the coordinate axis segmentation model to determine, from the curve image, pixels belonging to the coordinate axis category based on the coordinate axis classification results for each pixel, and use the pixels belonging to the coordinate axis category as first pixels. Clustering is performed on the multiple first pixels to form a clustering result of first pixels corresponding to the coordinate axis. The axis position corresponding to the coordinate axis is determined using the pixel coordinates of each first pixel in the first pixel clustering result.
[0089] Step S206 : Input the curve image into the curve segmentation model, perform curve detection on the curve image through the curve segmentation model, and generate a curve classification result for each pixel point.
[0090] Specifically, a pre-trained curve segmentation model can be deployed in the server, wherein the curve segmentation model can use labeled sample curves as training data, and use the labeling results of pixel points in the sample curves (for example, belonging to the curve category or non-curve category) as labels of the training data, and iteratively train the initial curve segmentation model.
[0091] Optionally, in some embodiments, the server may iteratively train the same initial semantic segmentation model using different training data and training labels to obtain the axis segmentation model and the curve segmentation model. Alternatively, the server may select, based on the segmentation characteristics of the axis, an initial semantic segmentation model with better straight line segmentation performance as the initial axis segmentation model; and, based on the segmentation characteristics of the curve, select an initial semantic segmentation model with better curve segmentation performance as the initial curve segmentation model.
[0092] The server can input the curve image into the curve segmentation model, perform curve detection on the curve image through the curve segmentation model, obtain the curve features of each pixel in the curve image, match the sample category features corresponding to each label collected during the pre-training process of the curve segmentation model with the curve features of the currently acquired pixel points, determine the label corresponding to the pixel point, and thus generate a curve classification result for each pixel point in the curve image.
[0093] Step S208 : determining a second pixel point belonging to the curve category from the curve image according to the curve classification result using the curve segmentation model, and clustering the second pixel point to obtain a curve position corresponding to the target curve.
[0094] Specifically, the server can use the curve segmentation model to determine, from the curve image, pixels belonging to a curve category based on the curve classification results of the pixels. The pixels belonging to the curve category are used as second pixels, and a clustering process is performed on the plurality of second pixels to form a second pixel clustering result corresponding to the target curve. The pixel coordinates of each second pixel in the second pixel clustering result are used to determine the curve position corresponding to the target curve.
[0095] In one example, the server can perform binarization processing on the coordinate axis classification result generated by each pixel point in the curve image according to the coordinate axis segmentation model, such as Figure 2B As shown in , the coordinate axis classification results output by the coordinate axis segmentation model are displayed in the form of a visual binary image. Figure 2B It can be seen that the accuracy of performing coordinate axis segmentation on the curve image using the coordinate axis segmentation model in this embodiment is relatively high.
[0096] In another example, the server can perform binarization processing on the curve classification result generated by each pixel in the curve image according to the curve segmentation model, such as Figure 2C As shown in , the curve classification results output by the curve segmentation model are displayed in the form of a visual binary image. Figure 2C It can be seen that the curve segmentation model used in this embodiment has a high accuracy rate in performing curve segmentation on the curve image.
[0097] In this embodiment, by separating the segmentation operations of the coordinate axis and the curve, and using different segmentation models to perform coordinate axis segmentation and curve segmentation on the curve image, the segmentation accuracy of the coordinate axis segmentation model and the curve segmentation model can be improved. At the same time, since the segmentation tasks of the coordinate axis segmentation model and the curve segmentation model are single, the model training cost of the coordinate axis segmentation model and the curve segmentation model can also be reduced.
[0098] In one embodiment, the target curve may include multiple curve categories. Step S208, using the curve segmentation model to determine second pixel points belonging to the curve category from the curve image based on the curve classification result, clustering the second pixel points to obtain a curve position corresponding to the target curve, may also include: using the curve segmentation model to determine second pixel points belonging to the same curve category from the curve image based on the curve classification result, clustering the second pixel points in the same curve category, and obtaining a curve position of the target curve corresponding to each curve category.
[0099] The curve categories may include but are not limited to waveform categories, hyperbola categories, spiral line categories, dotted line categories, solid line categories, and other categories.
[0100] Specifically, the server can use the sample curves corresponding to each curve category as training data, and use the annotation results of the pixel points in the sample curves (for example, belonging to the waveform category / hyperbola category / dotted line category / non-curve category, etc.) as the labels of the training data, and iteratively train the initial curve segmentation model to obtain a pre-trained curve segmentation model.
[0101] The curve image is input into a pre-trained curve segmentation model. The curve segmentation model then performs curve detection on the curve image, referring to the curve detection method provided in the above-described embodiment, to generate a curve classification result corresponding to each pixel. The curve segmentation model then determines, based on the curve classification results for each pixel, a second pixel belonging to the same curve category in the curve image. Clustering is then performed on the second pixel belonging to each curve category, forming a clustering result corresponding to each curve category. This results in the curve position of the target curve corresponding to each curve category.
[0102] In this embodiment, by increasing the curve variety richness of the curve segmentation model training data, the curve segmentation model can be applied to curve segmentation scenarios under a variety of different curve categories, thereby improving the flexibility of the curve segmentation model.
[0103] In one embodiment, Figure 3 As shown, step S204, using the coordinate axis segmentation model to determine the first pixel point belonging to the coordinate axis category from the curve image according to the coordinate axis classification result, clustering the first pixel point to obtain the axis position corresponding to the coordinate axis, including:
[0104] In step S302 , a first horizontal axis pixel point belonging to the horizontal axis category and a first vertical axis pixel point belonging to the vertical axis category are determined from the curve image according to the coordinate axis classification result using a coordinate axis segmentation model.
[0105] Step S304 , clustering the first horizontal axis pixel points using a coordinate axis segmentation model to obtain a horizontal axis position corresponding to the horizontal axis, and clustering the first vertical axis pixel points to obtain a vertical axis position corresponding to the vertical axis.
[0106] Step S306 : determining the origin position of the coordinate system according to the horizontal axis position and the vertical axis position through the coordinate axis segmentation model.
[0107] Specifically, the server can use sample coordinate axis images that have been labeled with horizontal axis categories, vertical axis categories, and non-axis categories as training data, and use the labeled results as labels of the training data to iteratively train the initial coordinate axis segmentation model to obtain the coordinate axis segmentation model.
[0108] The curve image is input into the coordinate axis segmentation model, and the coordinate axis classification result for each pixel point in the curve image is generated by the coordinate axis segmentation model. According to the coordinate axis classification result, the first horizontal axis pixel point belonging to the horizontal axis category and the first vertical axis pixel point belonging to the vertical axis category are determined from the curve image.
[0109] Using the coordinate axis segmentation model, multiple first horizontal axis pixels are clustered to obtain the horizontal axis position corresponding to the horizontal axis, and multiple first vertical axis pixels are clustered to obtain the vertical axis position corresponding to the vertical axis. The horizontal axis position corresponding to the horizontal axis and the vertical axis position corresponding to the vertical axis are compared to determine the pixel coordinates shared by the horizontal and vertical axis positions, thereby obtaining the intersection of the horizontal and vertical axes, which is also the origin of the coordinate system.
[0110] In this embodiment, the coordinate axis segmentation model is used to determine the pixel points belonging to the horizontal axis category and the pixel points under the vertical axis category, and the horizontal axis pixel points and the vertical axis pixel points are clustered respectively to obtain the horizontal axis and vertical axis of the coordinate system. The origin position of the coordinate system is determined based on the horizontal axis position and the vertical axis position, which can improve the segmentation accuracy of the coordinate axis segmentation model, thereby further improving the accuracy of the subsequently established coordinate system.
[0111] In one embodiment, Figure 4A As shown, step S108, matching the coordinate axis and scale text identifier according to the axis position and scale position to determine the coordinate system, includes:
[0112] Step S402: Obtain a first distance between the scale text mark and the horizontal axis, and a second distance between the scale text mark and the vertical axis.
[0113] Specifically, the server may determine a target horizontal axis scale located on the same vertical line as the scale text identifier based on the scale position of the scale text identifier and the horizontal axis position corresponding to the horizontal axis. The spacing between the scale text identifier and the target horizontal axis scale at this time is used as the first spacing. The server may determine a target vertical axis scale located on the same horizontal line as the scale text identifier based on the scale position of the scale text identifier and the vertical axis position corresponding to the vertical axis. The spacing between the scale text identifier and the target vertical axis scale at this time is used as the second spacing.
[0114] Since the horizontal axis scale corresponding to the horizontal axis in the coordinate system is distributed along and near the horizontal axis, and the vertical axis scale corresponding to the vertical axis is distributed along and near the vertical axis, the server can compare the first and second distances with the preset distance thresholds. If the first distance is less than the preset distance threshold, step S404 is executed, and if the second distance is less than the preset threshold, step S406 is executed. Optionally, in some embodiments, when the server determines that the first distance is less than the preset distance threshold, there is no need to compare the second distance with the preset distance threshold.
[0115] Step S404 : In response to the comparison result that the first distance is smaller than the preset distance threshold, the scale text identifier is matched with the horizontal axis, and a first mapping relationship between the scale result and the horizontal axis scale is established.
[0116] Step S406 : In response to the comparison result that the second distance is smaller than the preset distance threshold, the scale text identifier is matched with the vertical axis, and a second mapping relationship between the scale result and the vertical axis scale is established.
[0117] Specifically, in response to a comparison result that the first spacing is less than a preset spacing threshold, the server may match the scale text identifier with the horizontal axis, and establish a first mapping relationship between the scale result of the scale text identifier and the target horizontal axis scale corresponding to the scale text identifier in the horizontal axis. Alternatively, in response to a comparison result that the second spacing is less than a preset spacing threshold, the server may match the scale text identifier with the vertical axis, and establish a second mapping relationship between the scale result of the scale text identifier and the target vertical axis scale corresponding to the scale text identifier in the vertical axis.
[0118] Step S408, determining the coordinate system position of the coordinate system according to the horizontal axis position, the origin position and the vertical axis position, determining the scale mapping relationship corresponding to the coordinate system according to the first mapping relationship and the second mapping relationship, and determining the coordinate system using the coordinate system position and the scale mapping relationship.
[0119] Specifically, the server may use the pixel coordinate set corresponding to the horizontal axis position, the origin position, and the vertical axis position as the coordinate system position of the coordinate system in the curve graph. Multiple scale text identifiers matching the horizontal axis are determined from the first mapping relationship, and the scale position distances and scale result differences between the determined multiple scale text identifiers are obtained. The scale position distances and scale result differences are calculated to obtain a first pixel distance corresponding to a unit horizontal axis scale in the horizontal axis. Multiple scale text identifiers matching the vertical axis are determined from the second mapping relationship, and the scale position distances and scale result differences between the determined multiple scale text identifiers are obtained to determine a second pixel distance corresponding to a unit vertical axis scale in the vertical axis. A scale mapping relationship is established between the unit scale result corresponding to the unit horizontal axis scale and the first pixel distance, and a scale mapping relationship is established between the unit scale result corresponding to the unit vertical axis scale and the second pixel distance. Thus, a scale mapping relationship corresponding to the coordinate system is obtained. Coordinate system modeling is performed using the coordinate system position and scale mapping relationship, and the coordinate system is determined in the curve image.
[0120] For example, the size of the curve image obtained by the server may be (w, h).
[0121] In the curve image, there may be scale text labels "A" and "E" corresponding to the horizontal axis. The scale position of the scale text label "A" is (X_A_w, X_A_h), and the scale result is A. The scale position of the scale text label "E" is (X_E_w, X_E_h), and the scale result is E. The server can generate the first pixel distance according to the following formula:
[0122] x_pixel_ditance=(X_E_h-X_A_h) / (EA)
[0123] Here, x_pixel_ditance can be used to represent the first pixel distance.
[0124] In the curve image, there may be scale text labels "C" and "D" corresponding to the vertical axis. The scale position of the scale text label "C" is (Y_C_w, Y_C_h), and the scale result is C. The scale position of the scale text label "D" is (Y_D_w, Y_D_h), and the scale result is D. The server can generate the second pixel distance according to the following formula:
[0125] y_pixel_ditance=(Y_C_h-Y_D_h) / (CD)
[0126] Among them, y_pixel_ditance can be used to represent the second pixel distance.
[0127] In this embodiment, the scale text identifier and the coordinate axis are matched by the spacing between the scale text identifier and the horizontal and vertical axes, and a mapping relationship between the scale result and the coordinate axis scale is established. The mapping relationship is used to determine the pixel distance corresponding to the unit scale of the coordinate axis, thereby establishing a scale mapping relationship between the unit scale result and the pixel distance. The coordinate system in the curve image is modeled using the coordinate system position and the scale mapping relationship, and the coordinate system in the curve image is determined. This can improve the accuracy of coordinate system determination. At the same time, since this embodiment does not require specific scenarios and preset specified coordinate information, it can also improve the generalization and robustness of the coordinate system determination method.
[0128] In one embodiment, step S110 determines the relative position of the target curve in the coordinate system based on the curve position, and generates curve data corresponding to the target curve based on the target scale result corresponding to the relative position in the coordinate system, including: determining the relative position of the target curve in the coordinate system based on the curve position and the origin position; converting the relative position according to the scale mapping relationship to obtain the target scale result corresponding to the relative position in the coordinate system, and generating curve data corresponding to the target curve using the target scale result.
[0129] Specifically, the server can perform computational processing on the curve position corresponding to each pixel point in the target curve and the origin position of the coordinate system to determine the relative position of each pixel point in the target curve in the coordinate system. The server then uses a scale conversion relationship to convert the relative position corresponding to each pixel point in the target curve to obtain the target scale result corresponding to each pixel point in the target curve in the coordinate system. Using the target scale result corresponding to each pixel point in the target curve, the server generates curve data corresponding to the target curve.
[0130] In an example, Figure 4B As shown in FIG, a schematic diagram of a curve image is provided, wherein the curve image may include any pixel point P. Figure 4C As shown, the server can determine the relative position of the pixel point in the coordinate system based on the origin position of the coordinate system and the pixel position of the pixel point. For example, the server can obtain the relative position corresponding to any pixel point P in the curve image by referring to the following formula:
[0131] Xp-o=(Xp-Xo)
[0132] Yp-o=(Yp-Yo)
[0133] Among them, (Xp, Yp) can be used to represent the pixel position corresponding to pixel point P. (Xo, Yo) can be used to represent the origin position of the coordinate system origin o in the curve image. (Xp-0, Yp-o) can be used to represent the relative position of pixel point P in the coordinate system.
[0134] In another example, Figure 4D As shown, a schematic diagram of a curve image is provided, wherein the curve image may include a pixel point B on the target curve. The server may obtain the target scale result corresponding to the pixel point B in the target curve by referring to the following formula:
[0135] Xb=(XB-Xo) / x_Bixel_ditance=(15-5)*(XB-Xo) / (X_15_h-X_5_h)
[0136] Yb=(YB-Yo) / y_Bixel_ditance=(120-20)*(YB-Yo) / (Y_120_h-Y_20_h)
[0137] Among them, (XB, YB) can be used to represent the pixel position corresponding to pixel point B. (Xo, Yo) can be used to represent the origin position of the coordinate system origin in the curve image. Xb can be used to represent the relative position of the horizontal axis corresponding to the horizontal axis of the coordinate system of the pixel point B. Yb can be used to represent the relative position of the vertical axis corresponding to the vertical axis of the coordinate system of the pixel point B. The meanings of the remaining parameters can be determined by referring to the corresponding interpretations of the same parameters provided in the above embodiments and will not be elaborated on here.
[0138] In this embodiment, the relative position of the target curve in the coordinate system is determined based on the curve position and the origin position, and the relative position is converted using a scale conversion relationship to obtain a target scale result corresponding to the target curve, thereby generating curve data corresponding to the target curve, which can improve the efficiency and accuracy of curve data extraction.
[0139] In one embodiment, Figure 5 As shown, a method for extracting curve data is provided, comprising:
[0140] Step S502: Acquire the curve image to be processed.
[0141] Step S504: input the curve image into a coordinate axis segmentation model, and determine the coordinate system position through the coordinate axis segmentation model.
[0142] Specifically, the server can obtain a curve image to be processed. The curve image is input into a pre-trained coordinate axis segmentation model. The coordinate axis detection of the curve image is performed using the coordinate axis segmentation model to generate a coordinate axis classification result corresponding to each pixel in the curve image. The pixels are clustered according to the coordinate axis classification result to form a horizontal axis position corresponding to the horizontal axis and a vertical axis position corresponding to the vertical axis. The origin position is determined based on the horizontal and vertical axis positions. The coordinate system position is determined using the pixel coordinates corresponding to the horizontal and vertical axis positions and the origin position.
[0143] Step S506: Perform text recognition processing on the curve image to determine the scale position and scale result of the scale text mark.
[0144] Specifically, the server can perform text detection on the curve image to determine the text box area where each scale text mark in the curve image is located. A text recognition algorithm is then used to detect the text box area and determine the text recognition result, also known as the scale result. This results in the scale position and scale result corresponding to each scale text mark in the curve image.
[0145] Step S508 : determining the distance between the scale text mark and the coordinate axis, matching the scale text mark with the coordinate axis, and establishing a mapping relationship between the scale result and the coordinate axis scale.
[0146] Step S510: determining a scale mapping relationship corresponding to the coordinate system according to the first mapping relationship and the second mapping relationship, and determining the coordinate system by using the coordinate system position and the scale mapping relationship.
[0147] Specifically, the server can determine the spacing between the scale text identifier and the coordinate axis based on the scale position, the horizontal axis position, and the vertical axis position. The spacing is compared with a preset spacing threshold, and in response to the comparison result that the spacing is less than the preset spacing threshold, the scale text identifier is matched with the coordinate axis, and a first mapping relationship between the scale result and the horizontal axis scale and a second mapping relationship between the scale result and the vertical axis scale are established. The first mapping relationship is used to process multiple scale text identifiers that match the horizontal axis to determine the pixel distance corresponding to the unit horizontal axis scale. The second mapping relationship is used to process multiple scale text identifiers that match the vertical axis to determine the pixel distance corresponding to the unit vertical axis scale. In this way, a scale mapping relationship corresponding to the coordinate system is established, and the coordinate system is determined using the coordinate system position and the scale mapping relationship.
[0148] Step S512: input the curve image into a curve segmentation model, and determine the curve position of the target curve through the curve segmentation model.
[0149] Step S514 , determining the relative position of the target curve in the coordinate system according to the curve position, converting the relative position using a scale mapping relationship to obtain a target scale result, and generating curve data corresponding to the target curve.
[0150] Specifically, the server can input a curve image into a curve segmentation model, which then performs curve segmentation on the curve image, generating curve classification results for each pixel. Based on the curve classification results, the curve position of the target curve corresponding to each curve category is determined. The curve position and the origin position are then calculated to determine the relative position of the target curve in the coordinate system. A scale mapping relationship is then used to convert the relative position to obtain the target scale result, generating curve data corresponding to the target curve.
[0151] In this embodiment, a curve image to be processed is obtained, the curve image includes a coordinate system and a target curve located in the coordinate system, and the coordinate system includes a coordinate axis and a scale text identifier; the curve image is input into a pre-trained semantic segmentation model, and the classification result of each pixel point in the curve image is determined by the semantic segmentation model, and multiple pixel points are clustered according to the classification result to obtain the axis position corresponding to the coordinate axis and the curve position corresponding to the target curve; text recognition processing is performed on the curve image to determine the scale position and scale result of the scale text identifier; the coordinate axis and the scale text identifier are matched according to the axis position and the scale position to determine the coordinate system; the relative position of the target curve in the coordinate system is determined according to the curve position, and curve data corresponding to the target curve is generated according to the target scale result corresponding to the relative position in the coordinate system. The coordinate system in the curve image can be restored, thereby improving the data extraction efficiency and accuracy of the curve image.
[0152] In addition, since the curve data extraction method provided in this application only uses a semantic segmentation model to segment the curve image, it can simplify the segmentation operation of the curve image based on the neural network classification principle, so that the image segmentation is not limited to specific conditions such as the color or curvature of the curve, thereby improving the robustness and anti-interference ability of the curve image segmentation.
[0153] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the steps or stages in other steps.
[0154] Based on the same inventive concept, embodiments of the present application also provide a curve data extraction device for implementing the aforementioned curve data extraction method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more curve data extraction device embodiments provided below can be found in the aforementioned limitations of the curve data extraction method and will not be further elaborated here.
[0155] In one embodiment, Figure 6As shown, a curve data extraction device 600 is provided, comprising: an image acquisition module 602, an image segmentation module 604, a text recognition module 606, a coordinate system establishment module 608 and a data generation module 610, wherein:
[0156] The image acquisition module 602 is used to acquire a curve image to be processed, wherein the curve image includes a coordinate system and a target curve located in the coordinate system, wherein the coordinate system includes a coordinate axis and a scale text identifier.
[0157] The image segmentation module 604 is used to input the curve image into a pre-trained semantic segmentation model, determine the classification result of each pixel point in the curve image through the semantic segmentation model, and cluster multiple pixel points according to the classification result to obtain the axis position corresponding to the coordinate axis and the curve position corresponding to the target curve.
[0158] The text recognition module 606 is used to perform text recognition processing on the curve image to determine the scale position and scale result of the scale text mark.
[0159] The coordinate system establishing module 608 is used to match the coordinate axis and the scale text identifier according to the axis position and the scale position to determine the coordinate system.
[0160] The data generation module 610 is used to determine the relative position of the target curve in the coordinate system according to the curve position, and generate curve data corresponding to the target curve according to the target scale result corresponding to the relative position in the coordinate system.
[0161] In one embodiment, the semantic segmentation model includes a coordinate axis segmentation model and a curve segmentation model.
[0162] The image segmentation module 604 includes: a first segmentation unit, which is used to input the curve image into the coordinate axis segmentation model, perform coordinate axis detection on the curve image through the coordinate axis segmentation model, and generate a coordinate axis classification result for each pixel point; a first position unit, which is used to determine the first pixel point belonging to the coordinate axis category from the curve image according to the coordinate axis classification result through the coordinate axis segmentation model, and cluster the first pixel point to obtain the axis position corresponding to the coordinate axis; a second segmentation unit, which is used to input the curve image into the curve segmentation model, perform curve detection on the curve image through the curve segmentation model, and generate a curve classification result for each pixel point; a second position unit, which is used to determine the second pixel point belonging to the curve category from the curve image according to the curve classification result through the curve segmentation model, and cluster the second pixel point to obtain the curve position corresponding to the target curve.
[0163] In one embodiment, the target curve includes multiple curve categories. The second position unit is further configured to determine, from the curve image, second pixels belonging to the same curve category based on the curve classification result using the curve segmentation model, and cluster the second pixels belonging to the same curve category to obtain the curve position of the target curve corresponding to each curve category.
[0164] In one embodiment, the first position unit is also used to determine the first horizontal axis pixel point belonging to the horizontal axis category and the first vertical axis pixel point belonging to the vertical axis category from the curve image according to the coordinate axis classification result through the coordinate axis segmentation model; cluster the first horizontal axis pixel point through the coordinate axis segmentation model to obtain the horizontal axis position corresponding to the horizontal axis, and cluster the first vertical axis pixel point to obtain the vertical axis position corresponding to the vertical axis; determine the origin position of the coordinate system according to the horizontal axis position and the vertical axis position through the coordinate axis segmentation model.
[0165] In one embodiment, the coordinate system establishment module 608 includes: a spacing determination unit, which is used to determine a first spacing between the scale text identifier and the horizontal axis according to the scale position and the horizontal axis position, and determine a second spacing between the scale text identifier and the vertical axis according to the scale position and the vertical axis position; a mapping establishment unit, which is used to match the scale text identifier with the horizontal axis in response to a comparison result that the first spacing is less than a preset spacing threshold, and establish a first mapping relationship between the scale result and the horizontal axis scale; or, in response to a comparison result that the second spacing is less than a preset spacing threshold, match the scale text identifier with the vertical axis, and establish a second mapping relationship between the scale result and the vertical axis scale; a coordinate system determination unit, which is used to determine the coordinate system position of the coordinate system according to the horizontal axis position, the origin position and the vertical axis position, determine the scale mapping relationship corresponding to the coordinate system according to the first mapping relationship and the second mapping relationship, and determine the coordinate system using the coordinate system position and the scale mapping relationship.
[0166] In one embodiment, the data generation module 610 includes: a position determination unit, which is used to determine the relative position of the target curve in the coordinate system based on the curve position and the origin position; a position conversion unit, which is used to convert the relative position according to the scale mapping relationship, obtain a target scale result corresponding to the relative position in the coordinate system, and use the target scale result to generate curve data corresponding to the target curve.
[0167] Each module in the curve data extraction device described above may be implemented in whole or in part through software, hardware, or a combination thereof. Each module may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0168] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory and a network interface connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as the axis position of the coordinate axis, the curve position of the target curve, the scale position of the scale text mark and the scale result. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a method for extracting curve data is implemented.
[0169] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0170] In one embodiment, a computer device is further provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.
[0171] In one embodiment, a computer-readable storage medium is further provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0172] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0173] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, and the like.
[0174] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0175] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A method for extracting curve data, characterized in that: The method comprises: Acquire a curve image to be processed, wherein the curve image includes a coordinate system and a target curve located in the coordinate system, wherein the coordinate system includes a coordinate axis and a scale text identifier; Inputting the curve image into a pre-trained semantic segmentation model, determining a classification result of each pixel in the curve image through the semantic segmentation model, and clustering the plurality of pixels according to the classification result to obtain an axis position corresponding to the coordinate axis and a curve position corresponding to the target curve; Performing text recognition processing on the curve image to determine the scale position and scale result of the scale text mark; Matching the coordinate axis and the scale text identifier according to the axis position and the scale position to determine the coordinate system; Determining the relative position of the target curve in the coordinate system according to the curve position, and generating curve data corresponding to the target curve according to a target scale result corresponding to the relative position in the coordinate system; Wherein, the semantic segmentation model includes a coordinate axis segmentation model and a curve segmentation model; Inputting the curve image into a pre-trained semantic segmentation model, determining a classification result of each pixel in the curve image by the semantic segmentation model, and clustering a plurality of the pixels according to the classification result to obtain an axis position corresponding to the coordinate axis and a curve position corresponding to the target curve, including: Inputting the curve image into the coordinate axis segmentation model, performing coordinate axis detection on the curve image through the coordinate axis segmentation model, and generating a coordinate axis classification result for each pixel point; Determining a first pixel point belonging to a coordinate axis category from the curve image according to the coordinate axis classification result by using the coordinate axis segmentation model, and clustering the first pixel point to obtain an axis position corresponding to the coordinate axis; Inputting the curve image into the curve segmentation model, performing curve detection on the curve image through the curve segmentation model, and generating a curve classification result for each pixel point; The curve segmentation model is used to determine second pixel points belonging to the curve category from the curve image according to the curve classification result, and the second pixel points are clustered to obtain the curve position corresponding to the target curve.
2. The method according to claim 1, characterized in that The target curve includes multiple curve categories; Determining second pixel points belonging to a curve category from the curve image using the curve segmentation model according to the curve classification result, and clustering the second pixel points to obtain a curve position corresponding to the target curve, includes: The curve segmentation model is used to determine the second pixel points belonging to the same curve category from the curve image according to the curve classification result, and the second pixel points under the same curve category are clustered respectively to obtain the curve position of the target curve corresponding to each curve category.
3. The method according to claim 1, characterized in that The step of determining a first pixel point belonging to a coordinate axis category from the curve image by using the coordinate axis segmentation model according to the coordinate axis classification result, and clustering the first pixel point to obtain an axis position corresponding to the coordinate axis includes: Determining, from the curve image, a first horizontal axis pixel point belonging to the horizontal axis category and a first vertical axis pixel point belonging to the vertical axis category according to the coordinate axis classification result using the coordinate axis segmentation model; Clustering the first horizontal axis pixel points using the coordinate axis segmentation model to obtain a horizontal axis position corresponding to the horizontal axis, and clustering the first vertical axis pixel points to obtain a vertical axis position corresponding to the vertical axis; The origin position of the coordinate system is determined according to the horizontal axis position and the vertical axis position through the coordinate axis segmentation model.
4. The method according to claim 3, characterized in that The matching of the coordinate axis and the scale text identifier according to the axis position and the scale position to determine the coordinate system includes: Determine a first distance between the scale text mark and the horizontal axis according to the scale position and the horizontal axis position, and determine a second distance between the scale text mark and the vertical axis according to the scale position and the vertical axis position; In response to a comparison result that the first spacing is less than a preset spacing threshold, matching the scale text identifier with the horizontal axis to establish a first mapping relationship between the scale result and the horizontal axis scale; or In response to a comparison result that the second spacing is smaller than the preset spacing threshold, matching the scale text identifier with the vertical axis, and establishing a second mapping relationship between the scale result and the vertical axis scale; The coordinate system position of the coordinate system is determined according to the horizontal axis position, the origin position and the vertical axis position, the scale mapping relationship corresponding to the coordinate system is determined according to the first mapping relationship and the second mapping relationship, and the coordinate system is determined using the coordinate system position and the scale mapping relationship.
5. The method according to claim 4, characterized in that Determining the relative position of the target curve in the coordinate system according to the curve position, and generating curve data corresponding to the target curve according to a target scale result corresponding to the relative position in the coordinate system, includes: Determining the relative position of the target curve in the coordinate system according to the curve position and the origin position; The relative position is converted according to the scale mapping relationship to obtain a target scale result corresponding to the relative position in the coordinate system, and curve data corresponding to the target curve is generated using the target scale result.
6. A device for extracting curve data, characterized in that: The device comprises: An image acquisition module is used to acquire a curve image to be processed, wherein the curve image includes a coordinate system and a target curve located in the coordinate system, wherein the coordinate system includes a coordinate axis and a scale text identifier; An image segmentation module is configured to input the curve image into a pre-trained semantic segmentation model, determine a classification result for each pixel in the curve image using the semantic segmentation model, and cluster the plurality of pixels according to the classification result to obtain an axis position corresponding to the coordinate axis and a curve position corresponding to the target curve; A text recognition module is used to perform text recognition processing on the curve image to determine the scale position and scale result of the scale text mark; A coordinate system establishing module, configured to match the coordinate axis and the scale text identifier according to the axis position and the scale position to determine the coordinate system; a data generating module, configured to determine a relative position of the target curve in the coordinate system according to the curve position, and generate curve data corresponding to the target curve according to a target scale result corresponding to the relative position in the coordinate system; Wherein, the semantic segmentation model includes a coordinate axis segmentation model and a curve segmentation model; The image segmentation module comprises: a first segmentation unit, configured to input the curve image into the coordinate axis segmentation model, perform coordinate axis detection on the curve image through the coordinate axis segmentation model, and generate a coordinate axis classification result for each pixel point; a first position unit, configured to determine, from the curve image, a first pixel point belonging to a coordinate axis category according to the coordinate axis classification result using the coordinate axis segmentation model, and cluster the first pixel point to obtain an axis position corresponding to the coordinate axis; a second segmentation unit, configured to input the curve image into the curve segmentation model, perform curve detection on the curve image through the curve segmentation model, and generate a curve classification result for each pixel point; The second position unit is used to determine a second pixel point belonging to the curve category from the curve image according to the curve classification result through the curve segmentation model, and cluster the second pixel point to obtain the curve position corresponding to the target curve.
7. The device according to claim 6, characterized in that The target curve includes multiple curve categories; The second position unit is also used to determine the second pixel points belonging to the same curve category from the curve image according to the curve classification result through the curve segmentation model, and cluster the second pixel points under the same curve category respectively to obtain the curve position of the target curve corresponding to each of the curve categories.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Statistical graph data extraction method, electronic equipment and storage medium
CN113095267A
Custom multi axis chart visualization
US20180165844A1