



技术领域technical field
本说明书实施例涉及计算机技术领域,特别涉及一种图片识别方法。The embodiments of this specification relate to the field of computer technology, and in particular, to a method for image recognition.
背景技术Background technique
随着计算机技术的不断发展,越来越多的应用场景(比如:涉及金融、保险或者公益等应用场景)需要对用户上传的图片的真实性进行验证,但随着数据拍照技术的提升,许多不法分子通过翻拍图像来验证获取不法收益的手段层出不穷,使得图片验证的过程变得越来越难于核查,导致图片验证的效率较低。With the continuous development of computer technology, more and more application scenarios (such as application scenarios involving finance, insurance or public welfare) need to verify the authenticity of the pictures uploaded by users, but with the improvement of data photography technology, many There are endless ways for criminals to verify and obtain illegal gains by retaking images, which makes the process of image verification more and more difficult to verify, resulting in low efficiency of image verification.
发明内容SUMMARY OF THE INVENTION
有鉴于此,本说明书施例提供了一种图片识别方法。本说明书一个或者多个实施例同时涉及一种图片识别装置,一种计算设备,一种计算机可读存储介质,一种计算机程序,以解决现有技术中存在的技术缺陷。In view of this, the embodiments of this specification provide a picture recognition method. One or more embodiments of this specification also relate to a picture recognition apparatus, a computing device, a computer-readable storage medium, and a computer program, so as to solve the technical defects existing in the prior art.
根据本说明书实施例的第一方面,提供了一种图片识别方法,包括:According to a first aspect of the embodiments of the present specification, a picture recognition method is provided, including:
将待识别图片输入预先训练的图片识别模型,其中,所述图片识别模型基于有标签图片样本以及满足预设规则的无标签图片样本训练获得;Input the image to be recognized into a pre-trained image recognition model, wherein the image recognition model is obtained by training based on labeled image samples and unlabeled image samples that satisfy preset rules;
获取所述图片识别模型对所述待识别图片的识别结果,基于所述识别结果确定所述待识别图片是否为风险图片。Obtain the recognition result of the picture to be recognized by the picture recognition model, and determine whether the to-be-recognized picture is a risk picture based on the recognition result.
根据本说明书实施例的第二方面,提供了一种图片识别装置,包括:According to a second aspect of the embodiments of the present specification, there is provided a picture recognition device, including:
输入模块,被配置为将待识别图片输入预先训练的图片识别模型,其中,所述图片识别模型基于有标签图片样本以及满足预设规则的无标签图片样本训练获得;The input module is configured to input the to-be-recognized picture into a pre-trained picture recognition model, wherein the picture recognition model is obtained by training based on labeled picture samples and unlabeled picture samples that satisfy preset rules;
确定模块,被配置为获取所述图片识别模型对所述待识别图片的识别结果,基于所述识别结果确定所述待识别图片是否为风险图片。A determination module configured to acquire a recognition result of the picture to be recognized by the picture recognition model, and determine whether the to-be-recognized picture is a risk picture based on the recognition result.
根据本说明书实施例的第三方面,提供了一种计算设备,包括:According to a third aspect of the embodiments of the present specification, a computing device is provided, including:
存储器和处理器;memory and processor;
所述存储器用于存储计算机可执行指令,所述处理器用于执行所述计算机可执行指令,该计算机可执行指令被处理器执行时实现所述图片识别方法的步骤。The memory is used for storing computer-executable instructions, the processor is used for executing the computer-executable instructions, and when the computer-executable instructions are executed by the processor, the steps of the image recognition method are implemented.
根据本说明书实施例的第四方面,提供了一种计算机可读存储介质,其存储有计算机可执行指令,该计算机可执行指令被处理器执行时实现所述图片识别方法的步骤。According to a fourth aspect of the embodiments of the present specification, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, implements the steps of the picture recognition method.
根据本说明书实施例的第五方面,提供了一种计算机程序,其中,当所述计算机程序在计算机中执行时,令计算机执行所述图片识别方法的步骤。According to a fifth aspect of the embodiments of the present specification, a computer program is provided, wherein, when the computer program is executed in a computer, the computer is caused to execute the steps of the picture recognition method.
本说明书提供的图片识别方法,包括:将待识别图片输入预先训练的图片识别模型,其中,所述图片识别模型基于有标签图片样本以及满足预设规则的无标签图片样本训练获得;获取所述图片识别模型对所述待识别图片的识别结果,基于所述识别结果确定所述待识别图片是否为风险图片。The picture recognition method provided in this specification includes: inputting the picture to be recognized into a pre-trained picture recognition model, wherein the picture recognition model is obtained by training based on labeled picture samples and unlabeled picture samples that meet preset rules; Based on the recognition result of the picture to be recognized by the picture recognition model, it is determined whether the picture to be recognized is a risk picture based on the recognition result.
具体地,该方法通过基于有标签图片样本以及满足预设规则的无标签图片样本训练获得的图片识别模型,识别输入的待识别图片是否为风险图片,从而提高了风险图片的识别效率,降低了图片验证过程的难度。Specifically, the method identifies whether the input to-be-recognized picture is a risk picture by training a picture recognition model based on labeled picture samples and unlabeled picture samples that satisfy preset rules, thereby improving the identification efficiency of risk pictures and reducing the risk of The difficulty of the image verification process.
附图说明Description of drawings
图1是本说明书一个实施例提供的一种图片识别方法的流程图;Fig. 1 is a flow chart of a picture recognition method provided by an embodiment of this specification;
图2是本说明书一个实施例提供的一种图片识别方法中模型训练的过程示意图;2 is a schematic diagram of a model training process in a picture recognition method provided by an embodiment of this specification;
图3是本说明书一个实施例提供的一种图片识别装置的结构示意图;3 is a schematic structural diagram of a picture recognition device provided by an embodiment of the present specification;
图4是本说明书一个实施例提供的一种计算设备的结构框图。FIG. 4 is a structural block diagram of a computing device provided by an embodiment of the present specification.
具体实施方式Detailed ways
在下面的描述中阐述了很多具体细节以便于充分理解本说明书。但是本说明书能够以很多不同于在此描述的其它方式来实施,本领域技术人员可以在不违背本说明书内涵的情况下做类似推广,因此本说明书不受下面公开的具体实施的限制。In the following description, numerous specific details are set forth in order to provide a thorough understanding of this specification. However, this specification can be implemented in many other ways different from those described herein, and those skilled in the art can make similar promotions without departing from the connotation of this specification. Therefore, this specification is not limited by the specific implementation disclosed below.
在本说明书一个或多个实施例中使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本说明书一个或多个实施例。在本说明书一个或多个实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本说明书一个或多个实施例中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。The terminology used in one or more embodiments of this specification is for the purpose of describing a particular embodiment only and is not intended to limit the one or more embodiments of this specification. As used in the specification or embodiments and the appended claims, the singular forms "a," "the," and "the" are intended to include the plural forms as well, unless the context clearly dictates otherwise. It will also be understood that the term "and/or" as used in this specification in one or more embodiments refers to and includes any and all possible combinations of one or more of the associated listed items.
应当理解,尽管在本说明书一个或多个实施例中可能采用术语第一、第二等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本说明书一个或多个实施例范围的情况下,第一也可以被称为第二,类似地,第二也可以被称为第一。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It will be understood that although the terms first, second, etc. may be used in one or more embodiments of this specification to describe various information, such information should not be limited by these terms. These terms are only used to distinguish the same type of information from each other. For example, a first could be termed a second, and similarly, a second could be termed a first, without departing from the scope of one or more embodiments of this specification. Depending on the context, the word "if" as used herein can be interpreted as "at the time of" or "when" or "in response to determining."
首先,对本说明书一个或多个实施例涉及的名词术语进行解释。First, the terminology involved in one or more embodiments of the present specification is explained.
半监督学习:使用大量的未标记数据,以及同时使用标记数据,来进行模式识别工作。Semi-supervised learning: Use large amounts of unlabeled data, as well as labeled data, for pattern recognition work.
难例:模型训练过程中损失最高的样本。Hard example: The sample with the highest loss during model training.
数据增广:是指用于增加训练数据集的方法,通过数据增广能够让数据集尽可能的多样化,使得训练的模型具有更强的泛化能力。Data augmentation: refers to the method used to increase the training data set. Through data augmentation, the data set can be as diverse as possible, so that the trained model has stronger generalization ability.
随着计算机技术的不断发展,越来越多的应用场景(比如:涉及金融、保险或者公益等应用场景)需要对用户上传的图片的真实性进行验证,但随着数据拍照技术的提升,许多不法分子通过翻拍图像来验证获取不法利益的手段层出不穷,使得图片验证的过程变得越来越难于核查。With the continuous development of computer technology, more and more application scenarios (such as application scenarios involving finance, insurance or public welfare) need to verify the authenticity of the pictures uploaded by users, but with the improvement of data photography technology, many There are endless ways for criminals to verify and obtain illegal benefits by reproducing images, making the process of image verification more and more difficult to verify.
例如,在公益场景中,为了响应低碳减排的号召,许多机构会针对车辆尾气排放污染严重的问题推出各种低碳减排项目,比如,当用户每周的车辆行驶公里数较低的情况下,就会给予用户一定的奖励,而用户则需要上传手机拍摄的车辆仪表盘图片,用于判断该用户的车辆行驶公里数。For example, in public welfare scenarios, in response to the call for low-carbon emission reduction, many organizations will launch various low-carbon emission reduction projects for the serious problem of vehicle exhaust pollution. In this case, a certain reward will be given to the user, and the user needs to upload a picture of the vehicle dashboard taken by the mobile phone to judge the number of kilometers traveled by the user's vehicle.
但在此过程中,一些用户会通过拍摄手机/电脑上的图片来冒充真实的仪表盘图片,也即是“翻拍”。因此,许多机构在接收到用户上传的手机拍摄的仪表盘图片时,需要判断该仪表盘图片是否为翻拍图片,从而确定该用户是否存在作弊行为。But in the process, some users will pretend to be real dashboard pictures by taking pictures on their mobile phones/computers, that is, "remakes". Therefore, when many institutions receive a dashboard picture uploaded by a user and taken by a mobile phone, they need to determine whether the dashboard picture is a remake, so as to determine whether the user has cheated.
或者,在金融场景下,金融机构需要通过证件图片识别、人脸图像识别等方式对用户身份进行验证,从而避免非法分子通过伪装身份进行非法金融活动。Or, in financial scenarios, financial institutions need to verify user identities through ID image recognition, face image recognition, etc., so as to avoid illegal financial activities by disguised identities.
基于此,在本说明书中,提供了一种图片识别方法,本说明书同时涉及一种图片识别装置,一种计算设备,一种计算机可读存储介质以及一种计算机程序,在下面的实施例中逐一进行详细说明。Based on this, in this specification, a picture recognition method is provided. This specification also relates to a picture recognition device, a computing device, a computer-readable storage medium and a computer program. In the following embodiments They are explained in detail one by one.
图1示出了根据本说明书一个实施例提供的一种图片识别方法的流程图,具体包括以下步骤。Fig. 1 shows a flowchart of a method for image recognition according to an embodiment of the present specification, which specifically includes the following steps.
步骤102:将待识别图片输入预先训练的图片识别模型,其中,所述图片识别模型基于有标签图片样本以及满足预设规则的无标签图片样本训练获得。Step 102: Input the image to be recognized into a pre-trained image recognition model, wherein the image recognition model is obtained by training based on labeled image samples and unlabeled image samples that satisfy preset rules.
其中,该待识别图片可以理解为需要识别是否具有风险的图片;例如,用户的人脸图像、用户的证件图片、用户车辆的仪表盘图片等。The to-be-recognized picture can be understood as a picture that needs to be identified as having a risk; for example, the user's face image, the user's certificate image, the user's vehicle dashboard image, and the like.
该图片识别模型可以理解为能够识别出该图片是否具有风险的模型;在实际应用中,该图片识别模型可以理解为任意一种能够对图片进行识别或检测的模型,本说明书对此不做具体限制。例如,该图片识别模型可以为MobileNet V2(一种轻量级卷积神经网络)、CNN(卷积神经网络)模型等。相应地,该有标签图片样本可以理解为用于对图片识别模型进行训练、且具有样本标签的样本。该无标签图片样本可以理解为用于对图片识别模型进行训练、但不具有样本标签的样本。The picture recognition model can be understood as a model that can identify whether the picture has risks; in practical applications, the picture recognition model can be understood as any model that can identify or detect pictures, which is not specified in this specification. limit. For example, the image recognition model may be MobileNet V2 (a lightweight convolutional neural network), CNN (convolutional neural network) model, and the like. Correspondingly, the labeled picture sample can be understood as a sample that is used for training the picture recognition model and has a sample label. The unlabeled image sample can be understood as a sample that is used for training the image recognition model but does not have a sample label.
在实际应用中,本说明书提供的图片识别方法应用的场景不同,该待识别图片也不同;例如,在图片识别方法应用的金融场景的情况下,该待识别图片可以为用户的证件图片、用户的纸质文件图片等;相应的,图片识别模型可以理解为能够检测证件图片或纸质文件图片的真实性的模型,也即是检测证件图片或纸质文件图片是否为翻拍图片的模型。In practical applications, the picture recognition method provided in this specification is applied in different scenarios, and the picture to be recognized is also different; for example, in the case of a financial scene where the picture recognition method is applied, the picture to be recognized Correspondingly, the picture recognition model can be understood as a model that can detect the authenticity of the picture of the certificate or the picture of the paper file, that is, the model that detects whether the picture of the certificate or the picture of the paper file is a copy of the picture.
或者,在图片识别方法应用的安保场景的情况下,该待识别图片可以为用户的证件图片、用户的人脸图像等;相应的,图片识别模型可以理解为能够检测证件图片或人脸图像的真实性的模型,也即是检测证件图片或人脸图像是否为翻拍图片的模型。Or, in the case of a security scene where the image recognition method is applied, the image to be recognized may be the user's certificate image, the user's face image, etc.; correspondingly, the image recognition model can be understood as a device capable of detecting certificate images or face images. The model of authenticity, that is, the model that detects whether the certificate image or the face image is a remake image.
或者,在图片识别方法应用的低碳减排项目场景的情况下,该待识别图片可以为用户车辆的仪表盘图片等;相应的,图片识别模型可以理解为能够检测仪表盘图片的真实性的模型,也即是检测该仪表盘图片是否为翻拍图片的模型。Or, in the case of a low-carbon emission reduction project scenario where the picture recognition method is applied, the picture to be recognized may be a picture of the dashboard of the user's vehicle, etc.; correspondingly, the picture recognition model can be understood as a device capable of detecting the authenticity of the picture of the instrument panel. Model, that is, the model that detects whether the dashboard picture is a remake.
对应的,在图片识别模型不同的情况下,针对该图片识别模型进行训练的有标签图片样本和无标签图片样本也不同,例如,该有标签图片样本可以为具有样本标签的证件图片样本、具有样本标签的人脸图像样本或具有样本标签的仪表盘图片样本。该有标签图片样本可以为包含不具有样本标签的证件图片的样本、包含不具有样本标签的人脸图像的样本或包含不具有样本标签的仪表盘图片的样本。Correspondingly, when the image recognition models are different, the labeled image samples and unlabeled image samples trained for the image recognition model are also different. For example, the labeled image samples may be certificate image samples with sample labels, Sample face image samples with sample labels or dashboard image samples with sample labels. The labeled image sample may be a sample including a certificate image without a sample label, a sample including a face image without a sample label, or a sample including a dashboard image without a sample label.
具体地,本说明书提供的图片识别方法,能够将需要进行风险识别的待识别图片,输入至通过有标签图片样本以及满足预设规则的无标签图片样本训练获得的图片识别模型中。Specifically, the image recognition method provided in this specification can input the to-be-recognized images that require risk identification into the image recognition model obtained by training the labeled image samples and the unlabeled image samples that satisfy preset rules.
在实际应用中,该预设规则可以根据实际应用场景进行设置,本说明书对此不做具体限制。例如,预设规则可以为通过半监督方法,对伪标签样本中的难例进行挖掘,并基于该难例确定更有价值的样本。从而将该更有价值的样本加入到对图片识别模型的训练中,提高图片识别模型的性能和训练效率。In practical applications, the preset rule may be set according to an actual application scenario, which is not specifically limited in this specification. For example, the preset rule may be to mine difficult examples in pseudo-label samples through a semi-supervised method, and determine more valuable samples based on the difficult examples. Thus, the more valuable samples are added to the training of the image recognition model, and the performance and training efficiency of the image recognition model are improved.
下面以本说明书提供的图片识别方法在检测仪表盘图片是否为翻拍图片的场景下,对将待识别图片输入预先训练的图片识别模型做进一步说明,其中,该待识别图片为用户车辆的仪表盘图片,图片识别模型可以理解为能够识别出仪表盘图片是否为翻拍图片的图片识别模型,基于此,本说明书提供的图片识别方法,能够将用户车辆的仪表盘图片,输入至能够识别出仪表盘图片是否为翻拍图片的图片识别模型中。In the following, the picture recognition method provided in this specification is used to further describe the input of the to-be-recognized picture into the pre-trained picture recognition model under the scenario of detecting whether the instrument panel picture is a retaken picture, wherein the to-be-recognized picture is the instrument panel of the user's vehicle The picture, the picture recognition model can be understood as a picture recognition model that can identify whether the dashboard picture is a remade picture. Based on this, the picture recognition method provided in this manual can input the dashboard picture of the user's vehicle into the dashboard that can identify the picture. Whether the picture is in the picture recognition model of the remake picture.
在本说明书提供的一实施例中,在将该待识别图片输入图片识别模型之前,还需要对该图片识别模型进行训练。因此,在本说明书提供了两种针对该图片识别模型的方案,第一种方案是通过人工标注有限的样本数据训练卷积神经网络,从而实现对翻拍图片的识别。但是,该方案具有两方面的缺点,第一方面是,样本数据量很大,导致人工标注成本非常高,且标注时间很长;并且还会造成模型迭代效率低下。第二方面是,在有限的人力下标注的资源少,导致模型泛化性不佳。In an embodiment provided in this specification, before the image to be recognized is input into the image recognition model, the image recognition model also needs to be trained. Therefore, this specification provides two solutions for the image recognition model. The first solution is to train a convolutional neural network by manually labeling limited sample data, so as to realize the recognition of the retaken pictures. However, this scheme has two disadvantages. The first aspect is that the amount of sample data is very large, which leads to very high manual labeling costs and a long labeling time; and it also causes low model iteration efficiency. The second aspect is that there are few annotation resources under limited manpower, resulting in poor model generalization.
第二种方案是,通过半监督学习的方案做多次数据增广,并通过取均值将样本数据打上伪标签,并将伪标签样本加入针对模型的训练。但是,该方案同样具有两方面的缺点,第一方面是,均值中可能存在异常小的值,会导致很多有用样本无法加入训练,进一步导致半监督学习带来的性能增益降低。第二方面是,未通过半监督方法针对难例进行挖掘,并未把更有价值的样本加入训练中。The second scheme is to perform multiple data augmentation through the semi-supervised learning scheme, and label the sample data with pseudo-labels by taking the mean value, and add the pseudo-labeled samples to the training of the model. However, this scheme also has two disadvantages. The first aspect is that there may be abnormally small values in the mean, which will cause many useful samples to fail to join training, further reducing the performance gain brought by semi-supervised learning. The second aspect is that the semi-supervised method is not used to mine difficult examples, and more valuable samples are not added to the training.
基于上述两种方案所存在的缺陷,本说明书提供的图片识别方法中,首先,在伪标签阶段将无标签图片经过多次数据增广后,将得分取最大值的样本作为加入训练的样本,提高了无标签样本的利用率。并且,通过在半监督学习的训练方式中,引入相似度比对的方式进行难例挖掘,将更有价值的无标签样本加入了训练,同样大幅提高了无标签样本的利用率。基于此,本说明书提供的图片识别方法中,所述图片识别模型的训练步骤,包括步骤一至步骤四。Based on the defects of the above two solutions, in the image recognition method provided in this specification, first, after the unlabeled image is augmented for many times in the pseudo-label stage, the sample with the maximum score is used as the sample to be added to the training. Improved utilization of unlabeled samples. Moreover, in the training method of semi-supervised learning, the method of similarity comparison is introduced to mine difficult cases, and more valuable unlabeled samples are added to the training, which also greatly improves the utilization rate of unlabeled samples. Based on this, in the image recognition method provided in this specification, the training steps of the image recognition model include steps 1 to 4.
步骤一:基于所述有标签图片样本训练获得初始图片识别模型。Step 1: Obtain an initial image recognition model based on the labeled image sample training.
其中,该初始图片识别模型可以理解为通过有标签图片样本训练获得的模型。Among them, the initial image recognition model can be understood as a model obtained by training with labeled image samples.
具体地,本说明书提供的图片识别方法能够基于有标签图片样本对未训练的图片识别模型进行训练,从而获得训练完成的初始图片识别模型。其中,该基于有标签图片样本训练获得初始图片识别模型的操作,可以采用任意一种基于有标签图片样本对模型进行训练的方式实现,本说明书对此不做具体限制。Specifically, the image recognition method provided in this specification can train an untrained image recognition model based on a labeled image sample, thereby obtaining a trained initial image recognition model. The operation of obtaining the initial image recognition model based on the training of the labeled picture samples can be implemented by any method of training the model based on the labeled picture samples, which is not specifically limited in this specification.
沿用上例,该有标签图片样本可以为包含样本标签的仪表盘图片样本,基于此,本说明书提供的图片识别方法,能够确定出包含样本标签的仪表盘图片样本,将该仪表盘图片样本输入至待训练的图片识别模型中,获得该仪表盘图片样本的识别结果,基于该识别结果以及仪表盘图片样本的样本标签确定损失值,基于该损失值对该待训练的图片识别模型进行调参,使得该图片识别模型达到收敛,从而获得训练完成的初始图片识别模型。Following the above example, the labeled image sample can be a dashboard image sample containing the sample label. Based on this, the image recognition method provided in this specification can determine the dashboard image sample containing the sample label, and input the dashboard image sample. In the image recognition model to be trained, the recognition result of the dashboard image sample is obtained, the loss value is determined based on the recognition result and the sample label of the dashboard image sample, and the parameters of the image recognition model to be trained are adjusted based on the loss value. , so that the image recognition model reaches convergence, so as to obtain the initial image recognition model after training.
步骤二:基于所述初始图片识别模型,从无标签图片样本中确定第一伪标签样本和第二伪标签样本。Step 2: Determine the first pseudo-label sample and the second pseudo-label sample from the unlabeled picture samples based on the initial picture recognition model.
其中,第一伪标签样本可以理解为无标签图片样本中被打上伪标签的图片样本,即伪标签图片样本;该第二伪标签样本理解为无标签图片样本中没有被打上伪标签的图片样本,也即是无标签图片样本中除伪标签图片样本之外的图片样本。The first pseudo-label sample can be understood as a pseudo-labeled image sample in an unlabeled image sample, namely a pseudo-labeled image sample; the second pseudo-labeled sample can be understood as an unlabeled image sample without a pseudo-labeled image sample , that is, the image samples in the unlabeled image samples except the pseudo-labeled image samples.
具体的,在基于有标签图片样本训练获得初始图片识别模型之后,能够基于该初始识别模型,从而该无标签图片样本中确定出第一伪标签样本和第二为标签样本。Specifically, after the initial image recognition model is obtained by training based on the labeled image samples, the first pseudo-labeled sample and the second labeled sample can be determined from the unlabeled image samples based on the initial recognition model.
沿用上例,将该无标签仪表盘图片样本输入至训练获得的初始图片识别模型中,基于该初始图片识别模型对该无标签仪表盘图片样本进行识别,获得该无标签仪表盘图片样本的识别结果,其中,该识别结果可以为表示该无标签仪表盘图片样本是否为翻拍图片的预测得分,比如[0,1]区间内任意的数值。Following the above example, input the unlabeled dashboard image sample into the initial image recognition model obtained by training, identify the unlabeled dashboard image sample based on the initial image recognition model, and obtain the identification of the unlabeled dashboard image sample As a result, the recognition result may be a prediction score indicating whether the unlabeled instrument panel picture sample is a remake picture, such as any numerical value in the [0,1] interval.
在确定无标签仪表盘图片样本的识别结果之后,确定该无标签仪表盘图片样本的识别结果是否大于等于预设得分阈值,若是,则确定该无标签仪表盘图片可能是翻拍图片,因此将该无标签仪表盘图片样本打上“翻拍仪表盘图片”的样本伪标签。若否,则确定该无标签仪表盘图片可能是真实的无标签仪表盘图片,并不是翻拍图片,因此,不对该无标签仪表盘图片样本打上标签。比如,无标签仪表盘图片样本中的图片样本A的预测得分为0.3、图片样本B的预测得分为0.6,预设得分阈值为0.5分。基于此,该图片样本A不会打上伪标签,该图片样本B则会被打上伪标签。其中,该预设得分阈值可以根据实际应用场景进行设置,本说明书对此不做具体限制。After determining the recognition result of the unlabeled instrument panel picture sample, determine whether the recognition result of the unlabeled instrument panel picture sample is greater than or equal to the preset score threshold; Samples of unlabeled dashboard images are labeled with the sample pseudo-label of "Remake Dashboard Image". If not, it is determined that the unlabeled instrument panel picture may be a real unlabeled instrument panel picture, not a remake image, and therefore, the unlabeled instrument panel picture sample is not labeled. For example, the predicted score of picture sample A in the unlabeled dashboard picture sample is 0.3, the predicted score of picture sample B is 0.6, and the preset score threshold is 0.5 points. Based on this, the picture sample A will not be labeled with a pseudo-label, and the picture sample B will be labeled with a pseudo-label. The preset score threshold may be set according to an actual application scenario, which is not specifically limited in this specification.
在本说明书提供的实施例中,在从无标签图片样本中确定第一伪标签样本和第二伪标签样本的过程中,还可以对无标签图片样本进行数据增广,基于数据增广后获得的图片样本和无标签图片样本,确定第一伪标签样本和第二伪标签样本,从而提高了第一伪标签样本和第二伪标签样本的准确度。基于此,所述基于所述初始图片识别模型,从无标签图片样本中确定第一伪标签样本和第二伪标签样本,包括:In the embodiments provided in this specification, in the process of determining the first pseudo-label sample and the second pseudo-label sample from the unlabeled picture samples, the unlabeled picture samples may also be subjected to data augmentation, and the obtained data is obtained based on the data augmentation. The first pseudo-label sample and the second pseudo-label sample are determined, thereby improving the accuracy of the first pseudo-label sample and the second pseudo-label sample. Based on this, the determination of the first pseudo-label sample and the second pseudo-label sample from the unlabeled picture samples based on the initial picture recognition model includes:
基于无标签图片样本确定与所述无标签图片样本相关联的待处理图片样本;determining the to-be-processed picture sample associated with the unlabeled picture sample based on the unlabeled picture sample;
将所述无标签图片样本以及相关联的待处理图片样本输入所述初始图片识别模型,获得所述无标签图片样本的第一识别结果,以及所述待处理图片样本的第二识别结果;Inputting the unlabeled picture sample and the associated to-be-processed picture sample into the initial picture recognition model to obtain a first recognition result of the unlabeled picture sample and a second recognition result of the to-be-processed picture sample;
基于所述第一识别结果以及所述第二识别结果,从所述无标签图片样本中确定第一伪标签样本和第二伪标签样本。Based on the first recognition result and the second recognition result, a first pseudo-label sample and a second pseudo-label sample are determined from the unlabeled picture samples.
其中,待处理图片样本可以理解为对无标签样本进行数据增广后获得的图片样本。无标签图片样本的第一识别结果,可以理解为初始图片识别模型对该无标签图片样本进行识别后输出的预测得分,例如[0,1]区间内任意的数值。相应地,待处理图片样本的第二识别结果,可以理解为初始图片识别模型对该待处理图片样本进行识别后输出的预测得分,例如[0,1]区间内任意的数值。The image samples to be processed may be understood as image samples obtained by performing data augmentation on unlabeled samples. The first recognition result of the unlabeled picture sample can be understood as the prediction score output by the initial picture recognition model after identifying the unlabeled picture sample, for example, any numerical value in the [0,1] interval. Correspondingly, the second recognition result of the picture sample to be processed can be understood as a prediction score output by the initial picture recognition model after identifying the picture sample to be processed, such as any numerical value in the [0,1] interval.
该无标签图片样本为可以多个,对应的,与该无标签图片样本相关联的待处理图片样本,可以理解为与每个无标签图片样本对应的待处理图片样本。进一步地,与每个无标签图片样本对应的待处理图片样本,也可以为多个,也即是,每个无标签图片样本可以对应的多个待处理图片样本。The unlabeled picture sample may be multiple. Correspondingly, the to-be-processed picture sample associated with the unlabeled picture sample may be understood as the to-be-processed picture sample corresponding to each unlabeled picture sample. Further, there may be multiple image samples to be processed corresponding to each unlabeled image sample, that is, each unlabeled image sample may correspond to multiple image samples to be processed.
具体地,在基于有标签图片样本训练获得初始图片识别模型之后,能够确定出对该初始图片识别模型进行训练的无标签图片样本。并通过对该无标签图片样本进行数据增广处理,获得与该无标签图片样本相关联的待处理图片样本。并将该无标签图片样本,以及与无标签图片样本相关联的待处理图片样本,输入至初始图片识别模型,从而获得无标签图片样本的第一识别结果,以及待处理图片样本的第二识别结果。并基于该第一识别结果以及第二识别结果,从无标签图片样本中确定第一伪标签样本和第二伪标签样本。Specifically, after the initial picture recognition model is obtained by training based on the labeled picture samples, the unlabeled picture samples for training the initial picture recognition model can be determined. And by performing data augmentation processing on the unlabeled picture sample, a to-be-processed picture sample associated with the unlabeled picture sample is obtained. Input the unlabeled picture sample and the unlabeled picture sample to be processed into the initial picture recognition model, so as to obtain the first recognition result of the unlabeled picture sample and the second recognition result of the unlabeled picture sample result. And based on the first recognition result and the second recognition result, the first pseudo-label sample and the second pseudo-label sample are determined from the unlabeled picture samples.
沿用上例,在基于有标签仪表盘图片样本训练获得初始图片识别模型之后,能够确定出对该初始图片识别模型进行训练的无标签的仪表盘图片样本A(简称图片样本A)和无标签的仪表盘图片样本B(简称图片样本B),并对图片样本A,和图片样本B进行数据增广处理,从而获得与图片样本A相关的增广图片样本A1和增广图片样本A2,以及与图片样本B相关的增广图片样本B1和增广图片样本B2。Following the above example, after training the initial image recognition model based on the labeled dashboard image samples, it is possible to determine the unlabeled dashboard image sample A (referred to as image sample A) and the unlabeled dashboard image sample A for training the initial image recognition model. Dashboard picture sample B (referred to as picture sample B), and perform data augmentation processing on picture sample A and picture sample B, so as to obtain augmented picture sample A1 and augmented picture sample A2 related to picture sample A, and Augmented picture sample B1 and augmented picture sample B2 related to picture sample B.
将该图片样本A、增广图片样本A1和增广图片样本A2,以及图片样本B、增广图片样本B1和增广图片样本B2输入至初始图片识别模型中,获得每个图片样本的预测得分,比如图片样本A为0.1分、增广图片样本A1为0.2分、增广图片样本A2为0.3分、图片样本B为0.4分、增广图片样本B1为0.5分、增广图片样本B2为0.6分。Input the picture sample A, the augmented picture sample A1 and the augmented picture sample A2, as well as the picture sample B, the augmented picture sample B1 and the augmented picture sample B2 into the initial picture recognition model, and obtain the prediction score of each picture sample For example, the picture sample A is 0.1 points, the augmented picture sample A1 is 0.2 points, the augmented picture sample A2 is 0.3 points, the picture sample B is 0.4 points, the augmented picture sample B1 is 0.5 points, and the augmented picture sample B2 is 0.6 points point.
基于每个无标签的仪表盘图片样本的预测得分,以及每个增广图片样本的预测得分,从无标签的仪表盘图片样本中,确定出被打上伪标签的仪表盘图片样本,以及未被打上伪标签的仪表盘图片样本。Based on the predicted score of each unlabeled dashboard image sample and the predicted score of each augmented image sample, from the unlabeled dashboard image sample, it is determined that the pseudo-labeled dashboard image sample, and the unlabeled dashboard image sample Sample dashboard image with pseudo-labels.
需要说明的是,本说明书实施例中,仅以无标签图片样本的数量为两个,且与每个无标签图片样本对应的待处理图片样本的数量为两个进行举例说明,该无标签图片样本的数量和待处理图片样本的数量可以根据实际应用场景进行设置,本说明书对此不做具体限定。It should be noted that, in the embodiments of this specification, only the number of unlabeled picture samples is two, and the number of unlabeled picture samples corresponding to each unlabeled picture sample is two for example. The number of samples and the number of image samples to be processed can be set according to actual application scenarios, which are not specifically limited in this specification.
进一步的,所述基于所述第一识别结果以及所述第二识别结果,从所述无标签图片样本中确定第一伪标签样本和第二伪标签样本,包括:Further, determining the first pseudo-label sample and the second pseudo-label sample from the unlabeled picture sample based on the first identification result and the second identification result, including:
基于所述无标签图片样本的第一识别结果,以及与所述无标签图片样本相关联的待处理图片样本的第二识别结果,确定所述无标签图片样本对应的目标识别结果;determining a target recognition result corresponding to the unlabeled picture sample based on the first identification result of the unlabeled picture sample and the second identification result of the to-be-processed picture sample associated with the unlabeled picture sample;
判断所述无标签图片样本对应的目标识别结果是否大于等于预设结果阈值,judging whether the target recognition result corresponding to the unlabeled picture sample is greater than or equal to a preset result threshold,
若是,则将所述无标签图片样本确定为第一伪标签样本,If so, the unlabeled picture sample is determined as the first pseudo-label sample,
若否,则将所述无标签图片样本确定为第二伪标签样本。If not, the unlabeled picture sample is determined as the second pseudo-label sample.
其中,预设结果阈值可以根据实际应用场景进行设置,本说明书对此不做具体限定。例如,该预设结果阈值可以为0.5分。The preset result threshold may be set according to an actual application scenario, which is not specifically limited in this specification. For example, the preset result threshold may be 0.5 points.
具体地,在确定出无标签图片样本的第一识别结果,以及与该无标签图片样本相关联的待处理图片样本的第二识别结果之后,能够从第一识别结果和第二识别结果确定出最大识别结果,并将该最大识别结果作为该无标签图片样本对应的目标识别结果。之后,判断该无标签图片样本对应的目标识别结果是否大于等于预设结果阈值,若是,则将该无标签图片样本确定为第一伪标签样本,若否,则将该无标签图片样本确定为第二伪标签样本。Specifically, after the first identification result of the unlabeled picture sample and the second identification result of the to-be-processed picture sample associated with the unlabeled picture sample are determined, it can be determined from the first identification result and the second identification result The maximum recognition result is used as the target recognition result corresponding to the unlabeled image sample. After that, it is judged whether the target recognition result corresponding to the unlabeled picture sample is greater than or equal to the preset result threshold, and if so, the unlabeled picture sample is determined as the first pseudo-labeled sample, and if not, the unlabeled picture sample is determined as the first pseudo-labeled sample. The second pseudo-label sample.
沿用上例,其中,预设结果阈值可以为0.5分。基于此,在确定出每个无标签的仪表盘图片样本的预测得分,以及每个增广图片样本的预测得分之后,能够从每个无标签的仪表盘图片样本的预测得分,以及与每个无标签的仪表盘图片样本相对应的增广图片样本的预测得分中,确定出最大的预测得分,并将该最大的预测得分作为无标签的仪表盘图片样本的目标预测得分。比如,图片样本A为0.1分、该图片样本A相对应的增广图片样本A1为0.2分、增广图片样本A2为0.3分,因此,将预测得分中最大的0.3分作为图片样本A的目标预测得分;图片样本B为0.4分,该图片样本B相对应的增广图片样本B1为0.5分、增广图片样本B2为0.6分,因此,将预测得分中最大的0.6分作为图片样本B的目标预测得分。Following the above example, the preset result threshold may be 0.5 points. Based on this, after determining the predicted score of each unlabeled dashboard image sample and the predicted score of each augmented image sample, the predicted score of each unlabeled dashboard image sample can be obtained from the predicted score of each unlabeled dashboard image sample, and with each Among the prediction scores of the augmented image samples corresponding to the unlabeled dashboard image samples, the largest predicted score is determined, and the largest predicted score is used as the target predicted score of the unlabeled dashboard image samples. For example, the picture sample A is 0.1 points, the augmented picture sample A1 corresponding to the picture sample A is 0.2 points, and the augmented picture sample A2 is 0.3 points. Therefore, the maximum predicted score of 0.3 points is used as the target of the picture sample A. Prediction score; picture sample B is 0.4 points, the corresponding augmented picture sample B1 of this picture sample B is 0.5 points, and the augmented picture sample B2 is 0.6 points. Therefore, the largest 0.6 points in the prediction scores are used as the picture sample B’s score. Target prediction score.
之后判断图片样本A和图片样本B的目标预测得分是否大于等于0.5分,若是,则将该无标签的仪表盘图片样本打上伪标签,因此,将该图片样本B打上伪标签,从而获得伪标签仪表盘图片样本。若否,则不将该无标签的仪表盘图片样本打上伪标签,因此,不会将图片样本A打上伪标签,从而确定后该图片样本A为无标签的仪表盘图片样本。Then judge whether the target prediction score of picture sample A and picture sample B is greater than or equal to 0.5 points, if so, label the unlabeled dashboard picture sample with a pseudo-label. Therefore, label the picture sample B with a pseudo-label to obtain a pseudo-label Dashboard image sample. If not, the unlabeled instrument panel picture sample will not be marked with a pseudo-label, therefore, the picture sample A will not be marked with a pseudo-label, so that the picture sample A is determined to be an unlabeled instrument panel picture sample.
本说明书实施例中,在伪标签阶段通过对无标签图片样本经过多次样本数据增广后,将样本数据中得分取最大值的样本数据,作为加入训练的样本(伪标签样本),提高了无标签样本的利用率。In the embodiment of this specification, in the pseudo-label stage, after the unlabeled image samples are augmented by the sample data for many times, the sample data with the maximum score in the sample data is used as the sample added to the training (pseudo-label sample), which improves the performance of the sample data. Utilization of unlabeled samples.
步骤三:基于预设确定规则从所述第一伪标签样本中确定第三伪标签样本,并基于所述第三伪标签样本从所述第二伪标签样本中确定第四伪标签样本。Step 3: Determine a third pseudo-label sample from the first pseudo-label sample based on a preset determination rule, and determine a fourth pseudo-label sample from the second pseudo-label sample based on the third pseudo-label sample.
其中,预设确定规则可以根据实际应用场景进行设置,本说明书对此不做具体设置,例如,该预设确定规则可以为将特定数量的,且识别结果最接近预设结果阈值的第一伪标签样本确定为第三伪标签样本。Wherein, the preset determination rule can be set according to the actual application scenario, which is not specifically set in this specification. For example, the preset determination rule can be a specific number of first pseudonyms whose identification results are closest to the preset result threshold. The label sample is determined as the third pseudo-label sample.
该第三伪标签样本可以理解为该第一伪标签样本中的难例样本。相应地,第四伪标签样本可以理解为第二伪标签样本中的难例样本。The third pseudo-label sample can be understood as a difficult sample in the first pseudo-label sample. Correspondingly, the fourth pseudo-label sample can be understood as a difficult sample in the second pseudo-label sample.
具体地,本说明书提供的图片识别方法,能够基于该预设确定规则从第一伪标签样本中确定出第三伪标签样本,并基于该第三伪标签样本从第二伪标签样本中确定第四伪标签样本。Specifically, the image recognition method provided in this specification can determine the third pseudo-label sample from the first pseudo-label sample based on the preset determination rule, and determine the third pseudo-label sample from the second pseudo-label sample based on the third pseudo-label sample. Four pseudo-label samples.
在本说明书提供的一实施例中,所述基于预设确定规则从所述第一伪标签样本中确定第三伪标签样本,包括:In an embodiment provided in this specification, the determining a third pseudo-label sample from the first pseudo-label sample based on a preset determination rule includes:
确定所述第一伪标签样本对应的目标识别结果;determining the target recognition result corresponding to the first pseudo-label sample;
基于所述目标识别结果对所述第一伪标签样本进行升序排序,获得所述第一伪标签样本的样本排序结果;Sort the first pseudo-label samples in ascending order based on the target recognition result, and obtain a sample sorting result of the first pseudo-label samples;
按照从上到下从所述第一伪标签样本的样本排序结果中,获取第一预设数量的第一伪标签样本,并将所述第一预设数量的第一伪标签样本作为第三伪标签样本。Obtain a first preset number of first pseudo-label samples from the sample sorting results of the first pseudo-label samples from top to bottom, and use the first preset number of first pseudo-label samples as the third Pseudo-label samples.
其中,第一预设数量可以根据实际应用场景进行设置,本说明书对此不做具体设置,例如,该第一预设数量可以为100个、1000个。The first preset number may be set according to an actual application scenario, which is not specifically set in this specification. For example, the first preset number may be 100 or 1000.
具体地,在从无标签图片样本中确定出第一伪标签样本之后,能够确定出该第一伪标签样本所对应的目标识别结果,并基于该目标识别结果对该第一伪标签样本进行升序排序,从而获得该第一伪标签样本的样本排序结果,之后按照从上到下的方式从该样本排序结果中获取第一预设数量的第一伪标签样本,并将该第一预设数量的第一伪标签样本作为第三伪标签样本。Specifically, after the first pseudo-label sample is determined from the unlabeled picture sample, the target recognition result corresponding to the first pseudo-label sample can be determined, and the first pseudo-label sample is sorted in ascending order based on the target recognition result. Sorting, thereby obtaining the sample sorting result of the first pseudo-label sample, then obtaining a first preset number of first pseudo-label samples from the sample sorting result in a top-to-bottom manner, and placing the first preset number of The first pseudo-label sample is used as the third pseudo-label sample.
沿用上例,其中,该第一预设数量可以为100个,基于此,在从无标签的仪表盘图片样本中确定出伪标签仪表盘图片样本之后,能够将该确定出每个伪标签仪表盘图片样本对应的目标预测得分,并基于该目标预测得分对伪标签仪表盘图片样本进行升序排序,从而获得该伪标签仪表盘图片样本的样本排序结果,并按照从上到下的方式从样本排序结果中选择前100个伪标签仪表盘图片样本,并将该前100个伪标签仪表盘图片样本作为伪标签仪表盘图片样本中的难例样本。Following the above example, the first preset number may be 100. Based on this, after the pseudo-labeled instrument panel picture samples are determined from the unlabeled instrument panel picture samples, each pseudo-labeled instrument can be determined. The target prediction score corresponding to the panel image sample, and based on the target prediction score, the pseudo-label dashboard image samples are sorted in ascending order, so as to obtain the sample sorting result of the pseudo-label dashboard image sample, and the samples are sorted from top to bottom in a top-to-bottom manner. In the sorting result, the first 100 pseudo-label dashboard image samples are selected, and the first 100 pseudo-label dashboard image samples are used as difficult samples in the pseudo-label dashboard image samples.
此外,在本说明书提供的一实施例中,该第三伪标签样本还能够从有标签图片样本中确定,具体实现方式如下。In addition, in an embodiment provided in this specification, the third pseudo-label sample can also be determined from a labeled picture sample, and the specific implementation is as follows.
所述基于有标签图片样本训练获得初始图片识别模型之后,还包括:After obtaining the initial image recognition model based on the labeled image sample training, the method further includes:
确定所述有标签图片样本对应的样本识别结果,其中,所述样本识别结果为基于所述有标签图片样本训练获得所述初始图片识别模型的过程中确定的识别结果;Determine the sample recognition result corresponding to the labeled picture sample, wherein the sample recognition result is the recognition result determined in the process of obtaining the initial picture recognition model based on the labeled picture sample training;
基于所述样本识别结果对所述有标签图片样本进行升序排序,获得所述有标签图片样本的样本排序结果;Sort the labeled picture samples in ascending order based on the sample identification results, and obtain a sample sorting result of the labeled picture samples;
按照从上到下从所述有标签图片样本的样本排序结果中,获取第二预设数量的有标签图片样本,并将所述第二预设数量的有标签图片样本作为第三伪标签样本。Obtain a second preset number of labeled image samples from the sample sorting results of the labeled image samples from top to bottom, and use the second preset number of labeled image samples as the third pseudo-labeled sample .
其中,有标签图片样本对应的样本识别结果,可以理解为在通过有标签图片样本训练获得初始图片识别模型的过程中,图片识别模型为有标签图片样本确定出预测得分。在实际应用中,该有标签图片样本可以分为训练有标签图片样本以及测试有标签图片样本,因此,该有标签图片样本对应的样本识别结果,可以理解为该训练有标签图片样本对应的预测得分,和/或该测试有标签图片样本对应的预测得分。Among them, the sample recognition result corresponding to the labeled image sample can be understood as the image recognition model determines the prediction score for the labeled image sample in the process of obtaining the initial image recognition model through the labeled image sample training. In practical applications, the labeled image samples can be divided into training labeled image samples and test labeled image samples. Therefore, the sample recognition results corresponding to the labeled image samples can be understood as the prediction corresponding to the labeled training image samples. score, and/or the predicted score corresponding to the labeled image sample for this test.
第二预设数量可以根据实际应用场景进行设置,本说明书对此不做具体设置,例如,该第二预设数量可以为100个、1000个。The second preset number may be set according to an actual application scenario, which is not specifically set in this specification. For example, the second preset number may be 100 or 1000.
具体地,在训练获得初始图片识别模型之后,能够确定出该有标签图片样本对应的样本识别结果,基于该样本识别结果对有标签图片样本进行升序排序,从而获得有标签图片样本对应的样本排序结果;并按照从上到下从该有标签图片样本的样本排序结果中,获取第二预设数量的有标签图片样本,例如该第二预设数量为100个,且将该100个有标签图片样本作为第三伪标签样本。Specifically, after the initial image recognition model is obtained by training, the sample recognition result corresponding to the labeled image sample can be determined, and the labeled image sample is sorted in ascending order based on the sample recognition result, so as to obtain the sample ranking corresponding to the labeled image sample. and obtain a second preset number of labeled image samples from the sample sorting results of the labeled image samples from top to bottom, for example, the second preset number is 100, and the 100 labeled image samples are The image sample is used as the third pseudo-label sample.
在本说明书提供的一实施例中,所述基于所述第三伪标签样本从所述第二伪标签样本中确定第四伪标签样本,包括:In an embodiment provided in this specification, the determining a fourth pseudo-label sample from the second pseudo-label sample based on the third pseudo-label sample includes:
基于所述初始图片识别模型确定所述第三伪标签样本的样本特征,以及所述第二伪标签样本的样本特征;Determine the sample feature of the third pseudo-label sample and the sample feature of the second pseudo-label sample based on the initial picture recognition model;
确定所述第三伪标签样本的样本特征以及所述第二伪标签样本的样本特征的相似度;determining the similarity between the sample feature of the third pseudo-label sample and the sample feature of the second pseudo-label sample;
基于所述相似度从所述第二伪标签样本中确定第四伪标签样本。A fourth pseudo-label sample is determined from the second pseudo-label samples based on the similarity.
其中,相似度可以理解为表征第三伪标签样本的样本特征和第二伪标签样本的样本特征之间相似程度的数值。例如[0,10]区间中的任意数值。The similarity may be understood as a numerical value representing the degree of similarity between the sample features of the third pseudo-label sample and the sample features of the second pseudo-label sample. For example, any number in the interval [0,10].
具体地,在确定出第三伪标签样本之后,能够通过将该第三伪标签样本输入至初始图片识别模型中,基于初始图片识别模型确定该第三伪标签样本的样本特征,以及将该第二伪标签样本输入至初始图片识别模型中,基于初始图片识别模型确定该第二伪标签样本的样本特征。Specifically, after the third pseudo-label sample is determined, the third pseudo-label sample can be input into the initial picture recognition model, the sample characteristics of the third pseudo-label sample can be determined based on the initial picture recognition model, and the third pseudo-label sample can be determined based on the initial picture recognition model. The two pseudo-label samples are input into the initial picture recognition model, and the sample characteristics of the second pseudo-label samples are determined based on the initial picture recognition model.
之后确定该每个第三伪标签样本的样本特征与第二伪标签样本的样本特征之间的相似度,并基于该相似度从第二伪标签样本中确定第四伪标签样本。其中,确定第三伪标签样本的样本特征与第二伪标签样本的样本特征之间的相似度的操作,可以通过任意一种计算样本特征之间相似度的方式实现,本说明书在此不做具体限制,例如,可以通过一种相似度确定算法确定出该相似度、或者通过计算机程序确定出该相似度。Then, the similarity between the sample feature of each third pseudo-label sample and the sample feature of the second pseudo-label sample is determined, and the fourth pseudo-label sample is determined from the second pseudo-label sample based on the similarity. Among them, the operation of determining the similarity between the sample features of the third pseudo-label sample and the sample features of the second pseudo-label sample can be implemented by any method of calculating the similarity between the sample features, which is not described in this specification. Specific limitations, for example, the similarity may be determined by a similarity determination algorithm, or the similarity may be determined by a computer program.
本说明书提供的一实施例中,在通过初始图片识别模型确定样本特征的过程中,可以通过该初始图片识别模型中用于进行特征提取的模块,实现确定第三伪标签样本的样本特征以及第二伪标签样本的样本特征的操作。具体实现方式如下。In an embodiment provided in this specification, in the process of determining the sample features through the initial image recognition model, the module for feature extraction in the initial image recognition model can be used to determine the sample features of the third pseudo-label sample and the third sample features. Operations on sample features of two pseudo-labeled samples. The specific implementation is as follows.
所述基于所述初始图片识别模型确定所述第三伪标签样本的样本特征,以及所述第二伪标签样本的样本特征,包括:The determining the sample feature of the third pseudo-label sample and the sample feature of the second pseudo-label sample based on the initial picture recognition model includes:
将所述第三伪标签样本输入所述初始图片识别模型,基于所述初始图片识别模型中的特征提取模块确定所述第三伪标签样本的样本特征;Inputting the third pseudo-label sample into the initial picture recognition model, and determining the sample features of the third pseudo-label sample based on the feature extraction module in the initial picture recognition model;
将所述第二伪标签样本输入所述初始图片识别模型,基于所述初始图片识别模型中的特征提取模块确定所述第二伪标签样本的样本特征。The second pseudo-label sample is input into the initial picture recognition model, and the sample features of the second pseudo-label sample are determined based on the feature extraction module in the initial picture recognition model.
其中,该特征提取模块可以理解为该初始图片识别模型中用于进行特征提取的模块,例如,模型中用于进行图片特征提取的网络层。The feature extraction module may be understood as a module used for feature extraction in the initial image recognition model, for example, a network layer in the model for image feature extraction.
沿用上例,该特征提取模块为初始图片识别模型中用于进行特征提取的特征提取层。基于此,将该伪标签仪表盘图片样本中的样本难例输入至初始图片识别模型中,基于该初始图片识别模型中的特征提取层对该样本难例进行特征提取处理,从而获得该样本难例的样本特征。并且,将无标签仪表盘图片样本中没有被打上伪标签的仪表盘图片样本,输入至该始图片识别模型中,基于该初始图片识别模型中的特征提取层,对该没有被打上伪标签的仪表盘图片样本进行特征提取处理,从而获得该没有被打上伪标签的仪表盘图片样本所对应的样本特征。Following the above example, the feature extraction module is the feature extraction layer used for feature extraction in the initial image recognition model. Based on this, the sample difficult example in the pseudo-label dashboard picture sample is input into the initial picture recognition model, and the feature extraction process is performed on the sample difficult example based on the feature extraction layer in the initial picture recognition model, so as to obtain the sample difficult example. sample features of the example. And, input the dashboard image samples that have not been pseudo-labeled in the unlabeled dashboard image samples into the initial image recognition model, and based on the feature extraction layer in the initial image recognition model, the unlabeled dashboard image samples have not been pseudo-labeled. The instrument panel picture sample is subjected to feature extraction processing, so as to obtain sample features corresponding to the instrument panel picture sample that has not been marked with a pseudo-label.
之后确定出每个样本难例的样本特征,与该没有被打上伪标签的仪表盘图片样本所对应的样本特征之间的相似度,并基于该相似度从该没有被打上伪标签的仪表盘图片样本中,确定出该难例样本。Then determine the similarity between the sample features of each sample difficult example and the sample features corresponding to the dashboard image samples without pseudo-labels, and based on the similarity from the dashboard without pseudo-labels. Among the picture samples, the difficult sample is determined.
进一步地,所述基于所述相似度从所述第二伪标签样本中确定第四伪标签样本,包括:Further, determining a fourth pseudo-label sample from the second pseudo-label sample based on the similarity includes:
基于所述相似度对所述第二伪标签样本进行降序排序,获得所述第二伪标签样本的样本排序结果;Sort the second pseudo-label samples in descending order based on the similarity to obtain a sample sorting result of the second pseudo-label samples;
按照从上到下从所述第二伪标签样本的样本排序结果中,获取第三预设数量的第二伪标签样本,并将所述第三预设数量的第二伪标签样本作为第四伪标签样本。Obtain a third preset number of second pseudo-label samples from the sample sorting results of the second pseudo-label samples from top to bottom, and use the third preset number of second pseudo-label samples as the fourth Pseudo-label samples.
其中,第三预设数量可以根据实际应用场景进行设置,本说明书对此不做具体设置,例如,该第三预设数量可以为10个。The third preset number may be set according to an actual application scenario, which is not specifically set in this specification. For example, the third preset number may be 10.
具体地,在确定出每个第三伪标签样本的样本特征与第二伪标签样本的样本特征之间的相似度之后,基于该相似度对第二伪标签样本进行降序排序,从而获得该第二伪标签样本的对应多个降序样本排序结果,其中,每个第三伪标签样本的样本特征均对应的一个降序样本排序结果,之后按照从上到下从每个第二伪标签样本的样本排序结果中,获取第三预设数量的第二伪标签样本,例如,该第三预设数量可以为10个,则按照从上到下从每个第二伪标签样本的样本排序结果中,获取10个第二伪标签样本,并将获取到的第二伪标签样本作为第四伪标签样本。Specifically, after determining the similarity between the sample feature of each third pseudo-label sample and the sample feature of the second pseudo-label sample, sort the second pseudo-label samples in descending order based on the similarity, so as to obtain the first pseudo-label sample. The sorting results of multiple descending samples corresponding to the second pseudo-label samples, wherein the sample features of each third pseudo-label sample correspond to a descending sample sorting result, and then the samples of each second pseudo-label sample are sorted from top to bottom In the sorting result, a third preset number of second pseudo-label samples is obtained. For example, the third preset number may be 10, and in the sample sorting result of each second pseudo-label sample from top to bottom, Obtain 10 second pseudo-label samples, and use the obtained second pseudo-label samples as the fourth pseudo-label sample.
本说明书提供的实施例中,通过在半监督学习的训练方式中,引入相似度比对的方式进行难例挖掘,将更有价值的无标签样本加入了训练,同样大幅提高了无标签样本的利用率。In the embodiment provided in this specification, the training method of semi-supervised learning introduces the method of similarity comparison to mine difficult examples, and adds more valuable unlabeled samples to the training, which also greatly improves the performance of unlabeled samples. utilization.
步骤四:基于所述第一伪标签样本、所述第四伪标签样本以及所述有标签图片样本,对所述初始图片识别模型进行训练,获得训练完成的图片识别模型。Step 4: Based on the first pseudo-label sample, the fourth pseudo-label sample, and the labeled picture sample, train the initial picture recognition model to obtain a trained picture recognition model.
具体地,本说明书提供的图片识别方法中,在确定出第一伪标签样本和第四伪标签样本之后,能够基于该第一伪标签样本、第四伪标签样本以及有标签图片样本,对初始图片识别模型进行训练,从而获得训练完成的图片识别模型。其中,该基于第一伪标签样本、第四伪标签样本以及有标签图片样本训练获得初始图片识别模型的操作,可以采用任意一种基于伪标签样本和有标签图片样本对模型进行训练的方式实现,本说明书对此不做具体限制。例如,将第一伪标签样本、第四伪标签样本以及有标签图片样本,输入至初始图片识别模型中,从而获得第一伪标签样本、第四伪标签样本以及有标签图片样本对应的预测得分,确定第一伪标签样本、第四伪标签样本和有标签图片样本对应的样本标签,基于该样本标签以及预测得分确定损失值,基于该损失值对初始图片识别模型进行调参,使得该初始图片识别模型达到收敛,从而获得训练完成的图片识别模型。Specifically, in the image recognition method provided in this specification, after the first pseudo-label sample and the fourth pseudo-label sample are determined, based on the first pseudo-label sample, the fourth pseudo-label sample and the labeled picture sample, the initial The image recognition model is trained to obtain a trained image recognition model. The operation of obtaining the initial image recognition model based on the training of the first pseudo-label sample, the fourth pseudo-label sample and the labeled image sample can be implemented by any method of training the model based on the pseudo-label sample and the labeled image sample. , which is not specifically limited in this manual. For example, the first pseudo-label sample, the fourth pseudo-label sample and the labeled picture sample are input into the initial picture recognition model, so as to obtain the prediction scores corresponding to the first pseudo-label sample, the fourth pseudo-label sample and the labeled picture sample , determine the sample labels corresponding to the first pseudo-label sample, the fourth pseudo-label sample and the labeled picture sample, determine the loss value based on the sample label and the predicted score, and adjust the parameters of the initial picture recognition model based on the loss value, so that the initial The image recognition model reaches convergence, thereby obtaining a trained image recognition model.
本说明书提供的实施例中,通过采用半监督学习方法进行难例挖掘,并通过对无标签图片多次增广取最大值作为伪标签并加入训练,从而提高了图片识别模型的性能,便于后续基于该图片识别模型识别出翻拍的图片,进一步地实现了图片自动化审核的目的。In the embodiments provided in this specification, the semi-supervised learning method is used to mine difficult examples, and the unlabeled pictures are augmented multiple times to take the maximum value as a pseudo-label and add training, thereby improving the performance of the picture recognition model and facilitating the follow-up Based on the image recognition model, the retaken images are recognized, and the purpose of automatic image review is further realized.
步骤104:获取所述图片识别模型对所述待识别图片的识别结果,基于所述识别结果确定所述待识别图片是否为风险图片。Step 104: Acquire a recognition result of the picture to be recognized by the picture recognition model, and determine whether the to-be-recognized picture is a risk picture based on the recognition result.
其中,该待识别图片的识别结果可以理解为判断该待识别图片是否为风险图片的预测分值,例如[0,1]区间中的任意数值;相应地,风险图片可以理解为具有风险的图片,例如虚假的图片、翻拍图片等等。Wherein, the recognition result of the picture to be recognized can be understood as a prediction score for judging whether the picture to be recognized is a risk picture, such as any value in the [0,1] interval; correspondingly, a risk picture can be understood as a risky picture , such as fake pictures, remakes, etc.
具体地,在将待识别图片输入至训练完成的图片识别模型之后,能够获得该图片识别模型对待识别图片的识别结果,并基于识别结果确定待识别图片是否为风险图片。Specifically, after the image to be recognized is input into the trained image recognition model, the recognition result of the image to be recognized by the image recognition model can be obtained, and whether the image to be recognized is a risk image is determined based on the recognition result.
沿用上例,将该仪表盘图片输入至图片识别模型之后,基于该图片识别模型对该仪表盘图片进行识别,从而获得该图片识别模型输出的预测得分,基于该预测得分能够确定出该仪表盘图片是否为翻拍图片。Following the above example, after inputting the picture of the dashboard into the picture recognition model, the picture of the dashboard is recognized based on the picture recognition model, so as to obtain the prediction score output by the picture recognition model, and the dashboard can be determined based on the prediction score. Whether the picture is a remake.
进一步地,所述基于所述识别结果确定所述待识别图片是否为风险图片,包括:Further, determining whether the picture to be identified is a risk picture based on the identification result includes:
判断所述识别结果是否大于等于预设风险阈值,若是,则确定所述待识别图片为风险图片,若否,则确定所述待识别图片为非风险图片。It is judged whether the identification result is greater than or equal to a preset risk threshold, and if so, it is determined that the picture to be identified is a risk picture, and if not, it is determined that the picture to be identified is a non-risk picture.
其中,该非风险图片为不具有风险的图片,例如真实的图片、非翻拍图片等等。该预设风险阈值可以根据实际应用场景进行设置,本说明书对此不做具体限制;例如0.5分。Wherein, the non-risk picture is a picture without risk, such as a real picture, a non-remake picture, and the like. The preset risk threshold can be set according to the actual application scenario, which is not specifically limited in this specification; for example, 0.5 points.
沿用上例,在基于图片识别模型确定出仪表盘图片的预测得分之后,判断该预测得分是否大于等于0.5分,若是,则确定该仪表盘图片是翻拍图片,若否,则确定该仪表盘图片不是翻拍图片。Following the above example, after determining the predicted score of the dashboard image based on the image recognition model, determine whether the predicted score is greater than or equal to 0.5 points, if so, determine that the dashboard image is a remake, if not, determine the dashboard image Not a remake of the picture.
本说明书提供的图片识别方法,包括:将待识别图片输入预先训练的图片识别模型,其中,所述图片识别模型基于有标签图片样本以及满足预设规则的无标签图片样本训练获得;获取所述图片识别模型对所述待识别图片的识别结果,基于所述识别结果确定所述待识别图片是否为风险图片。The picture recognition method provided in this specification includes: inputting the picture to be recognized into a pre-trained picture recognition model, wherein the picture recognition model is obtained by training based on labeled picture samples and unlabeled picture samples that meet preset rules; Based on the recognition result of the picture to be recognized by the picture recognition model, it is determined whether the picture to be recognized is a risk picture based on the recognition result.
下述结合附图2,以本说明书提供的图片识别方法在识别仪表盘图片是否为翻拍图片场景下的应用为例,对所述图片识别方法进行进一步说明。其中,图2示出了本说明书一个实施例提供的一种图片识别方法中模型训练的过程示意图。本说明书提供的图片识别方法在识别仪表盘图片是否为翻拍图片场景下,能够将用户车辆的仪表盘图片,输入至能够识别出仪表盘图片是否为翻拍图片的图片识别模型中,基于该图片识别模型对该仪表盘图片进行识别,从而获得该图片识别模型输出的预测得分,基于该预测得分能够确定出该仪表盘图片是否为翻拍图片。其中,在将用户车辆的仪表盘图片输入至图片识别模型中进行识别处理之前,还需要对通过有标签图片样本和无标签图片样本对该图片识别模型进行训练,从而获得训练完成的图片识别模型。基于此,针对该图片识别模型的训练步骤可以参见图2,如图2所示,本说明书提供的图片识别方法。在对该图片识别模型进行训练的步骤可以分为4个阶段,包括训练阶段一、伪标签阶段一、伪标签阶段二、训练阶段二。In the following, in conjunction with FIG. 2 , the image recognition method will be further described by taking the application of the image recognition method provided in this specification in the scenario of recognizing whether a dashboard image is a duplicated image as an example. Among them, FIG. 2 shows a schematic diagram of a model training process in an image recognition method provided by an embodiment of the present specification. The picture recognition method provided in this specification can input the instrument panel picture of the user's vehicle into a picture recognition model that can identify whether the instrument panel picture is a duplicated picture in the scenario of recognizing whether the instrument panel picture is a remake picture, and recognizes based on the picture. The model recognizes the picture of the instrument panel, thereby obtaining a prediction score output by the picture recognition model, and based on the prediction score, it can be determined whether the picture of the instrument panel is a remake picture. Before inputting the dashboard picture of the user's vehicle into the picture recognition model for recognition processing, it is also necessary to train the picture recognition model through the labeled picture samples and the unlabeled picture samples, so as to obtain the trained picture recognition model. . Based on this, for the training steps of the image recognition model, reference may be made to FIG. 2 , as shown in FIG. 2 , the image recognition method provided in this specification. The steps of training the image recognition model can be divided into 4 stages, including training stage 1, pseudo-label stage 1, pseudo-label stage 2, and training stage 2.
其中,该训练阶段一:是指通过人工标注的有标签图片样本对模型A进行训练,从而训练出一个初始图片识别模型A;Among them, the training stage 1: refers to the training of model A through manually labeled labeled image samples, thereby training an initial image recognition model A;
其中,伪标签阶段一:是指对该无标签图片样本进行多次数据增广,从而通过不同数据增广方式得到每个无标签图片样本对应的多张图片样本。将该无标签图片样本和数据增广获得的图片样本输入至初始图片识别模型A,并将得到数据增广获得的图片样本的预测得分,以及无标签图片样本的预测得分,共同作为无标签图片样本的预测得分,也即是图2中的多次数据增广得到的多个数值;之后,从无标签图片样本的预测得分中取最大值,从而获得最大的预测得分;判断该预测得分是否高于预设阈值,若是,则将该无标签图片样本可以打标,也即是打上伪标签,从而获得伪标签样本图片样本。Among them, pseudo-label stage 1: refers to performing multiple data augmentation on the unlabeled image sample, thereby obtaining multiple image samples corresponding to each unlabeled image sample through different data augmentation methods. Input the unlabeled image sample and the image sample obtained by data augmentation into the initial image recognition model A, and obtain the predicted score of the image sample obtained by data augmentation and the predicted score of the unlabeled image sample, which are collectively used as an unlabeled image. The prediction score of the sample, that is, the multiple values obtained by multiple data augmentation in Figure 2; after that, take the maximum value from the prediction score of the unlabeled picture sample to obtain the maximum prediction score; determine whether the prediction score is If the value is higher than the preset threshold, if so, the unlabeled image sample can be marked, that is, a pseudo-label is added, so as to obtain a pseudo-labeled sample image sample.
需要说明是的,该数据增广获得的图片样本可以理解为上述实施例中的待处理图片样本。预设阈值可以理解为上述实施例中的预设结果阈值。It should be noted that, the picture samples obtained by the data augmentation can be understood as the picture samples to be processed in the foregoing embodiment. The preset threshold may be understood as the preset result threshold in the above-mentioned embodiment.
其中,伪标签阶段二:是指从该有标签图片样本中的确定出难例样本,该有标签图片样本可以为是训练阶段一中通过人工标注的有标签图片样本,和/或伪标签阶段一中获得伪标签图片样本。Among them, pseudo-label stage 2: refers to determining difficult samples from the labeled picture samples, and the labeled picture samples may be manually labeled picture samples in training stage 1, and/or pseudo-label stage. A sample of pseudo-labeled images is obtained.
将有标签图片样本中的难例送入模型A中得到对应的特征,然后将大量无标签图片样本也送入模型得到对应特征;该大量无标签图片样本可以为,伪标签阶段一中除未被打标的无标签图片样本,也即是,预测得分低于等于预设阈值的无标签图片样本。Send the difficult examples in the labeled picture samples into model A to get the corresponding features, and then send a large number of unlabeled picture samples into the model to get the corresponding features; the large number of unlabeled picture samples can be, in the pseudo-label stage one, remove the unlabeled Labeled unlabeled picture samples, that is, unlabeled picture samples whose predicted scores are lower than or equal to a preset threshold.
对有标签图片样本的特征和每个无标签图片样本的特征进行相似度计算,从而获得有标签图片样本的特征和每个无标签图片样本的特征之间的相似度,并基于该相似度对该每个无标签图片样本进行排序,并将排序靠前的前10个无标签图片样本打伪标签,从而再次获得一定数量的伪标签图片样本,并将该伪标签图片样本加入后续训练中。Calculate the similarity between the features of the labeled image samples and the features of each unlabeled image sample, so as to obtain the similarity between the features of the labeled image samples and the features of each unlabeled image sample, and based on the similarity Each unlabeled image sample is sorted, and the top 10 unlabeled image samples are pseudo-labeled, so as to obtain a certain number of pseudo-labeled image samples again, and the pseudo-labeled image samples are added to the subsequent training.
其中,训练阶段二:是指将伪标签阶段一和伪标签阶段二获得的伪标签图片样本,以及训练阶段一中人工标注的有标签图片样本共同加入针对初始图片识别模型A的训练中,从而获得训练完成的目标图片识别模型A。该目标图片识别模型A可以理解为上述实施例中的预先训练的图片识别模型。Among them, the training stage 2: refers to the pseudo-label image samples obtained in the pseudo-label stage 1 and the pseudo-label stage 2, and the manually labeled image samples in the training stage 1. Obtain the trained target image recognition model A. The target image recognition model A may be understood as the pre-trained image recognition model in the above embodiment.
本说明书提供的图片识别方法,通过在伪标签阶段将无标签图片样本经过多次数据增广后,将得分取最大值的样本作为加入训练的样本,提高了无标签样本的利用率。并且,通过在半监督学习的训练方式中,引入相似度比对的方式进行难例挖掘,将更有价值的无标签样本加入了训练,同样大幅提高了无标签样本的利用率。The image recognition method provided in this specification improves the utilization of unlabeled samples by augmenting the unlabeled image samples for many times in the pseudo-label stage, and using the sample with the maximum score as the training sample. Moreover, in the training method of semi-supervised learning, the method of similarity comparison is introduced to mine difficult cases, and more valuable unlabeled samples are added to the training, which also greatly improves the utilization rate of unlabeled samples.
与上述方法实施例相对应,本说明书还提供了图片识别装置实施例,图3示出了本说明书一个实施例提供的一种图片识别装置的结构示意图。如图3所示,该装置包括:Corresponding to the foregoing method embodiments, this specification also provides an embodiment of a picture recognition apparatus, and FIG. 3 shows a schematic structural diagram of a picture recognition apparatus provided by an embodiment of this specification. As shown in Figure 3, the device includes:
输入模块302,被配置为将待识别图片输入预先训练的图片识别模型,其中,所述图片识别模型基于有标签图片样本以及满足预设规则的无标签图片样本训练获得;The input module 302 is configured to input the to-be-recognized picture into a pre-trained picture recognition model, wherein the picture recognition model is obtained by training based on labeled picture samples and unlabeled picture samples that satisfy preset rules;
确定模块304,被配置为获取所述图片识别模型对所述待识别图片的识别结果,基于所述识别结果确定所述待识别图片是否为风险图片。The determining module 304 is configured to obtain a recognition result of the picture to be recognized by the picture recognition model, and determine whether the to-be-recognized picture is a risk picture based on the recognition result.
可选地,所述图片识别装置还包括模型训练模块,被配置为:Optionally, the picture recognition device further includes a model training module, configured as:
基于所述有标签图片样本训练获得初始图片识别模型;Obtaining an initial image recognition model based on the labeled image sample training;
基于所述初始图片识别模型,从无标签图片样本中确定第一伪标签样本和第二伪标签样本;determining a first pseudo-label sample and a second pseudo-label sample from unlabeled picture samples based on the initial picture recognition model;
基于预设确定规则从所述第一伪标签样本中确定第三伪标签样本,并基于所述第三伪标签样本从所述第二伪标签样本中确定第四伪标签样本;determining a third pseudo-label sample from the first pseudo-label sample based on a preset determination rule, and determining a fourth pseudo-label sample from the second pseudo-label sample based on the third pseudo-label sample;
基于所述第一伪标签样本、所述第四伪标签样本以及所述有标签图片样本,对所述初始图片识别模型进行训练,获得训练完成的图片识别模型。Based on the first pseudo-label sample, the fourth pseudo-label sample, and the labeled picture sample, the initial picture recognition model is trained to obtain a trained picture recognition model.
可选地,所述模型训练模块,还被配置为:Optionally, the model training module is also configured as:
基于无标签图片样本确定与所述无标签图片样本相关联的待处理图片样本;determining the to-be-processed picture sample associated with the unlabeled picture sample based on the unlabeled picture sample;
将所述无标签图片样本以及相关联的待处理图片样本输入所述初始图片识别模型,获得所述无标签图片样本的第一识别结果,以及所述待处理图片样本的第二识别结果;Inputting the unlabeled picture sample and the associated to-be-processed picture sample into the initial picture recognition model to obtain a first recognition result of the unlabeled picture sample and a second recognition result of the to-be-processed picture sample;
基于所述第一识别结果以及所述第二识别结果,从所述无标签图片样本中确定第一伪标签样本和第二伪标签样本。Based on the first recognition result and the second recognition result, a first pseudo-label sample and a second pseudo-label sample are determined from the unlabeled picture samples.
可选地,所述模型训练模块,还被配置为:Optionally, the model training module is also configured as:
基于所述无标签图片样本的第一识别结果,以及与所述无标签图片样本相关联的待处理图片样本的第二识别结果,确定所述无标签图片样本对应的目标识别结果;determining a target recognition result corresponding to the unlabeled picture sample based on the first identification result of the unlabeled picture sample and the second identification result of the to-be-processed picture sample associated with the unlabeled picture sample;
判断所述无标签图片样本对应的目标识别结果是否大于等于预设结果阈值,judging whether the target recognition result corresponding to the unlabeled picture sample is greater than or equal to a preset result threshold,
若是,则将所述无标签图片样本确定为第一伪标签样本,If so, the unlabeled picture sample is determined as the first pseudo-label sample,
若否,则将所述无标签图片样本确定为第二伪标签样本。If not, the unlabeled picture sample is determined as the second pseudo-label sample.
可选地,所述模型训练模块,还被配置为:Optionally, the model training module is also configured as:
确定所述第一伪标签样本对应的目标识别结果;determining the target recognition result corresponding to the first pseudo-label sample;
基于所述目标识别结果对所述第一伪标签样本进行升序排序,获得所述第一伪标签样本的样本排序结果;Sort the first pseudo-label samples in ascending order based on the target recognition result, and obtain a sample sorting result of the first pseudo-label samples;
按照从上到下从所述第一伪标签样本的样本排序结果中,获取第一预设数量的第一伪标签样本,并将所述第一预设数量的第一伪标签样本作为第三伪标签样本。Obtain a first preset number of first pseudo-label samples from the sample sorting results of the first pseudo-label samples from top to bottom, and use the first preset number of first pseudo-label samples as the third Pseudo-label samples.
可选地,所述模型训练模块,还被配置为:Optionally, the model training module is also configured as:
确定所述有标签图片样本对应的样本识别结果,其中,所述样本识别结果为基于所述有标签图片样本训练获得所述初始图片识别模型的过程中确定的识别结果;Determine the sample recognition result corresponding to the labeled picture sample, wherein the sample recognition result is the recognition result determined in the process of obtaining the initial picture recognition model based on the labeled picture sample training;
基于所述样本识别结果对所述有标签图片样本进行升序排序,获得所述有标签图片样本的样本排序结果;Sort the labeled picture samples in ascending order based on the sample identification results, and obtain a sample sorting result of the labeled picture samples;
按照从上到下从所述有标签图片样本的样本排序结果中,获取第二预设数量的有标签图片样本,并将所述第二预设数量的有标签图片样本作为第三伪标签样本。Obtain a second preset number of labeled image samples from the sample sorting results of the labeled image samples from top to bottom, and use the second preset number of labeled image samples as the third pseudo-labeled sample .
可选地,所述模型训练模块,还被配置为:Optionally, the model training module is also configured as:
基于所述初始图片识别模型确定所述第三伪标签样本的样本特征,以及所述第二伪标签样本的样本特征;Determine the sample feature of the third pseudo-label sample and the sample feature of the second pseudo-label sample based on the initial picture recognition model;
确定所述第三伪标签样本的样本特征以及所述第二伪标签样本的样本特征的相似度;determining the similarity between the sample feature of the third pseudo-label sample and the sample feature of the second pseudo-label sample;
基于所述相似度从所述第二伪标签样本中确定第四伪标签样本。A fourth pseudo-label sample is determined from the second pseudo-label samples based on the similarity.
可选地,所述模型训练模块,还被配置为:Optionally, the model training module is also configured as:
将所述第三伪标签样本输入所述初始图片识别模型,基于所述初始图片识别模型中的特征提取模块确定所述第三伪标签样本的样本特征;Inputting the third pseudo-label sample into the initial picture recognition model, and determining the sample features of the third pseudo-label sample based on the feature extraction module in the initial picture recognition model;
将所述第二伪标签样本输入所述初始图片识别模型,基于所述初始图片识别模型中的特征提取模块确定所述第二伪标签样本的样本特征。The second pseudo-label sample is input into the initial picture recognition model, and the sample features of the second pseudo-label sample are determined based on the feature extraction module in the initial picture recognition model.
可选地,所述模型训练模块,还被配置为:Optionally, the model training module is also configured as:
基于所述相似度对所述第二伪标签样本进行降序排序,获得所述第二伪标签样本的样本排序结果;Sort the second pseudo-label samples in descending order based on the similarity to obtain a sample sorting result of the second pseudo-label samples;
按照从上到下从所述第二伪标签样本的样本排序结果中,获取第三预设数量的第二伪标签样本,并将所述第三预设数量的第二伪标签样本作为第四伪标签样本。Obtain a third preset number of second pseudo-label samples from the sample sorting results of the second pseudo-label samples from top to bottom, and use the third preset number of second pseudo-label samples as the fourth Pseudo-label samples.
可选地,所述确定模块304,还被配置为:Optionally, the determining module 304 is further configured to:
判断所述识别结果是否大于等于预设风险阈值,若是,则确定所述待识别图片为风险图片,若否,则确定所述待识别图片为非风险图片。It is judged whether the identification result is greater than or equal to a preset risk threshold, and if so, it is determined that the picture to be identified is a risk picture, and if not, it is determined that the picture to be identified is a non-risk picture.
本说明书提供的图片识别装置,通过基于有标签图片样本以及满足预设规则的无标签图片样本训练获得的图片识别模型,识别输入的待识别图片是否为风险图片,从而提高了风险图片的识别效率,降低了图片验证过程的难度。The picture recognition device provided in this specification can identify whether the input picture to be recognized is a risk picture by training a picture recognition model based on labeled picture samples and unlabeled picture samples that meet preset rules, thereby improving the identification efficiency of risk pictures , which reduces the difficulty of the image verification process.
上述为本实施例的一种图片识别装置的示意性方案。需要说明的是,该图片识别装置的技术方案与上述的图片识别方法的技术方案属于同一构思,图片识别装置的技术方案未详细描述的细节内容,均可以参见上述图片识别方法的技术方案的描述。The above is a schematic solution of a picture recognition apparatus according to this embodiment. It should be noted that the technical solution of the image recognition device and the technical solution of the above-mentioned image recognition method belong to the same concept, and the details that are not described in detail in the technical solution of the image recognition device can be referred to the description of the technical solution of the above-mentioned image recognition method. .
图4示出了根据本说明书一个实施例提供的一种计算设备400的结构框图。该计算设备400的部件包括但不限于存储器410和处理器420。处理器420与存储器410通过总线430相连接,数据库450用于保存数据。FIG. 4 shows a structural block diagram of a computing device 400 provided according to an embodiment of the present specification. Components of the computing device 400 include, but are not limited to, memory 410 and processor 420 . The processor 420 is connected with the memory 410 through the bus 430, and the database 450 is used for saving data.
计算设备400还包括接入设备440,接入设备440使得计算设备400能够经由一个或多个网络460通信。这些网络的示例包括公用交换电话网(PSTN)、局域网(LAN)、广域网(WAN)、个域网(PAN)或诸如因特网的通信网络的组合。接入设备440可以包括有线或无线的任何类型的网络接口(例如,网络接口卡(NIC))中的一个或多个,诸如IEEE802.11无线局域网(WLAN)无线接口、全球微波互联接入(Wi-MAX)接口、以太网接口、通用串行总线(USB)接口、蜂窝网络接口、蓝牙接口、近场通信(NFC)接口,等等。Computing device 400 also includes access device 440 that enables computing device 400 to communicate via one or more networks 460 . Examples of such networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. Access device 440 may include one or more of any type of network interface (eg, network interface card (NIC)), wired or wireless, such as IEEE 802.11 wireless local area network (WLAN) wireless interface, World Interoperability for Microwave Access ( Wi-MAX) interface, Ethernet interface, Universal Serial Bus (USB) interface, cellular network interface, Bluetooth interface, Near Field Communication (NFC) interface, and the like.
在本说明书的一个实施例中,计算设备400的上述部件以及图4中未示出的其他部件也可以彼此相连接,例如通过总线。应当理解,图4所示的计算设备结构框图仅仅是出于示例的目的,而不是对本说明书范围的限制。本领域技术人员可以根据需要,增添或替换其他部件。In one embodiment of the present specification, the above-described components of computing device 400 and other components not shown in FIG. 4 may also be connected to each other, such as through a bus. It should be understood that the structural block diagram of the computing device shown in FIG. 4 is only for the purpose of example, rather than limiting the scope of this specification. Those skilled in the art can add or replace other components as required.
计算设备400可以是任何类型的静止或移动计算设备,包括移动计算机或移动计算设备(例如,平板计算机、个人数字助理、膝上型计算机、笔记本计算机、上网本等)、移动电话(例如,智能手机)、可佩戴的计算设备(例如,智能手表、智能眼镜等)或其他类型的移动设备,或者诸如台式计算机或PC的静止计算设备。计算设备400还可以是移动式或静止式的服务器。Computing device 400 may be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (eg, tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (eg, smart phones) ), wearable computing devices (eg, smart watches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or PCs. Computing device 400 may also be a mobile or stationary server.
其中,处理器420用于执行如下计算机可执行指令,该计算机可执行指令被处理器420执行时实现上述图片识别方法的步骤。The processor 420 is configured to execute the following computer-executable instructions, and when the computer-executable instructions are executed by the processor 420, implement the steps of the above-mentioned image recognition method.
上述为本实施例的一种计算设备的示意性方案。需要说明的是,该计算设备的技术方案与上述的图片识别方法的技术方案属于同一构思,计算设备的技术方案未详细描述的细节内容,均可以参见上述图片识别方法的技术方案的描述。The above is a schematic solution of a computing device according to this embodiment. It should be noted that the technical solution of the computing device and the technical solution of the above-mentioned image recognition method belong to the same concept, and the details not described in detail in the technical solution of the computing device can be referred to the description of the technical solution of the above-mentioned image recognition method.
本说明书一实施例还提供一种计算机可读存储介质,其存储有计算机可执行指令,该计算机可执行指令被处理器执行时实现上述图片识别方法的步骤。An embodiment of the present specification further provides a computer-readable storage medium, which stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, implements the steps of the above-mentioned image recognition method.
上述为本实施例的一种计算机可读存储介质的示意性方案。需要说明的是,该存储介质的技术方案与上述的图片识别方法的技术方案属于同一构思,存储介质的技术方案未详细描述的细节内容,均可以参见上述图片识别方法的技术方案的描述。The above is a schematic solution of a computer-readable storage medium of this embodiment. It should be noted that the technical solution of the storage medium and the technical solution of the above-mentioned image recognition method belong to the same concept, and the details not described in detail in the technical solution of the storage medium can be referred to the description of the technical solution of the above-mentioned image recognition method.
本说明书一实施例还提供一种计算机程序,其中,当所述计算机程序在计算机中执行时,令计算机执行上述图片识别方法的步骤。An embodiment of the present specification further provides a computer program, wherein, when the computer program is executed in a computer, the computer is made to execute the steps of the above-mentioned image recognition method.
上述为本实施例的一种计算机程序的示意性方案。需要说明的是,该计算机程序的技术方案与上述的图片识别方法的技术方案属于同一构思,计算机程序的技术方案未详细描述的细节内容,均可以参见上述图片识别方法的技术方案的描述。The above is a schematic solution of a computer program of this embodiment. It should be noted that the technical solution of the computer program and the technical solution of the above-mentioned image recognition method belong to the same concept, and the details not described in detail in the technical solution of the computer program can be referred to the description of the technical solution of the above-mentioned image recognition method.
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。The foregoing describes specific embodiments of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that in the embodiments and still achieve desirable results. Additionally, the processes depicted in the figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
所述计算机指令包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述计算机可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读介质不包括电载波信号和电信信号。The computer instructions include computer program code, which may be in source code form, object code form, an executable file, some intermediate form, or the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM, Read-Only Memory) , Random Access Memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable media may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer-readable media Electric carrier signals and telecommunication signals are not included.
需要说明的是,对于前述的各方法实施例,为了简便描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本说明书实施例并不受所描述的动作顺序的限制,因为依据本说明书实施例,某些步骤可以采用其它顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定都是本说明书实施例所必须的。It should be noted that, for the convenience of description, the foregoing method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the embodiments of this specification are not limited by the described action sequences. Limitation, because certain steps may be performed in other orders or simultaneously according to embodiments of the present specification. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily all necessary for the embodiments of the specification.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其它实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
以上公开的本说明书优选实施例只是用于帮助阐述本说明书。可选实施例并没有详尽叙述所有的细节,也不限制该发明仅为所述的具体实施方式。显然,根据本说明书实施例的内容,可作很多的修改和变化。本说明书选取并具体描述这些实施例,是为了更好地解释本说明书实施例的原理和实际应用,从而使所属技术领域技术人员能很好地理解和利用本说明书。本说明书仅受权利要求书及其全部范围和等效物的限制。The preferred embodiments of the present specification disclosed above are provided only to aid in the elaboration of the present specification. Alternative embodiments are not intended to exhaust all details, nor do they limit the invention to only the described embodiments. Obviously, many modifications and changes can be made in accordance with the contents of the embodiments of the present specification. These embodiments are selected and described in this specification to better explain the principles and practical applications of the embodiments of this specification, so that those skilled in the art can well understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202411231742.5ACN119479084A (en) | 2022-02-25 | 2022-02-25 | Image recognition method and device |
| CN202210181146.5ACN114529993B (en) | 2022-02-25 | 2022-02-25 | Image recognition method and device |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210181146.5ACN114529993B (en) | 2022-02-25 | 2022-02-25 | Image recognition method and device |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202411231742.5ADivisionCN119479084A (en) | 2022-02-25 | 2022-02-25 | Image recognition method and device |
| Publication Number | Publication Date |
|---|---|
| CN114529993Atrue CN114529993A (en) | 2022-05-24 |
| CN114529993B CN114529993B (en) | 2024-09-24 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202210181146.5AActiveCN114529993B (en) | 2022-02-25 | 2022-02-25 | Image recognition method and device |
| CN202411231742.5APendingCN119479084A (en) | 2022-02-25 | 2022-02-25 | Image recognition method and device |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202411231742.5APendingCN119479084A (en) | 2022-02-25 | 2022-02-25 | Image recognition method and device |
| Country | Link |
|---|---|
| CN (2) | CN114529993B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CA2995850A1 (en)* | 2015-08-31 | 2017-03-09 | Ryan Kottenstette | Systems and methods for analyzing remote sensing imagery |
| US20190065939A1 (en)* | 2017-08-30 | 2019-02-28 | International Business Machines Corporation | Bayesian network based hybrid machine learning |
| CN110807197A (en)* | 2019-10-31 | 2020-02-18 | 支付宝(杭州)信息技术有限公司 | Training method and device for recognition model and risk website recognition method and device |
| CN111582185A (en)* | 2020-05-11 | 2020-08-25 | 北京百度网讯科技有限公司 | Method and apparatus for recognizing images |
| US20210142046A1 (en)* | 2019-11-13 | 2021-05-13 | Nec Laboratories America, Inc. | Deep face recognition based on clustering over unlabeled face data |
| CN113283388A (en)* | 2021-06-24 | 2021-08-20 | 中国平安人寿保险股份有限公司 | Training method, device and equipment of living human face detection model and storage medium |
| CN113326764A (en)* | 2021-05-27 | 2021-08-31 | 北京百度网讯科技有限公司 | Method and device for training image recognition model and image recognition |
| CN113989549A (en)* | 2021-10-21 | 2022-01-28 | 神思电子技术股份有限公司 | A Pseudo-Label-Based Semi-Supervised Learning Image Classification Optimization Method and System |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CA2995850A1 (en)* | 2015-08-31 | 2017-03-09 | Ryan Kottenstette | Systems and methods for analyzing remote sensing imagery |
| US20190065939A1 (en)* | 2017-08-30 | 2019-02-28 | International Business Machines Corporation | Bayesian network based hybrid machine learning |
| CN110807197A (en)* | 2019-10-31 | 2020-02-18 | 支付宝(杭州)信息技术有限公司 | Training method and device for recognition model and risk website recognition method and device |
| US20210142046A1 (en)* | 2019-11-13 | 2021-05-13 | Nec Laboratories America, Inc. | Deep face recognition based on clustering over unlabeled face data |
| CN111582185A (en)* | 2020-05-11 | 2020-08-25 | 北京百度网讯科技有限公司 | Method and apparatus for recognizing images |
| CN113326764A (en)* | 2021-05-27 | 2021-08-31 | 北京百度网讯科技有限公司 | Method and device for training image recognition model and image recognition |
| CN113283388A (en)* | 2021-06-24 | 2021-08-20 | 中国平安人寿保险股份有限公司 | Training method, device and equipment of living human face detection model and storage medium |
| CN113989549A (en)* | 2021-10-21 | 2022-01-28 | 神思电子技术股份有限公司 | A Pseudo-Label-Based Semi-Supervised Learning Image Classification Optimization Method and System |
| Title |
|---|
| 韩彦岭;赵耀;周汝雁;张云;王静;杨树瑚;洪中华;: "协同主动学习和半监督方法的海冰图像分类", 海洋学报, no. 01, 15 January 2020 (2020-01-15)* |
| Publication number | Publication date |
|---|---|
| CN114529993B (en) | 2024-09-24 |
| CN119479084A (en) | 2025-02-18 |
| Publication | Publication Date | Title |
|---|---|---|
| US11281945B1 (en) | Multimodal dimensional emotion recognition method | |
| CN109003624B (en) | Emotion recognition method, device, computer equipment and storage medium | |
| CN111275107A (en) | Multi-label scene image classification method and device based on transfer learning | |
| CN110502976B (en) | Text recognition model training method and related products | |
| CN112632248B (en) | Question and answer method, device, computer equipment and storage medium | |
| CN116561270A (en) | Question-answering method and question-answering model training method | |
| CN118155199A (en) | Bill identification method, bill identification device, computer equipment and storage medium | |
| JP2023526899A (en) | Methods, devices, media and program products for generating image inpainting models | |
| CN115481246A (en) | Text detection model training method and device | |
| CN117540007A (en) | Multimodal emotion analysis method, system and device based on similar modal completion | |
| CN111126347A (en) | Human eye state recognition method and device, terminal and readable storage medium | |
| CN114078471B (en) | Network model processing method, device, equipment and computer readable storage medium | |
| CN113806574A (en) | Software and hardware integrated artificial intelligent image recognition data processing method | |
| CN114782958A (en) | Text error detection model training method, text error detection method and device | |
| CN118153564B (en) | Script processing method, device, computer equipment, storage medium and program product | |
| CN114491010A (en) | Training method and device for information extraction model | |
| CN114529993A (en) | Picture identification method and device | |
| CN114358313B (en) | Data processing method and device | |
| CN115206296B (en) | Speech recognition method and device | |
| WO2024016945A1 (en) | Training method for image classification model, image classification method, and related device | |
| CN115270968A (en) | Data processing method and device | |
| CN114356860A (en) | Dialog generation method and device | |
| CN114647717A (en) | Intelligent question and answer method and device | |
| CN113934843A (en) | Article classification method and device based on model fusion | |
| CN116912920B (en) | Expression recognition method and device |
| 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 | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |