Image data classification method and device, processor and electronic equipment

By scaling the proportions of the hardware platform and the target vision library on the image data, generating target scaling features and predicting them, the problem of low classification accuracy of image data on different hardware platforms is solved, and higher classification accuracy is achieved.

CN119904689APending Publication Date: 2025-04-29CHINA TELECOM ARTIFICIAL INTELLIGENCE TECHNOLOGY (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411978653.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-29

AI Technical Summary

Technical Problem

The scaling phenomenon of image data when running on different hardware platforms leads to loss of image features, thereby reducing the classification accuracy of image data.

Method used

By acquiring the initial image data, scaling according to different proportions of the hardware platform and the target vision library, the first zoomed image data and the second zoomed image data are generated. Then, based on these two scaling image data, the target scaling feature is determined and input into the prediction model for prediction to obtain the prediction results of the initial image data.

Benefits of technology

It avoids the problem of inconsistent hardware scaling and OpenCV scaling, and improves the classification accuracy of image data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119904689A_ABST
    Figure CN119904689A_ABST
Patent Text Reader

Abstract

The invention discloses an image data classification method and device, a processor and electronic equipment. The method comprises the following steps: acquiring initial image data collected in a target scene; scaling the initial image data according to a first target proportion to obtain first scaled image data, and scaling the initial image data according to a second target proportion to obtain second scaled image data; determining a target scaling feature of the first scaled image data based on the first scaled image data and the second scaled image data; and inputting the target zoom feature into a target prediction model for prediction to obtain a target prediction result of the initial image data. The technical problem of low classification accuracy of the image data is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing, and in particular to an image data classification method, device, processor and electronic device. Background Art

[0002] In the process of image processing, when the prediction model runs on different hardware platforms, image scaling often occurs. Since the scaled image loses important features, it leads to the technical problem of low classification accuracy of image data.

[0003] Currently, no effective solution has been proposed to the technical problem of low classification accuracy of the above-mentioned image data. Summary of the invention

[0004] Embodiments of the present invention provide a method, device, processor and electronic device for classifying image data, so as to at least solve the technical problem of low classification accuracy of image data.

[0005] According to one aspect of an embodiment of the present invention, a method for classifying image data is provided, the method comprising: acquiring initial image data collected in a target scene; scaling the initial image data according to a first target ratio to obtain first scaled image data, and scaling the initial image data according to a second target ratio to obtain second scaled image data, wherein the first target ratio is used to indicate the ratio at which the initial image data is scaled using a hardware platform, and the second target ratio is used to indicate the ratio at which the initial image data is scaled using a target visual library; determining a target scaling feature of the first scaled image data based on the first scaled image data and the second scaled image data; inputting the target scaling feature into a target prediction model for prediction to obtain a target prediction result of the initial image data, wherein the target prediction model is obtained by training the initial prediction model using the scaling features of scaled image data samples of the image data samples and the corresponding prediction result samples, the target prediction result is used to indicate the category to which the initial image data belongs, and the prediction result sample is used to indicate the category to which the image data sample belongs.

[0006] Optionally, determining a target zoom feature of the first zoomed image data based on the first zoomed image data and the second zoomed image data includes: performing feature extraction on the first zoomed image data to obtain a first zoom feature of the first zoomed image data, and performing feature extraction on the second zoomed image data to obtain a second zoom feature of the second zoomed image data; and determining a target zoom feature based on the first zoom feature and the second zoom feature.

[0007] Optionally, determining a target scaling feature based on the first scaling feature and the second scaling feature includes: determining a similarity between the first scaling feature and the second scaling feature; determining gradient information of a loss function that matches the similarity; and determining the target scaling feature based on the gradient information and the first scaling feature.

[0008] Optionally, determining a target scaling feature based on the gradient information and the first scaling feature includes: determining a product value between a learning rate of the gradient information and the gradient information; determining a sum value between the first scaling feature and the product value; and determining the sum value as the target scaling feature.

[0009] Optionally, the target scaling feature is input into the target prediction model for prediction to obtain a target prediction result of the initial image data, including: inputting the target scaling feature into the target prediction model for prediction to obtain an initial prediction result, wherein the initial prediction result is used to indicate the possibility that the initial image data belongs to different categories; based on the initial prediction result, determining the target prediction result.

[0010] Optionally, the initial prediction result includes different probabilities corresponding to different categories, and the probability is used to indicate the degree of possibility that the initial image data belongs to the corresponding category. Based on the initial prediction result, the target prediction result is determined, including: determining the target probability from the different probabilities in the initial prediction result, wherein the target probability is greater than the probability among the different probabilities except the target probability; and determining the target probability as the target prediction result.

[0011] According to one aspect of an embodiment of the present invention, there is provided an image data classification device, which may include: an acquisition unit, configured to acquire initial image data collected in a target scene; a scaling unit, configured to scale the initial image data according to a first target ratio to obtain first scaled image data, and to scale the initial image data according to a second target ratio to obtain second scaled image data, wherein the first target ratio is used to indicate the ratio at which the initial image data is scaled using a hardware platform, and the second target ratio is used to indicate the ratio at which the initial image data is scaled using a target visual library; a determination unit, configured to determine a target scaling feature of the first scaled image data based on the first scaled image data and the second scaled image data; and a prediction unit, configured to input the target scaling feature into a target prediction model for prediction, to obtain a target prediction result of the initial image data, wherein the target prediction model is obtained by training the initial prediction model using the scaling features of scaled image data samples of the image data samples and the corresponding prediction result samples, the target prediction result is used to indicate the category to which the initial image data belongs, and the prediction result sample is used to indicate the category to which the image data sample belongs.

[0012] According to another aspect of an embodiment of the present invention, a processor is further provided, wherein the processor is used to run a program, wherein when the program is run by the processor, the image data classification method in the embodiment of the present invention is executed.

[0013] According to another aspect of an embodiment of the present invention, an electronic device is provided, including: a memory storing an executable program; and a processor for running the program, wherein the image data classification method in each embodiment of the present invention is executed when the program is running.

[0014] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the image data classification method in the present invention.

[0015] According to another aspect of an embodiment of the present invention, a computer program product is further provided. The computer program product includes a computer program. When the computer program is executed by a processor, the image data classification method in the embodiment of the present invention is implemented.

[0016] According to another aspect of an embodiment of the present invention, a computer program product is also provided, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, the image data classification method in the embodiment of the present invention is implemented.

[0017] According to another aspect of the embodiments of the present invention, the embodiments of the present application further provide a computer program, which, when executed by a processor, implements the image data classification method in the above-mentioned embodiments of the present invention.

[0018] In an embodiment of the present invention, when classifying image data, initial image data collected in a target scene can be obtained. The acquired initial image data is scaled according to a first target ratio to obtain first scaled image data, and the acquired initial image data is scaled according to a second target ratio to obtain second scaled image data. According to the above-mentioned first scaled image data and the above-mentioned second scaled image data obtained by scaling, the target scaling feature of the first scaled image data can be determined, and the above-mentioned determined target scaling feature is input into the target prediction model for prediction, and the target prediction result of the initial image data can be obtained, thereby achieving the purpose of avoiding the inconsistency between hardware scaling and scaling of the target visual library (for example, OpenCV library), thereby solving the technical problem of low classification accuracy of image data, and then achieving the technical effect of improving the classification accuracy of image data. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0020] Figure 1 is a flow chart of a method for classifying image data according to an embodiment of the present invention;

[0021] Figure 2 is a flow chart of a method for correcting features of image data according to an embodiment of the present invention;

[0022] Figure 3 is a schematic diagram of a device for classifying image data according to an embodiment of the present invention. DETAILED DESCRIPTION

[0023] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only embodiments of a part of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0025] According to an embodiment of the present invention, a method for classifying image data is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0026] Figure 1 is a flow chart of a method for classifying image data according to an embodiment of the present invention. The method may include the following steps:

[0027] Step S101, acquiring initial image data collected in a target scene.

[0028] In the technical solution provided in the above step S101 of the present invention, the above target scenarios may include: monitoring scenarios, autonomous driving scenarios, medical analysis scenarios, etc., which are only given as examples here and are not specifically limited.

[0029] In this embodiment, the initial image data collected in the target scene is obtained. Optionally, in the target scene, the embodiment uses an image acquisition device to collect image data of the target area to obtain the initial image data. The image acquisition device may include at least one of the following devices or a combination thereof: an image sensor, a camera, a camera, and a drone, etc. The target area may be used to represent an area that needs to be monitored set in the target scene.

[0030] Optionally, if the target scene is a monitoring scene, in the monitoring scene, a camera is used to capture the state of an area to be monitored in the monitoring scene to obtain initial image data. The scene and acquisition equipment are only used as examples and are not specifically limited.

[0031] Step S102: scaling the initial image data according to a first target ratio to obtain first scaled image data, and scaling the initial image data according to a second target ratio to obtain second scaled image data.

[0032] In the technical solution provided in step S102 of the present invention, the first target ratio can be used to represent the ratio of scaling the initial image data using the hardware platform. For example, the first target ratio can be represented by r_h, which is only used as an example and is not specifically limited.

[0033] In this embodiment, the second target ratio can be used to represent the ratio of scaling the initial image data using the target visual library. For example, the second target ratio can be represented by r_o, which is only used as an example and is not specifically limited.

[0034] In this embodiment, after acquiring the initial image data collected in the target scene, the initial image data is scaled according to the first target ratio to obtain the first scaled image data, and the initial image data is scaled according to the second target ratio to obtain the second scaled image data. Optionally, based on the acquisition of the initial image data, the embodiment scales the initial image data according to the ratio of scaling the initial image data using the hardware platform to obtain the first scaled image data, and scales the initial image data according to the ratio of scaling the initial image data using the target visual library to obtain the second scaled image data. The first scaled image data can be represented by I_h, and the second scaled image data can be represented by I_o, which is only used as an example and is not specifically limited.

[0035] Step S103: determining a target zoom feature of the first zoomed image data based on the first zoomed image data and the second zoomed image data.

[0036] In the technical solution provided in the above step S103 of the present invention, after scaling the initial image data according to the first target ratio to obtain the first scaled image data, and scaling the initial image data according to the second target ratio to obtain the second scaled image data, the target scaling feature of the first scaled image data is determined based on the first scaled image data and the second scaled image data. Optionally, in this embodiment, based on the first scaled image data and the second scaled image data, the first scaling feature of the first scaled image data is corrected using the second scaled image data to obtain the target scaling feature of the first scaled image data.

[0037] Step S104: input the target scaling feature into the target prediction model for prediction to obtain the target prediction result of the initial image data.

[0038] In the technical solution provided in the above step S104 of the present invention, the above target prediction model can be obtained by training the initial prediction model using the scaling features of the scaled image data samples of the image data samples and the corresponding prediction result samples. The above scaled image data samples may include a first scaled image data sample and a second scaled image data sample. Optionally, the image data sample is scaled according to the first target ratio to obtain the first scaled image data sample, and the image data sample is scaled according to the second target ratio to obtain the second scaled image data sample, and the initial scaling features of the first scaled image data sample are corrected using the obtained second scaled image data sample to obtain the scaling features of the first scaled image data sample.

[0039] In this embodiment, the target prediction result can be used to indicate the category to which the initial image data belongs. The prediction result sample can be used to indicate the category to which the image data sample belongs.

[0040] In this embodiment, after determining the target scaling feature of the first scaled image data based on the first scaled image data and the second scaled image data, the target scaling feature is input into the target prediction model for prediction to obtain a target prediction result of the initial image data. Optionally, this embodiment, on the basis of determining the target scaling feature of the first scaled image data, inputs the determined target scaling feature into the target prediction model for prediction to obtain an initial prediction result, wherein the initial prediction result can be used to indicate the degree of possibility that the initial image data belongs to different categories. Based on the obtained initial prediction result, the target prediction result of the initial image data can be determined, that is, based on the degree of possibility that the initial image data belongs to different categories, the category to which the initial image data belongs can be determined.

[0041] In the above steps S101 to S104 of the present application, when classifying image data, the initial image data collected in the target scene can be obtained. The acquired initial image data is scaled according to the first target ratio to obtain the first scaled image data, and the acquired initial image data is scaled according to the second target ratio to obtain the second scaled image data. According to the above-mentioned first scaled image data and the above-mentioned second scaled image data obtained by scaling, the target scaling feature of the first scaled image data can be determined, and the above-mentioned determined target scaling feature is input into the target prediction model for prediction, and the target prediction result of the initial image data can be obtained, thereby achieving the purpose of avoiding the inconsistency between hardware scaling and OpenCV scaling, thereby solving the technical problem of low classification accuracy of image data, and then achieving the technical effect of improving the classification accuracy of image data.

[0042] The above method of this embodiment is further introduced below.

[0043] As an optional implementation method, step S103, based on the first scaled image data and the second scaled image data, determines the target scaling feature of the first scaled image data, including: performing feature extraction on the first scaled image data to obtain a first scaling feature of the first scaled image data, and performing feature extraction on the second scaled image data to obtain a second scaling feature of the second scaled image data; based on the first scaling feature and the second scaling feature, determines the target scaling feature.

[0044] In this embodiment, the first zoom feature of the first zoomed image data may be represented by F_h, and the second zoom feature of the second zoomed image data may be represented by F_o, which is only used as an example and is not specifically limited.

[0045] In this embodiment, after scaling the initial image data according to the first target ratio to obtain the first scaled image data, and scaling the initial image data according to the second target ratio to obtain the second scaled image data, feature extraction is performed on the first scaled image data to obtain the first scaled feature of the first scaled image data, and feature extraction is performed on the second scaled image data to obtain the second scaled feature of the second scaled image data. Optionally, in this embodiment, based on the first scaled image data and the second scaled image data, the first scaled image data is input into a deep learning model for feature extraction to obtain the first scaled feature of the first scaled image data, and the second scaled image data is input into a deep learning model for feature extraction to obtain the second scaled feature of the second scaled image data.

[0046] In this embodiment, after extracting features from the first scaled image data to obtain a first scaled feature of the first scaled image data, and extracting features from the second scaled image data to obtain a second scaled feature of the second scaled image data, a target scaled feature is determined based on the first scaled feature and the second scaled feature. Optionally, in this embodiment, based on obtaining the first scaled feature and the second scaled feature, the obtained first scaled feature is corrected using the obtained second scaled feature to obtain a target scaled feature of the first scaled image data.

[0047] As an optional implementation method, determining a target scaling feature based on a first scaling feature and a second scaling feature includes: determining a similarity between the first scaling feature and the second scaling feature; determining gradient information of a loss function that matches the similarity; and determining a target scaling feature based on the gradient information and the first scaling feature.

[0048] In this embodiment, the above similarity can be used to represent the similarity between the first scaling feature and the second scaling feature, and the similarity can be represented by S(F_h, F_o).

[0049] In this embodiment, after extracting features from the first scaled image data to obtain a first scaled feature of the first scaled image data, and extracting features from the second scaled image data to obtain a second scaled feature of the second scaled image data, the similarity between the first scaled feature and the second scaled feature is determined. Optionally, in this embodiment, similarity calculation is performed on the first scaled feature and the second scaled feature based on the first scaled feature and the second scaled feature, so as to obtain the similarity between the first scaled feature and the second scaled feature.

[0050] In this embodiment, the above gradient information can be used to represent the gradient of the loss function matched with the similarity, and the gradient can be used To express.

[0051] In this embodiment, after determining the similarity between the first scaling feature and the second scaling feature, the gradient information of the loss function matching the similarity is determined. Optionally, based on the similarity between the first scaling feature and the second scaling feature, this embodiment performs a difference calculation between the target parameter and the similarity to obtain a loss function matching the similarity, thereby obtaining the gradient information of the above loss function, wherein the target parameter is but not limited to 1.

[0052] In this embodiment, after determining the gradient information of the loss function matching the similarity, the target scaling feature is determined based on the gradient information and the first scaling feature. Optionally, this embodiment corrects the first scaling feature using the determined gradient information based on the determined gradient information to obtain the target scaling feature of the first scaled image data.

[0053] As an optional implementation method, determining a target scaling feature based on the gradient information and the first scaling feature includes: determining a product value between a learning rate of the gradient information and the gradient information; determining a sum value between the first scaling feature and the product value; and determining the sum value as the target scaling feature.

[0054] In this embodiment, the learning rate of the above-mentioned gradient information can be represented by α.

[0055] In this embodiment, after determining the gradient information of the loss function matching the similarity, the product value between the learning rate of the gradient information and the gradient information is determined. Optionally, based on the determination of the gradient information, this embodiment can determine the learning rate of the gradient information, and multiply the determined learning rate by the above-mentioned gradient information to obtain the product value between the learning rate of the gradient information and the gradient information, wherein the product value can be used To express.

[0056] In this embodiment, after determining the product value between the learning rate of the gradient information and the gradient information, the sum value between the first scaling feature and the product value is determined; and the sum value is determined as the target scaling feature. Optionally, this embodiment, based on determining the product value between the learning rate of the gradient information and the gradient information, performs a sum calculation on the first scaling feature of the first scaled image data and the determined product value, so as to obtain the sum value between the first scaling feature and the product value, and determines the obtained sum value as the target scaling feature, wherein the target scaling feature can be represented by F_h'.

[0057] Optionally, determining the sum value between the first scaling feature and the product value may be implemented by the following formula:

[0058]

[0059] As an optional implementation method, the target scaling feature is input into the target prediction model for prediction to obtain the target prediction result of the initial image data, including: inputting the target scaling feature into the target prediction model for prediction to obtain the initial prediction result; based on the initial prediction result, determining the target prediction result.

[0060] In this embodiment, the above initial prediction results can be used to indicate the possibility that the initial image data belongs to different categories.

[0061] In this embodiment, after determining the target zoom feature of the first zoomed image data based on the first zoomed image data and the second zoomed image data, the target zoom feature is input into the target prediction model for prediction to obtain an initial prediction result. Optionally, this embodiment, based on determining the target zoom feature of the first zoomed image data, inputs the determined target zoom feature into the target prediction model for prediction to obtain an initial prediction result, that is, the degree of possibility that the initial image data belongs to different categories can be obtained.

[0062] In this embodiment, after the target scaling feature is input into the target prediction model for prediction and an initial prediction result is obtained, the target prediction result is determined based on the initial prediction result. Optionally, based on the initial prediction result, the embodiment can determine the category to which the initial image data belongs according to the initial prediction result.

[0063] As an optional implementation method, the initial prediction result includes different probabilities corresponding to different categories, and the probability is used to indicate the possibility that the initial image data belongs to the corresponding category. Based on the initial prediction result, the target prediction result is determined, including: determining the target probability from the different probabilities in the initial prediction result; and determining the target probability as the target prediction result.

[0064] In this embodiment, the initial prediction result may include different probabilities corresponding to different categories, wherein the probability may be used to indicate the possibility that the initial image data belongs to the corresponding category.

[0065] In this embodiment, the target probability may be greater than the probabilities other than the target probability among the different probabilities.

[0066] In this embodiment, after the target scaling feature is input into the target prediction model for prediction and the initial prediction result is obtained, the target probability is determined from the different probabilities in the initial prediction result. Optionally, based on the initial prediction result, the embodiment compares the probabilities that the initial image data belongs to different categories one by one, thereby obtaining the target probability, wherein the target probability can also be called the maximum probability.

[0067] In this embodiment, after determining the target probability from different probabilities in the initial prediction result, the target probability is determined as the target prediction result. Optionally, this embodiment determines the above-mentioned target probability as the target prediction result on the basis of obtaining the target probability, that is, from different categories, the target category to which the initial image data belongs is determined as the category to which the initial image data belongs. Among them, the target category corresponds to the target probability one-to-one. For example, if the target probability indicates that the probability corresponding to category A is greater than the probability other than the probability corresponding to category A in different probabilities, then the target category is category A. This is only an example and is not specifically limited.

[0068] In an embodiment of the present invention, when classifying image data, initial image data collected in a target scene can be obtained. The acquired initial image data is scaled according to a first target ratio to obtain first scaled image data, and the acquired initial image data is scaled according to a second target ratio to obtain second scaled image data. According to the above-mentioned first scaled image data and the above-mentioned second scaled image data obtained by scaling, the target scaling feature of the first scaled image data can be determined, and the above-mentioned determined target scaling feature is input into the target prediction model for prediction, and the target prediction result of the initial image data can be obtained, thereby achieving the purpose of avoiding the inconsistency between hardware scaling and OpenCV scaling, thereby solving the technical problem of low classification accuracy of image data, and further achieving the technical effect of improving the classification accuracy of image data.

[0069] The technical solution of the embodiment of the present invention is illustrated below in conjunction with preferred implementation modes.

[0070] In the process of image processing, when the prediction model runs on different hardware platforms, image scaling often occurs. Since the scaled image loses important features, it leads to the technical problem of low classification accuracy of image data.

[0071] In order to solve the above technical problems, an embodiment of the present invention proposes a classification method for image data, which performs hardware scaling and OpenCV scaling on the acquired initial image data according to different ratios, and can obtain different scaled image data. According to the above different scaled image data, the target scaling features of the scaled image data obtained by hardware scaling are determined, and the target scaling features of the scaled image data obtained by hardware scaling are input into the target prediction model for prediction, so as to obtain the category to which the initial image data belongs, thereby achieving the purpose of avoiding the inconsistency between hardware scaling and OpenCV scaling, thereby solving the technical problem of low classification accuracy of image data, and further achieving the technical effect of improving the classification accuracy of image data.

[0072] In this embodiment, the steps included in the feature correction method of image data are executed to perform feature correction on the first scaled image data, so as to obtain the target scaled feature of the first scaled image data. For example, Figure 2 is a flow chart of a method for correcting features of image data according to an embodiment of the present invention. Figure 2 As shown, the method may include the following steps:

[0073] Step S201, obtaining an input image.

[0074] In the technical solution provided in the above step S201 of the present invention, an input image I is obtained by an image sensor. For example, in a monitoring scenario, a camera can be used to capture image data in real time.

[0075] After the input image is acquired, the process proceeds to step S202 and step S203 to perform hardware scaling on the input image and Opencv scaling on the input image.

[0076] In the technical solution provided in the above step S202 of the present invention, the hardware scaling ratio is set to r_h, and the input image is scaled to I_h. The hardware scaling may adopt, but is not limited to, algorithms such as bilinear interpolation.

[0077] In the technical solution provided in the above step S203 of the present invention, the OpenCV scaling ratio is set to r_o, and the above input image is scaled to I_o. Among them, OpenCV can use but is not limited to cubic interpolation algorithms.

[0078] After the input image is hardware scaled, the process proceeds to step S204 to perform feature extraction on the input image after hardware scaling.

[0079] In the technical solution provided in the above step S204 of the present invention, the input image after hardware scaling is input into a pre-trained deep learning model for feature extraction, and a first scaling feature F_h can be obtained.

[0080] After the input image is scaled by Opencv, the process proceeds to step S205 to perform feature extraction on the input image scaled by Opencv.

[0081] In the technical solution provided in the above step S205 of the present invention, the input image scaled by Opencv is input into a pre-trained deep learning model for feature extraction, and a second scaled feature F_o can be obtained.

[0082] After extracting features from the input image after hardware scaling and the input image after Opencv scaling, the process proceeds to step S206, where the features of the input image after Opencv scaling are used to correct the features of the input image after hardware scaling, thereby obtaining target scaling features.

[0083] In the technical solution provided in the above step S206 of the present invention, the similarity between the first scaling feature and the second scaling feature is calculated by the formula S(F_h, F_o)=(F_h^T*F_o) / (||F_h||*||F_o||), and the loss function L=1-S(F_h, F_o) matching the similarity is determined. The gradient information of the loss function is multiplied by the learning rate of the gradient information to obtain the product value between the learning rate of the gradient information and the gradient information. The first scaling feature of the first scaling image data and the determined product value By summing the calculation, we can get the first scaled feature and product value The sum of the first scaling feature of the first scaled image data and the determined product value is determined as the target scaling feature. The summation calculation can be achieved by the following formula:

[0084]

[0085] In this embodiment, the corrected target scaling feature is input into the target prediction model for prediction, and the target prediction result of the initial image data can be obtained. The target prediction result can be a classification label, a regression value or other forms of prediction results.

[0086] Optionally, if multiple input images are obtained, hardware scaling and Opencv scaling are performed on the multiple input images respectively. Feature extraction is performed on the multiple input images after hardware scaling, and feature extraction is performed on the multiple input images after Opencv scaling, and the features of the multiple input images after hardware scaling and the features of the multiple input images after Opencv scaling are clustered, so that feature sets {F_h^i} and {F_o^i} of multiple samples can be obtained. According to the feature sets of the above multiple samples, a representative feature map is selected for correction, thereby reducing the impact of noise on the prediction results. The features selected from the feature set are averaged to obtain the corrected feature F_avg = (1 / N)Σ(F_h^i), and the corrected feature F_avg is output.

[0087] In this embodiment, when classifying image data, initial image data collected in the target scene can be obtained. The acquired initial image data is scaled according to the first target ratio to obtain first scaled image data, and the acquired initial image data is scaled according to the second target ratio to obtain second scaled image data. According to the above-mentioned first scaled image data and the above-mentioned second scaled image data obtained by scaling, the target scaling feature of the first scaled image data can be determined, and the above-mentioned determined target scaling feature is input into the target prediction model for prediction, and the target prediction result of the initial image data can be obtained, thereby achieving the purpose of avoiding the inconsistency between hardware scaling and OpenCV scaling, thereby solving the technical problem of low classification accuracy of image data, and then achieving the technical effect of improving the classification accuracy of image data.

[0088] According to an embodiment of the present invention, a device for classifying image data is also provided. It should be noted that the device for classifying image data can be used to execute a method for classifying image data in an embodiment.

[0089] Figure 3 FIG. 1 is a schematic diagram of a device for classifying image data according to an embodiment of the present invention. Figure 3 As shown, the image data classification device 300 may include: an acquisition unit 301 , a scaling unit 302 , a determination unit 303 and a prediction unit 304 .

[0090] The acquisition unit 301 is used to acquire initial image data collected in a target scene.

[0091] The scaling unit 302 is used to scale the initial image data according to a first target ratio to obtain first scaled image data, and to scale the initial image data according to a second target ratio to obtain second scaled image data, wherein the first target ratio is used to represent the ratio at which the initial image data is scaled using the hardware platform, and the second target ratio is used to represent the ratio at which the initial image data is scaled using the target visual library.

[0092] The determining unit 303 is configured to determine a target scaling feature of the first scaled image data based on the first scaled image data and the second scaled image data.

[0093] The prediction unit 304 is used to input the target scaling feature into the target prediction model for prediction to obtain the target prediction result of the initial image data, wherein the target prediction model is obtained by training the initial prediction model using the scaling features of the scaled image data samples and the corresponding prediction result samples of the scaled image data samples, the target prediction result is used to indicate the category to which the initial image data belongs, and the prediction result sample is used to indicate the category to which the image data sample belongs.

[0094] Optionally, the determination unit 303 may include: an extraction module, used to perform feature extraction on the first scaled image data to obtain a first scaled feature of the first scaled image data, and to perform feature extraction on the second scaled image data to obtain a second scaled feature of the second scaled image data; and a first determination module, used to determine a target scaled feature based on the first scaled feature and the second scaled feature.

[0095] Optionally, the first determination module may include: a first determination submodule, used to determine the similarity between the first scaling feature and the second scaling feature; a second determination submodule, used to determine the gradient information of the loss function matching the similarity; and a third determination submodule, used to determine the target scaling feature based on the gradient information and the first scaling feature.

[0096] Optionally, the third determination submodule can determine the target scaling feature based on the gradient information and the first scaling feature by performing the following steps: determining the product value between the learning rate of the gradient information and the gradient information; determining the sum value between the first scaling feature and the product value; and determining the sum value as the target scaling feature.

[0097] Optionally, the prediction unit 304 may include: a prediction module, used to input the target scaling feature into the target prediction model for prediction to obtain an initial prediction result, wherein the initial prediction result is used to indicate the degree of possibility that the initial image data belongs to different categories; and a second determination module, used to determine the target prediction result based on the initial prediction result.

[0098] Optionally, the initial prediction result includes different probabilities corresponding to different categories, and the probability is used to indicate the possibility that the initial image data belongs to the corresponding category. The second determination module may include: a fourth determination submodule, used to determine the target probability from the different probabilities in the initial prediction result, wherein the target probability is greater than the probability other than the target probability in the different probabilities; and a fifth determination submodule, used to determine the target probability as the target prediction result.

[0099] In this embodiment, an acquisition unit is used to acquire initial image data collected in a target scene; a scaling unit is used to scale the initial image data according to a first target ratio to obtain first scaled image data, and to scale the initial image data according to a second target ratio to obtain second scaled image data, wherein the first target ratio is used to indicate the ratio of scaling the initial image data using a hardware platform, and the second target ratio is used to indicate the ratio of scaling the initial image data using a target visual library; a determination unit is used to determine a target scaling feature of the first scaled image data based on the first scaled image data and the second scaled image data; a prediction unit is used to input the target scaling feature into a target prediction model for prediction, and obtain a target prediction result of the initial image data, wherein the target prediction model is obtained by training the initial prediction model using the scaling features of the scaled image data samples of the image data samples and the corresponding prediction result samples, the target prediction result is used to indicate the category to which the initial image data belongs, and the prediction result sample is used to indicate the category to which the image data sample belongs, thereby achieving the purpose of avoiding inconsistency between hardware scaling and OpenCV scaling, thereby solving the technical problem of low classification accuracy of image data, and further achieving the technical effect of improving the classification accuracy of image data.

[0100] According to an embodiment of the present invention, a processor is further provided. The processor is used to run a program. When the program is run by the processor, the method for classifying image data in the embodiment is executed.

[0101] According to an embodiment of the present invention, there is further provided an electronic device, comprising: a memory storing an executable program; and a processor for running the program, wherein the method for classifying image data in the embodiment is executed when the program is running.

[0102] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the image data classification method in the embodiment.

[0103] According to an embodiment of the present invention, a computer program product is further provided. The computer program product includes a computer program. When the computer program is executed by a processor, the image data classification method in the embodiment is implemented.

[0104] According to an embodiment of the present invention, a computer program product is also provided, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, the image data classification method in the embodiment is implemented.

[0105] According to an embodiment of the present invention, a computer program is further provided. When the computer program is executed by a processor, the image data classification method in the embodiment is implemented.

[0106] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0107] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0108] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0109] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed over multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0110] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0111] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the relevant technology or the whole or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, referred to as Read-Only Memory), random access memory (RAM, referred to as Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

[0112] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for classifying image data, characterized in that: include: Acquire initial image data collected in the target scene; Scaling the initial image data according to a first target ratio to obtain first scaled image data, and scaling the initial image data according to a second target ratio to obtain second scaled image data, wherein the first target ratio is used to indicate a ratio at which the initial image data is scaled using a hardware platform, and the second target ratio is used to indicate a ratio at which the initial image data is scaled using a target visual library; determining a target scaling feature of the first scaled image data based on the first scaled image data and the second scaled image data; The target scaling feature is input into a target prediction model for prediction to obtain a target prediction result of the initial image data, wherein the target prediction model is obtained by training an initial prediction model using the scaling features of the scaled image data samples and the corresponding prediction result samples of the scaled image data samples, the target prediction result is used to represent the category to which the initial image data belongs, and the prediction result sample is used to represent the category to which the image data sample belongs.

2. The method according to claim 1, characterized in that Determining a target scaling feature of the first scaled image data based on the first scaled image data and the second scaled image data includes: performing feature extraction on the first scaled image data to obtain a first scaled feature of the first scaled image data, and performing feature extraction on the second scaled image data to obtain a second scaled feature of the second scaled image data; The target scaling feature is determined based on the first scaling feature and the second scaling feature.

3. The method according to claim 2, characterized in that Determining the target scaling feature based on the first scaling feature and the second scaling feature includes: determining a similarity between the first scaling feature and the second scaling feature; Determining gradient information of a loss function that matches the similarity; The target scaling feature is determined based on the gradient information and the first scaling feature.

4. The method according to claim 3, characterized in that Determining the target scaling feature based on the gradient information and the first scaling feature includes: Determine a product value between a learning rate of the gradient information and the gradient information; determining a sum value between the first scaling feature and the product value; The sum value is determined as the target scaling feature.

5. The method according to claim 1, characterized in that Inputting the target scaling feature into a target prediction model for prediction to obtain a target prediction result of the initial image data includes: Inputting the target scaling feature into a target prediction model for prediction to obtain an initial prediction result, wherein the initial prediction result is used to indicate the possibility that the initial image data belongs to different categories; Based on the initial prediction result, the target prediction result is determined.

6. The method according to claim 5, characterized in that The initial prediction result includes different probabilities corresponding to different categories, and the probability is used to indicate the possibility that the initial image data belongs to the corresponding category. Based on the initial prediction result, determining the target prediction result includes: Determine a target probability from the different probabilities in the initial prediction result, wherein the target probability is greater than the probabilities other than the target probability in the different probabilities; The target probability is determined as the target prediction result.

7. A device for classifying image data, characterized in that: include: An acquisition unit, used to acquire initial image data collected in a target scene; a scaling unit, configured to scale the initial image data according to a first target ratio to obtain first scaled image data, and to scale the initial image data according to a second target ratio to obtain second scaled image data, wherein the first target ratio is used to indicate a ratio at which the initial image data is scaled using a hardware platform, and the second target ratio is used to indicate a ratio at which the initial image data is scaled using a target visual library; a determining unit, configured to determine a target scaling feature of the first scaled image data based on the first scaled image data and the second scaled image data; A prediction unit is used to input the target scaling feature into a target prediction model for prediction, so as to obtain a target prediction result of the initial image data, wherein the target prediction model is obtained by training an initial prediction model using the scaling features of the scaled image data samples and the corresponding prediction result samples of the scaled image data samples, the target prediction result is used to indicate the category to which the initial image data belongs, and the prediction result sample is used to indicate the category to which the image data sample belongs.

8. A processor, characterized in that: The processor is used to run a program, wherein the program, when run by the processor, executes the image data classification method according to any one of claims 1 to 6.

9. An electronic device, characterized in that: include: A memory storing an executable program; A processor is used to run the program, wherein the program executes the image data classification method described in any one of claims 1 to 6 when running.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored executable program, wherein when the executable program is executed, the device where the storage medium is located is controlled to execute the image data classification method according to any one of claims 1 to 6.