WO2021098618A1 - Data classification method and apparatus, terminal device and readable storage medium - Google Patents

Data classification method and apparatus, terminal device and readable storage medium Download PDF

Info

Publication number
WO2021098618A1
WO2021098618A1 PCT/CN2020/128856 CN2020128856W WO2021098618A1 WO 2021098618 A1 WO2021098618 A1 WO 2021098618A1 CN 2020128856 W CN2020128856 W CN 2020128856W WO 2021098618 A1 WO2021098618 A1 WO 2021098618A1
Authority
WO
WIPO (PCT)
Prior art keywords
label
value
type
sample data
preset
Prior art date
Application number
PCT/CN2020/128856
Other languages
French (fr)
Chinese (zh)
Inventor
董师周
乔宇
王亚立
Original Assignee
中国科学院深圳先进技术研究院
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中国科学院深圳先进技术研究院 filed Critical 中国科学院深圳先进技术研究院
Publication of WO2021098618A1 publication Critical patent/WO2021098618A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/243Classification techniques relating to the number of classes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting

Definitions

  • This application belongs to the field of machine learning technology, and in particular relates to a data classification method, device, terminal device, and readable storage medium.
  • Multi-label classification is one of the basic research tasks of machine learning. Its purpose is to predict multiple category labels that appear in each sample data. When training a classification model, because the type and number of category labels in each sample data are not fixed Therefore, in the predicted labels of the sample data, the data volume of individual category labels is very different from the data volume of other category labels, and data imbalance occurs, which in turn reduces the accuracy of the machine learning model.
  • a convolutional neural network can be used to extract the features of the sample data, and then the features are linearly combined through a fully connected layer, and then the classification probability is generated through the sigmoid function, and then the focus loss function Perform back propagation as a loss function, train a classification model, and then perform classification through the trained classification model.
  • the embodiments of the present application provide a data classification method, device, terminal device, and readable storage medium to improve the situation in which the prior art only relies on the weight in the focus loss function for adjustment, resulting in the inability to accurately obtain the classification boundary, resulting in a certain degree
  • the data is not balanced, which affects the accuracy of label classification.
  • an embodiment of the present application provides a data classification method, including:
  • the classification model is trained based on the distance focus loss function.
  • the distance focus loss function is used to represent the predicted label of the sample data and the preset label of the sample data according to the predicted label of the sample data and the separation distance of the preset label of the sample data. The gap between.
  • the training method of the trained classification model is: first obtain at least one sample data from a preset database, where each sample data includes at least one preset label. Then through the preset classification model, the predicted label of each sample data is obtained. Then obtain the separation distance between the predicted label of the sample data and the preset label of the sample data. Then according to the separation distance, the maximum distance focus loss value is calculated through the distance focus loss function, where the maximum distance focus loss value is used to indicate the maximum value of the gap between the predicted label of the sample data and the preset label of the sample data. Finally, the preset classification model is trained according to the maximum distance focus loss value, and the trained classification model is obtained.
  • the predicted label includes N categories, where N is an integer greater than 1.
  • obtaining the separation distance between the predicted label of the sample data and the preset label of the sample data includes: obtaining the sample data according to the value of the i-th type predicted label of the sample data and the value of the i-th type preset label of the sample data The separation distance between the i-th type predicted label and the i-th type preset label, where i is an integer greater than or equal to 1 and less than or equal to N.
  • the separation distance between the i-th type predicted label and the i-th type preset label of the sample data is obtained .
  • the maximum separation focus loss value is calculated through the separation focus loss function, and the i-th type prediction can be adjusted according to the separation distance, the value of the i-th type predicted label, and the value of the i-th type preset label.
  • the value range of the label value is used to obtain the predicted label value of the i-th type after the range adjustment. Then, according to the predicted label value of the i-th type and the distance focus loss function after the range adjustment, the maximum distance focus loss value is obtained.
  • the value range of the i-th predicted label value is adjusted to obtain the i-th predicted label after the range adjustment.
  • the value includes: first multiplying the i-th type preset label value by two and then subtracting one to obtain the i-th type preset label value after mapping. Then subtract the product of the separation distance and the mapped preset label value from the i-th type predicted label value to obtain the mapped i-th type predicted label value. Finally, the mapped i-th type predicted label value is multiplied by the preset range scaling factor to obtain the i-th type predicted label value after the range adjustment.
  • obtaining the maximum distance focus loss value according to the predicted label value of the i-th type after the range adjustment and the distance focus loss function includes: first classifying the predicted label value of the i-th type after the range adjustment, and after obtaining the second classification The i-th class predicted label value. Then, the maximum distance focus loss value is obtained according to the predicted label value and distance focus loss function of the i-th class after the two classifications.
  • the execution subject of the data classification method is a terminal with image processing capabilities.
  • the terminal may be a physical terminal, such as a desktop computer, a server, a notebook computer, a tablet computer, etc., or a virtual terminal, such as a cloud server, cloud computing, etc. It should be understood that the above execution subject is only an example, and it is not limited to the above terminal.
  • an embodiment of the present application provides a data classification device, including a receiving module, configured to receive data to be classified.
  • the classification module is used to input the data to be classified into the trained classification model to obtain at least one data label of the data to be classified, where the classification model is trained according to the distance focus loss function, and the distance focus loss function is used to calculate the data according to the sample data.
  • the separation distance between the predicted label and the preset label of the sample data represents the gap between the predicted label of the sample data and the preset label of the sample data.
  • the device further includes a training module for obtaining a trained classification model according to the following steps: first obtain at least one sample data from a preset database, wherein each sample data includes at least one preset label. Then, through the preset classification model, the predicted label of each sample data is obtained. Then obtain the separation distance between the predicted label of the sample data and the preset label of the sample data. Then according to the separation distance, the maximum distance focus loss value is calculated through the distance focus loss function, where the maximum distance focus loss value is used to indicate the maximum value of the gap between the predicted label of the sample data and the preset label of the sample data. Finally, the preset classification model is trained according to the maximum distance focus loss value, and the trained classification model is obtained.
  • the predicted label includes N categories, where N is an integer greater than 1.
  • the training module is specifically used to obtain the value of the i-th type predicted label and the i-th type preset label of the sample data according to the value of the i-th type predicted label of the sample data and the value of the i-th type preset label of the sample data.
  • the separation distance where i is an integer greater than or equal to 1 and less than or equal to N.
  • the training module is specifically used to first subtract the value of the i-th type predicted label from the value of the i-th type preset label to obtain one of the i-th type predicted label and the i-th type preset label of the sample data. The absolute distance between. Then, the absolute distance is multiplied by the preset scaling factor to obtain the separation distance between the i-th type predicted label and the i-th type preset label of the sample data.
  • the training module is specifically configured to first adjust the value range of the i-th type predicted label value according to the separation distance, the value of the i-th type predicted label, and the value of the i-th type preset label, to obtain the adjusted range Type i predicted label value. Then, according to the predicted label value of the i-th type and the distance focus loss function after the range adjustment, the maximum distance focus loss value is obtained.
  • the training module is specifically configured to first multiply the preset label value of the i-th type by two and then subtract one to obtain the mapped preset label value of the i-th type. Then subtract the product of the separation distance and the mapped preset label value from the i-th type predicted label value to obtain the mapped i-th type predicted label value. Finally, the mapped i-th type predicted label value is multiplied by the preset range scaling factor to obtain the i-th type predicted label value after the range adjustment.
  • the training module is specifically configured to first classify the predicted label value of the i-th type after the range adjustment, and obtain the predicted label value of the i-th type after the two classification. Then, the maximum distance focus loss value is obtained according to the predicted label value and distance focus loss function of the i-th class after the two classifications.
  • the embodiments of the present application provide a terminal device, including: a memory, a processor, and a computer program stored in the memory and running on the processor. Methods.
  • an embodiment of the present application provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as provided in the first aspect.
  • the embodiments of the present application provide a computer program product, which when the computer program product runs on a terminal device, causes the terminal device to execute the method provided in the above-mentioned first aspect.
  • the embodiment of the present application has the beneficial effect that the received data to be classified is classified through the trained classification model to obtain at least one data label of the data to be classified.
  • the trained classification model is obtained by training the preset classification model according to the distance focus loss function. Since the distance focus loss function can represent the gap between the predicted label of the sample data and the preset label of the sample data according to the distance between the predicted label of the sample data and the preset label of the sample data. Therefore, the preset classification model is trained by the distance focus loss function.
  • the sample data is classified and trained, the number of samples does not need to be considered, and the classification is determined based on the difference between the predicted label of the sample data and the preset label of the sample data.
  • the boundary can effectively reduce the data imbalance, and the trained classification model can more accurately classify the classified data.
  • FIG. 1 is a schematic diagram of an application scenario of a data classification method provided by an embodiment of the present application
  • FIG. 2 is a schematic flowchart of a data classification method provided by an embodiment of the present application.
  • FIG. 3 is a schematic flowchart of a data classification method provided by another embodiment of the present application.
  • FIG. 4 is a schematic diagram of sample data labels in a data classification method provided by an embodiment of the present application.
  • FIG. 5 is a schematic flowchart of a data classification method provided by another embodiment of the present application.
  • FIG. 6 is a schematic flowchart of a data classification method provided by another embodiment of the present application.
  • FIG. 7 is a schematic flowchart of a data classification method provided by another embodiment of the present application.
  • FIG. 8 is a schematic flowchart of a data classification method provided by another embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of a data classification device provided by an embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of a data classification device provided by another embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of a terminal device provided by an embodiment of the present application.
  • the data classification method provided by the embodiments of this application can be applied to mobile phones, tablet computers, wearable devices, in-vehicle devices, augmented reality (AR)/virtual reality (VR) devices, notebook computers, and super mobile personal computers
  • terminal devices such as ultra-mobile personal computer (UMPC), netbooks, personal digital assistants (personal digital assistants, PDAs), security cameras, surveillance cameras, etc.
  • UMPC ultra-mobile personal computer
  • PDAs personal digital assistants
  • security cameras surveillance cameras, etc.
  • FIG. 1 shows a schematic diagram of an application scenario of the data classification method provided by the present application.
  • an image acquisition device 11, a server 12, and a database 13 are included.
  • the image acquisition device 11 and the server 12 communicate with each other, and the server 12 and the database 13 communicate with each other.
  • the communication connection can be wired Network or wireless network, where wireless network can include wireless local area network (Wireless Localarea Networks, WLAN) (such as Wi-Fi network), Bluetooth, Zigbee, mobile communication network, Near Field Communication (NFC), infrared technology (Infrared, IR) and other communication solutions.
  • WLAN wireless local area network
  • WLAN such as Wi-Fi network
  • Bluetooth such as Wi-Fi network
  • Zigbee such as Wi-Fi network
  • mobile communication network such as Wi-Fi network
  • NFC Near Field Communication
  • infrared technology Infrared, IR
  • Wired networks can include optical fiber networks, telecommunication networks, intranets, etc., such as Local Area Network (LAN), Wide Area Network (WAN), Metropolitan Area Network (MAN), and public switched telephone network ( Public Switched Telephone Network, PSTN), etc. There are no restrictions on the types of wireless networks and wired networks.
  • LAN Local Area Network
  • WAN Wide Area Network
  • MAN Metropolitan Area Network
  • PSTN Public Switched Telephone Network
  • the image acquisition device 11 may include a tablet computer 111, a notebook computer 112, a desktop computer 113, a smart phone 114, a digital camera 115, a surveillance camera 116, etc.
  • the method of acquiring an image may be a real-time image captured by a camera. It may also be to call the image stored in the image acquisition device 11, or to access a server or database storing the image through the image acquisition device 11, and forward the image to the server 12.
  • the image acquisition device 11 is a device with a photographing function, such as a smart phone 114, a digital camera 115, or a surveillance camera 116
  • a real-time image can be captured by the camera and sent to the server 12.
  • the image acquisition device 11 When the image acquisition device 11 is a tablet computer 111, a notebook computer 112, a desktop computer 113, etc., the image stored therein can be sent to the server 12.
  • the image acquisition device 11 and the server 12 can be two separate devices. That is, the server 12 is a cloud server, a rack server, a cabinet server, a blade server, etc.; or the image acquisition device 11 and the server 12 may also be the same device, for example, the server 12 may be a virtual server running on a desktop computer 113 , There is no restriction here.
  • the database 13 and the server 12 can be implemented on the same device, or on different devices.
  • the implementation is a common method used by those skilled in the art and will not be repeated here.
  • FIG. 2 shows a schematic flowchart of a data classification method provided by an embodiment of the present application.
  • the method can be applied to terminal devices in the above-mentioned scenarios, such as a tablet computer 111, a notebook computer 112, a desktop computer 113, Smart phone 114, digital camera 115 or surveillance camera 116, etc.
  • the data classification methods include:
  • pictures are used as the data to be classified for description, but the type of data to be classified is not limited to this.
  • the data to be classified can also be data in other forms such as video, text, and audio.
  • the adjustment method is a common method of those skilled in the art, and will not be repeated here.
  • the classification model is trained based on the distance focus loss function.
  • the distance focus loss function is used to represent the predicted label of the sample data and the preset label of the sample data according to the predicted label of the sample data and the separation distance of the preset label of the sample data. The gap between.
  • the gap between the predicted label of the sample data and the preset label of the sample data is small, it means that the category is easy to distinguish, and the boundary of the classification can be closer (that is, the separation distance); otherwise, it means that the category It is difficult to distinguish, and the classification boundary needs to be set farther to reduce the difficulty of distinguishing.
  • the received data to be classified is classified through the trained classification model to obtain at least one data label of the data to be classified.
  • the trained classification model is obtained by training the preset classification model according to the distance focus loss function. Since the distance focus loss function can represent the gap between the predicted label of the sample data and the preset label of the sample data according to the distance between the predicted label of the sample data and the preset label of the sample data. Therefore, the preset classification model is trained by the distance focus loss function.
  • the sample data is classified and trained, the number of samples does not need to be considered, and the classification is determined based on the difference between the predicted label of the sample data and the preset label of the sample data.
  • the boundary can effectively reduce the data imbalance, and the trained classification model can more accurately classify the classified data.
  • the training method of the trained classification model is:
  • each sample data includes at least one preset label.
  • multiple sample data and at least one preset label corresponding to each sample data are stored in the preset database. For example, when the sample data is a picture, if there are both cats and dogs in the picture, Then there are two preset labels corresponding to the sample data, namely "cat" and "dog".
  • the preset label can be represented by a vector containing N elements, where N is the number of label categories, N is an integer greater than 1, and the value range of each element is [0,1].
  • Figure 4 shows a schematic diagram of sample data labels. Assuming there are 4 types of labels in sample data, they are square, circle, triangle, and diamond. In Figure 4 , There are square 15, circle 16, triangle 17, the preset label vector y of the sample data can be expressed as y ⁇ [1,1,1,0].
  • the value of the first element is 1, which means that in the sample data, the probability of the label of the first category (ie the label of square 15) is 100%;
  • the value of the second element is 1, which means that In the sample data, the probability of the label of the second category (that is, the label of the circle 16) is 100%, and the value of the third element is 1, which means that there is a label of the third category in the sample data ( That is, the probability of the label of the triangle 17) is 100%;
  • the value of the fourth element is 0, which means that the probability of the label of the fourth category (that is, the label of the diamond) is 0% in the sample data.
  • the predicted label can also be represented by a vector containing N elements.
  • the number of label categories is certain, that is, the predicted label also contains labels of N categories.
  • the predicted label vector of the sample data can be used Means that the value of the first element is 0.9, which means that in the sample data, the probability of the label of the first category (ie the label of square 15) is 90%; the value of the second element is 0.7, then Indicates that in the sample data, there is a probability of 70% of the label of the second category (that is, the label of the circle 16); the value of the third element is 0.6, which means that there is a label of the third category in the sample data
  • the probability of the label that is, the label of the triangle 17
  • the value of the fourth element is 0, which means that in the sample data, the probability of the label of the fourth category (that is, the label of the diamond) is 80%.
  • the value of the label can be predicted based on the i-th type of sample data The value y i of the i-th type preset label of the sample data to obtain the interval distance between the i-th type predicted label and the i-th type preset label of the sample data, where i is an integer greater than or equal to 1 and less than or equal to N .
  • the method of obtaining the separation distance between the i-th type predicted label and the i-th type preset label of the sample data may include:
  • the value y 1 of the preset label of the first type is 1, and the value of the predicted label of the first type Is 0.9, then the absolute distance between the first type of predicted label and the first type of preset label of the sample data is
  • the preset zoom factor can be expressed by ⁇ , then the separation distance
  • the absolute distance is between [0,1] because the value range is narrow, it is difficult to effectively reflect the degree of easy distinction of the category. Therefore, it is easier to judge the absolute distance by magnifying the absolute distance by ⁇ times and expanding the absolute distance.
  • the category is easy to distinguish, for example, refer to the examples in S31 and S32, y ⁇ [1,1,1,0],
  • the absolute distance of the second category is 0.3
  • the absolute distance of the third category is 0.4. The two are close to the midpoint of the value range 0.5, indicating that the two are between easy to distinguish and difficult to distinguish. Set ⁇ to 4, and then scale the absolute distance above.
  • the absolute distance of the second category is enlarged from 0.3 to 1.2, and the absolute distance of the third category is enlarged from 0.4 to 1.6.
  • the distance has also been enlarged by four times, making the two farther away from the midpoint of the value range, making it easier to judge whether the category is easy to distinguish.
  • the absolute distance between the i-th type prediction label and the i-th type preset label of the sample data is enlarged, and the enlarged absolute distance is used as the i-th type prediction label and the i-th type prediction label of the sample data.
  • Setting the separation distance between the labels enlarges the gap between the predicted label of the sample data and the preset label of the sample data, making the decision boundary clearer, and obtaining the predicted label of the sample data more accurately.
  • the absolute distance is obtained by subtracting the value of the i-th type predicted label from the value of the i-th preset label, for each training, the absolute distance of the i-th type will adaptively change according to the value of the i-th type predicted label. , So that the obtained separation distance is more accurate, and then the predicted label prediction of the category is more accurate, and the prediction effect of the classification model is improved.
  • the maximum distance focus loss value is used to indicate the maximum value of the gap between the predicted label of the sample data and the preset label of the sample data.
  • the maximum pitch focus loss value can be calculated in the following way.
  • the value range of the predicted label value of the i-th type can be adjusted by using the spacing distance, the value of the i-th type predicted label and the value of the i-th type preset label, and the output of the predicted label value can be adjusted on the basis of S33.
  • the changing curvature of the curve makes the decision boundary of the value of the i-th prediction label after the range adjustment clearer, and improves the prediction effect of the classification model.
  • the value of the i-th type predicted label and the value of the i-th type preset label adjust the value range of the i-th type predicted label value to obtain the i-th type predicted label value after the range adjustment.
  • S3413 Multiply the mapped predicted label value of the i-th type by a preset range scaling factor to obtain the predicted label value of the i-th type after the range adjustment.
  • the steps in S3411, S3412, and S3413 can be expressed by a formula, that is, the predicted label value of the i-th category after the range adjustment Is calculated as:
  • s is the scale scaling factor.
  • the value range of and y i are both [0,1], the value of s can be set to 10, then The value range of is [-10m i ,10+10m i ].
  • S342 Obtain a maximum distance focus loss value according to the i-th type predicted label value and the distance focus loss function after the range adjustment.
  • the method of obtaining the focal loss value of the maximum distance can be through the following steps:
  • S3421 Perform two classifications on the predicted label value of the i-th type after the range adjustment, and obtain the predicted label value of the i-th type after the two classification.
  • the predicted label value of the i-th class after two classifications It can be expressed by the following formula:
  • the pitch focus loss function is:
  • w i 0 represents the weight of the corresponding loss function when there is no predicted label of the i-th category in the sample data
  • w i 1 represents the weight of the corresponding loss function when the predicted label of the i-th category exists in a sample data
  • the maximum distance focus loss value can be used for back propagation, multiple iterations, and repeated training of the preset classification model, and finally the trained classification model is obtained.
  • the specific training method is not limited here.
  • the training of the automatic picture classification model is taken as an example to illustrate the application scenarios of the data classification method provided in this application.
  • i 1, 2, 3...N ⁇ .
  • x i is an image sample
  • y i are multiple category labels corresponding to the image sample.
  • the machine learning classification model is determined.
  • a convolutional neural network f ⁇ can be used, where ⁇ is a parameter of the model.
  • L is the maximum focus loss value calculated by the maximum focus loss function provided in this application.
  • the image x to be predicted is input to the trained classification model f ⁇ * , and the multi-class label vector f ⁇ * (x) of the image to be predicted is output.
  • FIG. 9 shows a schematic structural diagram of a data classification device provided in an embodiment of the present application. For ease of description, only the parts related to the embodiment of the present application are shown.
  • the device includes: a receiving module 51 for receiving data to be classified.
  • the classification module 52 is used to input the data to be classified into the trained classification model to obtain at least one data label of the data to be classified, wherein the classification model is obtained by training according to the distance focus loss function, and the distance focus loss function is used according to the sample data
  • the separation distance between the predicted label of the sample data and the preset label of the sample data represents the gap between the predicted label of the sample data and the preset label of the sample data.
  • the device further includes a training module 53 for obtaining a trained classification model according to the following steps: first obtain at least one sample data from a preset database, wherein each sample data includes at least one The preset label. Then, the predicted label of each sample data is obtained through the preset classification model. Then obtain the separation distance between the predicted label of the sample data and the preset label of the sample data. Then according to the separation distance, the maximum distance focus loss value is calculated through the distance focus loss function, where the maximum distance focus loss value is used to indicate the maximum value of the gap between the predicted label of the sample data and the preset label of the sample data. Finally, the preset classification model is trained according to the maximum distance focus loss value, and the trained classification model is obtained.
  • the predicted label includes N categories, where N is an integer greater than 1.
  • the training module 53 is specifically configured to obtain the value of the i-th type predicted label and the i-th type preset label of the sample data according to the value of the i-th type predicted label of the sample data and the value of the i-th type preset label of the sample data
  • the training module 53 is specifically configured to first subtract the value of the i-th type predicted label from the value of the i-th type preset label to obtain the i-th type predicted label and the i-th type preset label of the sample data. The absolute distance between. Then, the absolute distance is multiplied by the preset scaling factor to obtain the separation distance between the i-th type predicted label and the i-th type preset label of the sample data.
  • the training module 53 is specifically configured to first adjust the value range of the i-th type predicted label value according to the separation distance, the value of the i-th type predicted label, and the value of the i-th type preset label, to obtain the adjusted range
  • the i-th type predicts the label value. Then, according to the predicted label value of the i-th type and the distance focus loss function after the range adjustment, the maximum distance focus loss value is obtained.
  • the training module 53 is specifically configured to first multiply the preset label value of the i-th type by two and then subtract one to obtain the mapped preset label value of the i-th type. Then subtract the product of the separation distance and the mapped preset label value from the i-th type predicted label value to obtain the mapped i-th type predicted label value. Finally, the mapped i-th type predicted label value is multiplied by the preset range scaling factor to obtain the i-th type predicted label value after the range adjustment.
  • the training module 53 is specifically configured to first classify the predicted label value of the i-th type after the range adjustment, and obtain the predicted label value of the i-th type after the two classification. Then, the maximum distance focus loss value is obtained according to the predicted label value and distance focus loss function of the i-th class after the two classifications.
  • FIG. 11 shows a schematic structural diagram of a terminal device provided by an embodiment of the present application.
  • the terminal device 6 includes:
  • the embodiments of the present application also provide a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in each of the foregoing method embodiments can be realized.
  • the embodiments of the present application provide a computer program product.
  • the steps in the foregoing method embodiments can be realized when the mobile terminal is executed.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the computer program can be stored in a computer-readable storage medium.
  • the computer program can be stored in a computer-readable storage medium.
  • the steps of the foregoing method embodiments can be implemented.
  • the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file, or some intermediate forms.
  • the computer-readable medium may at least include: any entity or device capable of carrying the computer program code to the photographing device/terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunications signal and software distribution medium.
  • ROM read-only memory
  • RAM random access memory
  • electric carrier signal telecommunications signal and software distribution medium.
  • U disk mobile hard disk, floppy disk or CD-ROM, etc.
  • computer-readable media cannot be electrical carrier signals and telecommunication signals.
  • the disclosed apparatus/network equipment and method may be implemented in other ways.
  • the device/network device embodiments described above are only illustrative.
  • the division of the modules or units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units.
  • components can be combined or integrated into another system, or some features can be omitted or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Disclosed are a data classification method and apparatus, a terminal device and a readable storage medium, wherein same are applicable to the technical field of machine learning. The data classification method comprises: first, receiving data to be classified (S21); and then, inputting said data into a trained classification model to obtain at least one data label of said data (S22), wherein the classification model is obtained by means of training according to a distance focal loss function, and the distance focal loss function is used for representing the difference between a predicted label of sample data and a preset label of the sample data according to the distance between the predicted label of the sample data and the preset label of the sample data. When classification training is carried out by means of sample data, there is no need to take the number of samples into consideration, and it is only necessary to determine a classification boundary according to the difference between a predicted label of the sample data and a preset label of the sample data, such that data imbalance can be effectively reduced, and the trained classification model can more accurately perform label classification on data to be classified.

Description

数据分类方法、装置、终端设备及可读存储介质Data classification method, device, terminal equipment and readable storage medium 技术领域Technical field
本申请属于机器学习技术领域,尤其涉及一种数据分类方法、装置、终端设备及可读存储介质。This application belongs to the field of machine learning technology, and in particular relates to a data classification method, device, terminal device, and readable storage medium.
背景技术Background technique
多标签分类是机器学习的基础研究任务之一,其目的在于预测每个样本数据中出现的多个类别标签,在训练分类模型时,由于每个样本数据中类别标签的种类和数量都不固定,因此会导致样本数据的预测标签中,出现个别类别标签的数据量与其他类别标签的数据量差别很大,发生数据不均衡的情况,进而使得机器学习模型的准确度降低。Multi-label classification is one of the basic research tasks of machine learning. Its purpose is to predict multiple category labels that appear in each sample data. When training a classification model, because the type and number of category labels in each sample data are not fixed Therefore, in the predicted labels of the sample data, the data volume of individual category labels is very different from the data volume of other category labels, and data imbalance occurs, which in turn reduces the accuracy of the machine learning model.
现有技术中,在改善数据不均衡的情况时,可以使用卷积神经网络提取样本数据的特征,然后通过全连接层对特征进行线性组合,再通过sigmoid函数生成分类概率,然后将焦点损失函数作为损失函数进行反向传播,训练分类模型,然后通过训练后的分类模型进行分类。In the prior art, when improving the data imbalance, a convolutional neural network can be used to extract the features of the sample data, and then the features are linearly combined through a fully connected layer, and then the classification probability is generated through the sigmoid function, and then the focus loss function Perform back propagation as a loss function, train a classification model, and then perform classification through the trained classification model.
但是,根据现有技术训练分类模型时,由于样本数据中每个类别的数量不同,对于数量较少的类别,无法提取的足够的样本数据特征,仅依靠焦点损失函数中的权重进行调节,会导致无法准确获得分类的边界的情况,因此依然会造成一定程度的数据不平衡,影响标签分类的准确率。However, when training the classification model according to the prior art, due to the different number of each category in the sample data, for a small number of categories, sufficient sample data features cannot be extracted, and adjustments are made only by relying on the weights in the focus loss function. As a result, the classification boundary cannot be accurately obtained, and therefore, a certain degree of data imbalance is still caused, which affects the accuracy of label classification.
发明内容Summary of the invention
本申请实施例提供了数据分类方法、装置、终端设备及可读存储介质,以改善现有技术中仅依靠焦点损失函数中的权重进行调节,导致无法准确获得分类的边界的情况,造成一定程度的数据不平衡,影响标签分类的准确率的问题。The embodiments of the present application provide a data classification method, device, terminal device, and readable storage medium to improve the situation in which the prior art only relies on the weight in the focus loss function for adjustment, resulting in the inability to accurately obtain the classification boundary, resulting in a certain degree The data is not balanced, which affects the accuracy of label classification.
第一方面,本申请实施例提供了一种数据分类方法,包括:In the first aspect, an embodiment of the present application provides a data classification method, including:
先接收待分类数据,然后将待分类数据输入训练后的分类模型,得到待分类数据的至少一个数据标签。其中,分类模型是根据间距焦点损失函数训练得到的,间距焦点损失函数用于根据样本数据的预测标签、样本数据的预设标签的间隔距离,表示样本数据的预测标签、样本数据的预设标签之间的差距。First receive the data to be classified, and then input the data to be classified into the trained classification model to obtain at least one data label of the data to be classified. Among them, the classification model is trained based on the distance focus loss function. The distance focus loss function is used to represent the predicted label of the sample data and the preset label of the sample data according to the predicted label of the sample data and the separation distance of the preset label of the sample data. The gap between.
一些实现方式中,训练后的分类模型的训练方式为:先从预设数据库中获取至少一个样本数据,其中,每个样本数据包括至少一个预设的标签。然后通过预设分类模型,获取每 个样本数据的预测标签。再获取样本数据的预测标签和样本数据的预设标签之间的间隔距离。再根据间隔距离,通过间距焦点损失函数,计算最大间距焦点损失值,其中,最大间距焦点损失值用于指示样本数据的预测标签、样本数据的预设标签之间差距的最大值。最后,根据最大间距焦点损失值训练预设分类模型,获取训练后的分类模型。In some implementation manners, the training method of the trained classification model is: first obtain at least one sample data from a preset database, where each sample data includes at least one preset label. Then through the preset classification model, the predicted label of each sample data is obtained. Then obtain the separation distance between the predicted label of the sample data and the preset label of the sample data. Then according to the separation distance, the maximum distance focus loss value is calculated through the distance focus loss function, where the maximum distance focus loss value is used to indicate the maximum value of the gap between the predicted label of the sample data and the preset label of the sample data. Finally, the preset classification model is trained according to the maximum distance focus loss value, and the trained classification model is obtained.
需要说明的是,预测标签包括N个分类,其中,N为大于1的整数。It should be noted that the predicted label includes N categories, where N is an integer greater than 1.
相应的,获取样本数据的预测标签和样本数据的预设标签之间的间隔距离,包括:根据样本数据第i类预测标签的值、样本数据第i类预设标签的值,获取样本数据的第i类预测标签、第i类预设标签之间的间隔距离,其中,i为大于或等于1且小于或等于N的整数。Correspondingly, obtaining the separation distance between the predicted label of the sample data and the preset label of the sample data includes: obtaining the sample data according to the value of the i-th type predicted label of the sample data and the value of the i-th type preset label of the sample data The separation distance between the i-th type predicted label and the i-th type preset label, where i is an integer greater than or equal to 1 and less than or equal to N.
还有一些实现方式中,根据样本数据第i类预测标签的值、样本数据第i类预设标签的值,获取样本数据的第i类预测标签、第i类预设标签之间的间隔距离,可以先将第i类预设标签的值减去第i类预测标签的值,获取样本数据的第i类预测标签、第i类预设标签之间的绝对距离。再将绝对距离与预设缩放系数相乘,得到样本数据的第i类预测标签、第i类预设标签之间的间隔距离。In some other implementations, according to the value of the i-th type predicted label of the sample data and the value of the i-th type preset label of the sample data, the separation distance between the i-th type predicted label and the i-th type preset label of the sample data is obtained , You can first subtract the value of the i-th type predicted label from the value of the i-th type preset label to obtain the absolute distance between the i-th type predicted label and the i-th type preset label of the sample data. Then, the absolute distance is multiplied by the preset scaling factor to obtain the separation distance between the i-th type predicted label and the i-th type preset label of the sample data.
可选地,根据间隔距离,通过间距焦点损失函数,计算获取最大间距焦点损失值,可以先根据间隔距离、第i类预测标签的值以及第i类预设标签的值,调整第i类预测标签值的取值范围,得到范围调整后的第i类预测标签值。再根据范围调整后的第i类预测标签值、间距焦点损失函数,得到最大间距焦点损失值。Optionally, according to the separation distance, the maximum separation focus loss value is calculated through the separation focus loss function, and the i-th type prediction can be adjusted according to the separation distance, the value of the i-th type predicted label, and the value of the i-th type preset label. The value range of the label value is used to obtain the predicted label value of the i-th type after the range adjustment. Then, according to the predicted label value of the i-th type and the distance focus loss function after the range adjustment, the maximum distance focus loss value is obtained.
还有一些实现方式中,根据间隔距离、第i类预测标签的值以及第i类预设标签的值,调整第i类预测标签值的取值范围,得到范围调整后的第i类预测标签值,包括:先将第i类预设标签值乘以二再减一,获取映射后的第i类预设标签值。再将第i类预测标签值减去间隔距离与映射后的第i类预设标签值的乘积,获取映射后的第i类预测标签值。最后将映射后的第i类预测标签值乘以预设范围缩放系数,获取范围调整后的第i类预测标签值。In some implementations, according to the separation distance, the value of the i-th predicted label, and the value of the i-th preset label, the value range of the i-th predicted label value is adjusted to obtain the i-th predicted label after the range adjustment. The value includes: first multiplying the i-th type preset label value by two and then subtracting one to obtain the i-th type preset label value after mapping. Then subtract the product of the separation distance and the mapped preset label value from the i-th type predicted label value to obtain the mapped i-th type predicted label value. Finally, the mapped i-th type predicted label value is multiplied by the preset range scaling factor to obtain the i-th type predicted label value after the range adjustment.
可选地,根据范围调整后的第i类预测标签值、间距焦点损失函数,得到最大间距焦点损失值,包括:先对范围调整后的第i类预测标签值进行二分类,获取二分类后的第i类预测标签值。然后根据二分类后的第i类预测标签值、间距焦点损失函数,获取最大间距焦点损失值。Optionally, obtaining the maximum distance focus loss value according to the predicted label value of the i-th type after the range adjustment and the distance focus loss function includes: first classifying the predicted label value of the i-th type after the range adjustment, and after obtaining the second classification The i-th class predicted label value. Then, the maximum distance focus loss value is obtained according to the predicted label value and distance focus loss function of the i-th class after the two classifications.
一些实现方式中,该数据分类方法的执行主体为具有图像处理能力的终端。示例性的,该终端可以是实体终端,如台式电脑、服务器、笔记本电脑、平板电脑等,也可是虚拟终端,如云端服务器、云计算等。应理解,以上执行主体仅为实例,并非限制必须是以上终端。In some implementations, the execution subject of the data classification method is a terminal with image processing capabilities. Exemplarily, the terminal may be a physical terminal, such as a desktop computer, a server, a notebook computer, a tablet computer, etc., or a virtual terminal, such as a cloud server, cloud computing, etc. It should be understood that the above execution subject is only an example, and it is not limited to the above terminal.
第二方面,本申请实施例提供了一种数据分类装置,包括:接收模块,用于接收待分类数据。分类模块,用于将待分类数据输入训练后的分类模型,得到待分类数据的至少一个 数据标签,其中,分类模型是根据间距焦点损失函数训练得到的,间距焦点损失函数用于根据样本数据的预测标签、样本数据的预设标签的间隔距离,表示样本数据的预测标签、样本数据的预设标签之间的差距。In a second aspect, an embodiment of the present application provides a data classification device, including a receiving module, configured to receive data to be classified. The classification module is used to input the data to be classified into the trained classification model to obtain at least one data label of the data to be classified, where the classification model is trained according to the distance focus loss function, and the distance focus loss function is used to calculate the data according to the sample data. The separation distance between the predicted label and the preset label of the sample data represents the gap between the predicted label of the sample data and the preset label of the sample data.
一些实现方式中,该装置还包括训练模块,用于根据以下步骤得到训练后的分类模型:先从预设数据库中获取至少一个样本数据,其中,每个样本数据包括至少一个预设的标签。然后通过预设分类模型,获取每个样本数据的预测标签。再获取样本数据的预测标签和样本数据的预设标签之间的间隔距离。再根据间隔距离,通过间距焦点损失函数,计算最大间距焦点损失值,其中,最大间距焦点损失值用于指示样本数据的预测标签、样本数据的预设标签之间差距的最大值。最后,根据最大间距焦点损失值训练预设分类模型,获取训练后的分类模型。In some implementations, the device further includes a training module for obtaining a trained classification model according to the following steps: first obtain at least one sample data from a preset database, wherein each sample data includes at least one preset label. Then, through the preset classification model, the predicted label of each sample data is obtained. Then obtain the separation distance between the predicted label of the sample data and the preset label of the sample data. Then according to the separation distance, the maximum distance focus loss value is calculated through the distance focus loss function, where the maximum distance focus loss value is used to indicate the maximum value of the gap between the predicted label of the sample data and the preset label of the sample data. Finally, the preset classification model is trained according to the maximum distance focus loss value, and the trained classification model is obtained.
需要说明的是,预测标签包括N个分类,其中,N为大于1的整数。It should be noted that the predicted label includes N categories, where N is an integer greater than 1.
相应的,训练模块,具体用于根据样本数据第i类预测标签的值、样本数据第i类预设标签的值,获取样本数据的第i类预测标签、第i类预设标签之间的间隔距离,其中,i为大于或等于1且小于或等于N的整数。Correspondingly, the training module is specifically used to obtain the value of the i-th type predicted label and the i-th type preset label of the sample data according to the value of the i-th type predicted label of the sample data and the value of the i-th type preset label of the sample data. The separation distance, where i is an integer greater than or equal to 1 and less than or equal to N.
还有一些实现方式中,训练模块,具体用于先将第i类预设标签的值减去第i类预测标签的值,获取样本数据的第i类预测标签、第i类预设标签之间的绝对距离。再将绝对距离与预设缩放系数相乘,得到样本数据的第i类预测标签、第i类预设标签之间的间隔距离。In some other implementations, the training module is specifically used to first subtract the value of the i-th type predicted label from the value of the i-th type preset label to obtain one of the i-th type predicted label and the i-th type preset label of the sample data. The absolute distance between. Then, the absolute distance is multiplied by the preset scaling factor to obtain the separation distance between the i-th type predicted label and the i-th type preset label of the sample data.
可选地,训练模块,具体用于先根据间隔距离、第i类预测标签的值以及第i类预设标签的值,调整第i类预测标签值的取值范围,得到范围调整后的第i类预测标签值。再根据范围调整后的第i类预测标签值、间距焦点损失函数,得到最大间距焦点损失值。Optionally, the training module is specifically configured to first adjust the value range of the i-th type predicted label value according to the separation distance, the value of the i-th type predicted label, and the value of the i-th type preset label, to obtain the adjusted range Type i predicted label value. Then, according to the predicted label value of the i-th type and the distance focus loss function after the range adjustment, the maximum distance focus loss value is obtained.
还有一些实现方式中,训练模块,具体用于先将第i类预设标签值乘以二再减一,获取映射后的第i类预设标签值。再将第i类预测标签值减去间隔距离与映射后的第i类预设标签值的乘积,获取映射后的第i类预测标签值。最后将映射后的第i类预测标签值乘以预设范围缩放系数,获取范围调整后的第i类预测标签值。In some other implementations, the training module is specifically configured to first multiply the preset label value of the i-th type by two and then subtract one to obtain the mapped preset label value of the i-th type. Then subtract the product of the separation distance and the mapped preset label value from the i-th type predicted label value to obtain the mapped i-th type predicted label value. Finally, the mapped i-th type predicted label value is multiplied by the preset range scaling factor to obtain the i-th type predicted label value after the range adjustment.
可选地,训练模块,具体用于先对范围调整后的第i类预测标签值进行二分类,获取二分类后的第i类预测标签值。然后根据二分类后的第i类预测标签值、间距焦点损失函数,获取最大间距焦点损失值。Optionally, the training module is specifically configured to first classify the predicted label value of the i-th type after the range adjustment, and obtain the predicted label value of the i-th type after the two classification. Then, the maximum distance focus loss value is obtained according to the predicted label value and distance focus loss function of the i-th class after the two classifications.
第三方面,本申请实施例提供了一种终端设备,包括:存储器、处理器以及存储在存储器中并可在处理器上运行的计算机程序,处理器执行计算机程序时实现如第一方面所提供的方法。In the third aspect, the embodiments of the present application provide a terminal device, including: a memory, a processor, and a computer program stored in the memory and running on the processor. Methods.
第四方面,本申请实施例提供了一种计算机可读存储介质,计算机可读存储介质存储 有计算机程序,该计算机程序被处理器执行时实现如如第一方面所提供的方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as provided in the first aspect.
第五方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在终端设备上运行时,使得终端设备执行上述第一方面所提供的方法。In the fifth aspect, the embodiments of the present application provide a computer program product, which when the computer program product runs on a terminal device, causes the terminal device to execute the method provided in the above-mentioned first aspect.
可以理解的是,上述第二方面至第五方面的有益效果可以参见上述第一方面中的相关描述,在此不再赘述。It can be understood that, for the beneficial effects of the second aspect to the fifth aspect described above, reference may be made to the related description in the first aspect described above, and details are not repeated here.
本申请实施例与现有技术相比存在的有益效果是:通过训练后的分类模型对接收到的待分类数据进行分类,得到待分类数据的至少一个数据标签。其中,训练后的分类模型是预设分类模型根据间距焦点损失函数训练得到的。由于间距焦点损失函数可以根据样本数据的预测标签、样本数据的预设标签的间隔距离,来表示样本数据的预测标签、样本数据的预设标签之间的差距。因此通过间距焦点损失函数训练预设分类模型,在对样本数据进行分类训练时,可以无需考虑样本的数量,只需根据样本数据的预测标签、样本数据的预设标签之间的差距确定分类的边界,使得数据不平衡的情况能够有效减少,训练后的分类模型能够更加准确地对待分类数据进行标签分类。Compared with the prior art, the embodiment of the present application has the beneficial effect that the received data to be classified is classified through the trained classification model to obtain at least one data label of the data to be classified. Among them, the trained classification model is obtained by training the preset classification model according to the distance focus loss function. Since the distance focus loss function can represent the gap between the predicted label of the sample data and the preset label of the sample data according to the distance between the predicted label of the sample data and the preset label of the sample data. Therefore, the preset classification model is trained by the distance focus loss function. When the sample data is classified and trained, the number of samples does not need to be considered, and the classification is determined based on the difference between the predicted label of the sample data and the preset label of the sample data. The boundary can effectively reduce the data imbalance, and the trained classification model can more accurately classify the classified data.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly describe the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only of the present application. For some embodiments, those of ordinary skill in the art can obtain other drawings based on these drawings without creative labor.
图1是本申请一实施例提供的数据分类方法的应用场景示意图;FIG. 1 is a schematic diagram of an application scenario of a data classification method provided by an embodiment of the present application;
图2是本申请一实施例提供的数据分类方法的流程示意图;2 is a schematic flowchart of a data classification method provided by an embodiment of the present application;
图3是本申请另一实施例提供的数据分类方法的流程示意图;FIG. 3 is a schematic flowchart of a data classification method provided by another embodiment of the present application;
图4是本申请一实施例提供的数据分类方法中样本数据标签的示意图;4 is a schematic diagram of sample data labels in a data classification method provided by an embodiment of the present application;
图5是本申请另一实施例提供的数据分类方法的流程示意图;FIG. 5 is a schematic flowchart of a data classification method provided by another embodiment of the present application;
图6是本申请另一实施例提供的数据分类方法的流程示意图;FIG. 6 is a schematic flowchart of a data classification method provided by another embodiment of the present application;
图7是本申请另一实施例提供的数据分类方法的流程示意图;FIG. 7 is a schematic flowchart of a data classification method provided by another embodiment of the present application;
图8是本申请另一实施例提供的数据分类方法的流程示意图;FIG. 8 is a schematic flowchart of a data classification method provided by another embodiment of the present application;
图9是本申请一实施例提供的数据分类装置的结构示意图;FIG. 9 is a schematic structural diagram of a data classification device provided by an embodiment of the present application;
图10是本申请另一实施例提供的数据分类装置的结构示意图;FIG. 10 is a schematic structural diagram of a data classification device provided by another embodiment of the present application;
图11是本申请实施例提供的终端设备的结构示意图。FIG. 11 is a schematic structural diagram of a terminal device provided by an embodiment of the present application.
具体实施方式Detailed ways
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。In the following description, for the purpose of illustration rather than limitation, specific details such as a specific system structure and technology are proposed for a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from obstructing the description of this application.
在本申请说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实现方式中”、“在一些实现方式中”、“在其他一些实现方式中”、“在另外一些实现方式中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。Reference to "one embodiment" or "some embodiments" described in the specification of this application means that one or more embodiments of this application include a specific feature, structure, or characteristic described in combination with the embodiment. Therefore, the sentences "in one implementation", "in some implementations", "in some other implementations", "in other implementations", etc. appearing in the differences in this specification are not necessarily All refer to the same embodiment, but mean "one or more but not all embodiments" unless it is specifically emphasized otherwise. The terms "including", "including", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.
本申请实施例提供的数据分类方法可以应用于手机、平板电脑、可穿戴设备、车载设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)、安防摄像头、监控摄像头等终端设备上,本申请实施例对终端设备的具体类型不作任何限制。The data classification method provided by the embodiments of this application can be applied to mobile phones, tablet computers, wearable devices, in-vehicle devices, augmented reality (AR)/virtual reality (VR) devices, notebook computers, and super mobile personal computers For terminal devices such as ultra-mobile personal computer (UMPC), netbooks, personal digital assistants (personal digital assistants, PDAs), security cameras, surveillance cameras, etc., the embodiments of this application do not impose any restrictions on the specific types of terminal devices.
图1示出了本申请提供的数据分类方法的应用场景示意图。参考图1,在该场景中,包括图像获取设备11、服务器12和数据库13,图像获取设备11和服务器12之间通信连接,服务器12和数据库13之间通信连接,通信连接的方式可以为有线网络或无线网络,其中,无线网络可以包括无线局域网(Wireless LocalareaNetworks,WLAN)(如Wi-Fi网络),蓝牙,Zigbee,移动通信网络,近距离无线通信技术(Near Field Communication,NFC),红外技术(Infrared,IR)等通信的解决方案。有线网络可以包括光纤网络、远程通信网络、内联网等,如局域网(Local Area Network,LAN)、广域网(Wide Area Network,WAN)、城域网(Metropolitan Area Network,MAN)、公共电话交换网(Public Switched Telephone Network,PSTN)等。无线网络和有线网络的类型在此不做限制。Figure 1 shows a schematic diagram of an application scenario of the data classification method provided by the present application. Referring to Figure 1, in this scenario, an image acquisition device 11, a server 12, and a database 13 are included. The image acquisition device 11 and the server 12 communicate with each other, and the server 12 and the database 13 communicate with each other. The communication connection can be wired Network or wireless network, where wireless network can include wireless local area network (Wireless Localarea Networks, WLAN) (such as Wi-Fi network), Bluetooth, Zigbee, mobile communication network, Near Field Communication (NFC), infrared technology (Infrared, IR) and other communication solutions. Wired networks can include optical fiber networks, telecommunication networks, intranets, etc., such as Local Area Network (LAN), Wide Area Network (WAN), Metropolitan Area Network (MAN), and public switched telephone network ( Public Switched Telephone Network, PSTN), etc. There are no restrictions on the types of wireless networks and wired networks.
仅作为示例而非限定,图像获取设备11可以包括平板电脑111、笔记本电脑112、台式电脑113、智能手机114、数码相机115、监控摄像头116等,获取图像的方式可以是通过摄像头拍摄实时图像,也可以是调用存储在图像获取设备11中的图像,或者是通过图像获取设备11访问存储有图像的服务器、数据库等,并将图像转发给服务器12。As an example and not a limitation, the image acquisition device 11 may include a tablet computer 111, a notebook computer 112, a desktop computer 113, a smart phone 114, a digital camera 115, a surveillance camera 116, etc. The method of acquiring an image may be a real-time image captured by a camera. It may also be to call the image stored in the image acquisition device 11, or to access a server or database storing the image through the image acquisition device 11, and forward the image to the server 12.
例如,当图像获取设备11为智能手机114、数码相机115或监控摄像头116等具有拍照功能的设备时,可以通过摄像头拍摄实时图像并发送给服务器12。For example, when the image acquisition device 11 is a device with a photographing function, such as a smart phone 114, a digital camera 115, or a surveillance camera 116, a real-time image can be captured by the camera and sent to the server 12.
当图像获取设备11为平板电脑111、笔记本电脑112、台式电脑113等时,可以将存储在其中的图像发送给服务器12,此时,图像获取设备11和服务器12可以是分离的两个设备,即服务器12为云服务器、机架式服务器、机柜式服务器、刀片服务器等;或者,图像获取设备11和服务器12也可以是同一个设备,如服务器12可以是在台式电脑113上运行的虚拟服务器,在此不做限制。When the image acquisition device 11 is a tablet computer 111, a notebook computer 112, a desktop computer 113, etc., the image stored therein can be sent to the server 12. At this time, the image acquisition device 11 and the server 12 can be two separate devices. That is, the server 12 is a cloud server, a rack server, a cabinet server, a blade server, etc.; or the image acquisition device 11 and the server 12 may also be the same device, for example, the server 12 may be a virtual server running on a desktop computer 113 , There is no restriction here.
同理,数据库13可以和服务器12在同一设备上实现,也可以在不同设备上实现,其实现方式是本领域技术人员的惯用手段,在此不做赘述。In the same way, the database 13 and the server 12 can be implemented on the same device, or on different devices. The implementation is a common method used by those skilled in the art and will not be repeated here.
图2示出了本申请一实施例提供的数据分类方法的流程示意图,作为示例而非限定,该方法可以应用于上述场景中的终端设备,如平板电脑111、笔记本电脑112、台式电脑113、智能手机114、数码相机115或监控摄像头116等。FIG. 2 shows a schematic flowchart of a data classification method provided by an embodiment of the present application. As an example and not a limitation, the method can be applied to terminal devices in the above-mentioned scenarios, such as a tablet computer 111, a notebook computer 112, a desktop computer 113, Smart phone 114, digital camera 115 or surveillance camera 116, etc.
请参阅图2,该数据分类方法包括:Please refer to Figure 2. The data classification methods include:
S21、接收待分类数据。S21. Receive data to be classified.
需要说明的是,在本申请中,均以图片作为待分类数据进行描述,但是待分类数据的类型不局限于此,例如,待分类数据还可以是视频、文本、音频等其他形式的数据,此时,需要根据数据的类型做相应的调整,调整的方法为本领域技术人员的惯用手段,在此不做赘述。It should be noted that in this application, pictures are used as the data to be classified for description, but the type of data to be classified is not limited to this. For example, the data to be classified can also be data in other forms such as video, text, and audio. At this time, it is necessary to make corresponding adjustments according to the type of data, and the adjustment method is a common method of those skilled in the art, and will not be repeated here.
S22、将待分类数据输入训练后的分类模型,得到待分类数据的至少一个数据标签。S22. Input the data to be classified into the trained classification model to obtain at least one data label of the data to be classified.
其中,分类模型是根据间距焦点损失函数训练得到的,间距焦点损失函数用于根据样本数据的预测标签、样本数据的预设标签的间隔距离,表示样本数据的预测标签、样本数据的预设标签之间的差距。Among them, the classification model is trained based on the distance focus loss function. The distance focus loss function is used to represent the predicted label of the sample data and the preset label of the sample data according to the predicted label of the sample data and the separation distance of the preset label of the sample data. The gap between.
需要说明的是,样本数据的预测标签、样本数据的预设标签之间的差距小,则说明该类别容易区分,分类的边界可以(即间隔距离)离得较近;反之,则说明该类别难以区分,需要将分类的边界设置的更远,降低区分的难度。It should be noted that if the gap between the predicted label of the sample data and the preset label of the sample data is small, it means that the category is easy to distinguish, and the boundary of the classification can be closer (that is, the separation distance); otherwise, it means that the category It is difficult to distinguish, and the classification boundary needs to be set farther to reduce the difficulty of distinguishing.
在本实现方式中,通过训练后的分类模型对接收到的待分类数据进行分类,得到待分类数据的至少一个数据标签。其中,训练后的分类模型是预设分类模型根据间距焦点损失函数训练得到的。由于间距焦点损失函数可以根据样本数据的预测标签、样本数据的预设标签的间隔距离,来表示样本数据的预测标签、样本数据的预设标签之间的差距。因此通过间距焦点损失函数训练预设分类模型,在对样本数据进行分类训练时,可以无需考虑样本的数量,只需根据样本数据的预测标签、样本数据的预设标签之间的差距确定分类的边界,使得数据不平衡的情况能够有效减少,训练后的分类模型能够更加准确地对待分类数据进行标签分类。In this implementation manner, the received data to be classified is classified through the trained classification model to obtain at least one data label of the data to be classified. Among them, the trained classification model is obtained by training the preset classification model according to the distance focus loss function. Since the distance focus loss function can represent the gap between the predicted label of the sample data and the preset label of the sample data according to the distance between the predicted label of the sample data and the preset label of the sample data. Therefore, the preset classification model is trained by the distance focus loss function. When the sample data is classified and trained, the number of samples does not need to be considered, and the classification is determined based on the difference between the predicted label of the sample data and the preset label of the sample data. The boundary can effectively reduce the data imbalance, and the trained classification model can more accurately classify the classified data.
请参阅图2,在该数据分类方法的另一实施例中,训练后的分类模型的训练方式为:Please refer to Fig. 2. In another embodiment of the data classification method, the training method of the trained classification model is:
S31、从预设数据库中获取至少一个样本数据。S31. Obtain at least one sample data from a preset database.
其中,每个样本数据包括至少一个预设的标签。Wherein, each sample data includes at least one preset label.
一些实现方式中,预设数据库中存储有多个样本数据,以及每个样本数据对应的至少一个类别的预设的标签,例如,当样本数据为图片时,若图片中同时存在猫和狗,则该样本数据对应的预设的标签有两个,分别为“猫”和“狗”。In some implementations, multiple sample data and at least one preset label corresponding to each sample data are stored in the preset database. For example, when the sample data is a picture, if there are both cats and dogs in the picture, Then there are two preset labels corresponding to the sample data, namely "cat" and "dog".
预设的标签可以通过包含N个元素的向量表示,其中,N是标签类别的数量,N为大于1的整数,每个元素的取值范围为[0,1]。The preset label can be represented by a vector containing N elements, where N is the number of label categories, N is an integer greater than 1, and the value range of each element is [0,1].
仅作为示例而非限制,请参照图4,图4中示出了样本数据标签的示意图,设样本数据中的标签种类共有4种,分别为方形、圆形、三角形、菱形,在图4中,存在方形15、圆形16,三角形17,则样本数据预设的标签向量y可以表示为y∈[1,1,1,0]。As an example and not a limitation, please refer to Figure 4. Figure 4 shows a schematic diagram of sample data labels. Assuming there are 4 types of labels in sample data, they are square, circle, triangle, and diamond. In Figure 4 , There are square 15, circle 16, triangle 17, the preset label vector y of the sample data can be expressed as y∈[1,1,1,0].
其中,第一个元素的值为1,则表示在样本数据中,存在第一个类别的标签(即方形15的标签)的概率为100%;第二个元素的值为1,则表示在样本数据中,存在第二个类别的标签(即圆形16的标签)的概率为100%,;第三个元素的值为1,则表示在样本数据中,存在第三个类别的标签(即三角形17的标签)的概率为100%;第四个元素的值为0,则表示在样本数据中,存在第四个类别的标签(即菱形的标签)的概率为0%。Among them, the value of the first element is 1, which means that in the sample data, the probability of the label of the first category (ie the label of square 15) is 100%; the value of the second element is 1, which means that In the sample data, the probability of the label of the second category (that is, the label of the circle 16) is 100%, and the value of the third element is 1, which means that there is a label of the third category in the sample data ( That is, the probability of the label of the triangle 17) is 100%; the value of the fourth element is 0, which means that the probability of the label of the fourth category (that is, the label of the diamond) is 0% in the sample data.
S32、通过预设分类模型,获取每个样本数据的预测标签。S32. Obtain the predicted label of each sample data through a preset classification model.
一些实施方式中,预测标签也可以通过包含N个元素的向量表示,一般来说,对于同一批样本数据,标签类别的数量是一定的,即预测的标签中也包含了N个类别的标签,可参考S31中的示例以及图4,样本数据的预测标签向量可以用
Figure PCTCN2020128856-appb-000001
表示,其中,第一个元素的值为0.9,则表示在样本数据中,存在第一个类别的标签(即方形15的标签)的概率为90%;第二个元素的值为0.7,则表示在样本数据中,存在第二个类别的标签(即圆形16的标签)的概率为70%,;第三个元素的值为0.6,则表示在样本数据中,存在第三个类别的标签(即三角形17的标签)的概率为60%;第四个元素的值为0,则表示在样本数据中,存在第四个类别的标签(即菱形的标签)的概率为80%。
In some embodiments, the predicted label can also be represented by a vector containing N elements. Generally speaking, for the same batch of sample data, the number of label categories is certain, that is, the predicted label also contains labels of N categories. Refer to the example in S31 and Figure 4, the predicted label vector of the sample data can be used
Figure PCTCN2020128856-appb-000001
Means that the value of the first element is 0.9, which means that in the sample data, the probability of the label of the first category (ie the label of square 15) is 90%; the value of the second element is 0.7, then Indicates that in the sample data, there is a probability of 70% of the label of the second category (that is, the label of the circle 16); the value of the third element is 0.6, which means that there is a label of the third category in the sample data The probability of the label (that is, the label of the triangle 17) is 60%; the value of the fourth element is 0, which means that in the sample data, the probability of the label of the fourth category (that is, the label of the diamond) is 80%.
S33、获取样本数据的预测标签和样本数据的预设标签之间的间隔距离。S33. Obtain the separation distance between the predicted label of the sample data and the preset label of the sample data.
参考S32和S31中给出的样本数据的预测标签向量以及样本数据预设的标签向量,由于
Figure PCTCN2020128856-appb-000002
是通过预设分类模型分类得到的预测结果,和y之间存在一定的差异,这个差异即为样本数据的预测标签和样本数据的预设标签之间的间隔距离。
Refer to the predicted label vector of the sample data given in S32 and S31 and the preset label vector of the sample data, because
Figure PCTCN2020128856-appb-000002
It is the prediction result obtained through the classification of the preset classification model, and there is a certain difference between y, and this difference is the separation distance between the predicted label of the sample data and the preset label of the sample data.
一些实施方式中,可根据样本数据第i类预测标签的值
Figure PCTCN2020128856-appb-000003
样本数据第i类预设标签的值y i,获取样本数据的第i类预测标签、第i类预设标签之间的间隔距离,其中,i为大于或等于1且小于或等于N的整数。
In some embodiments, the value of the label can be predicted based on the i-th type of sample data
Figure PCTCN2020128856-appb-000003
The value y i of the i-th type preset label of the sample data to obtain the interval distance between the i-th type predicted label and the i-th type preset label of the sample data, where i is an integer greater than or equal to 1 and less than or equal to N .
参考图5,获取样本数据的第i类预测标签、第i类预设标签之间的间隔距离的方法可包括:Referring to FIG. 5, the method of obtaining the separation distance between the i-th type predicted label and the i-th type preset label of the sample data may include:
S331、将第i类预设标签的值减去第i类预测标签的值,获取样本数据的第i类预测标签、第i类预设标签之间的绝对距离。S331. Subtract the value of the i-th type of predicted label from the value of the i-th type of preset label to obtain the absolute distance between the i-th type of predicted label and the i-th type of preset label of the sample data.
仅作为示例而非限制,参照S31和S32中的
Figure PCTCN2020128856-appb-000004
和y,第1类预设标签的值y 1为1,第一类预测标签的值
Figure PCTCN2020128856-appb-000005
为0.9,则样本数据的第1类预测标签、第1类预设标签之间的绝对距离为
Figure PCTCN2020128856-appb-000006
As an example and not a limitation, refer to S31 and S32 in
Figure PCTCN2020128856-appb-000004
And y, the value y 1 of the preset label of the first type is 1, and the value of the predicted label of the first type
Figure PCTCN2020128856-appb-000005
Is 0.9, then the absolute distance between the first type of predicted label and the first type of preset label of the sample data is
Figure PCTCN2020128856-appb-000006
S332、将绝对距离与预设缩放系数相乘,得到样本数据的第i类预测标签、第i类预设标签之间的间隔距离。S332. Multiply the absolute distance by the preset scaling factor to obtain the separation distance between the i-th type predicted label and the i-th type preset label of the sample data.
一些实施方式中,预设缩放系数可以用λ表示,则间隔距离
Figure PCTCN2020128856-appb-000007
In some embodiments, the preset zoom factor can be expressed by λ, then the separation distance
Figure PCTCN2020128856-appb-000007
由于
Figure PCTCN2020128856-appb-000008
和y中的元素的取值范围为[0,1],所以绝对距离
Figure PCTCN2020128856-appb-000009
的范围也在[0,1]之间。需要说明的是,第i类的绝对距离越小,则表示第i类越容易被区分出来,第i类的绝对距离越大,则表示第i类越难以被区分出来。
due to
Figure PCTCN2020128856-appb-000008
The value range of the elements in and y is [0,1], so the absolute distance
Figure PCTCN2020128856-appb-000009
The range is also between [0,1]. It should be noted that the smaller the absolute distance of the i-th category, the easier it is to distinguish the i-th category, and the larger the absolute distance of the i-th category, the more difficult it is to distinguish the i-th category.
但是,绝对距离在[0,1]之间时,由于取值范围较窄,难以得到有效地体现该类别容易区分的程度,因此,将绝对距离放大λ倍,扩大绝对距离,更容易判断该类别是否容易区分,例如,参考S31和S32中的示例,y∈[1,1,1,0],
Figure PCTCN2020128856-appb-000010
再未缩放时,第二个类别的绝对距离为0.3,第三个类别的绝对距离为0.4,二者接近取值范围的中点0.5,表示二者介于容易区分和难以区分之间,可以将λ设置为4,然后以上绝对距离进行缩放,第二个类别的绝对距离从0.3放大为1.2,第三个类别的绝对距离从0.4放大为1.6,二者与取值范围的中点2的距离也被放大了四倍,使得二者距离取值范围的中点更远,更容易判断该类别是否容易区分。
However, when the absolute distance is between [0,1], because the value range is narrow, it is difficult to effectively reflect the degree of easy distinction of the category. Therefore, it is easier to judge the absolute distance by magnifying the absolute distance by λ times and expanding the absolute distance. Whether the category is easy to distinguish, for example, refer to the examples in S31 and S32, y∈[1,1,1,0],
Figure PCTCN2020128856-appb-000010
When it is not zoomed, the absolute distance of the second category is 0.3, and the absolute distance of the third category is 0.4. The two are close to the midpoint of the value range 0.5, indicating that the two are between easy to distinguish and difficult to distinguish. Set λ to 4, and then scale the absolute distance above. The absolute distance of the second category is enlarged from 0.3 to 1.2, and the absolute distance of the third category is enlarged from 0.4 to 1.6. The distance has also been enlarged by four times, making the two farther away from the midpoint of the value range, making it easier to judge whether the category is easy to distinguish.
在上述实施方式中,通过放大样本数据的第i类预测标签、第i类预设标签之间的绝对距离,并将放大后的绝对距离作为样本数据的第i类预测标签、第i类预设标签之间的间隔距离,放大了样本数据的预测标签、样本数据的预设标签之间的差距,使得决策边界更加清晰,获取样本数据的预测标签时,更加准确。同时,由于绝对距离是将第i类预设标签的值减去第i类预测标签的值得到的,对于每一次训练,第i类的绝对距离会根据第i类预测标签的值自适应变化,使得得到的间隔距离更加准确,进而使该类别的预测标签预测更加准确,提高了分类模型的预测效果。In the above embodiment, the absolute distance between the i-th type prediction label and the i-th type preset label of the sample data is enlarged, and the enlarged absolute distance is used as the i-th type prediction label and the i-th type prediction label of the sample data. Setting the separation distance between the labels enlarges the gap between the predicted label of the sample data and the preset label of the sample data, making the decision boundary clearer, and obtaining the predicted label of the sample data more accurately. At the same time, since the absolute distance is obtained by subtracting the value of the i-th type predicted label from the value of the i-th preset label, for each training, the absolute distance of the i-th type will adaptively change according to the value of the i-th type predicted label. , So that the obtained separation distance is more accurate, and then the predicted label prediction of the category is more accurate, and the prediction effect of the classification model is improved.
S34、根据间隔距离,通过间距焦点损失函数,计算最大间距焦点损失值。S34: According to the separation distance, calculate the maximum separation focus loss value through the separation focus loss function.
其中,最大间距焦点损失值用于指示样本数据的预测标签、样本数据的预设标签之间差距的最大值。Among them, the maximum distance focus loss value is used to indicate the maximum value of the gap between the predicted label of the sample data and the preset label of the sample data.
参考图6,可以通过以下方式计算最大间距焦点损失值。Referring to Figure 6, the maximum pitch focus loss value can be calculated in the following way.
S341、根据间隔距离、第i类预测标签的值以及第i类预设标签的值,调整第i类预测标签值的取值范围,得到范围调整后的第i类预测标签值。S341: According to the separation distance, the value of the i-th type of predicted label and the value of the i-th type of preset label, adjust the value range of the i-th type of predicted label value to obtain the i-th type of predicted label value after the range adjustment.
一些实施方式中,使用间距距离、第i类预测标签的值以及第i类预设标签的值调整第i类预测标签值的取值范围,可以在S33的基础上,调整预测标签值的输出曲线的变化曲率,使得范围调整后的第i类预测标签的值的决策边界更加清晰,提高了分类模型的预测效果。In some embodiments, the value range of the predicted label value of the i-th type can be adjusted by using the spacing distance, the value of the i-th type predicted label and the value of the i-th type preset label, and the output of the predicted label value can be adjusted on the basis of S33. The changing curvature of the curve makes the decision boundary of the value of the i-th prediction label after the range adjustment clearer, and improves the prediction effect of the classification model.
参考图7,根据间隔距离、第i类预测标签的值以及第i类预设标签的值,调整第i类预测标签值的取值范围,得到范围调整后的第i类预测标签值,可以包括:Referring to Figure 7, according to the separation distance, the value of the i-th type predicted label and the value of the i-th type preset label, adjust the value range of the i-th type predicted label value to obtain the i-th type predicted label value after the range adjustment. include:
S3411、将第i类预设标签值乘以二再减一,获取映射后的第i类预设标签值。S3411, multiply the i-th type preset label value by two and then subtract one to obtain the i-th type preset label value after mapping.
S3412、将第i类预测标签值减去间隔距离与映射后的第i类预设标签值的乘积,获取映射后的第i类预测标签值。S3412, subtract the product of the separation distance and the mapped preset label value of the i-th type from the predicted label value of the i-th type to obtain the predicted label value of the i-th type after the mapping.
S3413、将映射后的第i类预测标签值乘以预设范围缩放系数,获取范围调整后的第i类预测标签值。S3413: Multiply the mapped predicted label value of the i-th type by a preset range scaling factor to obtain the predicted label value of the i-th type after the range adjustment.
一些实施方式中,可以将S3411、S3412、S3413中的步骤,用公式进行表示,即范围调整后的第i类预测标签值
Figure PCTCN2020128856-appb-000011
的计算方式为:
In some implementations, the steps in S3411, S3412, and S3413 can be expressed by a formula, that is, the predicted label value of the i-th category after the range adjustment
Figure PCTCN2020128856-appb-000011
Is calculated as:
Figure PCTCN2020128856-appb-000012
Figure PCTCN2020128856-appb-000012
其中,s为尺度缩放因子。Among them, s is the scale scaling factor.
仅作为示例而非限制,参考S31、S32中的示例,
Figure PCTCN2020128856-appb-000013
和y i的取值范围均为[0,1],s的值可以设置为10,则
Figure PCTCN2020128856-appb-000014
的取值范围为[-10m i,10+10m i]。
As an example and not a limitation, refer to the examples in S31 and S32,
Figure PCTCN2020128856-appb-000013
The value range of and y i are both [0,1], the value of s can be set to 10, then
Figure PCTCN2020128856-appb-000014
The value range of is [-10m i ,10+10m i ].
相对于
Figure PCTCN2020128856-appb-000015
在预测标签的种类数量相同时,预测标签值输出曲线的变化曲率更大,不同类别预测标签值的差距更大,使得第i类预测标签的决策边界更加清晰。
Relative to
Figure PCTCN2020128856-appb-000015
When the number of types of predicted labels is the same, the curvature of the predicted label value output curve is greater, and the difference between the predicted label values of different categories is larger, making the decision boundary of the i-th predicted label clearer.
S342、根据范围调整后的第i类预测标签值、间距焦点损失函数,得到最大间距焦点损失值。S342: Obtain a maximum distance focus loss value according to the i-th type predicted label value and the distance focus loss function after the range adjustment.
其中,得到最大间距焦点损失值的方式可以通过以下步骤:Among them, the method of obtaining the focal loss value of the maximum distance can be through the following steps:
S3421、对范围调整后的第i类预测标签值进行二分类,获取二分类后的第i类预测标签值。S3421 Perform two classifications on the predicted label value of the i-th type after the range adjustment, and obtain the predicted label value of the i-th type after the two classification.
由于范围调整后的第i类预测标签值的决策边界已经十分清晰了,因此,需要对范围调整后的第i类预测标签值进行二分类,来确定样本数据中每个类型的标签是否存在。Since the decision boundary of the predicted label value of the i-th type after the range adjustment is very clear, it is necessary to classify the predicted label value of the i-th type after the range adjustment to determine whether each type of label exists in the sample data.
二分类的方式有多种,如使用Sigmoid函数、Logistic回归等方式。There are many ways of binary classification, such as using Sigmoid function, Logistic regression and so on.
仅作为示例而非限制,使用Sigmoid函数计算时,二分类后的第i类预测标签值
Figure PCTCN2020128856-appb-000016
可以用以下公式表示:
As an example and not a limitation, when using the Sigmoid function to calculate, the predicted label value of the i-th class after two classifications
Figure PCTCN2020128856-appb-000016
It can be expressed by the following formula:
Figure PCTCN2020128856-appb-000017
Figure PCTCN2020128856-appb-000017
S3422、根据二分类后的第i类预测标签值、间距焦点损失函数,获取最大间距焦点损失值。S3422, according to the predicted label value and the distance focus loss function of the i-th category after the two classifications, obtain the maximum distance focus loss value.
一些实施方式中,间距焦点损失函数为:In some embodiments, the pitch focus loss function is:
Figure PCTCN2020128856-appb-000018
Figure PCTCN2020128856-appb-000018
Figure PCTCN2020128856-appb-000019
作为
Figure PCTCN2020128856-appb-000020
(即
Figure PCTCN2020128856-appb-000021
)代入公式,得到最大间距焦点损失函数:
will
Figure PCTCN2020128856-appb-000019
As
Figure PCTCN2020128856-appb-000020
(which is
Figure PCTCN2020128856-appb-000021
) Substitute into the formula to get the focal loss function of the maximum distance:
Figure PCTCN2020128856-appb-000022
Figure PCTCN2020128856-appb-000022
其中,w i 0表示样本数据中不存在第i个类别的预测标签时对应损失函数的权重;w i 1表示一个样本数据中存在第i个类别的预测标签时对应损失函数的权重,其计算方式为: Among them, w i 0 represents the weight of the corresponding loss function when there is no predicted label of the i-th category in the sample data; w i 1 represents the weight of the corresponding loss function when the predicted label of the i-th category exists in a sample data, and its calculation The way is:
Figure PCTCN2020128856-appb-000023
Figure PCTCN2020128856-appb-000023
Figure PCTCN2020128856-appb-000024
Figure PCTCN2020128856-appb-000024
α和β均为预设的参数,一些实施方式中,α=0.5,β=2,但不以此为限。Both α and β are preset parameters. In some embodiments, α=0.5 and β=2, but not limited to this.
最后,通过最大间距焦点损失函数,计算得到每个类别的最大焦点损失值。Finally, through the maximum distance focus loss function, the maximum focus loss value of each category is calculated.
S35、根据最大间距焦点损失值训练预设分类模型,获取训练后的分类模型。S35: Train a preset classification model according to the maximum distance focus loss value, and obtain a trained classification model.
需要说明的是,可以使用最大间距焦点损失值进行反向传播,多次迭代,反复训练预设分类模型,最终得到训练后的分类模型,具体的训练方法在此不做限制。It should be noted that the maximum distance focus loss value can be used for back propagation, multiple iterations, and repeated training of the preset classification model, and finally the trained classification model is obtained. The specific training method is not limited here.
在此,以图片自动分类模型的训练为例,说明本申请提供的数据分类方法的应用场景。Here, the training of the automatic picture classification model is taken as an example to illustrate the application scenarios of the data classification method provided in this application.
首先,先收集大量的图像样本,作为样本数据,可以用D={<x i,y i>|i=1,2,3...N}来表示。其中x i是图像样本,y i是图像样本对应的多个类别标签。 First, a large number of image samples are collected first, as sample data, which can be represented by D={<x i ,y i >|i=1, 2, 3...N}. Where x i is an image sample, and y i are multiple category labels corresponding to the image sample.
然后,确定机器学习的分类模型,在此,可以使用卷积神经网络f θ,其中θ是该模型的参数。 Then, the machine learning classification model is determined. Here, a convolutional neural network f θ can be used, where θ is a parameter of the model.
接着,将B个图像样本输入卷积神经网络f θ,并根据以下公式更新卷积神经网络的参数θ: Next, input B image samples into the convolutional neural network f θ , and update the parameters θ of the convolutional neural network according to the following formula:
Figure PCTCN2020128856-appb-000025
Figure PCTCN2020128856-appb-000025
其中,L即为本申请中提供的最大焦点损失函数计算的得到的最大焦点损失值。Among them, L is the maximum focus loss value calculated by the maximum focus loss function provided in this application.
然后,将上一步迭代T次,直到模型收敛或L小于预设阈值,即可得到训练后的分类模型f θ*Then, iterate the previous step T times until the model converges or L is less than the preset threshold, and the trained classification model f θ* can be obtained.
最后,将待预测图像x输入训练后的分类模型f θ*,输出待预测图像的多类别标签向量f θ*(x)。 Finally, the image x to be predicted is input to the trained classification model f θ* , and the multi-class label vector f θ* (x) of the image to be predicted is output.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the sequence number of each step in the foregoing embodiment does not mean the order of execution. The execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
对应于上文实施例所述的数据分类方法,图9示出了本申请一实施例提供的数据分类装置的结构示意图,为了便于说明,仅示出了与本申请实施例相关的部分。Corresponding to the data classification method described in the above embodiment, FIG. 9 shows a schematic structural diagram of a data classification device provided in an embodiment of the present application. For ease of description, only the parts related to the embodiment of the present application are shown.
参照图9,该装置包括:接收模块51,用于接收待分类数据。分类模块52,用于将待分类数据输入训练后的分类模型,得到待分类数据的至少一个数据标签,其中,分类模型是根据间距焦点损失函数训练得到的,间距焦点损失函数用于根据样本数据的预测标签、样本数据的预设标签的间隔距离,表示样本数据的预测标签、样本数据的预设标签之间的差距。Referring to FIG. 9, the device includes: a receiving module 51 for receiving data to be classified. The classification module 52 is used to input the data to be classified into the trained classification model to obtain at least one data label of the data to be classified, wherein the classification model is obtained by training according to the distance focus loss function, and the distance focus loss function is used according to the sample data The separation distance between the predicted label of the sample data and the preset label of the sample data represents the gap between the predicted label of the sample data and the preset label of the sample data.
一些实现方式中,参照图10,该装置还包括训练模块53,用于根据以下步骤得到训练后的分类模型:先从预设数据库中获取至少一个样本数据,其中,每个样本数据包括至少一个预设的标签。然后通过预设分类模型,获取每个样本数据的预测标签。再获取样本数据的预测标签和样本数据的预设标签之间的间隔距离。再根据间隔距离,通过间距焦点损失函数,计算最大间距焦点损失值,其中,最大间距焦点损失值用于指示样本数据的预测标签、样本数据的预设标签之间差距的最大值。最后,根据最大间距焦点损失值训练预设分类模型,获取训练后的分类模型。In some implementations, referring to FIG. 10, the device further includes a training module 53 for obtaining a trained classification model according to the following steps: first obtain at least one sample data from a preset database, wherein each sample data includes at least one The preset label. Then, the predicted label of each sample data is obtained through the preset classification model. Then obtain the separation distance between the predicted label of the sample data and the preset label of the sample data. Then according to the separation distance, the maximum distance focus loss value is calculated through the distance focus loss function, where the maximum distance focus loss value is used to indicate the maximum value of the gap between the predicted label of the sample data and the preset label of the sample data. Finally, the preset classification model is trained according to the maximum distance focus loss value, and the trained classification model is obtained.
需要说明的是,预测标签包括N个分类,其中,N为大于1的整数。It should be noted that the predicted label includes N categories, where N is an integer greater than 1.
相应的,训练模块53,具体用于根据样本数据第i类预测标签的值、样本数据第i类预设标签的值,获取样本数据的第i类预测标签、第i类预设标签之间的间隔距离,其中,i为大于或等于1且小于或等于N的整数。Correspondingly, the training module 53 is specifically configured to obtain the value of the i-th type predicted label and the i-th type preset label of the sample data according to the value of the i-th type predicted label of the sample data and the value of the i-th type preset label of the sample data The separation distance of, where i is an integer greater than or equal to 1 and less than or equal to N.
还有一些实现方式中,训练模块53,具体用于先将第i类预设标签的值减去第i类预测标签的值,获取样本数据的第i类预测标签、第i类预设标签之间的绝对距离。再将绝对距离与预设缩放系数相乘,得到样本数据的第i类预测标签、第i类预设标签之间的间隔距离。In some other implementations, the training module 53 is specifically configured to first subtract the value of the i-th type predicted label from the value of the i-th type preset label to obtain the i-th type predicted label and the i-th type preset label of the sample data. The absolute distance between. Then, the absolute distance is multiplied by the preset scaling factor to obtain the separation distance between the i-th type predicted label and the i-th type preset label of the sample data.
可选地,训练模块53,具体用于先根据间隔距离、第i类预测标签的值以及第i类预设标签的值,调整第i类预测标签值的取值范围,得到范围调整后的第i类预测标签值。再根据范围调整后的第i类预测标签值、间距焦点损失函数,得到最大间距焦点损失值。Optionally, the training module 53 is specifically configured to first adjust the value range of the i-th type predicted label value according to the separation distance, the value of the i-th type predicted label, and the value of the i-th type preset label, to obtain the adjusted range The i-th type predicts the label value. Then, according to the predicted label value of the i-th type and the distance focus loss function after the range adjustment, the maximum distance focus loss value is obtained.
还有一些实现方式中,训练模块53,具体用于先将第i类预设标签值乘以二再减一,获取映射后的第i类预设标签值。再将第i类预测标签值减去间隔距离与映射后的第i类预设标签值的乘积,获取映射后的第i类预测标签值。最后将映射后的第i类预测标签值乘以 预设范围缩放系数,获取范围调整后的第i类预测标签值。In some other implementations, the training module 53 is specifically configured to first multiply the preset label value of the i-th type by two and then subtract one to obtain the mapped preset label value of the i-th type. Then subtract the product of the separation distance and the mapped preset label value from the i-th type predicted label value to obtain the mapped i-th type predicted label value. Finally, the mapped i-th type predicted label value is multiplied by the preset range scaling factor to obtain the i-th type predicted label value after the range adjustment.
可选地,训练模块53,具体用于先对范围调整后的第i类预测标签值进行二分类,获取二分类后的第i类预测标签值。然后根据二分类后的第i类预测标签值、间距焦点损失函数,获取最大间距焦点损失值。Optionally, the training module 53 is specifically configured to first classify the predicted label value of the i-th type after the range adjustment, and obtain the predicted label value of the i-th type after the two classification. Then, the maximum distance focus loss value is obtained according to the predicted label value and distance focus loss function of the i-th class after the two classifications.
需要说明的是,上述装置之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例部分,此处不再赘述。It should be noted that the information exchange and execution process between the above-mentioned devices are based on the same concept as the method embodiment of this application, and its specific functions and technical effects can be found in the method embodiment section. Go into details again.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, only the division of the above functional units and modules is used as an example. In practical applications, the above functions can be allocated to different functional units and modules as needed. Module completion, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist alone physically, or two or more units can be integrated into one unit. The above-mentioned integrated units can be hardware-based Formal realization can also be realized in the form of software functional units. In addition, the specific names of the functional units and modules are only used to facilitate distinguishing from each other, and are not used to limit the protection scope of the present application. For the specific working process of the units and modules in the foregoing system, reference may be made to the corresponding process in the foregoing method embodiment, which will not be repeated here.
图11示出了本申请实施例提供的终端设备的结构示意图,参考图11,该终端设备6包括:FIG. 11 shows a schematic structural diagram of a terminal device provided by an embodiment of the present application. Referring to FIG. 11, the terminal device 6 includes:
存储器62、处理器61以及存储在存储器62中并可在处理器61上运行的计算机程序63,处理器61执行计算机程序63时实现上述各个方法实施例中的步骤。The memory 62, the processor 61, and a computer program 63 that is stored in the memory 62 and can run on the processor 61, and the processor 61 implements the steps in the foregoing method embodiments when the computer program 63 is executed.
本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现可实现上述各个方法实施例中的步骤。The embodiments of the present application also provide a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in each of the foregoing method embodiments can be realized.
本申请实施例提供了一种计算机程序产品,当计算机程序产品在移动终端上运行时,使得移动终端执行时实现可实现上述各个方法实施例中的步骤。The embodiments of the present application provide a computer program product. When the computer program product runs on a mobile terminal, the steps in the foregoing method embodiments can be realized when the mobile terminal is executed.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质至少可以包括:能够将计算机程序代码携带到拍照装置/终端设备的任何实体或装置、记录介质、计算机存储器、 只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质。例如U盘、移动硬盘、磁碟或者光盘等。在某些司法管辖区,根据立法和专利实践,计算机可读介质不可以是电载波信号和电信信号。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the implementation of all or part of the processes in the above-mentioned embodiment methods in the present application can be accomplished by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. The computer program can be stored in a computer-readable storage medium. When executed by the processor, the steps of the foregoing method embodiments can be implemented. Wherein, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file, or some intermediate forms. The computer-readable medium may at least include: any entity or device capable of carrying the computer program code to the photographing device/terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunications signal and software distribution medium. For example, U disk, mobile hard disk, floppy disk or CD-ROM, etc. In some jurisdictions, according to legislation and patent practices, computer-readable media cannot be electrical carrier signals and telecommunication signals.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail or recorded in an embodiment, reference may be made to related descriptions of other embodiments.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。A person of ordinary skill in the art may realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed by hardware or software depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
在本申请所提供的实施例中,应该理解到,所揭露的装置/网络设备和方法,可以通过其它的方式实现。例如,以上所描述的装置/网络设备实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided in this application, it should be understood that the disclosed apparatus/network equipment and method may be implemented in other ways. For example, the device/network device embodiments described above are only illustrative. For example, the division of the modules or units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units. Or components can be combined or integrated into another system, or some features can be omitted or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, a person of ordinary skill in the art should understand that it can still implement the foregoing The technical solutions recorded in the examples are modified, or some of the technical features are equivalently replaced; these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the application, and should be included in Within the scope of protection of this application.

Claims (10)

  1. 一种数据分类方法,其特征在于,包括:A data classification method, characterized in that it includes:
    接收待分类数据;Receive data to be classified;
    将所述待分类数据输入所述训练后的分类模型,得到所述待分类数据的至少一个数据标签,其中,所述分类模型是根据间距焦点损失函数训练得到的,所述间距焦点损失函数用于根据样本数据的预测标签、所述样本数据的预设标签的间隔距离,表示所述样本数据的预测标签、所述样本数据的预设标签之间的差距。Input the to-be-classified data into the trained classification model to obtain at least one data label of the to-be-classified data, wherein the classification model is obtained by training according to the distance focus loss function, and the distance focus loss function is The distance between the predicted label of the sample data and the preset label of the sample data indicates the gap between the predicted label of the sample data and the preset label of the sample data.
  2. 根据权利要求1所述的方法,其特征在于,所述训练后的分类模型的训练方式为:The method according to claim 1, wherein the training method of the trained classification model is:
    从预设数据库中获取至少一个所述样本数据,其中,每个所述样本数据包括至少一个预设的标签;Acquiring at least one of the sample data from a preset database, wherein each of the sample data includes at least one preset label;
    通过预设分类模型,获取每个所述样本数据的预测标签;Obtain the predicted label of each of the sample data through a preset classification model;
    获取所述样本数据的预测标签和所述样本数据的预设标签之间的间隔距离;Obtaining the separation distance between the predicted label of the sample data and the preset label of the sample data;
    根据所述间隔距离,通过所述间距焦点损失函数,计算最大间距焦点损失值,其中,所述最大间距焦点损失值用于指示所述样本数据的预测标签、所述样本数据的预设标签之间差距的最大值;According to the spacing distance, the maximum spacing focus loss value is calculated by the spacing focus loss function, wherein the maximum spacing focus loss value is used to indicate one of the predicted label of the sample data and the preset label of the sample data The maximum value of the gap between;
    根据所述最大间距焦点损失值训练所述预设分类模型,获取训练后的分类模型。The preset classification model is trained according to the maximum distance focus loss value, and the trained classification model is obtained.
  3. 根据权利要求2所述的方法,其特征在于,所述预测标签包括N个分类,其中,N为大于1的整数;The method according to claim 2, wherein the predicted label includes N categories, wherein N is an integer greater than 1;
    相应的,所述获取所述样本数据的预测标签和所述样本数据的预设标签之间的间隔距离,包括:Correspondingly, the obtaining the separation distance between the predicted label of the sample data and the preset label of the sample data includes:
    根据所述样本数据第i类预测标签的值、所述样本数据第i类预设标签的值,获取所述样本数据的第i类预测标签、第i类预设标签之间的间隔距离,其中,i为大于或等于1且小于或等于N的整数。According to the value of the i-th type of predicted label of the sample data and the value of the i-th type of preset label of the sample data, the separation distance between the i-th type of predicted label and the i-th type of preset label of the sample data is obtained, Wherein, i is an integer greater than or equal to 1 and less than or equal to N.
  4. 根据权利要求3所述的方法,其特征在于,所述根据所述样本数据第i类预测标签的值、所述样本数据第i类预设标签的值,获取所述样本数据的第i类预测标签、第i类预设标签之间的间隔距离,包括:The method according to claim 3, characterized in that, according to the value of the predicted label of the i-th type of the sample data and the value of the preset label of the i-th type of the sample data, the i-th type of the sample data is obtained The distance between the predicted label and the i-th preset label includes:
    将所述第i类预设标签的值减去所述第i类预测标签的值,获取所述样本数据的第i类预测标签、第i类预设标签之间的绝对距离;Subtracting the value of the i-th type prediction label from the value of the i-th type preset label to obtain the absolute distance between the i-th type prediction label and the i-th type preset label of the sample data;
    将所述绝对距离与预设缩放系数相乘,得到所述样本数据的第i类预测标签、第i类预设标签之间的间隔距离。The absolute distance is multiplied by a preset scaling factor to obtain the separation distance between the i-th type predicted label and the i-th type preset label of the sample data.
  5. 根据权利要求3或4所述的方法,其特征在于,所述根据所述间隔距离,通过所述间距焦点损失函数,计算获取最大间距焦点损失值,包括:The method according to claim 3 or 4, wherein the calculating and obtaining a maximum pitch focus loss value through the pitch focus loss function according to the pitch distance comprises:
    根据所述间隔距离、所述第i类预测标签的值以及所述第i类预设标签的值,调整所述第i类预测标签值的取值范围,得到范围调整后的第i类预测标签值;According to the separation distance, the value of the i-th type prediction label, and the value of the i-th type preset label, adjust the value range of the i-th type prediction label value to obtain the i-th type prediction after the range adjustment Label value
    根据所述范围调整后的第i类预测标签值、所述间距焦点损失函数,得到所述最大间距焦点损失值。According to the predicted tag value of the i-th type after the range adjustment and the distance focus loss function, the maximum distance focus loss value is obtained.
  6. 根据权利要求5所述的方法,其特征在于,所述根据所述间隔距离、所述第i类预测标签的值以及所述第i类预设标签的值,调整所述第i类预测标签值的取值范围,得到范围调整后的第i类预测标签值,包括:The method according to claim 5, wherein the adjustment of the i-th type predicted label is based on the separation distance, the value of the i-th type predicted label, and the value of the i-th type preset label The value range of the value to obtain the i-th type predicted label value after the range adjustment, including:
    将所述第i类预设标签值乘以二再减一,获取映射后的第i类预设标签值;Multiplying the i-th type preset label value by two and then subtracting one to obtain the i-th type preset label value after mapping;
    将所述第i类预测标签值减去所述间隔距离与所述映射后的第i类预设标签值的乘积,获取映射后的第i类预测标签值;Subtracting the product of the separation distance and the mapped i-th preset label value from the i-th type predicted label value to obtain a mapped i-th type predicted label value;
    将所述映射后的第i类预测标签值乘以预设范围缩放系数,获取所述范围调整后的第i类预测标签值。Multiplying the mapped i-th type predicted label value by a preset range scaling factor to obtain the i-th type predicted label value after the range adjustment.
  7. 根据权利要求5所述的方法,其特征在于,所述根据所述范围调整后的第i类预测标签值、所述间距焦点损失函数,得到所述最大间距焦点损失值,包括:The method according to claim 5, wherein the obtaining the maximum distance focus loss value according to the i-th type predicted label value after the range adjustment and the distance focus loss function comprises:
    对所述范围调整后的第i类预测标签值进行二分类,获取二分类后的第i类预测标签值;Perform two classifications on the predicted label value of the i-th category after the range adjustment, and obtain the predicted label value of the i-th category after the two classification;
    根据所述二分类后的第i类预测标签值、所述间距焦点损失函数,获取所述最大间距焦点损失值。Obtain the maximum distance focus loss value according to the predicted label value of the i-th type after the two classifications and the distance focus loss function.
  8. 一种数据分类装置,其特征在于,包括:A data classification device is characterized in that it comprises:
    接收模块,用于接收待分类数据;The receiving module is used to receive the data to be classified;
    分类模块,用于将所述待分类数据输入所述训练后的分类模型,得到所述待分类数据的至少一个数据标签,其中,所述分类模型是根据间距焦点损失函数训练得到的,所述间距焦点损失函数用于根据样本数据的预测标签、所述样本数据的预设标签的间隔距离,表示所述样本数据的预测标签、所述样本数据的预设标签之间的差距。The classification module is configured to input the data to be classified into the trained classification model to obtain at least one data label of the data to be classified, wherein the classification model is trained according to the distance focus loss function, and the The pitch focus loss function is used to represent the gap between the predicted label of the sample data and the preset label of the sample data according to the separation distance between the predicted label of the sample data and the preset label of the sample data.
  9. 一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至7任一项所述的方法。A terminal device, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program as claimed in claims 1 to 7. The method of any one.
  10. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述的方法。A computer-readable storage medium storing a computer program, wherein the computer program implements the method according to any one of claims 1 to 7 when the computer program is executed by a processor.
PCT/CN2020/128856 2019-11-21 2020-11-13 Data classification method and apparatus, terminal device and readable storage medium WO2021098618A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911150175.XA CN110929785B (en) 2019-11-21 2019-11-21 Data classification method, device, terminal equipment and readable storage medium
CN201911150175.X 2019-11-21

Publications (1)

Publication Number Publication Date
WO2021098618A1 true WO2021098618A1 (en) 2021-05-27

Family

ID=69850664

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/128856 WO2021098618A1 (en) 2019-11-21 2020-11-13 Data classification method and apparatus, terminal device and readable storage medium

Country Status (2)

Country Link
CN (1) CN110929785B (en)
WO (1) WO2021098618A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117633456A (en) * 2023-11-17 2024-03-01 国网江苏省电力有限公司 Marine wind power weather event identification method and device based on self-adaptive focus loss

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110929785B (en) * 2019-11-21 2023-12-05 中国科学院深圳先进技术研究院 Data classification method, device, terminal equipment and readable storage medium
CN111330871B (en) * 2020-03-31 2023-03-28 新华三信息安全技术有限公司 Quality classification method and device
CN112054967A (en) * 2020-08-07 2020-12-08 北京邮电大学 Network traffic classification method and device, electronic equipment and storage medium
CN112884569A (en) * 2021-02-24 2021-06-01 中国工商银行股份有限公司 Credit assessment model training method, device and equipment
CN113807400B (en) * 2021-08-17 2024-03-29 西安理工大学 Hyperspectral image classification method, hyperspectral image classification system and hyperspectral image classification equipment based on attack resistance

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015070314A1 (en) * 2013-11-13 2015-05-21 Yong Liu Supervised credit classifier with accounting ratios
CN109816092A (en) * 2018-12-13 2019-05-28 北京三快在线科技有限公司 Deep neural network training method, device, electronic equipment and storage medium
CN109840530A (en) * 2017-11-24 2019-06-04 华为技术有限公司 The method and apparatus of training multi-tag disaggregated model
CN110413791A (en) * 2019-08-05 2019-11-05 哈尔滨工业大学 File classification method based on CNN-SVM-KNN built-up pattern
CN110929785A (en) * 2019-11-21 2020-03-27 中国科学院深圳先进技术研究院 Data classification method and device, terminal equipment and readable storage medium

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106599913B (en) * 2016-12-07 2019-08-06 重庆邮电大学 A kind of multi-tag imbalance biomedical data classification method based on cluster
CN109840531B (en) * 2017-11-24 2023-08-25 华为技术有限公司 Method and device for training multi-label classification model
CN109189767B (en) * 2018-08-01 2021-07-23 北京三快在线科技有限公司 Data processing method and device, electronic equipment and storage medium
CN109635677B (en) * 2018-11-23 2022-12-16 华南理工大学 Compound fault diagnosis method and device based on multi-label classification convolutional neural network
CN110147456B (en) * 2019-04-12 2023-01-24 中国科学院深圳先进技术研究院 Image classification method and device, readable storage medium and terminal equipment
CN110163252B (en) * 2019-04-17 2023-11-24 平安科技(深圳)有限公司 Data classification method and device, electronic equipment and storage medium
CN110442722B (en) * 2019-08-13 2022-05-13 北京金山数字娱乐科技有限公司 Method and device for training classification model and method and device for data classification

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015070314A1 (en) * 2013-11-13 2015-05-21 Yong Liu Supervised credit classifier with accounting ratios
CN109840530A (en) * 2017-11-24 2019-06-04 华为技术有限公司 The method and apparatus of training multi-tag disaggregated model
CN109816092A (en) * 2018-12-13 2019-05-28 北京三快在线科技有限公司 Deep neural network training method, device, electronic equipment and storage medium
CN110413791A (en) * 2019-08-05 2019-11-05 哈尔滨工业大学 File classification method based on CNN-SVM-KNN built-up pattern
CN110929785A (en) * 2019-11-21 2020-03-27 中国科学院深圳先进技术研究院 Data classification method and device, terminal equipment and readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117633456A (en) * 2023-11-17 2024-03-01 国网江苏省电力有限公司 Marine wind power weather event identification method and device based on self-adaptive focus loss
CN117633456B (en) * 2023-11-17 2024-05-31 国网江苏省电力有限公司 Marine wind power weather event identification method and device based on self-adaptive focus loss

Also Published As

Publication number Publication date
CN110929785B (en) 2023-12-05
CN110929785A (en) 2020-03-27

Similar Documents

Publication Publication Date Title
WO2021098618A1 (en) Data classification method and apparatus, terminal device and readable storage medium
WO2021057848A1 (en) Network training method, image processing method, network, terminal device and medium
WO2020155627A1 (en) Facial image recognition method and apparatus, electronic device, and storage medium
WO2020186887A1 (en) Target detection method, device and apparatus for continuous small sample images
US20210182611A1 (en) Training data acquisition method and device, server and storage medium
CN109740620B (en) Method, device, equipment and storage medium for establishing crowd figure classification model
CN108197652B (en) Method and apparatus for generating information
WO2018099084A1 (en) Method, device, chip and system for training neural network model
EP4099220A1 (en) Processing apparatus, method and storage medium
WO2020253127A1 (en) Facial feature extraction model training method and apparatus, facial feature extraction method and apparatus, device, and storage medium
CN109522945B (en) Group emotion recognition method and device, intelligent device and storage medium
CN111339818B (en) Face multi-attribute recognition system
CN113159283A (en) Model training method based on federal transfer learning and computing node
WO2023185539A1 (en) Machine learning model training method, service data processing method, apparatuses, and systems
CN111382248A (en) Question reply method and device, storage medium and terminal equipment
CN114139013A (en) Image searching method and device, electronic equipment and computer readable storage medium
CN113191479A (en) Method, system, node and storage medium for joint learning
CN112232506A (en) Network model training method, image target recognition method, device and electronic equipment
WO2023274167A1 (en) Image classification method, model training method, device, storage medium, and computer program
CN114170484B (en) Picture attribute prediction method and device, electronic equipment and storage medium
JP2024508867A (en) Image clustering method, device, computer equipment and computer program
CN110276405A (en) Method and apparatus for output information
CN113919361A (en) Text classification method and device
CN116522988B (en) Federal learning method, system, terminal and medium based on graph structure learning
KR20220058915A (en) Image detection and related model training methods, apparatus, apparatus, media and programs

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20891405

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20891405

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205N DATED 19/01/2023)

122 Ep: pct application non-entry in european phase

Ref document number: 20891405

Country of ref document: EP

Kind code of ref document: A1