CN114022699A - Image classification method and device, computer equipment and storage medium - Google Patents

Image classification method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN114022699A
CN114022699A CN202111203991.XA CN202111203991A CN114022699A CN 114022699 A CN114022699 A CN 114022699A CN 202111203991 A CN202111203991 A CN 202111203991A CN 114022699 A CN114022699 A CN 114022699A
Authority
CN
China
Prior art keywords
image
processed
features
feature
similarity
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202111203991.XA
Other languages
Chinese (zh)
Inventor
茅天奇
丁拥科
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhongan Online P&c Insurance Co ltd
Original Assignee
Zhongan Online P&c Insurance Co ltd
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 Zhongan Online P&c Insurance Co ltd filed Critical Zhongan Online P&c Insurance Co ltd
Priority to CN202111203991.XA priority Critical patent/CN114022699A/en
Publication of CN114022699A publication Critical patent/CN114022699A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning

Landscapes

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

Abstract

The application relates to an image classification method, an image classification device, a computer device and a storage medium. The method comprises the following steps: acquiring an image to be processed; processing the image to be processed through a pre-trained feature extraction model to obtain branch features of at least two branches, and splicing partial features corresponding to the branches to obtain target features; calculating the similarity between the target characteristic of the image to be processed and the image characteristic of the historical image; and classifying the images to be processed according to the similarity. By adopting the method, the images to be processed can be classified.

Description

Image classification method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of artificial intelligence image technology, and in particular, to a method and an apparatus for analyzing background similarity, a computer device, and a storage medium.
Background
With the increase of economic level and the change of consumption concept, the advanced consumption mode using online loan, credit card and the like is becoming common nowadays, so that many companies develop related online financial services.
On-line loan only requires the borrower to provide corresponding identity information and upload the current photo to obtain loan qualification, so that many lawless persons can utilize the convenience of on-line loan, loan money from loan at a higher price or illegal funding or malicious loan, namely loan is not good, and the like, in a way of collectively applying for a large amount of loan, and in any case, certain economic loss is generated for the company.
Disclosure of Invention
In view of the above, it is necessary to provide an image classification method, an apparatus, a computer device, and a storage medium capable of classifying an image in view of the above technical problems.
An image classification method, comprising:
acquiring an image to be processed;
processing the image to be processed through a pre-trained feature extraction model to obtain branch features of at least two branches, and splicing the branch features to obtain target features;
calculating the similarity between the target characteristic of the image to be processed and the image characteristic of the historical image;
and classifying the images to be processed according to the similarity.
In one embodiment, the deriving at least two branches by a pre-trained feature extraction model includes:
extracting the integral features of the image to be processed through an integral feature extraction network of a pre-trained feature extraction model;
and selecting partial features from the overall features through at least one partial feature extraction branch of the pre-trained feature extraction model as branch features of the corresponding branch.
In one embodiment, the calculating the similarity between the target feature of the image to be processed and the image feature of the historical image includes:
and calculating the cosine similarity between the target feature of the image to be processed and the image feature of the historical image, wherein the cosine similarity is used as the similarity between the target feature of the image to be processed and the image feature of the historical image.
In one embodiment, the image classification method further includes:
obtaining a sample image, wherein the sample image carries a classification label;
inputting the sample image into an initial model to obtain a feature to be processed;
calculating to obtain a target loss function according to the classification label and the feature to be processed;
and optimizing the initial model according to the target loss function to obtain the feature extraction model.
In one embodiment, the calculating an objective loss function according to the classification label and the feature to be processed includes:
segmenting the features to be processed to obtain partial sample features corresponding to at least two branches;
calculating to obtain a first loss function according to the sample label and the feature to be processed;
calculating to obtain at least two second loss functions according to the sample labels and the partial sample characteristics corresponding to each branch;
and obtaining the target loss function according to the first loss function and the second loss function.
A risk image identification method, the risk image identification method comprising:
acquiring an image to be processed;
classifying the image to be processed according to the image classification method in any one of the above implementations;
counting the number of the historical images in the corresponding classification of the image to be processed;
and when the number of the historical images in the corresponding classification of the image to be processed exceeds a preset numerical value, judging that the image to be processed is a risk image.
An image classification apparatus, the apparatus comprising:
the receiving module is used for acquiring an image to be processed;
the characteristic extraction module is used for extracting the characteristics of the image to be processed;
the similarity calculation module is used for calculating the similarity between the features of the image to be processed and the image features in the database;
and the analysis module is used for judging the image to be processed according to the similarity.
A risk image recognition device, the device comprising:
a data receiving module: the image processing device is used for acquiring an image to be processed;
an image classification module: the image classification method is used for classifying the image to be processed according to the image classification method in any one of the embodiments;
an image statistics module: counting the number of the historical images in the corresponding classification of the image to be processed;
a risk image determination module: and the method is used for judging that the image to be processed is a risk image when the number of the historical images in the corresponding classification of the image to be processed exceeds a preset numerical value.
A computer device comprising a memory storing a computer program and a processor implementing the steps of the method described above when executing the computer program.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method.
According to the image classification method, partial characteristics of at least two branches of the image to be processed can be obtained through the characteristic extraction model, the branches are spliced to obtain target characteristics, the similarity between the target characteristics and the historical image is calculated according to the target characteristics, the image to be processed is classified according to the similarity, the target characteristics are obtained through splicing the branch characteristics, and therefore the image to be processed can be classified through comparing the target characteristics of the image to be processed with the image characteristics of the historical image. Secondly, as the target features are obtained by splicing the branch features, classification of the images to be processed according to the specific regions can be realized by setting rules for obtaining the branch features.
Drawings
FIG. 1 is a diagram of an exemplary embodiment of an image classification method;
FIG. 2 is a flow diagram illustrating a method for image classification in one embodiment;
FIG. 3 is a self-portrait photograph uploaded by a user in one embodiment;
FIG. 4 is a schematic flow diagram of training a feature extraction model in one embodiment;
FIG. 5 is a schematic flow chart of the calculation of the objective loss function in one embodiment;
FIG. 6 is a flow diagram illustrating a method for risk image identification in one embodiment;
FIG. 7 is a flow chart illustrating a process for determining a financial wind control method based on background similarity analysis in one embodiment;
FIG. 8 is a block diagram of an image classification apparatus according to an embodiment;
FIG. 9 is a block diagram of a risk image recognition device according to an embodiment;
FIG. 10 is a diagram showing an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The image classification method provided by the application can be applied to the application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The terminal 102 may send the acquired invoice image to be processed to the server 104, so that the server 104 may process the invoice image to be processed, for example, the server 104 inputs the image to be processed into a pre-trained feature extraction model to perform feature extraction and obtain partial features corresponding to at least two branches, then splices the partial features corresponding to the branches to obtain a target feature, and finally calculates a similarity between the target feature of the image to be processed and an image of the historical image and classifies the image to be processed according to the similarity. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented by an independent server or a server cluster formed by a plurality of servers.
In one embodiment, as shown in fig. 2, an image classification method is provided, which is described by taking the method as an example applied to the server in fig. 1, and includes the following steps:
s202, acquiring an image to be processed.
The image to be processed is a photo received by the server and uploaded by the terminal. Optionally, the terminal may upload the images to be processed in batch. The server can store the image to be processed uploaded by the terminal, so that the stored image to be processed is directly obtained during processing, and preferably, the server stores the image to be processed into the cache queue.
Alternatively, if the terminal uploads the personal photos taken by the borrower, the server can perform feature extraction on the personal photos taken by the borrower according to the instruction and classify the personal photos taken by the borrower according to the extracted features.
And S204, processing the image to be processed through a pre-trained feature extraction model to obtain branch features of at least two branches, and splicing the branch features to obtain a target feature.
Specifically, the feature extraction model is a model trained in advance for extracting features in an image to be processed. The branch feature refers to a part of the overall feature of the image to be processed, and the branch feature can be obtained by segmenting the overall feature according to a preset rule. For example, the branch feature may be the first half feature, the first third feature, and/or the first one-third to two-thirds feature of the overall feature of the image to be processed. Wherein the branch feature may be a part determined to be an extraction of the whole feature according to the purpose of classification. For example, the general background features are above the image, so if the classification is performed according to the background features, the first half feature, the first third feature and/or the first one-third to two-thirds feature of the overall features of the image to be processed can be extracted. If the classification is performed according to the foreground features, the last half feature, the last third feature, and/or the last one-third to two-thirds feature of the overall features may be extracted. Therefore, the positions of the classified features can be determined empirically in advance, and the positions of the features extracted by the branches corresponding to the feature extraction model can be rearranged and then trained.
Specifically, the target feature is a feature for characterizing the image to be processed, is a basis for classifying the image to be processed, and can be obtained by splicing the branch features. Optionally, the branch features may be directly spliced to obtain the target feature, or the partial features may be processed and then spliced, for example, the partial features are first subjected to feature fusion and then spliced, and a person skilled in the art can understand that the partial features are spliced after being subjected to certain processing in order to make a subsequent calculation process faster and more accurate, and is not limited herein.
It should be noted that the branch features of at least two branches obtained by processing the image to be processed may be selected according to actual situations, for example, if only the background of the image to be processed needs to be classified, the branch features may select the features at the first half, the first third, and the first one-third to two-thirds positions in the overall features of the image to be processed as the branch features, then the branch features are spliced to obtain the target features, and then the target features are further processed, for example, similarity comparison is performed, so as to classify the background in the image to be processed. Therefore, the rules for acquiring the branch features can be limited through the actual application scene, and the classification of the images to be processed according to the specific areas can be realized.
And S206, calculating the similarity between the target characteristic of the image to be processed and the image characteristic of the historical image.
Specifically, the history image refers to an existing image, which may be any one of images included in the database; specifically, the similarity is a quantitative value representing the similarity between the target feature of the image to be processed and the image feature of the historical image, and if the similarity between the target feature of the image to be processed and the image feature of the historical image is higher, the similarity between the target feature of the image to be processed and the image feature of the historical image is more similar.
Optionally, the similarity may be used as a classification index for classifying the images, and if the similarity between the two images satisfies a certain condition, the two images may be classified into the same type of photos.
Optionally, when the similarity is calculated, the server may perform calculation in multiple threads, and the specific manner of calculation is not limited herein.
And S208, classifying the images to be processed according to the similarity.
Specifically, the server classifies the target features of the image to be processed and the image features of the historical image according to the similarity, if the similarity between the target features of the image to be processed and the image features of the historical image meets the condition, the image to be processed and the historical image are classified into the same type of image, and the preset threshold value can be adjusted according to the actual situation. Optionally, for example, the classification only needs to be performed according to the background of the image to be processed, and if the similarity between the background in the image to be processed and the background in the historical image a is 95%, the similarity between the background in the image to be processed and the background in the historical image B is 70%, and the current similarity threshold is 90%, where the historical image a is a class a background image, and the historical image B is a class B background image, the server considers that the image to be processed and the historical image are the same class image, and classifies the image to be processed into the class a image.
In the embodiment, the features corresponding to the branches of at least two branches of the image to be processed can be obtained through the feature extraction model, the branches are spliced to obtain the target features, the similarity between the target features and the historical image is calculated according to the target features, and the image to be processed is classified according to the similarity, so that the image to be processed can be classified by comparing the target features of the image to be processed with the image features of the historical image, and the time consumption in the image classification process can be shortened. Secondly, as the target features are obtained by splicing the branch features, classification of the images to be processed according to the specific regions can be realized by setting rules for obtaining the branch features.
In one embodiment, deriving at least two branches from a pre-trained feature extraction model comprises: extracting the integral features of the image to be processed through an integral feature extraction network of a pre-trained feature extraction model; and selecting partial features from the overall features as branch features of the corresponding branches through at least one partial feature extraction branch of the pre-trained feature extraction model.
Specifically, the overall feature extraction network is a network for extracting overall features of an image, the partial feature extraction branch is a network for extracting partial features from the overall features of the image, and the partial feature extraction branch may be set according to an actual application scenario, taking background classification as an example, then the partial feature extraction branch may extract partial features at the first half, the first third, and the first third to two thirds of the overall features of the image as background features, that is, branch features, specifically, as shown in fig. 3, fig. 3 is a self-portrait photo uploaded by a user in an embodiment, because the background pixel ratios at the upper half of the picture and the first third of the picture are greater than the background pixel ratio at the lower part of the picture, that is, the upper part of the picture has a greater role in background classification than the lower part of the picture, the first half, the partial feature extraction branch of the overall features of the image, The first third and one-third to two-thirds of the partial features are used as branch features, which play a critical role in image background classification.
Specifically, after receiving the image to be processed, the server inputs the image to be processed into a pre-trained feature extraction model and obtains the overall feature of the image to be processed through an overall feature extraction network of the model, and then selects a partial feature from the overall feature as a branch feature of a corresponding branch through at least one partial feature extraction branch, wherein optionally the branch feature can be used for segmenting the overall feature of the image to be processed according to a preset rule to obtain a partial feature of the overall feature as a corresponding branch feature, for example, only a background of the image to be processed is classified, and then the partial feature extraction branch can extract the partial feature of the first half or the first third of the overall feature of the image to be processed as the branch feature.
In the above embodiment, the branch feature may be obtained through the whole feature extraction network and at least one partial feature extraction branch, where the branch feature may be set according to an actual application scenario, and therefore, a characteristic representative of the image to be processed may be obtained in a targeted manner by setting a rule for obtaining the branch feature.
In one embodiment, calculating the similarity between the target feature of the image to be processed and the image feature of the historical image comprises: and calculating the cosine similarity between the target characteristic of the image to be processed and the image characteristic of the historical image as the similarity between the target characteristic of the image to be processed and the image characteristic of the historical image.
Specifically, after obtaining the target feature of the image to be processed, the server obtains the similarity between the target feature of the image to be processed and the image feature of the historical image by calculating the cosine similarity between the target feature of the image to be processed and the image feature of the historical image, wherein optionally, the similarity between the target feature and the image feature of the historical image may be obtained by calculating the cosine similarity between each of the features between the target feature of the image to be processed and the image feature of the historical image, and then obtaining the similarity between the target feature of the image to be processed and the image feature of the historical image by performing a certain processing on the cosine similarities between all the features, which may be an operation of accumulating, averaging, or squaring the cosine similarities between all the features, and is not specifically limited herein.
In the above embodiment, the similarity between the target feature of the image to be processed and the image feature of the historical image can be obtained by calculating the cosine similarity between the target feature of the image to be processed and the image feature of the historical image.
In one embodiment, with reference to fig. 4, fig. 4 is a schematic flow chart of training a feature extraction model in one embodiment, where the feature extraction model includes the following steps:
s402: and acquiring a sample image, wherein the sample image carries the classification label.
Specifically, the sample images are training sets used for training the feature extraction model, and the classification labels are obtained by labeling the sample images, wherein the classification labels of the sample images of the same class are the same, and taking an image background as a classification label basis as an example, the labels of the images with the same background in the sample images are the same.
It should be noted that the larger the number of sample images, the higher the accuracy of the trained feature extraction model, wherein taking the background feature extraction model as an example, the data set may be composed of two parts, one of which is photos uploaded by a certain batch (about 50000 or more) of users selected from the database, and the photos are marked, and the photos under the same background are considered as one type; and the other part is generated by randomly pasting different portraits into pictures of the same scene in the public scene data set after extracting all portraits in the portrait segmentation public data set through the portrait segmentation model, so that a large number of sample images can be obtained in a manual synthesis mode to train the background feature extraction model, and the accuracy of the trained feature extraction model is more accurate.
S404: and inputting the sample image into the initial model to obtain the feature to be processed.
Specifically, the initial model is a machine learning model for extracting features of the sample image, and the features to be processed refer to features extracted from the sample image by the initial model. Optionally, the initial model may be any one of a resenst 50, a mobilenetv2, a shufflentv 2, and the like, which may perform feature extraction on the image.
S406: and calculating to obtain a target loss function according to the classification label and the feature to be processed.
In particular, the objective loss function is meant to guide the optimization of the initial model, wherein the initial model may optionally be optimized by minimizing the objective loss function. In one embodiment, the classification label of the sample image is a, after the feature extraction is performed through the initial model to obtain the feature to be processed, the difference between the features to be processed corresponding to the same classification label is used as a loss function, and the initial model is continuously iteratively optimized by using the loss function as an optimization condition until the loss function meets the requirement, for example, a preset threshold is reached, so that the trained feature extraction model is obtained. Optionally, the server may optimize the initial function according to an optimization direction and an optimization gradient of the model parameter obtained by the loss function.
Alternatively, the objective function may be obtained according to loss functions of different branch features, for example, the server first obtains the overall feature of the sample image through the overall feature extraction network of the initial model and obtains at least two branch features through partial feature extraction branches of the initial model, then calculates the loss functions corresponding to the overall feature and the branch features respectively, and finally superimposes the loss functions of the overall feature and the different branch features to always guide training of the initial model.
S408: and optimizing the initial model according to the target loss function to obtain a feature extraction model.
Specifically, the server optimizes the initial model according to the target loss function until the target loss function meets a certain condition, and the feature extraction model can be obtained after the model training is finished.
The optional server optimizes parameters of the initial model according to the target loss function obtained by each training until the target loss function is smaller than or equal to a preset threshold value, and the feature extraction model capable of accurately extracting the features of the image to be processed can be obtained after the model training is finished, wherein the preset threshold value can be adjusted according to an actual application scene.
In the above embodiment, the feature extraction model capable of accurately extracting features from the image to be processed is obtained by training a large number of sample images and optimizing the target loss function.
In an embodiment, with reference to fig. 5, fig. 5 is a schematic flow chart of calculating a target loss function in an embodiment, and the specific steps are as follows:
s502: dividing the feature to be processed to obtain sample features of at least two branches;
specifically, the server may segment the feature to be processed by a preset rule to obtain sample features of different branches, where the preset rule may be set according to an actual application scenario, and taking image background extraction as an example, the server segments the feature to be processed by using rules of one-half and one-third, where a feature of a first half of the feature to be processed is used as a first branch feature, a feature of a first third is used as a second branch feature, and a feature corresponding to the third and third is used as a third branch feature.
S504: calculating to obtain a first loss function according to the sample label and the feature to be processed;
specifically, after obtaining the to-be-processed features of the sample image, the server uses a difference between the to-be-processed features corresponding to the same label as a first loss function, and uses the first loss function as one of the optimization conditions for optimizing the initial model. Wherein optionally the first loss function may be calculated from a trip loss.
S506: calculating to obtain at least two second loss functions according to the sample labels and the partial sample characteristics corresponding to each branch;
specifically, the server divides the feature to be processed according to a preset rule to obtain partial sample features corresponding to different branches, uses the difference between the partial sample features corresponding to each branch corresponding to the same local label as second loss functions corresponding to the different branches, and uses the second loss functions as one of the initial optimization conditions. Wherein optionally the second loss function may be calculated from softmax loss.
It should be noted that, the manner of calculating the loss function of the branch feature, which is a part of the sample feature corresponding to each branch, may be different, for example, a third loss function of the difference between the first branch features corresponding to the same sample label is calculated according to the manner a, and a fourth loss function of the difference between the second branch features corresponding to the same sample label is calculated according to the manner B.
S508: and obtaining a target loss function according to the first loss function and the second loss function.
Specifically, the server superposes a first loss function corresponding to the feature to be processed and a second loss function corresponding to the branch feature to obtain a target loss function, and optimizes the initial model by using the target loss function. Optionally, the superposition operation refers to an operation of accumulating or averaging the first loss function and the second loss function to obtain a corresponding target loss function. In other embodiments, different weights may be set for the first loss function and the second loss function according to the needs of the user, and the like, which is not limited herein.
In the above embodiment, the target loss function is obtained by calculating the to-be-processed features and the loss functions corresponding to different branch features, where different branch features are set according to an actual application scene, and compared with the method in which the initial model is optimized by using the loss function corresponding to the to-be-processed features of the whole image, the optimization direction of the initial model by the target function is more accurate, and further, the target features obtained by the feature extraction model are more accurate.
In an embodiment, referring to fig. 6, fig. 6 is a schematic flow chart of a risk image identification method, which includes the following specific steps:
and S602, acquiring an image to be processed.
Specifically, the image to be processed is a personal photo uploaded by a lending user, the server classifies the image to be processed and a historical image after performing feature extraction and similarity comparison on the image to be processed, wherein the historical image is the personal photo of the high-risk user acquired by the server, and judges whether the image to be processed is the high-risk image according to the classification condition, if the image to be processed is the high-risk image, the loan operation of the user is terminated, manual investigation is performed, otherwise, the server considers the image to be processed as a trust image, and the loan user can perform the loan operation in the next step. Therefore, the occurrence of collective massive loan application can be reduced to a certain extent, and the expenditure of manual auditing cost can be reduced.
S604, classifying the images to be processed according to the image classification method in any one of the above embodiments.
Specifically, the server inputs an image uploaded by a user into a feature extraction model, and obtains an overall feature of the image to be processed and branch features of at least two branches through the feature extraction model, in one embodiment, in a process of identifying a risk image, whether the image to be processed is a high-risk image can be judged by analyzing background similarity, so that when the branch features are obtained, optionally, the upper half part of the overall feature of the image is used as a first branch feature, the first third part of the overall feature of the image is used as a second branch feature, and the corresponding branches from one third to two thirds of the overall feature are used as third branch features, and then the branch features are spliced to obtain target features, wherein optionally, the branch features can be spliced to obtain a 512-dimensional vector; then calculating cosine similarity between the target feature of the image to be processed and the image feature of the historical image, wherein the historical photograph can be a data set for inquiry prepared in advance; and if the similarity between the image to be processed and the historical image exceeds a preset threshold, the server judges the image to be processed and the historical image to be the same type of photo, wherein the preset threshold can be adjusted according to the actual situation.
And S606, counting the number of the historical images in the corresponding classification of the image to be processed.
Optionally, if the image to be processed is an image shot indoors, the similarity of the image to be processed and the photos shot indoors in the historical images is compared, and the number of the historical images with the similarity exceeding a certain threshold with the image to be processed is recorded.
S608, when the number of the historical images in the corresponding classification of the image to be processed exceeds a preset value, the image to be processed is judged to be a risk image.
Specifically, the preset value is a preset value, and the server further determines whether the image to be processed is a risk image by determining whether the number of the history images in the corresponding classification of the image to be processed exceeds the preset value. In one embodiment, if the preset value is 3, when the number of the images classified as the same kind as the images to be processed in the historical images is found by the server to exceed 3, the images to be processed are determined as risk images, the system is timely alerted and further manually checked, and otherwise, the images to be processed are determined as low-risk images by the server.
In the embodiment, the images to be processed are classified, and whether the images to be processed are risk images or not is judged by judging the number of the history images with the same classification, so that the system can be timely alerted, and the expenditure of manual examination cost is reduced; secondly, in the embodiment, target features are obtained by splicing different branches in the wind control process, for example, after feature extraction is completed, the features corresponding to the upper half part of the whole picture, the front third part of the picture and the third to two thirds of the picture are respectively extracted to form three branches, the feature branch corresponding to the whole picture is trained by using a three loss, the other feature branches are trained by using a softmax loss, and the features of the whole picture are trained and used for wind control in the conventional technology, so that the time consumption of the wind control process can be shortened in the embodiment; third, in the conventional technology, the human image in the image to be measured needs to be segmented by the semantic segmentation model, set as the same pixel, and then perform the processes of similarity analysis clustering and the like, but the semantic segmentation process is not performed in the actual wind control process in the embodiment, and only different human images are obtained by semantic segmentation in the data preparation stage and are pasted to different background images to form a data set, so that compared with the conventional technology, the time consumption in the actual wind control process is shorter in the embodiment, and the steps are simpler.
In one embodiment, referring to fig. 7, a financial wind control method based on the background similarity analysis includes the following steps:
the method comprises the steps that a server receives a personal photo, namely an image to be detected, uploaded by a loan user, and inputs the image to be detected into a feature extraction model after receiving the image to be detected, and 512-dimensional features corresponding to the image to be detected can be obtained after feature extraction is carried out on the image to be detected through the feature extraction model, wherein the 512-dimensional features are formed by splicing branches corresponding to a background part in the image to be detected, and can be formed by splicing a first branch feature corresponding to the first half of the image, a second branch feature corresponding to the first third of the image and a third branch feature corresponding to one-third to two-thirds of the image, and the proportion of the branches to background pixels in the image is the largest; then calculating cosine similarity of the image to be detected and corresponding features of all images in the historical data, judging whether the similarity between the three historical images and the image to be detected in the database exceeds a preset threshold, if the similarity between the three historical images and the image to be detected in the database exceeds the preset threshold, judging that the image to be detected is a high-risk image by the server, and if so, manually checking the high-risk image by the user who uploads the image; otherwise, the image is a low-risk image, and the user who correspondingly uploads the image is a low-risk user.
In the embodiment, the server can perform feature extraction on the personal photos uploaded by the borrowers, then perform similarity comparison on the personal photos and all images in the historical database, judge the high-risk users through the similarity comparison, and further timely manage and control the high-risk users.
It should be understood that although the various steps in the flowcharts of fig. 1-2 and 3-6 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 1-2 and 3-6 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least some of the other steps.
In one embodiment, as shown in fig. 8, there is provided an image classification apparatus including: the system comprises a receiving module 100, a feature extraction module 200, a similarity calculation module 300 and an analysis module 400, wherein:
the receiving module 100 is configured to acquire an image to be processed.
The feature extraction module 200 is configured to process the image to be processed through a pre-trained feature extraction model to obtain branch features of at least two branches, and splice the branch features to obtain a target feature.
And a similarity calculation module 300, configured to calculate a similarity between a target feature of the to-be-processed image and an image feature of the historical image.
And the analysis module 400 is configured to classify the images to be processed according to the similarity.
In one embodiment, the above feature extraction module 200 includes:
and the integral feature extraction unit is used for extracting the integral features of the image to be processed through an integral feature extraction network of the pre-trained feature extraction model.
And the branch feature extraction unit is used for selecting partial features from the overall features through at least one partial feature extraction branch of the pre-trained feature extraction model as branch features of the corresponding branch.
In one embodiment, the similarity calculation module 300 includes:
and the cosine similarity calculation unit is used for calculating the cosine similarity between the target characteristic of the image to be processed and the image characteristic of the historical image, and the cosine similarity is used as the similarity between the target characteristic of the image to be processed and the image characteristic of the historical image.
In one embodiment, the image classification apparatus further includes:
and the sample acquisition module is used for acquiring a sample image, and the sample image carries the classification label.
And the to-be-processed feature acquisition module is used for inputting the sample image into the initial model to obtain the to-be-processed feature.
And the target loss function calculation module is used for calculating to obtain a target loss function according to the classification label and the feature to be processed.
And the target loss function optimization module is used for optimizing the initial model according to the target loss function so as to obtain a feature extraction model.
In one embodiment, the objective loss function optimization module includes:
and the segmentation unit is used for segmenting the feature to be processed to obtain partial sample features corresponding to at least two branches.
And the first loss function obtaining unit is used for calculating to obtain a first loss function according to the sample label and the feature to be processed.
And the second loss function acquisition unit is used for calculating at least two second loss functions according to the sample label and the partial sample characteristics corresponding to each branch.
And the target loss function acquisition unit is used for acquiring a target loss function according to the first loss function and the second loss function.
In one embodiment, as shown in fig. 9, there is provided a risk image recognition apparatus including: data receiving module 500, image classification module 600, image statistics module 700, risk image discrimination module 800, wherein:
and the data receiving module 500 is used for acquiring the image to be processed.
An image classification module 600, configured to classify the image to be processed according to the image classification apparatus in any of the embodiments.
An image statistics module 700, configured to count the number of the historical images in the corresponding classification of the image to be processed.
A risk image determination module 800, configured to determine that the to-be-processed image is a risk image when the number of the history images in the corresponding classification of the to-be-processed image exceeds a preset value.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 10. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer equipment is used for storing invoice image data to be identified. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement an image classification method.
Those skilled in the art will appreciate that the architecture shown in fig. 10 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program: acquiring an image to be processed; processing the image to be processed through a pre-trained feature extraction model to obtain branch features of at least two branches, and splicing the branch features to obtain target features; calculating the similarity between the target characteristic of the image to be processed and the image characteristic of the historical image; and classifying the images to be processed according to the similarity.
In one embodiment, deriving at least two branches from a pre-trained feature extraction model implemented by a processor when executing a computer program comprises: extracting the integral features of the image to be processed through an integral feature extraction network of a pre-trained feature extraction model; and selecting partial features from the overall features through at least one partial feature extraction branch of the pre-trained feature extraction model as branch features of the corresponding branch.
In one embodiment, the processor, implemented when executing the computer program, for calculating the similarity between the target feature of the image to be processed and the image feature of the historical image includes: and calculating the cosine similarity between the target characteristic of the image to be processed and the image characteristic of the historical image as the similarity between the target characteristic of the image to be processed and the image characteristic of the historical image.
In one embodiment, the processor, implemented when executing the computer program, for calculating the similarity between the target feature of the image to be processed and the image feature of the historical image includes: calculating the cosine similarity between the target feature of the image to be processed and the image feature of the historical image as the similarity between the target feature of the image to be processed and the image feature of the historical image
In one embodiment, an image classification apparatus implemented by a processor when executing a computer program comprises: obtaining a sample image, wherein the sample image carries a classification label; inputting the sample image into an initial model to obtain a feature to be processed; calculating to obtain a target loss function according to the classification labels and the characteristics to be processed; and optimizing the initial model according to the target loss function to obtain a feature extraction model.
In one embodiment, the calculation of the objective loss function according to the classification label and the feature to be processed, which is performed when the processor executes the computer program, includes: dividing the feature to be processed to obtain partial sample features corresponding to at least two branches; calculating to obtain a first loss function according to the sample label and the feature to be processed; calculating to obtain at least two second loss functions according to the sample labels and the partial sample characteristics corresponding to each branch; and obtaining a target loss function according to the first loss function and the second loss function.
In one embodiment, a risk image recognition device implemented when a processor executes a computer program, comprises: acquiring an image to be processed; classifying images to be processed according to the image classification method of any one of the embodiments; counting the number of historical images in the corresponding classification of the image to be processed; and when the number of the historical images in the corresponding classification of the image to be processed exceeds a preset value, judging that the image to be processed is a risk image.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of: acquiring an image to be processed; processing the image to be processed through a pre-trained feature extraction model to obtain branch features of at least two branches, and splicing the branch features to obtain target features; calculating the similarity between the target characteristic of the image to be processed and the image characteristic of the historical image; and classifying the images to be processed according to the similarity.
In one embodiment, deriving at least two branches from a pre-trained feature extraction model implemented when the computer program is executed by the processor comprises: extracting the integral features of the image to be processed through an integral feature extraction network of a pre-trained feature extraction model; and selecting partial features from the overall features through at least one partial feature extraction branch of the pre-trained feature extraction model as branch features of the corresponding branch.
In one embodiment, the computer program, when executed by a processor, implements computing similarity of a target feature of an image to be processed and an image feature of a history image, comprising: and calculating the cosine similarity between the target characteristic of the image to be processed and the image characteristic of the historical image as the similarity between the target characteristic of the image to be processed and the image characteristic of the historical image.
In one embodiment, a computer readable storage medium is implemented by a computer program when executed by a processor, having a computer program stored thereon, the computer program when executed by the processor implementing the steps of: obtaining a sample image, wherein the sample image carries a classification label; inputting the sample image into an initial model to obtain a feature to be processed; calculating to obtain a target loss function according to the classification labels and the characteristics to be processed; and optimizing the initial model according to the target loss function to obtain a feature extraction model.
In one embodiment, the calculation of the objective loss function from the classification tags and the features to be processed, performed when the computer program is executed by the processor, includes: dividing the feature to be processed to obtain partial sample features corresponding to at least two branches; calculating to obtain a first loss function according to the sample label and the feature to be processed; calculating to obtain at least two second loss functions according to the sample labels and the partial sample characteristics corresponding to each branch; and obtaining a target loss function according to the first loss function and the second loss function.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of: acquiring an image to be processed; classifying the image to be processed according to the computer-readable storage medium in any one of the above embodiments; counting the number of historical images in the corresponding classification of the image to be processed; and when the number of the historical images in the corresponding classification of the image to be processed exceeds a preset value, judging that the image to be processed is a risk image.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. An image classification method, characterized in that the image classification method comprises:
acquiring an image to be processed;
processing the image to be processed through a pre-trained feature extraction model to obtain branch features of at least two branches, and splicing the branch features to obtain target features;
calculating the similarity between the target characteristic of the image to be processed and the image characteristic of the historical image;
and classifying the images to be processed according to the similarity.
2. The method of claim 1, wherein the deriving at least two branches from the pre-trained feature extraction model comprises:
extracting the integral features of the image to be processed through an integral feature extraction network of a pre-trained feature extraction model;
and selecting partial features from the overall features through at least one partial feature extraction branch of the pre-trained feature extraction model as branch features of the corresponding branch.
3. The method according to claim 1, wherein the calculating the similarity between the target feature of the image to be processed and the image feature of the historical image comprises:
and calculating the cosine similarity between the target feature of the image to be processed and the image feature of the historical image, wherein the cosine similarity is used as the similarity between the target feature of the image to be processed and the image feature of the historical image.
4. The method of claim 1, wherein the image classification method further comprises:
obtaining a sample image, wherein the sample image carries a classification label;
inputting the sample image into an initial model to obtain a feature to be processed;
calculating to obtain a target loss function according to the classification label and the feature to be processed;
and optimizing the initial model according to the target loss function to obtain the feature extraction model.
5. The method of claim 4, wherein the calculating an objective loss function from the class labels and the features to be processed comprises:
segmenting the features to be processed to obtain partial sample features corresponding to at least two branches;
calculating to obtain a first loss function according to the sample label and the feature to be processed;
calculating to obtain at least two second loss functions according to the sample labels and the partial sample characteristics corresponding to each branch;
and obtaining the target loss function according to the first loss function and the second loss function.
6. A risk image identification method, characterized by comprising:
acquiring an image to be processed;
classifying the image to be processed according to the image classification method of any one of claims 1 to 5;
counting the number of the historical images in the corresponding classification of the image to be processed;
and when the number of the historical images in the corresponding classification of the image to be processed exceeds a preset numerical value, judging that the image to be processed is a risk image.
7. An image classification apparatus, characterized in that the apparatus comprises:
the receiving module is used for acquiring an image to be processed;
the characteristic extraction module is used for extracting the characteristics of the image to be processed;
the similarity calculation module is used for calculating the similarity between the features of the image to be processed and the image features in the database;
and the analysis module is used for judging the image to be processed according to the similarity.
8. A risk image recognition apparatus, characterized in that the apparatus comprises:
a data receiving module: the image processing device is used for acquiring an image to be processed;
an image classification module: the image classification method is used for classifying the image to be processed according to any one of claims 1 to 5;
an image statistics module: counting the number of the historical images in the corresponding classification of the image to be processed;
a risk image determination module: and the method is used for judging that the image to be processed is a risk image when the number of the historical images in the corresponding classification of the image to be processed exceeds a preset numerical value.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 6.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 6.
CN202111203991.XA 2021-10-15 2021-10-15 Image classification method and device, computer equipment and storage medium Pending CN114022699A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111203991.XA CN114022699A (en) 2021-10-15 2021-10-15 Image classification method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111203991.XA CN114022699A (en) 2021-10-15 2021-10-15 Image classification method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114022699A true CN114022699A (en) 2022-02-08

Family

ID=80056304

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111203991.XA Pending CN114022699A (en) 2021-10-15 2021-10-15 Image classification method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114022699A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116049358A (en) * 2023-03-31 2023-05-02 得分数字科技(珠海)有限公司 Invoice information approximation degree detection method, storage medium and computer equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116049358A (en) * 2023-03-31 2023-05-02 得分数字科技(珠海)有限公司 Invoice information approximation degree detection method, storage medium and computer equipment

Similar Documents

Publication Publication Date Title
CN111738244B (en) Image detection method, image detection device, computer equipment and storage medium
CN109614921B (en) Cell segmentation method based on semi-supervised learning of confrontation generation network
CN110913243B (en) Video auditing method, device and equipment
CN111191568B (en) Method, device, equipment and medium for identifying flip image
JP2011525012A (en) Semantic event detection for digital content recording
CN113033519B (en) Living body detection method, estimation network processing method, device and computer equipment
CN110942456B (en) Tamper image detection method, device, equipment and storage medium
CN112651333B (en) Silence living body detection method, silence living body detection device, terminal equipment and storage medium
CN111814821A (en) Deep learning model establishing method, sample processing method and device
CN116563868A (en) Text image recognition method and device, computer equipment and storage medium
CN110135428B (en) Image segmentation processing method and device
CN115035347A (en) Picture identification method and device and electronic equipment
CN114022699A (en) Image classification method and device, computer equipment and storage medium
CN114519863A (en) Human body weight recognition method, human body weight recognition apparatus, computer device, and medium
CN112966687A (en) Image segmentation model training method and device and communication equipment
CN115223022B (en) Image processing method, device, storage medium and equipment
CN113706550A (en) Image scene recognition and model training method and device and computer equipment
CN115984588A (en) Image background similarity analysis method and device, electronic equipment and storage medium
CN113536845B (en) Face attribute identification method and device, storage medium and intelligent equipment
CN115294561A (en) Text recognition method and device and server
CN114359993A (en) Model training method, face recognition device, face recognition equipment, face recognition medium and product
CN114387496A (en) Target detection method and electronic equipment
CN115797990A (en) Image classification method, image processing method, image classification device and storage medium
US20190311184A1 (en) High Accuracy and Volume Facial Recognition on Mobile Platforms
KR102027786B1 (en) Method and system for recognizing face of user based on multiple images

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination