Image classification method, device, computer equipment and storage medium

By defining the main category and subcategory and dynamically adjusting the classification rules, the problem that image recognition classification methods are difficult to adapt to complex testing environments is solved, and image classification with high precision and low maintenance costs is achieved.

CN118864952BActive Publication Date: 2025-03-11镁佳(北京)科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410892774.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-04
Publication Date
2025-03-11
Estimated Expiration
2044-07-04

AI Technical Summary

Technical Problem

In the prior art, image recognition classification methods are difficult to adapt to complex and changeable testing environments and image features, resulting in high maintenance costs and low recognition accuracy.

Method used

By defining the main category and subcategory, dynamically adjust the initialization default rules to generate customized classification rules, and determine the image category based on the detection results. Classification rules include default values, arrays, preset values ​​and judgment conditions, and support flexible rule adjustment and update.

Benefits of technology

It improves the accuracy and flexibility of image classification, adapts to different test environments and image features, reduces the cost of maintenance and updates, and improves the efficiency of image classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118864952B_ABST
    Figure CN118864952B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image recognition technology, and discloses an image classification method, device, computer equipment and storage medium, the method comprising: determining the detection result of an image to be classified; the detection result comprises a detection feature and a value of the detection feature; adjusting at least one initialization default rule according to the classification requirements of the image to be classified to obtain at least one corresponding classification rule; determining the image category of the image to be classified according to the detection result and at least one classification rule; each of the at least one classification rule comprises a default value and at least one array, each of the at least one array comprises a preset value and at least one judgment condition, a single judgment condition corresponds to a single key-value pair, the key-value pair comprises a key and a key value, the key corresponds to a feature identifier, the key value corresponds to a comparison operator and a preset threshold; the classification rule corresponds to a main category; the preset value corresponds to a subcategory under the main category. The scheme of the present invention can improve the efficiency and accuracy of image classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image recognition technology, and in particular to an image classification method, device, computer equipment and storage medium. Background Art

[0002] With the rapid development of artificial intelligence technology, image recognition, as an important branch, has shown unparalleled application value in many fields, especially in industrial automation, intelligent transportation systems, smart homes and consumer electronics testing. Especially in the field of vehicle testing, ensuring that the screen displays normally without black screen, flowery screen, stripes, etc. is a key link to ensure driving safety and user experience.

[0003] At present, images are mainly identified and classified through algorithm recognition or machine learning models. However, due to the wide variety of abnormalities displayed on the car screen, and the influence of factors such as changes in external environmental lighting, object reflections, and differences in camera imaging quality, a single algorithm is difficult to achieve high-precision universal recognition, and it is often necessary to combine multiple algorithms for comprehensive judgment. Secondly, even if a machine learning model is used, it is necessary to continuously collect new data for iterative training to adapt to different test environments and image features, which leads to high maintenance costs and frequent update requirements.

[0004] Therefore, there is an urgent need for a unified and efficient image classification method that can adapt to complex and changing test environments and image features. Summary of the invention

[0005] Therefore, the technical problem to be solved by the present invention is to overcome the problems of image recognition and classification methods in related technologies, such as high development and maintenance costs and inability to adapt to complex and changeable test environments and image features.

[0006] In order to solve the above technical problem, the present invention provides an image classification method, which includes:

[0007] Determine a detection result of the image to be classified; the detection result includes a detection feature and a value of the detection feature;

[0008] Adjusting at least one initialization default rule according to the classification requirements of the image to be classified to obtain at least one corresponding classification rule;

[0009] The image category of the image to be classified is determined according to the detection result and at least one classification rule; the image category includes a main category and a subcategory; each of the at least one classification rule includes a default value and at least one array, each of the at least one array includes a preset value and at least one judgment condition, a single judgment condition corresponds to a single key-value pair, the key-value pair includes a key and a key value, the key corresponds to a feature identifier, and the key value corresponds to a comparison operator and a preset threshold; the classification rule corresponds to the main category; the preset value corresponds to the subcategory under the main category.

[0010] In an optional implementation, determining the image category of the image to be classified according to the detection result and at least one classification rule includes:

[0011] According to the detection results, a parsing operation is performed on each classification rule to obtain a parsing result corresponding to each classification rule;

[0012] Determine the image category of the image to be classified according to the analysis result corresponding to each classification rule;

[0013] According to the detection result, a parsing operation is performed on a single classification rule to obtain a parsing result corresponding to the single classification rule, including:

[0014] According to the detection result, determining whether a target array exists in a single classification rule; all judgment conditions in the target array are satisfied;

[0015] When it is determined that the target array exists in a single classification rule, determining a preset value in the target array as a parsing result corresponding to the single classification rule;

[0016] When it is determined that the target array does not exist in a single classification rule, a default value in the single classification rule is determined as a parsing result corresponding to the single classification rule.

[0017] In an optional implementation, determining the image category of the image to be classified according to the parsing result corresponding to each classification rule includes:

[0018] Determine the main category corresponding to the classification rule where the target array is located in the parsing result corresponding to each classification rule as the main category of the image to be classified;

[0019] The subcategory under the main category corresponding to the preset value in the target array in the parsing result corresponding to each classification rule is determined as the subcategory of the image to be classified.

[0020] In an optional implementation, determining whether a target array exists in a single classification rule according to the detection result includes:

[0021] According to the parsing order, for each judgment condition in each array under a single classification rule, the data to be verified is obtained from the detection result according to the feature identifier in the single judgment condition; the data to be verified includes the detection feature and the value of the detection feature corresponding to the feature identifier in the single judgment condition; according to the comparison operator in the single judgment condition, the value of the detection feature in the data to be verified is compared with the preset threshold in the single judgment condition to determine whether the single judgment condition is satisfied;

[0022] When there is an array satisfying all the judgment conditions among all the arrays under a single classification rule, it is determined that there is a target array in the single classification rule;

[0023] When there is no array satisfying all the judgment conditions among all the arrays under the single classification rule, it is determined that there is no target array in the single classification rule.

[0024] In an optional implementation, after determining the image category of the image to be classified according to the analysis result corresponding to each classification rule, the method further includes:

[0025] Determine the name corresponding to each classification rule;

[0026] The target file name of the image to be classified is determined according to the parsing result corresponding to each classification rule, the name corresponding to each classification rule, the original file name of the image to be classified and a connecting symbol; the connecting symbol is used to connect the parsing result corresponding to the previous classification rule and the name corresponding to the next classification rule, and to connect the original file name of the image to be classified and the name corresponding to the classification rule where the target array is located.

[0027] In an optional implementation, after determining the target file name of the image to be classified according to the parsing result corresponding to each classification rule, the name corresponding to each classification rule, the original file name of the image to be classified and the connection symbol, the method further includes:

[0028] The images to be classified are stored in a folder corresponding to a preset image category of the images to be classified.

[0029] In an optional implementation, determining the detection result of the image to be classified includes:

[0030] Generate a result key-value pair according to the detection feature of the image to be classified and the value of the detection feature;

[0031] Generate a detection result of the image to be classified according to the result key-value pair.

[0032] In a second aspect, the present invention provides an image classification device, the image classification device comprising:

[0033] A first processing module, used to determine a detection result of the image to be classified; the detection result includes a detection feature and a value of the detection feature;

[0034] A second processing module, configured to adjust at least one initialization default rule according to the classification requirements of the image to be classified to obtain at least one corresponding classification rule;

[0035] The third processing module is used to determine the image category of the image to be classified according to the detection result and at least one classification rule; the image category includes a main category and a subcategory; each classification rule in at least one classification rule includes a default value and at least one array, each array in at least one array includes a preset value and at least one judgment condition, a single judgment condition corresponds to a single key-value pair, the key-value pair includes a key and a key value, the key corresponds to a feature identifier, and the key value corresponds to a comparison operator and a preset threshold; the classification rule corresponds to the main category; the preset value corresponds to the subcategory under the main category.

[0036] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the image classification method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0037] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the image classification method of the first aspect or any corresponding embodiment thereof.

[0038] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the image classification method of the first aspect or any corresponding embodiment thereof.

[0039] The technical solution provided by the present invention has the following technical effects:

[0040] The technical solution of the present invention can perform refined classification of images to be classified by defining main categories and subcategories, can meet the in-depth requirements for image classification in different application scenarios, and improve the accuracy of classification. The default rules can be dynamically adjusted according to the classification requirements of the images to be classified to obtain customized classification rules, which is equivalent to selecting corresponding classification standards according to different test environments or image features for classification, thereby improving the flexibility and adaptability of image classification. When adding new judgment conditions and adjusting existing classification rules based on the design structure of classification rules (default values, arrays (preset values, judgment conditions)), there is no need to make major changes, which is conducive to reducing maintenance and update costs. The image category of the image to be classified can be quickly determined based on the detection results and classification rules of the image to be classified, thereby improving the efficiency of image classification. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0042] Figure 1 is a schematic diagram of a flow chart of an image classification method according to an embodiment of the present invention;

[0043] Figure 2 is a flowchart of another image classification method according to an embodiment of the present invention;

[0044] Figure 3 is a schematic diagram of the structure of an image classification device according to an embodiment of the present invention;

[0045] Figure 4 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution 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 part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0047] At present, the application of image recognition technology in vehicle computer testing is mainly divided into two categories: algorithm-based recognition methods and machine learning model-based methods. The former directly analyzes the screen status by designing a series of image processing algorithms, such as edge detection, template matching, feature extraction, etc., to determine the image category and whether the image is abnormal. The latter relies on advanced technologies such as deep learning to build a model that can automatically identify various screen abnormalities by learning a large number of labeled samples. However, due to the wide variety of abnormalities in vehicle computer screen display, and the influence of factors such as changes in external environmental lighting, object reflection, and differences in camera imaging quality, a single algorithm is difficult to achieve high-precision universal recognition, and it is often necessary to combine multiple algorithms for comprehensive judgment. Secondly, even if a machine learning model is used, it is necessary to continuously collect new data for iterative training to adapt to different test environments and project characteristics, which leads to high maintenance costs and frequent update requirements. Existing image recognition technology is difficult to cope with complex and changeable test environments, especially for image features unique to different vehicle computer projects, and often lacks a unified and efficient recognition solution. Frequent environmental changes and changes in test requirements require algorithms and models to be continuously maintained and updated, which not only consumes a lot of resources, but also may lead to low test efficiency. Therefore, developing an image classification solution that can flexibly adapt to changing test environments, maintain high recognition and classification accuracy, and reduce maintenance burden is of great significance to improving the efficiency and quality of vehicle computer testing.

[0048] Therefore, the embodiments of the present invention provide an image classification method, apparatus, computer device and storage medium to solve the above problems.

[0049] According to an embodiment of the present invention, an embodiment of an image classification method 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.

[0050] Figure 1 4 is a flowchart of an image classification method according to an embodiment of the present invention.

[0051] like Figure 1 As shown, an image classification method provided by the present invention in an embodiment of the present invention includes:

[0052] S101: Determine the detection result of the image to be classified.

[0053] In this embodiment, the detection result includes the detection feature and the value of the detection feature.

[0054] In this embodiment, the detection results of the image to be classified can be stored in the form of a data table or a dictionary. In this embodiment, the storage form of the detection features of the image to be classified and the values ​​of the detection features is not limited. If the detection results of the image to be classified are in the form of a dictionary, as an example, S101 determines the detection results of the image to be classified, specifically including: generating a result key-value pair according to the detection features of the image to be classified and the values ​​of the detection features, and generating the detection results of the image to be classified according to the result key-value pair. The result key-value pair includes a key and a key value, and the key can be generated according to the detection feature, and the key value can be generated according to the value of the detection feature.

[0055] In this embodiment, as an example, the image to be classified can be an image of the display interface of the vehicle to be tested. Considering that different image recognition algorithms have different recognition accuracy for different image features, in this embodiment, different algorithms can be applied to recognize different features of the image to be classified, for example, checking parallel lines, contours, color proportions in the image to be classified, performing grayscale analysis, binarization analysis, etc. After balancing the overhead and time consumption of different algorithms, the recognition results of different algorithms can be summarized to obtain the detection results of the image to be classified. As an example, the identification of the classified image includes: using the HSV spatial data algorithm, you can obtain the chromaticity extreme value difference, such as: the chromaticity extreme value difference of the color area greater than 1‰, the brightness extreme value difference, such as: the V channel extreme value difference, brightness statistics, such as: minimum value, maximum value, median, median value, etc., color area proportion statistics (proportion to thousandths), such as: maximum value, mode (proportion greater than 0), mode number, frequency number (frequency greater than 1), chromaticity 1 (area greater than 1‰), chromaticity 2 (based on chromaticity 1 minus mode frequency 1), area proportion classification number (minus 0.0). Determine the number of color contours with the largest area proportion, area proportion: maximum color proportion, contour number: retain the location of the maximum color, and obtain the number of contours after changing other areas to white. Grayscale frequency analysis: grayscale levels with an area proportion greater than 1%: maximum value, minimum value, and level number. Binarization analysis: automatic threshold binarization, output black and white proportion. Parallel line inspection: statistics on angles, half of the super frame, and the number of equal width strips. Contour detection: Contour statistics: number of root node contours, percentage of root node contour area, total number of adjacent non-included contours, percentage of adjacent non-included contour area. In this embodiment, different algorithms can be applied to identify different features of the image according to the recognition accuracy of different image recognition algorithms for image features. The algorithm only involves the recognition of image features and does not involve classifying images according to image features. There is no need to jointly apply image recognition algorithms and image classification algorithms, nor is there a need to jointly apply image recognition algorithms to identify the same feature. When the image recognition algorithm needs to be updated, it can be directly replaced, or a new algorithm can be directly added, and the algorithms for identifying images to be classified can be randomly combined.

[0056] S102: adjusting at least one initialization default rule according to the classification requirement of the image to be classified to obtain at least one corresponding classification rule.

[0057] In this embodiment, the classification requirements of the image to be classified can be determined according to the test environment, test target, and image features of the image to be classified. Initial classification rules expressed in the form of text, tables, etc. can be pre-designed, and the initial classification rules can be designed as dictionary format parameters to obtain initialization default rules. Corresponding initialization default rules can be designed according to different image categories, and one initialization default rule can be designed for each image category. At least one initialization default rule can be adjusted according to the classification requirements of the image to be classified in combination with the detection results of the image to be classified, which can specifically be adding or deleting judgment conditions, adjusting the size of the preset threshold, etc. As an example, the detection results of the image to be classified can be used as the basic data of the key-value pairs in the initialization default rules. For example, the feature identifier can be determined according to the detection features of the image to be classified, and the preset threshold can be determined according to the value of the detection features. The key-value pairs (for example, preset thresholds) in the initialization default rules can be adjusted later according to the classification requirements of the image to be classified.

[0058] S103: Determine the image category of the image to be classified according to the detection result and at least one classification rule.

[0059] In this embodiment, the image category includes a main category and a subcategory. Each of the at least one classification rule includes a default value and at least one array, each of the at least one array includes a preset value and at least one judgment condition, a single judgment condition corresponds to a single key-value pair, the key-value pair includes a key and a key value, the key corresponds to a feature identifier, and the key value corresponds to a comparison operator and a preset threshold. The classification rule corresponds to the main category. The preset value corresponds to the subcategory under the main category. The main category in the image category can be pre-set to multiple main categories such as normal, black screen, flower screen, stripes, etc. As an example, when the black screen is the main category, the subcategories under the main category can be pre-set to include a completely black screen, backlight but no picture, partial black screen, flickering black screen, startup black screen, black screen when the application is running, touch feedback black screen, temperature sensitivity black screen, etc.

[0060] In this embodiment, as an example, when the detection results and classification rules of the image to be classified are represented in dictionary form, it is necessary to unify the data formats in the detection results and classification rules of the image to be classified, and use unified fields to represent the same key-value pairs.

[0061] Taking the black screen as the main category in the image category as an example, the classification rules corresponding to the black screen are explained in detail:

[0062] Define the first-level key-value pairs, where the key in the first-level key-value pairs corresponds to the main category "black screen", and the key value in the first-level key-value pairs is a composite data structure. The composite data structure is in dictionary format and is used to parse the assertion rule settings and parse results.

[0063] The composite data structure corresponds to the second-level key-value pair. The composite data structure includes two subkeys and key values ​​corresponding to the two subkeys. One subkey is "default", and its key value is associated with a default value. One subkey is "rules", and its key value is associated with at least one array.

[0064] The array corresponds to the third-level key-value pair. Each array in at least one array includes a preset value and at least one judgment condition. Each judgment condition is an independent key-value pair structure. As an example, the key-value pair of one judgment condition includes: the key is "area proportion", and its key value includes a comparison operator "<" and a preset threshold value, that is, a specific value or ratio, such as "50%". Comparison operators can also include: ">", "=", etc.

[0065] Figure 2 FIG. 1 is a flow chart of another image classification method according to an embodiment of the present invention. Figure 2 As shown, in an optional implementation, the image classification method includes:

[0066] S201: Determine the detection result of the image to be classified. For details, please refer to Figure 1 The related description of S101 is not repeated here.

[0067] S202: Adjust at least one initialization default rule according to the classification requirements of the image to be classified to obtain at least one corresponding classification rule. Figure 1 The related description of S102 is not repeated here.

[0068] S203: According to the detection result, a parsing operation is performed on each classification rule to obtain a parsing result corresponding to each classification rule.

[0069] In this embodiment, according to the detection result, a parsing operation is performed on a single classification rule to obtain a parsing result corresponding to the single classification rule, including:

[0070] S2031: Determine whether a target array exists in the single classification rule according to the detection result. All judgment conditions in the target array are satisfied.

[0071] S2032: When it is determined that a target array exists in the single classification rule, a preset value in the target array is determined as a parsing result corresponding to the single classification rule.

[0072] In this embodiment, the preset values ​​in the arrays can be set according to the order of all the arrays in the single classification rule, and the preset values ​​in the arrays corresponding to the subcategories under the same main category are the same. As an example, the preset values ​​in all the arrays in the single classification rule can be set in sequence: 1, 2, 3, 4...

[0073] S2033: When it is determined that the target array does not exist in the single classification rule, a default value in the single classification rule is determined as a parsing result corresponding to the single classification rule.

[0074] In this embodiment, the default value in the single classification rule may be set to 0.

[0075] S204: Determine the image category of the image to be classified according to the analysis result corresponding to each classification rule.

[0076] In this embodiment, the main category corresponding to the classification rule where the target array in the parsing result corresponding to each classification rule is located can be determined as the main category of the image to be classified. The subcategory under the main category corresponding to the preset value in the target array in the parsing result corresponding to each classification rule can be determined as the subcategory of the image to be classified.

[0077] In an optional implementation, S2031 determines whether a target array exists in the single classification rule according to the detection result, specifically including:

[0078] According to the parsing order, a preset operation is performed for each judgment condition in each array under the single classification rule to determine whether each judgment condition in each array under the single classification rule is satisfied.

[0079] When there is an array satisfying all the judgment conditions among all the arrays under the single classification rule, it is determined that the target array exists in the single classification rule.

[0080] When there is no array satisfying all the judgment conditions among all the arrays under the single classification rule, it is determined that the target array does not exist in the single classification rule.

[0081] In this embodiment, according to the parsing order, a preset operation is performed for a single judgment condition to determine whether the single judgment condition is satisfied, including:

[0082] The data to be verified is obtained from the detection result according to the feature identifier in the single judgment condition. According to the comparison operator in the single judgment condition, the value of the detection feature in the data to be verified is compared with the preset threshold in the single judgment condition to determine whether the single judgment condition is satisfied. The data to be verified includes the detection feature corresponding to the feature identifier in the single judgment condition and the value of the detection feature.

[0083] In this embodiment, an array includes at least one judgment condition. Only when all the judgment conditions in the array are met, can the array be determined as the target array, and it is determined that the target array exists in the single classification rule. The parsing result of the single classification rule is the preset value in the target data, and the preset operation for the single classification rule is terminated. As long as there is at least one judgment condition in the array that is not met, the array is not the target data. If there is at least one judgment condition in all the arrays in the single classification rule that is not met, the target array does not exist in the single classification rule. The parsing result of the single classification rule is the default value in the single classification rule.

[0084] In an optional implementation, after determining the image category of the image to be classified according to the analysis result corresponding to each classification rule in S204, the image classification method further includes:

[0085] Determine the name corresponding to each classification rule.

[0086] The target file name of the image to be classified is determined according to the parsing result corresponding to each classification rule, the name corresponding to each classification rule, the original file name of the image to be classified and the connection symbol. The connection symbol is used to connect the parsing result corresponding to the previous classification rule and the name corresponding to the next classification rule, and to connect the original file name of the image to be classified and the name corresponding to the classification rule where the target array is located.

[0087] In this embodiment, after determining the target file name of the image to be classified according to the analysis results corresponding to each classification rule, the name corresponding to each classification rule, the original file name of the image to be classified and the connection symbol, the image to be classified can also be stored in a folder corresponding to the image category of the image to be classified that has been pre-set.

[0088] In this embodiment, corresponding folders can be set in advance according to image categories, and sub-category folders are under the main category folders. The images to be classified are stored and backed up in the folders, and the classification rules can be updated according to the images in the folders at a predetermined period.

[0089] As an example, the classification rule corresponding to "black screen" can be named "black", the classification rule corresponding to "flowered screen" can be named "lacuna", and the classification rule corresponding to "stripes" can be named "bar". In this embodiment, the target file name of the image to be classified is determined according to the rule of priority of non-default values. That is, the name corresponding to the classification rule where the target array is located is located before the names corresponding to other classification rules.

[0090] In this embodiment, the original file name of the image to be classified can be converted into the MD5 format. When there are three classification rules, the target file name of the image to be classified can be determined according to the format of the original file name of the image to be classified in the MD5 format, a connection symbol, the name corresponding to the classification rule where the target array is located, the parsing result corresponding to the classification rule where the target array is located, a connection symbol, the name corresponding to other classification rules, the parsing result corresponding to other classification rules, a connection symbol, the name corresponding to other classification rules, and the parsing result corresponding to other classification rules. Naming in the MD5 format can remove duplicates. If a file with the same name exists, it proves that it is the same image, and fields can also be added as needed.

[0091] In this embodiment, as an example, the composite data structure is as follows: Each element is a rule. A single rule contains two elements, that is, two sub-keys and the key values respectively corresponding to the two sub-keys. The first element is the result value after the rule passes, and the preset value in this array will replace the default value. The second element is the rule dictionary, that is, an array. As an example, the array format is as follows:

[0092] If there are two elements: the judgment condition of element 1, the judgment value x, referring to the if judgment in Python:

[0093] Less than: < or ltx < element 2

[0094] Less than or equal to: <= or lex <= element 2

[0095] Greater than: > or gtx > element 2

[0096] Greater than or equal to: >= or gex >= element 2

[0097] Equal to: == or eqx == element 2

[0098] Not equal to:!= or nex!= element 2

[0099] Is: isx is element 2

[0100] Not: nsx not is element 2

[0101] If there are three elements: the judgment condition of element 1, the judgment value x, referring to the if judgment in Python less than: < or lt element 2 < x < element 3

[0102] Less than or equal to: <= or le element 2 <= x <= element 3

[0103] Greater than: > or gtx < element 2 or x > element 3

[0104] Greater than or equal to: >= or gex <= element 2 or x >= element 3

[0105] Less than or equal to less than: <= < or lel element2 <= x < element3

[0106] Less than less than or equal to: <<= or lle element2 < x <= element3

[0107] Less than greater than or equal to: <> = or lgex < element2 or x >= element3

[0108] Less than or equal to greater than: <= > or legx <= element2 or x > element3

[0109] All key-value pair assertions in the array (rule dictionary) are in an AND relationship, that is, if all judgment conditions pass, the value is assigned to the first element value of the rule, which is the preset value in the array. The rule data in the classification rules is judged in the parsing order. If the rule passes, the subsequent rules are ignored; otherwise, continue. After the image recognition algorithm processes, the parsing results corresponding to each classification rule are summarized into a dictionary variable. If there is a rule dictionary configuration, the main category and subcategory of the image to be classified are determined, and the image to be classified is backed up according to the classification results.

[0110] The target folder name of the image to be classified includes the name corresponding to each classification rule and the combination of the parsing results corresponding to each classification rule. In the order of the array (rule dictionary), non-default values take precedence.

[0111] A specific example:

[0112] The original file name of the image to be classified: 1.png, the original file name of the image to be classified in MD5 format: 00bac47ff6e94531ea6d46b399d17f68.

[0113] The detection result of the image to be classified:

[0114] Classification rules:

[0115]

[0116]

[0117] In the present invention, if the classification rule is the above example, then according to the parsing order of the above classification rules, a preset operation can be performed for each judgment condition in each array under the single classification rule to determine whether each judgment condition in each array under the single classification rule is satisfied. The parsing order corresponding to the above classification rules is: the classification rule black corresponding to "black screen", the classification rule lacuna corresponding to "flowered screen", and the classification rule bar corresponding to "stripes". The classification rule black corresponding to "black screen" performs the preset operation in the parsing order of 1-9. As an example, the parsing result corresponding to each classification rule is: {'black':9, 'lacuna':0, 'bar':0}, and the image to be classified is reclassified into the black9 folder and named (target file name): 00bac47ff6e94531ea6d46b399d17f68_black9_lacuna0_bar0.png. In this embodiment, for example, the classification rule black corresponding to "black screen" includes [1,{'root-count':['<',2],'brightness_mean':['<',20],'brightness_max':['<',120],'lines':['=',0]}] as an array, the preset value in the array is: 1, and the array includes 4 judgment conditions.

[0118] The technical solution of the present invention involves image recognition algorithm, summary and analysis of algorithm results, design of classification rules, dynamic analysis of image classification results (such as missed detection and false detection of black flower screen), and updating of classification rules (or different rules for different projects). As a complete and standardized technical solution, the technical solution of the present invention is easy to operate and convenient for updating and configuration. Classification rules are designed, that is, the dictionary format of assertion multi-conditional rules, which can realize dynamic configuration of classification rules, support parameter transmission in json format, and can adapt to complex and changeable test environments. For example, different classification rules can be configured for different projects, different cameras, and different test purposes of vehicle computers. Images can be stored in folders of corresponding subcategories according to main categories and subcategories. Dynamic image sets can be obtained through continuous backup storage. Classification results can be continuously tracked according to different image sets to avoid false detection and missed detection. Classification rules can be dynamically updated according to classification results. For example, classification rules are updated daily to achieve maintenance. Both algorithms and classification rules support dynamic increase and decrease maintenance, and can be dynamically combined as needed. Classification rules are designed and defined to parse the assertion of multiple data elements in a fixed format to obtain classification results, and support dynamic updates to improve classification accuracy.

[0119] It should be noted that the contents not described in detail in the specification of the present invention belong to the common knowledge of those skilled in the art.

[0120] In this embodiment, an image classification device is also provided, which is used to implement the above-mentioned embodiment and optional implementation methods, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the system described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0121] Figure 3 is a schematic diagram of the structure of an image classification device according to an embodiment of the present invention.

[0122] The present invention provides an image classification device, such as Figure 3 As shown, the image classification device includes:

[0123] The first processing module 11 is used to determine the detection result of the image to be classified. The detection result includes the detection feature and the value of the detection feature.

[0124] The second processing module 12 is used to adjust at least one initialization default rule according to the classification requirement of the image to be classified to obtain at least one corresponding classification rule.

[0125] The third processing module 13 is used to determine the image category of the image to be classified according to the detection result and at least one classification rule. The image category includes a main category and a subcategory. Each of the at least one classification rule includes a default value and at least one array, and each of the at least one array includes a preset value and at least one judgment condition. A single judgment condition corresponds to a single key-value pair, and the key-value pair includes a key and a key value. The key corresponds to a feature identifier, and the key value corresponds to a comparison operator and a preset threshold. The classification rule corresponds to the main category. The preset value corresponds to a subcategory under the main category.

[0126] In an optional embodiment, the second processing module 12 includes:

[0127] The first processing unit is used to perform a parsing operation on each classification rule according to the detection result to obtain a parsing result corresponding to each classification rule.

[0128] According to the detection result, a parsing operation is performed on a single classification rule to obtain a parsing result corresponding to the single classification rule, including:

[0129] According to the detection result, it is determined whether the target array exists in the single classification rule. All the judgment conditions in the target array are satisfied.

[0130] When it is determined that the target array exists in the single classification rule, the preset value in the target array is determined as the parsing result corresponding to the single classification rule.

[0131] When it is determined that the target array does not exist in the single classification rule, a default value in the single classification rule is determined as the parsing result corresponding to the single classification rule.

[0132] The second processing unit is used to determine the image category of the image to be classified according to the parsing result corresponding to each classification rule.

[0133] In an optional embodiment, the second processing unit in the second processing module 12 is specifically configured to determine the main category corresponding to the classification rule where the target array is located in the parsing result corresponding to each classification rule as the main category of the image to be classified. The subcategory under the main category corresponding to the preset value in the target array in the parsing result corresponding to each classification rule is determined as the subcategory of the image to be classified.

[0134] In an optional implementation, the first processing unit in the second processing module 12 is specifically configured to determine whether a target array exists in the single classification rule according to the detection result.

[0135] The first processing unit in the second processing module 12 includes:

[0136] The first processing subunit is used to obtain the data to be verified from the detection result according to the feature identifier in the single judgment condition according to the parsing order and for each judgment condition in each array under the single classification rule. The data to be verified includes the detection feature corresponding to the feature identifier in the single judgment condition and the value of the detection feature. According to the comparison operator in the single judgment condition, the value of the detection feature in the data to be verified is compared with the preset threshold in the single judgment condition to determine whether the single judgment condition is met.

[0137] The second processing subunit is used to determine that a target array exists in the single classification rule when an array that satisfies all judgment conditions exists among all arrays under the single classification rule.

[0138] The third processing subunit is configured to determine that the target array does not exist in the single classification rule when there is no array satisfying all the judgment conditions among all the arrays under the single classification rule.

[0139] In an optional implementation, after the third processing module 13 determines the image category of the image to be classified according to the analysis result corresponding to each classification rule, the image classification device further includes: a backup module, the backup module includes:

[0140] The first processing unit is used to determine a name corresponding to each classification rule.

[0141] The second processing unit is used to determine the target file name of the image to be classified according to the parsing result corresponding to each classification rule, the name corresponding to each classification rule, the original file name of the image to be classified and the connection symbol. The connection symbol is used to connect the parsing result corresponding to the previous classification rule and the name corresponding to the next classification rule, and to connect the original file name of the image to be classified and the name corresponding to the classification rule where the target array is located.

[0142] In an optional embodiment, after the second processing unit of the backup module determines the target file name of the image to be classified according to the parsing result corresponding to each classification rule, the name corresponding to each classification rule, the original file name of the image to be classified and the connection symbol, the backup module in the image classification device further includes:

[0143] The third processing unit is used to store the image to be classified into a folder corresponding to the image category of the image to be classified that is preset.

[0144] In an optional implementation, the first processing module 11 is specifically configured to generate a result key-value pair according to the detection feature of the image to be classified and the value of the detection feature, and to generate a detection result of the image to be classified according to the result key-value pair.

[0145] The embodiment of the present invention also provides a computer device, see Figure 4 , Figure 4 Schematic diagram of the hardware structure of the computer device according to the embodiment of the present invention. Figure 4 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In an optional embodiment, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 4 A processor 10 is taken as an example.

[0146] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0147] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0148] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function. The data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage devices. In an optional embodiment, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0149] The memory 20 may include a volatile memory, such as a random access memory. The memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive. The memory 20 may also include a combination of the above-mentioned types of memory.

[0150] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0151] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc. Further, the storage medium can also include a combination of the above-mentioned types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0152] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0153] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. An image classification method, characterized in that: The image classification method comprises: Determine a detection result of the image to be classified; the detection result includes a detection feature and a value of the detection feature; Adjusting at least one initialization default rule according to the classification requirements of the image to be classified to obtain at least one corresponding classification rule; Determine the image category of the image to be classified according to the detection result and at least one classification rule; the image category includes a main category and a subcategory; each of the at least one classification rule includes a default value and at least one array, each of the at least one array includes a preset value and at least one judgment condition, a single judgment condition corresponds to a single key-value pair, the key-value pair includes a key and a key value, the key corresponds to a feature identifier, the key value corresponds to a comparison operator and a preset threshold; the classification rule corresponds to the main category; the preset value corresponds to a subcategory under the main category; The step of determining the image category of the image to be classified according to the detection result and at least one classification rule comprises: According to the detection results, a parsing operation is performed on each classification rule to obtain a parsing result corresponding to each classification rule; Determine the image category of the image to be classified according to the analysis result corresponding to each classification rule; According to the detection result, a parsing operation is performed on a single classification rule to obtain a parsing result corresponding to the single classification rule, including: According to the detection result, determining whether a target array exists in a single classification rule; all judgment conditions in the target array are satisfied; When it is determined that the target array exists in a single classification rule, determining a preset value in the target array as a parsing result corresponding to the single classification rule; When it is determined that the target array does not exist in a single classification rule, a default value in the single classification rule is determined as a parsing result corresponding to the single classification rule; The step of determining the image category of the image to be classified according to the parsing result corresponding to each classification rule includes: Determine the main category corresponding to the classification rule where the target array is located in the parsing result corresponding to each classification rule as the main category of the image to be classified; The subcategory under the main category corresponding to the preset value in the target array in the parsing result corresponding to each classification rule is determined as the subcategory of the image to be classified.

2. The method according to claim 1, characterized in that: Determining whether a target array exists in a single classification rule according to the detection result includes: According to the parsing order, for each judgment condition in each array under a single classification rule, the data to be verified is obtained from the detection result according to the feature identifier in the single judgment condition; the data to be verified includes the detection feature and the value of the detection feature corresponding to the feature identifier in the single judgment condition; according to the comparison operator in the single judgment condition, the value of the detection feature in the data to be verified is compared with the preset threshold in the single judgment condition to determine whether the single judgment condition is satisfied; When there is an array satisfying all the judgment conditions among all the arrays under a single classification rule, it is determined that there is a target array in the single classification rule; When there is no array satisfying all the judgment conditions among all the arrays under the single classification rule, it is determined that there is no target array in the single classification rule.

3. The method according to claim 1, characterized in that After determining the image category of the image to be classified according to the analysis result corresponding to each classification rule, the method further includes: Determine the name corresponding to each classification rule; The target file name of the image to be classified is determined according to the parsing result corresponding to each classification rule, the name corresponding to each classification rule, the original file name of the image to be classified and a connecting symbol; the connecting symbol is used to connect the parsing result corresponding to the previous classification rule and the name corresponding to the next classification rule, and to connect the original file name of the image to be classified and the name corresponding to the classification rule where the target array is located.

4. The method according to claim 3, characterized in that After determining the target file name of the image to be classified according to the parsing result corresponding to each classification rule, the name corresponding to each classification rule, the original file name of the image to be classified and the connection symbol, the method further includes: The images to be classified are stored in a folder corresponding to a preset image category of the images to be classified.

5. The method according to claim 1, characterized in that The step of determining the detection result of the image to be classified includes: Generate a result key-value pair according to the detection feature of the image to be classified and the value of the detection feature; Generate a detection result of the image to be classified according to the result key-value pair.

6. An image classification device, characterized in that: The image classification device comprises: A first processing module, used to determine a detection result of the image to be classified; the detection result includes a detection feature and a value of the detection feature; A second processing module, configured to adjust at least one initialization default rule according to the classification requirements of the image to be classified to obtain at least one corresponding classification rule; A third processing module is used to determine the image category of the image to be classified according to the detection result and at least one classification rule; the image category includes a main category and a subcategory; each of the at least one classification rule includes a default value and at least one array, each of the at least one array includes a preset value and at least one judgment condition, a single judgment condition corresponds to a single key-value pair, the key-value pair includes a key and a key value, the key corresponds to a feature identifier, the key value corresponds to a comparison operator and a preset threshold; the classification rule corresponds to the main category; the preset value corresponds to a subcategory under the main category; The third processing module comprises: A first processing unit, configured to perform a parsing operation on each classification rule according to the detection result to obtain a parsing result corresponding to each classification rule; The first processing unit is specifically used to determine whether a target array exists in a single classification rule according to the detection result; all judgment conditions in the target array are satisfied; when it is determined that the target array exists in a single classification rule, a preset value in the target array is determined as a parsing result corresponding to the single classification rule; when it is determined that the target array does not exist in a single classification rule, a default value in the single classification rule is determined as a parsing result corresponding to the single classification rule; A second processing unit, configured to determine the image category of the image to be classified according to the parsing result corresponding to each classification rule; The second processing unit is specifically used to determine the main category corresponding to the classification rule where the target array is located in the analysis results corresponding to each classification rule as the main category of the image to be classified; and determine the subcategory under the main category corresponding to the preset value in the target array in the analysis results corresponding to each classification rule as the subcategory of the image to be classified.

7. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the steps of the method according to any one of claims 1 to 5 by executing the computer instructions.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the steps of the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Data classification method and device and computer equipment

    CN112948370A

  • Image classification method and device, electronic equipment and storage medium

    CN116824158A