Sample classification method, apparatus and electronic device

By combining the number and similarity of reference samples in the sample library into the KNN algorithm to calculate classification weights, the problem of difficult classification of a few categories of samples in the sample library is solved, and more accurate sample classification is achieved.

CN116740454BActive Publication Date: 2026-03-20CHINA SCI INTELLICLOUD TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-21
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Existing KNN algorithms struggle to correctly classify samples when the number of samples for certain categories in the sample library is small.

Method used

By acquiring features from multiple labeled samples, samples with similarity differences greater than a preset range are selected as reference samples. The classification weight is calculated based on the number of reference samples to determine the category to which the sample to be classified belongs.

Benefits of technology

In scenarios where the number of certain classification samples in the sample library is relatively small, it can more accurately determine the classification of the sample to be classified.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116740454B_ABST
    Figure CN116740454B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a sample classification method and device and electronic equipment. In the process of determining the classification to which a sample belongs, the similarity of the nearest sample and the number of reference samples of each classification in the sample library are combined to determine the weight corresponding to each classification, and then the classification to which the sample belongs is determined according to the weight of each classification. In this way, in the case where there are some classifications with fewer samples in the sample library, the classification to which the sample belongs can be more accurately determined.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of artificial intelligence data processing, in particular to a sample classification method and device and electronic equipment. BACKGROUND

[0002] In some classification schemes using machine learning models, KNearestNeighbors (KNN) algorithm is often used to determine the classification to which a sample belongs. Specifically, when determining the class of a new sample, the classification with the most number of samples in the K nearest samples in the sample library is determined. For example, when K = 3, if 2 of the 3 nearest samples in the sample library are classified as A, then the new sample will also be classified as A.

[0003] However, for some special scenarios, it is difficult to collect samples of some categories, that is, the number of samples of some categories in the sample library is small, and the original KNN algorithm cannot correctly determine the category in this case. For example, the sample library contains two categories of samples, of which 100 samples belong to category A and 1 sample belongs to category B. For any number greater than 1, the KNN algorithm cannot correctly determine the category of the sample. SUMMARY

[0004] In order to overcome the above-mentioned deficiencies in the prior art, the purpose of the present application is to provide a sample classification method, which comprises:

[0005] Obtaining a plurality of labeled samples and obtaining the sample features and the classification to which each of the labeled samples belongs;

[0006] Selecting labeled samples with a similarity difference greater than a preset range as reference samples to form a sample library according to the sample features of each of the labeled samples;

[0007] Obtaining the number of reference samples corresponding to each classification in the sample library as the classification sample base;

[0008] Obtaining a sample to be classified and obtaining the sample features of the sample to be classified;

[0009] Calculating the target feature similarity between the sample to be classified and each of the reference samples in the sample library;

[0010] For each classification, calculating the weight corresponding to the classification according to the target feature similarity of the reference samples in the classification and the classification sample base of the classification;

[0011] Determining the classification with the largest weight as the classification to which the sample to be classified belongs.

[0012] In a possible implementation, the step of selecting, according to the sample features of each of the labeled samples, the labeled samples with similarity difference greater than a preset range as reference samples to form a sample library, comprises:

[0013] For each of the labeled samples, a reference feature similarity between the labeled sample and each of the reference samples in the sample library is calculated, if the highest reference feature similarity is lower than a first preset threshold, the labeled sample is inserted into the sample library as a new reference sample, otherwise, the labeled sample is abandoned.

[0014] In a possible implementation, the step of calculating the reference feature similarity between the labeled sample and each of the reference samples in the sample library, comprises:

[0015] The cosine similarity between the sample features of the labeled sample and each of the stored reference samples in the sample library is calculated as the reference feature similarity.

[0016] In a possible implementation, the step of calculating, for each of the categories, a weight corresponding to the category according to the target feature similarity corresponding to the reference samples in the category and the category sample base of the category, comprises:

[0017] A first subset is obtained by selecting, from the reference samples, the reference samples with target feature similarity greater than a second preset threshold;

[0018] A second subset is obtained by selecting, from each category, at most K reference samples;

[0019] A weight value corresponding to each of the categories is obtained according to the number of reference samples of each of the categories in the sample library and the sum of the target feature similarities of the reference samples of each of the categories in the second subset.

[0020] In a possible implementation, the step of obtaining, according to the number of reference samples of each of the categories in the sample library and the sum of the target feature similarities of the reference samples of each of the categories in the second subset, a weight value corresponding to each of the categories, comprises:

[0021] The weight W of the jth category is calculated according to the following formula: i :

[0022]

[0023] Wherein, S i,j is the target feature similarity of the jth sample of the ith category in the second subset; C i is the number of reference samples corresponding to the i categories in the sample library.

[0024] In a possible implementation, the step of obtaining the sample features of each of the labeled samples comprises:

[0025] extracting the sample features of each of the labeled samples by a pre-trained feature extraction model;

[0026] The step of obtaining the sample features of the sample to be classified comprises:

[0027] extracting the sample features of the sample to be classified by the feature extraction model.

[0028] In a possible implementation, the labeled samples comprise sample images and corresponding classification labels of the samples; and the sample to be classified comprises an image to be classified.

[0029] The application further provides a sample classification device, which comprises:

[0030] a first obtaining module, configured to obtain a plurality of labeled samples, and obtain sample features and a classification to which each of the labeled samples belongs;

[0031] a first similarity calculation module, configured to select, according to the sample features of each of the labeled samples, a labeled sample with a similarity difference greater than a preset range as a reference sample to form a sample library;

[0032] a sample data obtaining module, configured to obtain a quantity of reference samples corresponding to each classification in the sample library as a classification sample cardinality;

[0033] a second obtaining module, configured to obtain a sample to be classified, and obtain sample features of the sample to be classified;

[0034] a second similarity calculation module, configured to calculate a target feature similarity between the sample to be classified and features of each of the reference samples in the sample library respectively;

[0035] a weight calculation module, configured to calculate, for each of the classifications, a weight corresponding to the classification according to the target feature similarity corresponding to the reference samples in the classification and the classification sample cardinality of the classification;

[0036] a classification module, configured to determine a classification with the largest weight as a classification to which the sample to be classified belongs.

[0037] Another purpose of the application is to provide an electronic device comprising a processor and a machine readable storage medium, wherein the machine readable storage medium stores machine executable instructions, and the machine executable instructions, when executed by the processor, implement the sample classification method provided by the application.

[0038] Another object of the present application is to provide a machine readable storage medium storing machine executable instructions which, when executed by one or more processors, implement the sample classification method provided by the present application.

[0039] Compared with the prior art, the present application has the following beneficial effects:

[0040] The embodiments of the present application provide a sample classification method and device and electronic equipment. In the process of determining the classification to which a sample belongs, the similarity of the nearest sample and the number of reference samples of each classification in the sample library are combined to determine the weight corresponding to each classification, and then the classification to which the sample belongs is determined according to the weight of each classification. In this way, in the case where there are some classifications with a small number of samples in the sample library, the classification to which the sample belongs can be more accurately determined. BRIEF DESCRIPTION OF DRAWINGS

[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can also be obtained without creative labor.

[0042] Figure 1 The schematic diagram of the electronic equipment provided by the embodiments of the present application is shown in the figure.

[0043] Figure 2 The step flowchart of the sample classification method provided by the embodiments of the present application is shown in the figure.

[0044] Figure 3 The functional module schematic diagram of the sample classification device provided by the embodiments of the present application is shown in the figure. DETAILED DESCRIPTION

[0045] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the following will combine the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, not all. The components of the embodiments of the present application described and shown in the drawings can be arranged and designed in various different configurations.

[0046] Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

[0047] It should be noted that like reference numerals and letters refer to like elements throughout the accompanying drawings, and that, unless otherwise indicated, like reference numerals and letters used throughout the various figures denote like elements.

[0048] In the description of the present application, it should be noted that the terms "first", "second", "third", etc. are used only to distinguish descriptions, and cannot be understood as indicating or implying relative importance.

[0049] In the description of the present application, it should also be noted that, unless otherwise specified and limited, the terms "set", "install", "connect", "connect" should be understood broadly, for example, it can be fixedly connected, or it can be detachably connected, or integrally connected; it can be mechanically connected, or it can be electrically connected; it can be directly connected, or it can be indirectly connected through an intermediate medium, or it can be the communication inside two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.

[0050] The embodiment provides a schematic diagram of an electronic device which can be used to run the sample classification method provided by the embodiment. The electronic device is a device with data processing capability, for example, the electronic device can include a server, a personal computer, a notebook computer, an industrial computer, etc.

[0051] Please refer to Figure 1 , Figure 1 is a block schematic diagram of the electronic device 100. The electronic device 100 includes a sample classification apparatus 110, a machine readable storage medium 120 and a processor 130.

[0052] The machine readable storage medium 120 and the processor 130 are electrically connected to each other directly or indirectly to realize the transmission or interaction of data. For example, these elements can be electrically connected to each other through one or more communication buses or signal lines. The sample classification apparatus 110 includes at least one software function module which can be stored in the machine readable storage medium 120 in the form of software or firmware or solidified in the operating system (OS) of the electronic device 100. The processor 130 is used to execute the executable modules stored in the machine readable storage medium 120, such as the software function modules included in the sample classification apparatus 110 and computer programs, etc.

[0053] The machine readable storage medium 120 can be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc. The machine readable storage medium 120 is configured to store a program. The processor 130 executes the program after receiving an execution instruction, and can execute the sample classification method provided in the embodiment.

[0054] The processor 130 can be an integrated circuit chip with a processing capability. The processor can be a general purpose processor, including a central processing unit (CPU), a network processor (NP), etc. The processor can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The processor can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application. The general purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0055] Please refer to Figure 2 , Figure 2 for the electronic device 100 shown in Figure 1 A flowchart of a sample classification method applied to the electronic device 100 is shown in FIG. 1. The method will be described in detail below.

[0056] In step S110, a plurality of labeled samples are obtained, and sample features and a classification to which each of the labeled samples belongs are obtained.

[0057] In the embodiment, the labeled samples can be general data samples, and the labeled samples can be used for a machine learning model to perform a classification action. In one example, the labeled samples can include sample images and classification labels corresponding to the samples.

[0058] In a possible implementation, for the sample images, features of each of the labeled samples can be extracted by using a traditional feature extraction method; in another possible implementation, a deep learning model can be trained using the labeled samples, and a feature extraction model in the trained deep learning model can be used to obtain the sample features of each of the labeled samples.

[0059] In step S120, according to the sample features of each of the labeled samples, a labeled sample with a similarity difference greater than a preset range is selected as a reference sample to form a sample library.

[0060] In a possible implementation, for each of the labeled samples, a reference feature similarity between the labeled sample and each of the reference samples in the sample library is calculated, if the highest reference feature similarity is lower than a first preset threshold, the labeled sample is inserted into the sample library as a new reference sample, otherwise, the labeled sample is discarded.

[0061] Specifically, when there is no reference sample in the sample library, a labeled sample can be randomly selected as the reference sample to be added to the sample library. Then, for each of the other labeled samples, before being added to the sample library, a reference feature similarity between the labeled sample and each of the reference samples already stored in the sample library is calculated, for example, a cosine similarity between the sample features of the labeled sample and each of the reference samples already stored in the sample library can be calculated as the reference feature similarity.

[0062] If the maximum value of the reference feature similarity between a certain labeled sample and each of the reference samples already stored in the sample library is greater than a preset first preset threshold (for example, greater than 0.9), it indicates that there is a reference sample similar to the labeled sample in the sample library, and thus the labeled sample does not need to be added to the sample library, and the labeled sample can be discarded.

[0063] If the maximum value of the reference feature similarity between a certain labeled sample and each of the reference samples already stored in the sample library is not greater than the first preset threshold (for example, not greater than 0.9), it indicates that the reference samples already stored in the sample library are all different from the labeled sample, and thus the labeled sample can be added to the sample library as a new reference sample.

[0064] In this way, after the processing of step S120, samples with too high similarity are filtered out, and the samples in the sample library are all different samples, which can play a better reference role for subsequent classification.

[0065] In step S130, a number of reference samples corresponding to each category in the sample library is obtained as a category sample basis.

[0066] In this embodiment, after the sample library is completed, the classification of each reference sample in the sample library can be determined according to the classification label of each reference sample, and then the number of corresponding reference samples of each classification is used as the classification sample technology corresponding to each classification.

[0067] In step S140, a sample to be classified is obtained, and sample features of the sample to be classified are obtained.

[0068] In this embodiment, the sample to be classified can be a sample that needs to determine its classification by the scheme provided in this embodiment. In a possible implementation, the sample to be classified can include an image to be classified.

[0069] In this embodiment, the method for obtaining the sample features of the sample to be classified in step S140 can be the same as the method for obtaining the sample features of the labeled sample in step S110. For example, the feature extraction model used in step S110 is used to extract features of the sample to be classified, so as to obtain the sample features of the sample to be classified.

[0070] In step S150, a target feature similarity between the sample to be classified and the features of each reference sample in the sample library is calculated respectively.

[0071] In this embodiment, the cosine similarity between the sample features of the sample to be classified and each reference sample in the sample library can be calculated as the target feature similarity.

[0072] In step S160, for each classification, a weight corresponding to the classification is calculated according to the target feature similarity corresponding to the reference sample in the classification and the classification sample base of the classification.

[0073] In this embodiment, in step S160, a first subset of reference samples with a target feature similarity greater than a second preset threshold can be obtained. For example, reference samples with a target feature similarity greater than 0.6 are obtained to form the first subset. In this way, most reference samples with large differences from the sample to be classified can be screened out.

[0074] Then, for the first subset, at most K reference samples are taken from each classification to form a second subset. For example, at most 5 reference samples can be taken from the first subset for each classification, and for a classification with less than 5 reference samples, all reference samples of the classification can be taken. In this way, the taken reference samples form the second subset.

[0075] Then, according to the number of the reference samples of each category in the sample library and the sum of the target feature similarities of the reference samples of each category in the second subset, a weight value corresponding to each category is calculated.

[0076] Specifically, the weight W of the i-th category can be calculated according to the following formula i :

[0077]

[0078] wherein S i,j is the target feature similarity of the j-th sample of the i-th category in the second subset; C i is the number of the reference samples of the i-th category in the sample library.

[0079] In step S170, the category with the largest weight is determined as the category to which the sample to be classified belongs.

[0080] In the embodiment, the calculation of the weight takes into account the similarity between each reference sample and the sample to be classified and the number of samples in the category. In this way, a larger weight can be obtained for a category with a smaller number of samples but a higher similarity. Thus, in the case where there are some categories with a small number of samples in the sample library, the category to which the sample to be classified belongs can be determined more accurately.

[0081] For details, please refer to Figure 3 The sample classification apparatus 110 comprises at least one functional module which can be stored in the machine-readable storage medium 120 in the form of software. Functionally, the sample classification apparatus 110 can comprise a first acquisition module 111, a first similarity calculation module 112, a sample data acquisition module 113, a second acquisition module 114, a second similarity calculation module 115, a weight calculation module 116 and a classification module 117.

[0082] The first acquisition module 111 is configured to acquire a plurality of labeled samples and acquire the sample features and the category to which each of the labeled samples belongs.

[0083] In the embodiment, the first acquisition module 111 can be configured to perform the step S110 shown in FIG. 1. For details, please refer to the description of the step S110. Figure 2

[0084] The first similarity calculation module 112 is configured to select, according to the sample features of each of the labeled samples, labeled samples with a similarity difference greater than a preset range as reference samples to form a sample library.

[0085] ​In this embodiment, the first similarity calculation module 112 can be configured to perform Figure 2 The specific description of the first similarity calculation module 112 can refer to the description of step S120.

[0086] The sample data acquisition module 113 is configured to acquire the number of reference samples corresponding to each category in the sample library as a category sample cardinality.

[0087] In this embodiment, the sample data acquisition module 113 can be configured to perform Figure 2 The specific description of the sample data acquisition module 113 can refer to the description of step S130.

[0088] The second acquisition module 114 is configured to acquire a to-be-classified sample and acquire a sample feature of the to-be-classified sample.

[0089] In this embodiment, the second acquisition module 114 can be configured to perform Figure 2 The specific description of the second acquisition module 114 can refer to the description of step S140.

[0090] The second similarity calculation module 115 is configured to calculate a target feature similarity between the to-be-classified sample and each reference sample in the sample library.

[0091] In this embodiment, the second similarity calculation module 115 can be configured to perform Figure 2 The specific description of the second similarity calculation module 115 can refer to the description of step S150.

[0092] The weight calculation module 116 is configured to calculate, for each category, a weight corresponding to the category according to the target feature similarity corresponding to the reference sample in the category and the category sample cardinality of the category.

[0093] In this embodiment, the weight calculation module 116 can be configured to perform Figure 2 The specific description of the weight calculation module 116 can refer to the description of step S160.

[0094] The classification module 117 is configured to determine the category with the largest weight as the category to which the to-be-classified sample belongs.

[0095] In this embodiment, the classification module 117 can be configured to perform Figure 2 The specific description of the classification module 117 can refer to the description of step S170.

[0096] To sum up, the embodiment of the present application provides a sample classification method, device and electronic equipment. In the process of determining the classification to which the sample to be classified belongs, the similarity of the nearest sample and the number of reference samples of each classification in the sample library are combined to determine the weight corresponding to each classification, and then the classification to which the sample to be classified belongs is determined according to the weight of each classification. In this way, in the scene where there are some classifications with fewer samples in the sample library, the classification to which the sample to be classified belongs can be more accurately determined.

[0097] In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can also be implemented in other manners. The embodiment of the apparatus described above is only illustrative. For example, the flowchart and block diagram in the accompanying drawings show the possible implementation architectures, functions and operation of the apparatus, method and computer program product according to the embodiments of the present application. In this regard, each block in the flowchart or block diagram can represent a module, a program segment or a part of code, which contains one or more executable instructions for implementing the specified logic function. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in a different order than that noted in the accompanying drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and sometimes they can be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.

[0098] In addition, each functional module in the various embodiments of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0099] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application can essentially or contribute to the prior art or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various program code storage media.

[0100] It should be noted that, in this paper, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0101] The above is only various embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A sample classification method, characterized in that, The method includes: Multiple labeled samples are obtained, including sample images and corresponding classification labels, and the sample features and classification of each labeled sample are obtained. Based on the sample characteristics of each labeled sample, labeled samples with similarity differences greater than a preset range are selected as reference samples to form a sample library; The number of reference samples corresponding to each category in the sample library is used as the classification sample cardinality. Obtain samples to be classified, including images to be classified, and obtain sample features of the samples to be classified; Calculate the target feature similarity between the features of the sample to be classified and each of the reference samples in the sample library; For each category, the weight corresponding to the category is calculated based on the similarity of the target feature to the reference sample in the category and the cardinality of the category samples. The category with the highest weight is determined as the category to which the sample to be classified belongs; The step of calculating the weight of each category based on the similarity of the target features corresponding to the reference samples in that category and the cardinality of the category samples includes: A first subset is formed by obtaining the reference samples whose similarity to the target feature is greater than a second preset threshold. For the first subset, select the maximum value from each category. The second subset consists of 1 reference sample; The weight value corresponding to each category is calculated based on the number of reference samples for each category in the sample library and the sum of the target feature similarities of the reference samples for each category in the second subset.

2. The method according to claim 1, characterized in that, The step of selecting labeled samples with similarity differences greater than a preset range as reference samples to form a sample library based on the sample characteristics of each labeled sample includes: For each labeled sample, the similarity of the labeled sample with the reference features of each reference sample in the sample library is calculated. If the highest similarity of the reference features is lower than a first preset threshold, the labeled sample is inserted into the sample library as a new reference sample. Otherwise, the labeled sample is discarded.

3. The method according to claim 2, characterized in that, The step of calculating the similarity of the labeled sample with the reference features of each reference sample in the sample library includes: The cosine similarity between the labeled sample and each of the reference samples stored in the sample library is calculated as the reference feature similarity.

4. The method according to claim 1, characterized in that, The step of calculating the weight value corresponding to each category based on the number of reference samples for each category in the sample library and the sum of the target feature similarities of the reference samples for each category in the second subset includes: Calculate the number according to the following formula. Weights of each category : in, For the second subset The first category The similarity of the target features of each sample; For the sample library The number of reference samples corresponding to each category.

5. The method according to claim 1, characterized in that, The step of obtaining the sample features of each labeled sample includes: The sample features of each labeled sample are extracted using a pre-trained feature extraction model; The step of obtaining the sample features of the sample to be classified includes: The feature extraction model is used to extract the sample features of the sample to be classified.

6. A sample classification device, characterized in that, The sample classification device includes: The first acquisition module is used to acquire multiple labeled samples, wherein the labeled samples include sample images and the corresponding classification labels of the samples, and to acquire the sample features and classification of each labeled sample; The first similarity calculation module is used to select labeled samples with similarity differences greater than a preset range as reference samples to form a sample library based on the sample characteristics of each labeled sample. The sample data acquisition module is used to acquire the number of reference samples corresponding to each category in the sample library as the classification sample base. The second acquisition module is used to acquire samples to be classified, including images to be classified, and to acquire sample features of the samples to be classified. The second similarity calculation module is used to calculate the target feature similarity between the features of the sample to be classified and each of the reference samples in the sample library; The weight calculation module is used to calculate the weight of each category based on the similarity of the target feature to the reference sample in the category and the cardinality of the category samples. The classification module is used to determine the category with the highest weight as the category to which the sample to be classified belongs; Specifically, the weight calculation module is used for: A first subset is formed by obtaining the reference samples whose similarity to the target feature is greater than a second preset threshold. For the first subset, select the maximum value from each category. The second subset consists of 1 reference sample; The weight value corresponding to each category is calculated based on the number of reference samples for each category in the sample library and the sum of the target feature similarities of the reference samples for each category in the second subset.

7. An electronic device, characterized in that, The method includes a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions, which, when executed by the processor, implement the method according to any one of claims 1-5.

8. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions that, when executed by one or more processors, implement the method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Category determination method and device

    CN111476297A