技术领域Technical Field
本说明书实施例涉及计算机技术领域,特别涉及一种图片识别方法。The embodiments of the present specification relate to the field of computer technology, and in particular to a method for image recognition.
背景技术Background Art
随着计算机技术的不断发展,越来越多的应用场景(比如:涉及金融、保险或者公益等应用场景)需要对用户上传的图片的真实性进行验证,但随着数据拍照技术的提升,许多不法分子通过翻拍图像来验证获取不法收益的手段层出不穷,使得图片验证的过程变得越来越难于核查,导致图片验证的效率较低。With the continuous development of computer technology, more and more application scenarios (such as those involving finance, insurance or public welfare) require verification of the authenticity of pictures uploaded by users. However, with the improvement of data photography technology, many criminals have come up with endless means to obtain illegal profits by reshooting images, making the picture verification process more and more difficult to verify, resulting in low efficiency of picture verification.
发明内容Summary of the invention
有鉴于此,本说明书施例提供了一种图片识别方法。本说明书一个或者多个实施例同时涉及一种图片识别装置,一种计算设备,一种计算机可读存储介质,一种计算机程序,以解决现有技术中存在的技术缺陷。In view of this, the present specification provides an image recognition method. One or more embodiments of the present specification also relate to an image recognition device, a computing device, a computer-readable storage medium, and a computer program to solve the technical defects existing in the prior art.
根据本说明书实施例的第一方面,提供了一种图片识别方法,包括:According to a first aspect of an embodiment of this specification, there is provided a method for image recognition, comprising:
将待识别图片输入预先训练的图片识别模型,其中,所述图片识别模型基于有标签图片样本以及满足预设规则的无标签图片样本训练获得;Inputting the image to be recognized into a pre-trained image recognition model, wherein the image recognition model is trained based on labeled image samples and unlabeled image samples that meet preset rules;
获取所述图片识别模型对所述待识别图片的识别结果,基于所述识别结果确定所述待识别图片是否为风险图片。Obtain a recognition result of the image recognition model on the image to be recognized, and determine whether the image to be recognized is a risky image based on the recognition result.
根据本说明书实施例的第二方面,提供了一种图片识别装置,包括:According to a second aspect of an embodiment of this specification, there is provided an image recognition device, comprising:
输入模块,被配置为将待识别图片输入预先训练的图片识别模型,其中,所述图片识别模型基于有标签图片样本以及满足预设规则的无标签图片样本训练获得;An input module is configured to input the image to be recognized into a pre-trained image recognition model, wherein the image recognition model is trained based on labeled image samples and unlabeled image samples that meet preset rules;
确定模块,被配置为获取所述图片识别模型对所述待识别图片的识别结果,基于所述识别结果确定所述待识别图片是否为风险图片。The determination module is configured to obtain a recognition result of the image recognition model on the image to be recognized, and determine whether the image to be recognized is a risky image based on the recognition result.
根据本说明书实施例的第三方面,提供了一种计算设备,包括:According to a third aspect of an embodiment of this specification, a computing device is provided, including:
存储器和处理器;Memory and processor;
所述存储器用于存储计算机可执行指令,所述处理器用于执行所述计算机可执行指令,该计算机可执行指令被处理器执行时实现所述图片识别方法的步骤。The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. 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 this specification, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the steps of the image recognition method are implemented.
根据本说明书实施例的第五方面,提供了一种计算机程序,其中,当所述计算机程序在计算机中执行时,令计算机执行所述图片识别方法的步骤。According to a fifth aspect of the embodiments of this 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 image recognition method.
本说明书提供的图片识别方法,包括:将待识别图片输入预先训练的图片识别模型,其中,所述图片识别模型基于有标签图片样本以及满足预设规则的无标签图片样本训练获得;获取所述图片识别模型对所述待识别图片的识别结果,基于所述识别结果确定所述待识别图片是否为风险图片。The image recognition method provided in this specification includes: inputting a picture to be recognized into a pre-trained picture recognition model, wherein the picture recognition model is trained based on labeled picture samples and unlabeled picture samples that meet preset rules; obtaining a recognition result of the picture to be recognized by the picture recognition model, and determining whether the picture to be recognized is a risky picture based on the recognition result.
具体地,该方法通过基于有标签图片样本以及满足预设规则的无标签图片样本训练获得的图片识别模型,识别输入的待识别图片是否为风险图片,从而提高了风险图片的识别效率,降低了图片验证过程的难度。Specifically, the method obtains an image recognition model through training based on labeled image samples and unlabeled image samples that meet preset rules to identify whether the input image to be identified is a risky image, thereby improving the recognition efficiency of risky images and reducing the difficulty of the image verification process.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1是本说明书一个实施例提供的一种图片识别方法的流程图;FIG1 is a flow chart of an image recognition method provided by an embodiment of the present specification;
图2是本说明书一个实施例提供的一种图片识别方法中模型训练的过程示意图;FIG2 is a schematic diagram of a model training process in an image recognition method provided by an embodiment of the present specification;
图3是本说明书一个实施例提供的一种图片识别装置的结构示意图;FIG3 is a schematic diagram of the structure of an image recognition device provided by an embodiment of this specification;
图4是本说明书一个实施例提供的一种计算设备的结构框图。FIG. 4 is a structural block diagram of a computing device provided by an embodiment of the present specification.
具体实施方式DETAILED DESCRIPTION
在下面的描述中阐述了很多具体细节以便于充分理解本说明书。但是本说明书能够以很多不同于在此描述的其它方式来实施,本领域技术人员可以在不违背本说明书内涵的情况下做类似推广,因此本说明书不受下面公开的具体实施的限制。Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
在本说明书一个或多个实施例中使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本说明书一个或多个实施例。在本说明书一个或多个实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本说明书一个或多个实施例中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and/or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
应当理解,尽管在本说明书一个或多个实施例中可能采用术语第一、第二等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本说明书一个或多个实施例范围的情况下,第一也可以被称为第二,类似地,第二也可以被称为第一。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
首先,对本说明书一个或多个实施例涉及的名词术语进行解释。First, the terms involved in one or more embodiments of this specification are explained.
半监督学习:使用大量的未标记数据,以及同时使用标记数据,来进行模式识别工作。Semi-supervised learning: Use a large amount of unlabeled data and labeled data at the same time to perform pattern recognition.
难例:模型训练过程中损失最高的样本。Hard examples: Examples 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 made as diverse as possible, making the trained model have stronger generalization capabilities.
随着计算机技术的不断发展,越来越多的应用场景(比如:涉及金融、保险或者公益等应用场景)需要对用户上传的图片的真实性进行验证,但随着数据拍照技术的提升,许多不法分子通过翻拍图像来验证获取不法利益的手段层出不穷,使得图片验证的过程变得越来越难于核查。With the continuous development of computer technology, more and more application scenarios (such as those involving finance, insurance or public welfare) require verification of the authenticity of pictures uploaded by users. However, with the improvement of data photography technology, many criminals have come up with endless means to obtain illegal profits by reshooting images, making the picture verification process more and more difficult to verify.
例如,在公益场景中,为了响应低碳减排的号召,许多机构会针对车辆尾气排放污染严重的问题推出各种低碳减排项目,比如,当用户每周的车辆行驶公里数较低的情况下,就会给予用户一定的奖励,而用户则需要上传手机拍摄的车辆仪表盘图片,用于判断该用户的车辆行驶公里数。For example, in public welfare scenarios, in order to respond to the call for low-carbon emission reduction, many organizations will launch various low-carbon emission reduction projects to address the serious problem of vehicle exhaust emissions pollution. For example, when a user's weekly vehicle mileage is low, the user will be given a certain reward, and the user needs to upload a picture of the vehicle dashboard taken with a mobile phone to determine the user's vehicle mileage.
但在此过程中,一些用户会通过拍摄手机/电脑上的图片来冒充真实的仪表盘图片,也即是“翻拍”。因此,许多机构在接收到用户上传的手机拍摄的仪表盘图片时,需要判断该仪表盘图片是否为翻拍图片,从而确定该用户是否存在作弊行为。However, during this process, some users will take pictures on their mobile phones or computers to impersonate real dashboard pictures, which is also called "re-shooting". Therefore, when many institutions receive dashboard pictures uploaded by users, they need to determine whether the dashboard pictures are re-shot pictures, so as to determine whether the user has cheated.
或者,在金融场景下,金融机构需要通过证件图片识别、人脸图像识别等方式对用户身份进行验证,从而避免非法分子通过伪装身份进行非法金融活动。Alternatively, in a financial scenario, financial institutions need to verify user identities through methods such as ID image recognition and facial image recognition, so as to prevent criminals from engaging in illegal financial activities by disguising their identities.
基于此,在本说明书中,提供了一种图片识别方法,本说明书同时涉及一种图片识别装置,一种计算设备,一种计算机可读存储介质以及一种计算机程序,在下面的实施例中逐一进行详细说明。Based on this, in this specification, a picture recognition method is provided. This specification also involves a picture recognition device, a computing device, a computer-readable storage medium and a computer program, which are described in detail one by one in the following embodiments.
图1示出了根据本说明书一个实施例提供的一种图片识别方法的流程图,具体包括以下步骤。FIG1 shows a flow chart 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 trained based on labeled image samples and unlabeled image samples that meet preset rules.
其中,该待识别图片可以理解为需要识别是否具有风险的图片;例如,用户的人脸图像、用户的证件图片、用户车辆的仪表盘图片等。The image to be identified may be understood as an image that needs to be identified as to whether it is risky; for example, a user's face image, a user's ID image, a user's vehicle dashboard image, and the like.
该图片识别模型可以理解为能够识别出该图片是否具有风险的模型;在实际应用中,该图片识别模型可以理解为任意一种能够对图片进行识别或检测的模型,本说明书对此不做具体限制。例如,该图片识别模型可以为MobileNet V2(一种轻量级卷积神经网络)、CNN(卷积神经网络)模型等。相应地,该有标签图片样本可以理解为用于对图片识别模型进行训练、且具有样本标签的样本。该无标签图片样本可以理解为用于对图片识别模型进行训练、但不具有样本标签的样本。The image recognition model can be understood as a model that can identify whether the image is risky; in practical applications, the image recognition model can be understood as any model that can identify or detect images, and this specification does not impose specific restrictions on this. For example, the image recognition model can be a MobileNet V2 (a lightweight convolutional neural network), a CNN (convolutional neural network) model, etc. Correspondingly, the labeled image sample can be understood as a sample that is used to train the image recognition model and has a sample label. The unlabeled image sample can be understood as a sample that is used to train the image recognition model but does not have a sample label.
在实际应用中,本说明书提供的图片识别方法应用的场景不同,该待识别图片也不同;例如,在图片识别方法应用的金融场景的情况下,该待识别图片可以为用户的证件图片、用户的纸质文件图片等;相应的,图片识别模型可以理解为能够检测证件图片或纸质文件图片的真实性的模型,也即是检测证件图片或纸质文件图片是否为翻拍图片的模型。In actual applications, the image recognition method provided in this specification is applied in different scenarios, and the image to be recognized is also different; for example, in the case of a financial scenario in which the image recognition method is applied, the image to be recognized can be a user's ID image, a user's paper document image, etc.; accordingly, the image recognition model can be understood as a model that can detect the authenticity of an ID image or a paper document image, that is, a model that detects whether an ID image or a paper document image is a copied image.
或者,在图片识别方法应用的安保场景的情况下,该待识别图片可以为用户的证件图片、用户的人脸图像等;相应的,图片识别模型可以理解为能够检测证件图片或人脸图像的真实性的模型,也即是检测证件图片或人脸图像是否为翻拍图片的模型。Alternatively, in the case of a security scenario where the image recognition method is applied, the image to be identified may be a user's ID image, a user's face image, etc.; accordingly, the image recognition model can be understood as a model that can detect the authenticity of an ID image or a face image, that is, a model that detects whether the ID image or the face image is a copied image.
或者,在图片识别方法应用的低碳减排项目场景的情况下,该待识别图片可以为用户车辆的仪表盘图片等;相应的,图片识别模型可以理解为能够检测仪表盘图片的真实性的模型,也即是检测该仪表盘图片是否为翻拍图片的模型。Alternatively, in the case of a low-carbon emission reduction project scenario where the image recognition method is applied, the image to be identified may be a dashboard image of a user's vehicle, etc.; accordingly, the image recognition model can be understood as a model that can detect the authenticity of the dashboard image, that is, a model that detects whether the dashboard image is a copied image.
对应的,在图片识别模型不同的情况下,针对该图片识别模型进行训练的有标签图片样本和无标签图片样本也不同,例如,该有标签图片样本可以为具有样本标签的证件图片样本、具有样本标签的人脸图像样本或具有样本标签的仪表盘图片样本。该有标签图片样本可以为包含不具有样本标签的证件图片的样本、包含不具有样本标签的人脸图像的样本或包含不具有样本标签的仪表盘图片的样本。Correspondingly, in the case of different image recognition models, the labeled image samples and unlabeled image samples for training the image recognition models are also different. For example, the labeled image samples may be ID image samples with sample labels, face image samples with sample labels, or dashboard image samples with sample labels. The labeled image samples may be samples containing ID images without sample labels, samples containing face images without sample labels, or samples containing dashboard images without sample labels.
具体地,本说明书提供的图片识别方法,能够将需要进行风险识别的待识别图片,输入至通过有标签图片样本以及满足预设规则的无标签图片样本训练获得的图片识别模型中。Specifically, the image recognition method provided in this specification can input the to-be-recognized images that require risk identification into an image recognition model obtained by training with labeled image samples and unlabeled image samples that meet preset rules.
在实际应用中,该预设规则可以根据实际应用场景进行设置,本说明书对此不做具体限制。例如,预设规则可以为通过半监督方法,对伪标签样本中的难例进行挖掘,并基于该难例确定更有价值的样本。从而将该更有价值的样本加入到对图片识别模型的训练中,提高图片识别模型的性能和训练效率。In practical applications, the preset rules can be set according to the actual application scenario, and this specification does not impose specific restrictions on this. For example, the preset rules can be to mine difficult examples in pseudo-label samples through a semi-supervised method, and determine more valuable samples based on the difficult examples. Thereby, the more valuable samples are added to the training of the image recognition model to improve the performance and training efficiency of the image recognition model.
下面以本说明书提供的图片识别方法在检测仪表盘图片是否为翻拍图片的场景下,对将待识别图片输入预先训练的图片识别模型做进一步说明,其中,该待识别图片为用户车辆的仪表盘图片,图片识别模型可以理解为能够识别出仪表盘图片是否为翻拍图片的图片识别模型,基于此,本说明书提供的图片识别方法,能够将用户车辆的仪表盘图片,输入至能够识别出仪表盘图片是否为翻拍图片的图片识别模型中。The following is a further explanation of the image recognition method provided in this specification for inputting the image to be recognized into a pre-trained image recognition model in the scenario of detecting whether a dashboard image is a copied image, wherein the image to be recognized is a dashboard image of the user's vehicle, and the image recognition model can be understood as an image recognition model that can recognize whether the dashboard image is a copied image. Based on this, the image recognition method provided in this specification can input the dashboard image of the user's vehicle into the image recognition model that can recognize whether the dashboard image is a copied image.
在本说明书提供的一实施例中,在将该待识别图片输入图片识别模型之前,还需要对该图片识别模型进行训练。因此,在本说明书提供了两种针对该图片识别模型的方案,第一种方案是通过人工标注有限的样本数据训练卷积神经网络,从而实现对翻拍图片的识别。但是,该方案具有两方面的缺点,第一方面是,样本数据量很大,导致人工标注成本非常高,且标注时间很长;并且还会造成模型迭代效率低下。第二方面是,在有限的人力下标注的资源少,导致模型泛化性不佳。In one embodiment provided in this specification, before the image to be identified is input into the image recognition model, the image recognition model needs to be trained. Therefore, two solutions for the image recognition model are provided in this specification. The first solution is to train a convolutional neural network by manually annotating limited sample data, so as to realize the recognition of reproduced images. However, this solution has two disadvantages. The first is that the amount of sample data is very large, resulting in very high manual annotation costs and a long annotation time; and it also causes low model iteration efficiency. The second aspect is that the number of labeled resources is small under limited manpower, resulting in poor generalization of the model.
第二种方案是,通过半监督学习的方案做多次数据增广,并通过取均值将样本数据打上伪标签,并将伪标签样本加入针对模型的训练。但是,该方案同样具有两方面的缺点,第一方面是,均值中可能存在异常小的值,会导致很多有用样本无法加入训练,进一步导致半监督学习带来的性能增益降低。第二方面是,未通过半监督方法针对难例进行挖掘,并未把更有价值的样本加入训练中。The second solution is to perform multiple data augmentations through semi-supervised learning, and then add pseudo-labels to the sample data by taking the mean, and then add the pseudo-labeled samples to the training of the model. However, this solution also has two disadvantages. The first is that there may be abnormally small values in the mean, which will cause many useful samples to be unable to be added to the training, further reducing the performance gain brought by semi-supervised learning. The second 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 images are subjected to multiple data augmentation in the pseudo-label stage, the samples with the maximum scores are used as samples added to the training, thereby improving the utilization rate of the unlabeled samples. In addition, by introducing the similarity comparison method to mine difficult examples in the training method of semi-supervised learning, more valuable unlabeled samples are added to the training, which also greatly improves the utilization rate of the unlabeled samples. Based on this, in the image recognition method provided in this specification, the training steps of the image recognition model include steps one to four.
步骤一:基于所述有标签图片样本训练获得初始图片识别模型。Step 1: Obtain an initial image recognition model based on the labeled image sample training.
其中,该初始图片识别模型可以理解为通过有标签图片样本训练获得的模型。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 labeled image samples, thereby obtaining a trained initial image recognition model. The operation of obtaining the initial image recognition model based on labeled image samples can be implemented by any method of training the model based on labeled image samples, and this specification does not impose any specific restrictions on this.
沿用上例,该有标签图片样本可以为包含样本标签的仪表盘图片样本,基于此,本说明书提供的图片识别方法,能够确定出包含样本标签的仪表盘图片样本,将该仪表盘图片样本输入至待训练的图片识别模型中,获得该仪表盘图片样本的识别结果,基于该识别结果以及仪表盘图片样本的样本标签确定损失值,基于该损失值对该待训练的图片识别模型进行调参,使得该图片识别模型达到收敛,从而获得训练完成的初始图片识别模型。Continuing with the above example, the labeled image sample can be a dashboard image sample containing a sample label. Based on this, the image recognition method provided in this specification can determine the dashboard image sample containing the sample label, input the dashboard image sample into the image recognition model to be trained, obtain the recognition result of the dashboard image sample, determine the loss value based on the recognition result and the sample label of the dashboard image sample, and adjust the parameters of the image recognition model to be trained based on the loss value so that the image recognition model converges, thereby obtaining the trained initial image recognition model.
步骤二:基于所述初始图片识别模型,从无标签图片样本中确定第一伪标签样本和第二伪标签样本。Step 2: Based on the initial image recognition model, determine a first pseudo-label sample and a second pseudo-label sample from the unlabeled image samples.
其中,第一伪标签样本可以理解为无标签图片样本中被打上伪标签的图片样本,即伪标签图片样本;该第二伪标签样本理解为无标签图片样本中没有被打上伪标签的图片样本,也即是无标签图片样本中除伪标签图片样本之外的图片样本。Among them, the first pseudo-label sample can be understood as the image sample with a pseudo-label in the unlabeled image sample, that is, the pseudo-label image sample; the second pseudo-label sample is understood as the image sample without a pseudo-label in the unlabeled image sample, that is, the image sample in the unlabeled image sample except the pseudo-label image sample.
具体的,在基于有标签图片样本训练获得初始图片识别模型之后,能够基于该初始识别模型,从而该无标签图片样本中确定出第一伪标签样本和第二为标签样本。Specifically, after an initial image recognition model is obtained based on labeled image samples training, a first pseudo-label sample and a second labeled sample can be determined from the unlabeled image samples based on the initial recognition model.
沿用上例,将该无标签仪表盘图片样本输入至训练获得的初始图片识别模型中,基于该初始图片识别模型对该无标签仪表盘图片样本进行识别,获得该无标签仪表盘图片样本的识别结果,其中,该识别结果可以为表示该无标签仪表盘图片样本是否为翻拍图片的预测得分,比如[0,1]区间内任意的数值。Continuing with the above example, the unlabeled dashboard image sample is input into the trained initial image recognition model, and the unlabeled dashboard image sample is recognized based on the initial image recognition model to obtain a recognition result of the unlabeled dashboard image sample, wherein the recognition result can be a prediction score indicating whether the unlabeled dashboard image sample is a reshot image, such as any value in the interval [0,1].
在确定无标签仪表盘图片样本的识别结果之后,确定该无标签仪表盘图片样本的识别结果是否大于等于预设得分阈值,若是,则确定该无标签仪表盘图片可能是翻拍图片,因此将该无标签仪表盘图片样本打上“翻拍仪表盘图片”的样本伪标签。若否,则确定该无标签仪表盘图片可能是真实的无标签仪表盘图片,并不是翻拍图片,因此,不对该无标签仪表盘图片样本打上标签。比如,无标签仪表盘图片样本中的图片样本A的预测得分为0.3、图片样本B的预测得分为0.6,预设得分阈值为0.5分。基于此,该图片样本A不会打上伪标签,该图片样本B则会被打上伪标签。其中,该预设得分阈值可以根据实际应用场景进行设置,本说明书对此不做具体限制。After determining the recognition result of the unlabeled dashboard picture sample, determine whether the recognition result of the unlabeled dashboard picture sample is greater than or equal to the preset score threshold. If so, it is determined that the unlabeled dashboard picture may be a reshot picture, so the unlabeled dashboard picture sample is marked with a sample pseudo-label of "reshot dashboard picture". If not, it is determined that the unlabeled dashboard picture may be a real unlabeled dashboard picture, not a reshot picture, so the unlabeled dashboard picture sample is not marked with a label. For example, the predicted score of picture sample A in the unlabeled dashboard picture sample is 0.3, and 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 marked with a pseudo-label, and the picture sample B will be marked with a pseudo-label. Among them, the preset score threshold can be set according to the actual application scenario, and this manual does not make specific restrictions on this.
在本说明书提供的实施例中,在从无标签图片样本中确定第一伪标签样本和第二伪标签样本的过程中,还可以对无标签图片样本进行数据增广,基于数据增广后获得的图片样本和无标签图片样本,确定第一伪标签样本和第二伪标签样本,从而提高了第一伪标签样本和第二伪标签样本的准确度。基于此,所述基于所述初始图片识别模型,从无标签图片样本中确定第一伪标签样本和第二伪标签样本,包括:In the embodiment provided in this specification, in the process of determining the first pseudo-label sample and the second pseudo-label sample from the unlabeled picture sample, data augmentation can also be performed on the unlabeled picture sample, and the first pseudo-label sample and the second pseudo-label sample are determined based on the picture sample and the unlabeled picture sample obtained after the data augmentation, thereby improving the accuracy of the first pseudo-label sample and the second pseudo-label sample. Based on this, the method of determining the first pseudo-label sample and the second pseudo-label sample from the unlabeled picture sample based on the initial picture recognition model includes:
基于无标签图片样本确定与所述无标签图片样本相关联的待处理图片样本;Determine, based on the unlabeled picture sample, a to-be-processed picture sample associated with the unlabeled picture sample;
将所述无标签图片样本以及相关联的待处理图片样本输入所述初始图片识别模型,获得所述无标签图片样本的第一识别结果,以及所述待处理图片样本的第二识别结果;Inputting the unlabeled image sample and the associated to-be-processed image sample into the initial image recognition model to obtain a first recognition result of the unlabeled image sample and a second recognition result of the to-be-processed image 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 image samples.
其中,待处理图片样本可以理解为对无标签样本进行数据增广后获得的图片样本。无标签图片样本的第一识别结果,可以理解为初始图片识别模型对该无标签图片样本进行识别后输出的预测得分,例如[0,1]区间内任意的数值。相应地,待处理图片样本的第二识别结果,可以理解为初始图片识别模型对该待处理图片样本进行识别后输出的预测得分,例如[0,1]区间内任意的数值。Among them, the image sample to be processed can be understood as the image sample obtained after data augmentation of the unlabeled sample. The first recognition result of the unlabeled image sample can be understood as the prediction score output by the initial image recognition model after recognizing the unlabeled image sample, such as any value in the interval [0,1]. Correspondingly, the second recognition result of the image sample to be processed can be understood as the prediction score output by the initial image recognition model after recognizing the image sample to be processed, such as any value in the interval [0,1].
该无标签图片样本为可以多个,对应的,与该无标签图片样本相关联的待处理图片样本,可以理解为与每个无标签图片样本对应的待处理图片样本。进一步地,与每个无标签图片样本对应的待处理图片样本,也可以为多个,也即是,每个无标签图片样本可以对应的多个待处理图片样本。The unlabeled image sample can be multiple, and the corresponding to-be-processed image sample associated with the unlabeled image sample can be understood as the to-be-processed image sample corresponding to each unlabeled image sample. Further, the to-be-processed image sample corresponding to each unlabeled image sample can also be multiple, that is, each unlabeled image sample can correspond to multiple to-be-processed image samples.
具体地,在基于有标签图片样本训练获得初始图片识别模型之后,能够确定出对该初始图片识别模型进行训练的无标签图片样本。并通过对该无标签图片样本进行数据增广处理,获得与该无标签图片样本相关联的待处理图片样本。并将该无标签图片样本,以及与无标签图片样本相关联的待处理图片样本,输入至初始图片识别模型,从而获得无标签图片样本的第一识别结果,以及待处理图片样本的第二识别结果。并基于该第一识别结果以及第二识别结果,从无标签图片样本中确定第一伪标签样本和第二伪标签样本。Specifically, after obtaining an initial image recognition model based on labeled image sample training, it is possible to determine an unlabeled image sample for training the initial image recognition model. And by performing data augmentation processing on the unlabeled image sample, a to-be-processed image sample associated with the unlabeled image sample is obtained. And the unlabeled image sample and the to-be-processed image sample associated with the unlabeled image sample are input into the initial image recognition model, thereby obtaining a first recognition result of the unlabeled image sample and a second recognition result of the to-be-processed image sample. And 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 image sample.
沿用上例,在基于有标签仪表盘图片样本训练获得初始图片识别模型之后,能够确定出对该初始图片识别模型进行训练的无标签的仪表盘图片样本A(简称图片样本A)和无标签的仪表盘图片样本B(简称图片样本B),并对图片样本A,和图片样本B进行数据增广处理,从而获得与图片样本A相关的增广图片样本A1和增广图片样本A2,以及与图片样本B相关的增广图片样本B1和增广图片样本B2。Continuing with the above example, after the initial image recognition model is obtained based on the labeled dashboard image sample training, the unlabeled dashboard image sample A (referred to as image sample A) and the unlabeled dashboard image sample B (referred to as image sample B) for training the initial image recognition model can be determined, and image sample A and image sample B are subjected to data augmentation processing to obtain augmented image sample A1 and augmented image sample A2 related to image sample A, and augmented image sample B1 and augmented image sample B2 related to image 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分。The picture sample A, augmented picture sample A1 and augmented picture sample A2, as well as picture sample B, augmented picture sample B1 and augmented picture sample B2 are input into the initial picture recognition model to obtain the prediction score of each picture sample, for example, picture sample A is 0.1 point, augmented picture sample A1 is 0.2 point, augmented picture sample A2 is 0.3 point, picture sample B is 0.4 point, augmented picture sample B1 is 0.5 point, and augmented picture sample B2 is 0.6 point.
基于每个无标签的仪表盘图片样本的预测得分,以及每个增广图片样本的预测得分,从无标签的仪表盘图片样本中,确定出被打上伪标签的仪表盘图片样本,以及未被打上伪标签的仪表盘图片样本。Based on the prediction score of each unlabeled dashboard image sample and the prediction score of each augmented image sample, dashboard image samples with pseudo labels and dashboard image samples without pseudo labels are determined from the unlabeled dashboard image samples.
需要说明的是,本说明书实施例中,仅以无标签图片样本的数量为两个,且与每个无标签图片样本对应的待处理图片样本的数量为两个进行举例说明,该无标签图片样本的数量和待处理图片样本的数量可以根据实际应用场景进行设置,本说明书对此不做具体限定。It should be noted that in the embodiments of this specification, only the number of unlabeled image samples is two, and the number of to-be-processed image samples corresponding to each unlabeled image sample is two for illustration. The number of unlabeled image samples and the number of to-be-processed image samples can be set according to the actual application scenario, and this specification does not make any specific limitations on this.
进一步的,所述基于所述第一识别结果以及所述第二识别结果,从所述无标签图片样本中确定第一伪标签样本和第二伪标签样本,包括:Furthermore, the determining a first pseudo-label sample and a second pseudo-label sample from the unlabeled image sample based on the first recognition result and the second recognition result includes:
基于所述无标签图片样本的第一识别结果,以及与所述无标签图片样本相关联的待处理图片样本的第二识别结果,确定所述无标签图片样本对应的目标识别结果;Determine a target recognition result corresponding to the unlabeled image sample based on the first recognition result of the unlabeled image sample and the second recognition result of the to-be-processed image sample associated with the unlabeled image sample;
判断所述无标签图片样本对应的目标识别结果是否大于等于预设结果阈值,Determine whether the target recognition result corresponding to the unlabeled image sample is greater than or equal to a preset result threshold,
若是,则将所述无标签图片样本确定为第一伪标签样本,If yes, the unlabeled image sample is determined as the first pseudo-labeled sample.
若否,则将所述无标签图片样本确定为第二伪标签样本。If not, the unlabeled image sample is determined as a second pseudo-labeled sample.
其中,预设结果阈值可以根据实际应用场景进行设置,本说明书对此不做具体限定。例如,该预设结果阈值可以为0.5分。The preset result threshold can be set according to the actual application scenario, and this specification does not specifically limit this. For example, the preset result threshold can be 0.5 points.
具体地,在确定出无标签图片样本的第一识别结果,以及与该无标签图片样本相关联的待处理图片样本的第二识别结果之后,能够从第一识别结果和第二识别结果确定出最大识别结果,并将该最大识别结果作为该无标签图片样本对应的目标识别结果。之后,判断该无标签图片样本对应的目标识别结果是否大于等于预设结果阈值,若是,则将该无标签图片样本确定为第一伪标签样本,若否,则将该无标签图片样本确定为第二伪标签样本。Specifically, after determining the first recognition result of the unlabeled image sample and the second recognition result of the image sample to be processed associated with the unlabeled image sample, the maximum recognition result can be determined from the first recognition result and the second recognition result, and the maximum recognition result is used as the target recognition result corresponding to the unlabeled image sample. Afterwards, it is determined whether the target recognition result corresponding to the unlabeled image sample is greater than or equal to a preset result threshold. If so, the unlabeled image sample is determined as a first pseudo-label sample, and if not, the unlabeled image sample is determined as a 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的目标预测得分。Continuing with the above example, the preset result threshold can be 0.5 points. Based on this, after determining the prediction score of each unlabeled dashboard image sample and the prediction score of each augmented image sample, the maximum prediction score can be determined from the prediction score of each unlabeled dashboard image sample and the prediction score of the augmented image sample corresponding to each unlabeled dashboard image sample, and the maximum prediction score is used as the target prediction score of the unlabeled dashboard image sample. For example, image sample A is 0.1 points, the augmented image sample A1 corresponding to the image sample A is 0.2 points, and the augmented image sample A2 is 0.3 points. Therefore, the maximum prediction score of 0.3 points is used as the target prediction score of image sample A; image sample B is 0.4 points, the augmented image sample B1 corresponding to the image sample B is 0.5 points, and the augmented image sample B2 is 0.6 points. Therefore, the maximum prediction score of 0.6 points is used as the target prediction score of image sample B.
之后判断图片样本A和图片样本B的目标预测得分是否大于等于0.5分,若是,则将该无标签的仪表盘图片样本打上伪标签,因此,将该图片样本B打上伪标签,从而获得伪标签仪表盘图片样本。若否,则不将该无标签的仪表盘图片样本打上伪标签,因此,不会将图片样本A打上伪标签,从而确定后该图片样本A为无标签的仪表盘图片样本。Then, it is determined whether the target prediction scores of the image sample A and the image sample B are greater than or equal to 0.5 points. If so, the unlabeled dashboard image sample is pseudo-labeled, and thus the image sample B is pseudo-labeled to obtain the pseudo-labeled dashboard image sample. If not, the unlabeled dashboard image sample is not pseudo-labeled, and thus the image sample A is not pseudo-labeled, and it is determined that the image sample A is an unlabeled dashboard image sample.
本说明书实施例中,在伪标签阶段通过对无标签图片样本经过多次样本数据增广后,将样本数据中得分取最大值的样本数据,作为加入训练的样本(伪标签样本),提高了无标签样本的利用率。In the embodiments of the present specification, after multiple sample data augmentation of unlabeled image samples in the pseudo-label stage, the sample data with the maximum score in the sample data is used as the sample added to the training (pseudo-label sample), thereby improving the utilization rate of the unlabeled samples.
步骤三:基于预设确定规则从所述第一伪标签样本中确定第三伪标签样本,并基于所述第三伪标签样本从所述第二伪标签样本中确定第四伪标签样本。Step three: determining a third pseudo-label sample from the first pseudo-label samples based on a preset determination rule, and determining a fourth pseudo-label sample from the second pseudo-label samples based on the third pseudo-label sample.
其中,预设确定规则可以根据实际应用场景进行设置,本说明书对此不做具体设置,例如,该预设确定规则可以为将特定数量的,且识别结果最接近预设结果阈值的第一伪标签样本确定为第三伪标签样本。Among them, the preset determination rule can be set according to the actual application scenario, and this specification does not make specific settings for this. For example, the preset determination rule can be to determine a specific number of first pseudo-label samples whose recognition results are closest to the preset result threshold as the third pseudo-label samples.
该第三伪标签样本可以理解为该第一伪标签样本中的难例样本。相应地,第四伪标签样本可以理解为第二伪标签样本中的难例样本。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 a third pseudo-label sample from the first pseudo-label sample based on the preset determination rule, and determine a fourth pseudo-label sample from the second pseudo-label sample based on the third pseudo-label sample.
在本说明书提供的一实施例中,所述基于预设确定规则从所述第一伪标签样本中确定第三伪标签样本,包括: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:
确定所述第一伪标签样本对应的目标识别结果;Determine a 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 to obtain a sample sorting result of the first pseudo-label samples;
按照从上到下从所述第一伪标签样本的样本排序结果中,获取第一预设数量的第一伪标签样本,并将所述第一预设数量的第一伪标签样本作为第三伪标签样本。A first preset number of first pseudo-label samples are obtained from the sample sorting results of the first pseudo-label samples from top to bottom, and the first preset number of first pseudo-label samples are used as third pseudo-label samples.
其中,第一预设数量可以根据实际应用场景进行设置,本说明书对此不做具体设置,例如,该第一预设数量可以为100个、1000个。The first preset number may be set according to the actual application scenario, and this specification does not make specific settings for this. For example, the first preset number may be 100 or 1000.
具体地,在从无标签图片样本中确定出第一伪标签样本之后,能够确定出该第一伪标签样本所对应的目标识别结果,并基于该目标识别结果对该第一伪标签样本进行升序排序,从而获得该第一伪标签样本的样本排序结果,之后按照从上到下的方式从该样本排序结果中获取第一预设数量的第一伪标签样本,并将该第一预设数量的第一伪标签样本作为第三伪标签样本。Specifically, after determining the first pseudo-label sample from the unlabeled image 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 to obtain a sample sorting result of the first pseudo-label sample, and then a first preset number of first pseudo-label samples are obtained from the sample sorting result in a top-down manner, and the first preset number of first pseudo-label samples are used as the third pseudo-label samples.
沿用上例,其中,该第一预设数量可以为100个,基于此,在从无标签的仪表盘图片样本中确定出伪标签仪表盘图片样本之后,能够将该确定出每个伪标签仪表盘图片样本对应的目标预测得分,并基于该目标预测得分对伪标签仪表盘图片样本进行升序排序,从而获得该伪标签仪表盘图片样本的样本排序结果,并按照从上到下的方式从样本排序结果中选择前100个伪标签仪表盘图片样本,并将该前100个伪标签仪表盘图片样本作为伪标签仪表盘图片样本中的难例样本。Continuing with the above example, the first preset number can be 100. Based on this, after the pseudo-label dashboard image samples are determined from the unlabeled dashboard image samples, the target prediction score corresponding to each pseudo-label dashboard image sample can be determined, and the pseudo-label dashboard image samples can be sorted in ascending order based on the target prediction score to obtain the sample sorting result of the pseudo-label dashboard image samples, and the first 100 pseudo-label dashboard image samples are selected from the sample sorting results in a top-down manner, 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 labeled image samples, and the specific implementation method is as follows.
所述基于有标签图片样本训练获得初始图片识别模型之后,还包括:After the initial image recognition model is obtained through training based on labeled image samples, the method further includes:
确定所述有标签图片样本对应的样本识别结果,其中,所述样本识别结果为基于所述有标签图片样本训练获得所述初始图片识别模型的过程中确定的识别结果;Determine a sample recognition result corresponding to the labeled image sample, wherein the sample recognition result is a recognition result determined in a process of obtaining the initial image recognition model based on the labeled image sample training;
基于所述样本识别结果对所述有标签图片样本进行升序排序,获得所述有标签图片样本的样本排序结果;Sort the labeled image samples in ascending order based on the sample recognition result to obtain a sample sorting result of the labeled image 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 third pseudo-label samples.
其中,有标签图片样本对应的样本识别结果,可以理解为在通过有标签图片样本训练获得初始图片识别模型的过程中,图片识别模型为有标签图片样本确定出预测得分。在实际应用中,该有标签图片样本可以分为训练有标签图片样本以及测试有标签图片样本,因此,该有标签图片样本对应的样本识别结果,可以理解为该训练有标签图片样本对应的预测得分,和/或该测试有标签图片样本对应的预测得分。Among them, the sample recognition result corresponding to the labeled image sample can be understood as the prediction score determined by the image recognition model for the labeled image sample in the process of obtaining the initial image recognition model through training with the labeled image sample. In practical applications, the labeled image sample can be divided into training labeled image samples and testing labeled image samples. Therefore, the sample recognition result corresponding to the labeled image sample can be understood as the prediction score corresponding to the training labeled image sample and/or the prediction score corresponding to the testing labeled image sample.
第二预设数量可以根据实际应用场景进行设置,本说明书对此不做具体设置,例如,该第二预设数量可以为100个、1000个。The second preset number can be set according to the actual application scenario, and this specification does not make specific settings for this. For example, the second preset number can be 100 or 1000.
具体地,在训练获得初始图片识别模型之后,能够确定出该有标签图片样本对应的样本识别结果,基于该样本识别结果对有标签图片样本进行升序排序,从而获得有标签图片样本对应的样本排序结果;并按照从上到下从该有标签图片样本的样本排序结果中,获取第二预设数量的有标签图片样本,例如该第二预设数量为100个,且将该100个有标签图片样本作为第三伪标签样本。Specifically, after training to obtain the initial image recognition model, 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 to obtain the sample sorting result corresponding to the labeled image sample; and from the sample sorting results of the labeled image sample from top to bottom, a second preset number of labeled image samples is obtained, for example, the second preset number is 100, and the 100 labeled image samples are used as third pseudo-label samples.
在本说明书提供的一实施例中,所述基于所述第三伪标签样本从所述第二伪标签样本中确定第四伪标签样本,包括: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:
基于所述初始图片识别模型确定所述第三伪标签样本的样本特征,以及所述第二伪标签样本的样本特征;Determining sample features of the third pseudo-label sample and sample features of the second pseudo-label sample based on the initial image 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 can be understood as a value representing the similarity between the sample features of the third pseudo-label sample and the sample features of the second pseudo-label sample, for example, any value in the interval [0,10].
具体地,在确定出第三伪标签样本之后,能够通过将该第三伪标签样本输入至初始图片识别模型中,基于初始图片识别模型确定该第三伪标签样本的样本特征,以及将该第二伪标签样本输入至初始图片识别模型中,基于初始图片识别模型确定该第二伪标签样本的样本特征。Specifically, after determining the third pseudo-label sample, the third pseudo-label sample can be input into the initial image recognition model to determine the sample characteristics of the third pseudo-label sample based on the initial image recognition model, and the second pseudo-label sample can be input into the initial image recognition model to determine the sample characteristics of the second pseudo-label sample based on the initial image 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. The operation of determining the similarity between the sample feature of the third pseudo-label sample and the sample feature of the second pseudo-label sample can be implemented by any method of calculating the similarity between sample features, and this specification does not make specific restrictions here. For example, the similarity can be determined by a similarity determination algorithm, or by a computer program.
本说明书提供的一实施例中,在通过初始图片识别模型确定样本特征的过程中,可以通过该初始图片识别模型中用于进行特征提取的模块,实现确定第三伪标签样本的样本特征以及第二伪标签样本的样本特征的操作。具体实现方式如下。In one embodiment provided in this specification, in the process of determining sample features through the initial image recognition model, the sample features of the third pseudo-label sample and the sample features of the second pseudo-label sample can be determined through the module for feature extraction in the initial image recognition model. The specific implementation method is as follows.
所述基于所述初始图片识别模型确定所述第三伪标签样本的样本特征,以及所述第二伪标签样本的样本特征,包括:The determining, based on the initial image recognition model, the sample features of the third pseudo-label sample and the sample features of the second pseudo-label sample includes:
将所述第三伪标签样本输入所述初始图片识别模型,基于所述初始图片识别模型中的特征提取模块确定所述第三伪标签样本的样本特征;Inputting the third pseudo-label sample into the initial image recognition model, and determining a sample feature of the third pseudo-label sample based on a feature extraction module in the initial image recognition model;
将所述第二伪标签样本输入所述初始图片识别模型,基于所述初始图片识别模型中的特征提取模块确定所述第二伪标签样本的样本特征。The second pseudo-label sample is input into the initial image recognition model, and a sample feature of the second pseudo-label sample is determined based on a feature extraction module in the initial image recognition model.
其中,该特征提取模块可以理解为该初始图片识别模型中用于进行特征提取的模块,例如,模型中用于进行图片特征提取的网络层。Among them, the feature extraction module can be understood as a module used for feature extraction in the initial image recognition model, for example, a network layer in the model used for image feature extraction.
沿用上例,该特征提取模块为初始图片识别模型中用于进行特征提取的特征提取层。基于此,将该伪标签仪表盘图片样本中的样本难例输入至初始图片识别模型中,基于该初始图片识别模型中的特征提取层对该样本难例进行特征提取处理,从而获得该样本难例的样本特征。并且,将无标签仪表盘图片样本中没有被打上伪标签的仪表盘图片样本,输入至该始图片识别模型中,基于该初始图片识别模型中的特征提取层,对该没有被打上伪标签的仪表盘图片样本进行特征提取处理,从而获得该没有被打上伪标签的仪表盘图片样本所对应的样本特征。Continuing with the above example, the feature extraction module is a feature extraction layer used for feature extraction in the initial image recognition model. Based on this, the sample difficulty example in the pseudo-labeled dashboard image sample is input into the initial image recognition model, and the sample difficulty example is subjected to feature extraction processing based on the feature extraction layer in the initial image recognition model, thereby obtaining the sample feature of the sample difficulty example. In addition, the dashboard image sample that is not pseudo-labeled in the unlabeled dashboard image sample is input into the initial image recognition model, and the dashboard image sample that is not pseudo-labeled is subjected to feature extraction processing based on the feature extraction layer in the initial image recognition model, thereby obtaining the sample feature corresponding to the dashboard image sample that is not pseudo-labeled.
之后确定出每个样本难例的样本特征,与该没有被打上伪标签的仪表盘图片样本所对应的样本特征之间的相似度,并基于该相似度从该没有被打上伪标签的仪表盘图片样本中,确定出该难例样本。Then, the similarity between the sample features of each difficult sample and the sample features corresponding to the dashboard image sample that is not pseudo-labeled is determined, and based on the similarity, the difficult sample is determined from the dashboard image sample that is not pseudo-labeled.
进一步地,所述基于所述相似度从所述第二伪标签样本中确定第四伪标签样本,包括:Further, the 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;
按照从上到下从所述第二伪标签样本的样本排序结果中,获取第三预设数量的第二伪标签样本,并将所述第三预设数量的第二伪标签样本作为第四伪标签样本。A third preset number of second pseudo-label samples are obtained from the sample sorting results of the second pseudo-label samples from top to bottom, and the third preset number of second pseudo-label samples are used as fourth pseudo-label samples.
其中,第三预设数量可以根据实际应用场景进行设置,本说明书对此不做具体设置,例如,该第三预设数量可以为10个。The third preset number may be set according to the actual application scenario, and this specification does not make specific settings for this. For example, the third preset number may be 10.
具体地,在确定出每个第三伪标签样本的样本特征与第二伪标签样本的样本特征之间的相似度之后,基于该相似度对第二伪标签样本进行降序排序,从而获得该第二伪标签样本的对应多个降序样本排序结果,其中,每个第三伪标签样本的样本特征均对应的一个降序样本排序结果,之后按照从上到下从每个第二伪标签样本的样本排序结果中,获取第三预设数量的第二伪标签样本,例如,该第三预设数量可以为10个,则按照从上到下从每个第二伪标签样本的样本排序结果中,获取10个第二伪标签样本,并将获取到的第二伪标签样本作为第四伪标签样本。Specifically, after determining the similarity between the sample features of each third pseudo-label sample and the sample features of the second pseudo-label sample, the second pseudo-label samples are sorted in descending order based on the similarity to obtain a plurality of descending sample sorting results corresponding to the second pseudo-label sample, wherein each sample feature of the third pseudo-label sample corresponds to a descending sample sorting result, and then a third preset number of second pseudo-label samples are obtained from the sample sorting results of each second pseudo-label sample from top to bottom. For example, the third preset number may be 10, then 10 second pseudo-label samples are obtained from the sample sorting results of each second pseudo-label sample from top to bottom, and the obtained second pseudo-label samples are used as fourth pseudo-label samples.
本说明书提供的实施例中,通过在半监督学习的训练方式中,引入相似度比对的方式进行难例挖掘,将更有价值的无标签样本加入了训练,同样大幅提高了无标签样本的利用率。In the embodiments provided in this specification, by introducing a similarity comparison method into the semi-supervised learning training method to perform difficult example mining, more valuable unlabeled samples are added to the training, which also greatly improves the utilization rate of unlabeled samples.
步骤四:基于所述第一伪标签样本、所述第四伪标签样本以及所述有标签图片样本,对所述初始图片识别模型进行训练,获得训练完成的图片识别模型。Step 4: Based on the first pseudo-label sample, the fourth pseudo-label sample and the labeled image sample, the initial image recognition model is trained to obtain a trained image recognition model.
具体地,本说明书提供的图片识别方法中,在确定出第一伪标签样本和第四伪标签样本之后,能够基于该第一伪标签样本、第四伪标签样本以及有标签图片样本,对初始图片识别模型进行训练,从而获得训练完成的图片识别模型。其中,该基于第一伪标签样本、第四伪标签样本以及有标签图片样本训练获得初始图片识别模型的操作,可以采用任意一种基于伪标签样本和有标签图片样本对模型进行训练的方式实现,本说明书对此不做具体限制。例如,将第一伪标签样本、第四伪标签样本以及有标签图片样本,输入至初始图片识别模型中,从而获得第一伪标签样本、第四伪标签样本以及有标签图片样本对应的预测得分,确定第一伪标签样本、第四伪标签样本和有标签图片样本对应的样本标签,基于该样本标签以及预测得分确定损失值,基于该损失值对初始图片识别模型进行调参,使得该初始图片识别模型达到收敛,从而获得训练完成的图片识别模型。Specifically, in the image recognition method provided in this specification, after determining the first pseudo-label sample and the fourth pseudo-label sample, the initial image recognition model can be trained based on the first pseudo-label sample, the fourth pseudo-label sample and the labeled image sample, so as to obtain a trained image recognition model. Among them, the operation of obtaining the initial image recognition model based on 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, and this specification does not make specific restrictions on this. For example, the first pseudo-label sample, the fourth pseudo-label sample and the labeled image sample are input into the initial image recognition model to obtain the prediction scores corresponding to the first pseudo-label sample, the fourth pseudo-label sample and the labeled image sample, determine the sample labels corresponding to the first pseudo-label sample, the fourth pseudo-label sample and the labeled image sample, determine the loss value based on the sample label and the prediction score, and adjust the parameters of the initial image recognition model based on the loss value so that the initial image recognition model converges, thereby obtaining a trained image recognition model.
本说明书提供的实施例中,通过采用半监督学习方法进行难例挖掘,并通过对无标签图片多次增广取最大值作为伪标签并加入训练,从而提高了图片识别模型的性能,便于后续基于该图片识别模型识别出翻拍的图片,进一步地实现了图片自动化审核的目的。In the embodiments provided in this specification, a semi-supervised learning method is used to mine difficult examples, and the maximum value of unlabeled images is taken as a pseudo-label and added to the training, thereby improving the performance of the image recognition model, facilitating the subsequent identification of reproduced images based on the image recognition model, and further achieving the purpose of automated image review.
步骤104:获取所述图片识别模型对所述待识别图片的识别结果,基于所述识别结果确定所述待识别图片是否为风险图片。Step 104: Obtain a recognition result of the image recognition model on the image to be recognized, and determine whether the image to be recognized is a risky image based on the recognition result.
其中,该待识别图片的识别结果可以理解为判断该待识别图片是否为风险图片的预测分值,例如[0,1]区间中的任意数值;相应地,风险图片可以理解为具有风险的图片,例如虚假的图片、翻拍图片等等。Among them, the recognition result of the image to be identified can be understood as a predicted score for determining whether the image to be identified is a risky image, such as any value in the interval [0,1]; accordingly, a risky image can be understood as a risky image, such as a fake image, a copied image, etc.
具体地,在将待识别图片输入至训练完成的图片识别模型之后,能够获得该图片识别模型对待识别图片的识别结果,并基于识别结果确定待识别图片是否为风险图片。Specifically, after the image to be identified is input into a trained image recognition model, a recognition result of the image recognition model on the image to be identified can be obtained, and based on the recognition result, it is determined whether the image to be identified is a risky image.
沿用上例,将该仪表盘图片输入至图片识别模型之后,基于该图片识别模型对该仪表盘图片进行识别,从而获得该图片识别模型输出的预测得分,基于该预测得分能够确定出该仪表盘图片是否为翻拍图片。Continuing with the above example, after the dashboard image is input into the image recognition model, the dashboard image is recognized based on the image recognition model to obtain a prediction score output by the image recognition model. Based on the prediction score, it can be determined whether the dashboard image is a re-shot image.
进一步地,所述基于所述识别结果确定所述待识别图片是否为风险图片,包括:Further, determining whether the image to be identified is a risky image based on the identification result includes:
判断所述识别结果是否大于等于预设风险阈值,若是,则确定所述待识别图片为风险图片,若否,则确定所述待识别图片为非风险图片。It is determined whether the recognition result is greater than or equal to a preset risk threshold. If so, it is determined that the image to be recognized is a risk image. If not, it is determined that the image to be recognized is a non-risk image.
其中,该非风险图片为不具有风险的图片,例如真实的图片、非翻拍图片等等。该预设风险阈值可以根据实际应用场景进行设置,本说明书对此不做具体限制;例如0.5分。The non-risky picture is a picture without risk, such as a real picture, a non-reproduced picture, etc. The preset risk threshold can be set according to the actual application scenario, and this specification does not impose a specific limitation on this; for example, 0.5 points.
沿用上例,在基于图片识别模型确定出仪表盘图片的预测得分之后,判断该预测得分是否大于等于0.5分,若是,则确定该仪表盘图片是翻拍图片,若否,则确定该仪表盘图片不是翻拍图片。Continuing with 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 re-shot image. If not, determine that the dashboard image is not a re-shot image.
本说明书提供的图片识别方法,包括:将待识别图片输入预先训练的图片识别模型,其中,所述图片识别模型基于有标签图片样本以及满足预设规则的无标签图片样本训练获得;获取所述图片识别模型对所述待识别图片的识别结果,基于所述识别结果确定所述待识别图片是否为风险图片。The image recognition method provided in this specification includes: inputting a picture to be recognized into a pre-trained picture recognition model, wherein the picture recognition model is trained based on labeled picture samples and unlabeled picture samples that meet preset rules; obtaining a recognition result of the picture to be recognized by the picture recognition model, and determining whether the picture to be recognized is a risky picture based on the recognition result.
下述结合附图2,以本说明书提供的图片识别方法在识别仪表盘图片是否为翻拍图片场景下的应用为例,对所述图片识别方法进行进一步说明。其中,图2示出了本说明书一个实施例提供的一种图片识别方法中模型训练的过程示意图。本说明书提供的图片识别方法在识别仪表盘图片是否为翻拍图片场景下,能够将用户车辆的仪表盘图片,输入至能够识别出仪表盘图片是否为翻拍图片的图片识别模型中,基于该图片识别模型对该仪表盘图片进行识别,从而获得该图片识别模型输出的预测得分,基于该预测得分能够确定出该仪表盘图片是否为翻拍图片。其中,在将用户车辆的仪表盘图片输入至图片识别模型中进行识别处理之前,还需要对通过有标签图片样本和无标签图片样本对该图片识别模型进行训练,从而获得训练完成的图片识别模型。基于此,针对该图片识别模型的训练步骤可以参见图2,如图2所示,本说明书提供的图片识别方法。在对该图片识别模型进行训练的步骤可以分为4个阶段,包括训练阶段一、伪标签阶段一、伪标签阶段二、训练阶段二。In the following, in conjunction with Figure 2, the image recognition method provided in this specification is further described by taking the application of the image recognition method provided in this specification in the scene of identifying whether the dashboard image is a re-shot image as an example. Among them, Figure 2 shows a schematic diagram of the process of model training in an image recognition method provided in an embodiment of this specification. In the scene of identifying whether the dashboard image is a re-shot image, the image recognition method provided in this specification can input the dashboard image of the user's vehicle into the image recognition model that can identify whether the dashboard image is a re-shot image, and identify the dashboard image based on the image recognition model, so as to obtain the prediction score output by the image recognition model, and determine whether the dashboard image is a re-shot image based on the prediction score. Among them, before the dashboard image of the user's vehicle is input into the image recognition model for recognition processing, it is also necessary to train the image recognition model through labeled image samples and unlabeled image samples to obtain a trained image recognition model. Based on this, the training steps for the image recognition model can be referred to Figure 2, as shown in Figure 2, the image recognition method provided in this specification. The steps of training the image recognition model can be divided into four stages, including training stage one, pseudo labeling stage one, pseudo labeling stage two, and training stage two.
其中,该训练阶段一:是指通过人工标注的有标签图片样本对模型A进行训练,从而训练出一个初始图片识别模型A;The first training phase refers to training model A through manually annotated labeled image samples, thereby training an initial image recognition model A;
其中,伪标签阶段一:是指对该无标签图片样本进行多次数据增广,从而通过不同数据增广方式得到每个无标签图片样本对应的多张图片样本。将该无标签图片样本和数据增广获得的图片样本输入至初始图片识别模型A,并将得到数据增广获得的图片样本的预测得分,以及无标签图片样本的预测得分,共同作为无标签图片样本的预测得分,也即是图2中的多次数据增广得到的多个数值;之后,从无标签图片样本的预测得分中取最大值,从而获得最大的预测得分;判断该预测得分是否高于预设阈值,若是,则将该无标签图片样本可以打标,也即是打上伪标签,从而获得伪标签样本图片样本。Among them, pseudo-label stage one: refers to performing multiple data augmentations on the unlabeled image sample, so as to obtain multiple image samples corresponding to each unlabeled image sample through different data augmentation methods. The unlabeled image sample and the image sample obtained by data augmentation are input into the initial image recognition model A, and the prediction score of the image sample obtained by data augmentation and the prediction score of the unlabeled image sample are taken together as the prediction score of the unlabeled image sample, that is, the multiple values obtained by multiple data augmentations in Figure 2; then, the maximum value is taken from the prediction score of the unlabeled image sample to obtain the maximum prediction score; it is determined whether the prediction score is higher than the preset threshold. If so, the unlabeled image sample can be labeled, that is, a pseudo label is added, so as to obtain a pseudo-label sample image sample.
需要说明是的,该数据增广获得的图片样本可以理解为上述实施例中的待处理图片样本。预设阈值可以理解为上述实施例中的预设结果阈值。It should be noted that the image samples obtained by data augmentation can be understood as the image samples to be processed in the above embodiment. The preset threshold can be understood as the preset result threshold in the above embodiment.
其中,伪标签阶段二:是指从该有标签图片样本中的确定出难例样本,该有标签图片样本可以为是训练阶段一中通过人工标注的有标签图片样本,和/或伪标签阶段一中获得伪标签图片样本。Among them, the pseudo-label stage two refers to determining difficult samples from the labeled image samples. The labeled image samples can be labeled image samples manually annotated in the training stage one, and/or pseudo-label image samples obtained in the pseudo-label stage one.
将有标签图片样本中的难例送入模型A中得到对应的特征,然后将大量无标签图片样本也送入模型得到对应特征;该大量无标签图片样本可以为,伪标签阶段一中除未被打标的无标签图片样本,也即是,预测得分低于等于预设阈值的无标签图片样本。The difficult examples in the labeled image samples are sent to model A to obtain corresponding features, and then a large number of unlabeled image samples are also sent to the model to obtain corresponding features; the large number of unlabeled image samples can be the unlabeled image samples except those that are not labeled in the pseudo-label stage 1, that is, the unlabeled image samples whose prediction scores are less than or equal to the preset threshold.
对有标签图片样本的特征和每个无标签图片样本的特征进行相似度计算,从而获得有标签图片样本的特征和每个无标签图片样本的特征之间的相似度,并基于该相似度对该每个无标签图片样本进行排序,并将排序靠前的前10个无标签图片样本打伪标签,从而再次获得一定数量的伪标签图片样本,并将该伪标签图片样本加入后续训练中。The similarity between the features of the labeled image samples and the features of each unlabeled image sample is calculated to obtain the similarity between the features of the labeled image samples and the features of each unlabeled image sample, and each unlabeled image sample is sorted based on the similarity, and the top 10 unlabeled image samples with the highest sorting 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 adding the pseudo-label image samples obtained in the pseudo-label stage 1 and the pseudo-label stage 2, and the labeled image samples manually annotated in the training stage 1, to the training of the initial image recognition model A, so as to obtain the trained target image recognition model A. The target image recognition model A can be understood as the pre-trained image recognition model in the above embodiment.
本说明书提供的图片识别方法,通过在伪标签阶段将无标签图片样本经过多次数据增广后,将得分取最大值的样本作为加入训练的样本,提高了无标签样本的利用率。并且,通过在半监督学习的训练方式中,引入相似度比对的方式进行难例挖掘,将更有价值的无标签样本加入了训练,同样大幅提高了无标签样本的利用率。The image recognition method provided in this specification improves the utilization rate of unlabeled samples by augmenting the unlabeled image samples with multiple data in the pseudo-label stage and taking the sample with the maximum score as the sample to be added to the training. In addition, by introducing the similarity comparison method to the semi-supervised learning training method to mine difficult examples, more valuable unlabeled samples are added to the training, which also greatly improves the utilization rate of unlabeled samples.
与上述方法实施例相对应,本说明书还提供了图片识别装置实施例,图3示出了本说明书一个实施例提供的一种图片识别装置的结构示意图。如图3所示,该装置包括:Corresponding to the above method embodiment, this specification also provides an embodiment of an image recognition device. FIG3 shows a schematic diagram of the structure of an image recognition device provided by an embodiment of this specification. As shown in FIG3, the device includes:
输入模块302,被配置为将待识别图片输入预先训练的图片识别模型,其中,所述图片识别模型基于有标签图片样本以及满足预设规则的无标签图片样本训练获得;An input module 302 is configured to input a to-be-recognized image into a pre-trained image recognition model, wherein the image recognition model is trained based on labeled image samples and unlabeled image samples that meet preset rules;
确定模块304,被配置为获取所述图片识别模型对所述待识别图片的识别结果,基于所述识别结果确定所述待识别图片是否为风险图片。The determination module 304 is configured to obtain a recognition result of the image recognition model on the image to be recognized, and determine whether the image to be recognized is a risky image based on the recognition result.
可选地,所述图片识别装置还包括模型训练模块,被配置为:Optionally, the image recognition device further includes a model training module configured to:
基于所述有标签图片样本训练获得初始图片识别模型;Obtaining an initial image recognition model based on the labeled image sample training;
基于所述初始图片识别模型,从无标签图片样本中确定第一伪标签样本和第二伪标签样本;Based on the initial image recognition model, determining a first pseudo-label sample and a second pseudo-label sample from the unlabeled image sample;
基于预设确定规则从所述第一伪标签样本中确定第三伪标签样本,并基于所述第三伪标签样本从所述第二伪标签样本中确定第四伪标签样本;Determine a third pseudo-label sample from the first pseudo-label samples based on a preset determination rule, and determine a fourth pseudo-label sample from the second pseudo-label samples based on the third pseudo-label sample;
基于所述第一伪标签样本、所述第四伪标签样本以及所述有标签图片样本,对所述初始图片识别模型进行训练,获得训练完成的图片识别模型。Based on the first pseudo-label sample, the fourth pseudo-label sample and the labeled image sample, the initial image recognition model is trained to obtain a trained image recognition model.
可选地,所述模型训练模块,还被配置为:Optionally, the model training module is further configured to:
基于无标签图片样本确定与所述无标签图片样本相关联的待处理图片样本;Determine, based on the unlabeled picture sample, a to-be-processed picture sample associated with the unlabeled picture sample;
将所述无标签图片样本以及相关联的待处理图片样本输入所述初始图片识别模型,获得所述无标签图片样本的第一识别结果,以及所述待处理图片样本的第二识别结果;Inputting the unlabeled image sample and the associated to-be-processed image sample into the initial image recognition model to obtain a first recognition result of the unlabeled image sample and a second recognition result of the to-be-processed image 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 image samples.
可选地,所述模型训练模块,还被配置为:Optionally, the model training module is further configured to:
基于所述无标签图片样本的第一识别结果,以及与所述无标签图片样本相关联的待处理图片样本的第二识别结果,确定所述无标签图片样本对应的目标识别结果;Determine a target recognition result corresponding to the unlabeled image sample based on the first recognition result of the unlabeled image sample and the second recognition result of the to-be-processed image sample associated with the unlabeled image sample;
判断所述无标签图片样本对应的目标识别结果是否大于等于预设结果阈值,Determine whether the target recognition result corresponding to the unlabeled image sample is greater than or equal to a preset result threshold,
若是,则将所述无标签图片样本确定为第一伪标签样本,If yes, the unlabeled image sample is determined as the first pseudo-labeled sample.
若否,则将所述无标签图片样本确定为第二伪标签样本。If not, the unlabeled image sample is determined as a second pseudo-labeled sample.
可选地,所述模型训练模块,还被配置为:Optionally, the model training module is further configured to:
确定所述第一伪标签样本对应的目标识别结果;Determine a 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 to obtain a sample sorting result of the first pseudo-label samples;
按照从上到下从所述第一伪标签样本的样本排序结果中,获取第一预设数量的第一伪标签样本,并将所述第一预设数量的第一伪标签样本作为第三伪标签样本。A first preset number of first pseudo-label samples are obtained from the sample sorting results of the first pseudo-label samples from top to bottom, and the first preset number of first pseudo-label samples are used as third pseudo-label samples.
可选地,所述模型训练模块,还被配置为:Optionally, the model training module is further configured to:
确定所述有标签图片样本对应的样本识别结果,其中,所述样本识别结果为基于所述有标签图片样本训练获得所述初始图片识别模型的过程中确定的识别结果;Determine a sample recognition result corresponding to the labeled image sample, wherein the sample recognition result is a recognition result determined in a process of obtaining the initial image recognition model based on the labeled image sample training;
基于所述样本识别结果对所述有标签图片样本进行升序排序,获得所述有标签图片样本的样本排序结果;Sort the labeled image samples in ascending order based on the sample recognition result to obtain a sample sorting result of the labeled image 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 third pseudo-label samples.
可选地,所述模型训练模块,还被配置为:Optionally, the model training module is further configured to:
基于所述初始图片识别模型确定所述第三伪标签样本的样本特征,以及所述第二伪标签样本的样本特征;Determining sample features of the third pseudo-label sample and sample features of the second pseudo-label sample based on the initial image 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 further configured to:
将所述第三伪标签样本输入所述初始图片识别模型,基于所述初始图片识别模型中的特征提取模块确定所述第三伪标签样本的样本特征;Inputting the third pseudo-label sample into the initial image recognition model, and determining a sample feature of the third pseudo-label sample based on a feature extraction module in the initial image recognition model;
将所述第二伪标签样本输入所述初始图片识别模型,基于所述初始图片识别模型中的特征提取模块确定所述第二伪标签样本的样本特征。The second pseudo-label sample is input into the initial image recognition model, and a sample feature of the second pseudo-label sample is determined based on a feature extraction module in the initial image recognition model.
可选地,所述模型训练模块,还被配置为:Optionally, the model training module is further configured to:
基于所述相似度对所述第二伪标签样本进行降序排序,获得所述第二伪标签样本的样本排序结果;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;
按照从上到下从所述第二伪标签样本的样本排序结果中,获取第三预设数量的第二伪标签样本,并将所述第三预设数量的第二伪标签样本作为第四伪标签样本。A third preset number of second pseudo-label samples are obtained from the sample sorting results of the second pseudo-label samples from top to bottom, and the third preset number of second pseudo-label samples are used as fourth pseudo-label samples.
可选地,所述确定模块304,还被配置为:Optionally, the determining module 304 is further configured to:
判断所述识别结果是否大于等于预设风险阈值,若是,则确定所述待识别图片为风险图片,若否,则确定所述待识别图片为非风险图片。It is determined whether the recognition result is greater than or equal to a preset risk threshold. If so, it is determined that the image to be recognized is a risk image. If not, it is determined that the image to be recognized is a non-risk image.
本说明书提供的图片识别装置,通过基于有标签图片样本以及满足预设规则的无标签图片样本训练获得的图片识别模型,识别输入的待识别图片是否为风险图片,从而提高了风险图片的识别效率,降低了图片验证过程的难度。The image recognition device provided in this specification identifies whether an input image to be identified is a risky image through an image recognition model obtained by training based on labeled image samples and unlabeled image samples that meet preset rules, thereby improving the recognition efficiency of risky images and reducing the difficulty of the image verification process.
上述为本实施例的一种图片识别装置的示意性方案。需要说明的是,该图片识别装置的技术方案与上述的图片识别方法的技术方案属于同一构思,图片识别装置的技术方案未详细描述的细节内容,均可以参见上述图片识别方法的技术方案的描述。The above is a schematic scheme of an image recognition device of this embodiment. It should be noted that the technical scheme of the image recognition device and the technical scheme of the above-mentioned image recognition method belong to the same concept, and the details not described in detail in the technical scheme of the image recognition device can be referred to the description of the technical scheme of the above-mentioned image recognition method.
图4示出了根据本说明书一个实施例提供的一种计算设备400的结构框图。该计算设备400的部件包括但不限于存储器410和处理器420。处理器420与存储器410通过总线430相连接,数据库450用于保存数据。Fig. 4 shows a block diagram of a computing device 400 according to an embodiment of the present specification. The components of the computing device 400 include but are not limited to a memory 410 and a processor 420. The processor 420 is connected to the memory 410 via a bus 430, and the database 450 is used to store data.
计算设备400还包括接入设备440,接入设备440使得计算设备400能够经由一个或多个网络460通信。这些网络的示例包括公用交换电话网(PSTN)、局域网(LAN)、广域网(WAN)、个域网(PAN)或诸如因特网的通信网络的组合。接入设备440可以包括有线或无线的任何类型的网络接口(例如,网络接口卡(NIC))中的一个或多个,诸如IEEE802.11无线局域网(WLAN)无线接口、全球微波互联接入(Wi-MAX)接口、以太网接口、通用串行总线(USB)接口、蜂窝网络接口、蓝牙接口、近场通信(NFC)接口,等等。The computing device 400 also includes an access device 440 that enables the computing device 400 to communicate via one or more networks 460. Examples of these 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. The access device 440 may include one or more of any type of network interface (e.g., a network interface card (NIC)) that is wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Wide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
在本说明书的一个实施例中,计算设备400的上述部件以及图4中未示出的其他部件也可以彼此相连接,例如通过总线。应当理解,图4所示的计算设备结构框图仅仅是出于示例的目的,而不是对本说明书范围的限制。本领域技术人员可以根据需要,增添或替换其他部件。In one embodiment of the present specification, the above components of the computing device 400 and other components not shown in FIG. 4 may also be connected to each other, for example, through a bus. It should be understood that the computing device structure block diagram shown in FIG. 4 is only for illustrative purposes and is not intended to limit the scope of the present specification. Those skilled in the art may add or replace other components as needed.
计算设备400可以是任何类型的静止或移动计算设备,包括移动计算机或移动计算设备(例如,平板计算机、个人数字助理、膝上型计算机、笔记本计算机、上网本等)、移动电话(例如,智能手机)、可佩戴的计算设备(例如,智能手表、智能眼镜等)或其他类型的移动设备,或者诸如台式计算机或PC的静止计算设备。计算设备400还可以是移动式或静止式的服务器。Computing device 400 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. Computing device 400 may also be a mobile or stationary server.
其中,处理器420用于执行如下计算机可执行指令,该计算机可执行指令被处理器420执行时实现上述图片识别方法的步骤。The processor 420 is used to execute the following computer executable instructions, which, when executed by the processor 420, implement the steps of the above-mentioned image recognition method.
上述为本实施例的一种计算设备的示意性方案。需要说明的是,该计算设备的技术方案与上述的图片识别方法的技术方案属于同一构思,计算设备的技术方案未详细描述的细节内容,均可以参见上述图片识别方法的技术方案的描述。The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above-mentioned image recognition method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above-mentioned image recognition method.
本说明书一实施例还提供一种计算机可读存储介质,其存储有计算机可执行指令,该计算机可执行指令被处理器执行时实现上述图片识别方法的步骤。An embodiment of the present specification further provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the above-mentioned image recognition method.
上述为本实施例的一种计算机可读存储介质的示意性方案。需要说明的是,该存储介质的技术方案与上述的图片识别方法的技术方案属于同一构思,存储介质的技术方案未详细描述的细节内容,均可以参见上述图片识别方法的技术方案的描述。The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above-mentioned image recognition method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme 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 caused to execute the steps of the above-mentioned image recognition method.
上述为本实施例的一种计算机程序的示意性方案。需要说明的是,该计算机程序的技术方案与上述的图片识别方法的技术方案属于同一构思,计算机程序的技术方案未详细描述的细节内容,均可以参见上述图片识别方法的技术方案的描述。The above is an illustrative 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 above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired 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 codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium 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, computer-readable media do not include electric carrier signals and telecommunication signals.
需要说明的是,对于前述的各方法实施例,为了简便描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本说明书实施例并不受所描述的动作顺序的限制,因为依据本说明书实施例,某些步骤可以采用其它顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定都是本说明书实施例所必须的。It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其它实施例的相关描述。In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
以上公开的本说明书优选实施例只是用于帮助阐述本说明书。可选实施例并没有详尽叙述所有的细节,也不限制该发明仅为所述的具体实施方式。显然,根据本说明书实施例的内容,可作很多的修改和变化。本说明书选取并具体描述这些实施例,是为了更好地解释本说明书实施例的原理和实际应用,从而使所属技术领域技术人员能很好地理解和利用本说明书。本说明书仅受权利要求书及其全部范围和等效物的限制。The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can understand and use this specification well. This specification is only limited 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 |
|---|---|
| CN114529993A CN114529993A (en) | 2022-05-24 |
| CN114529993Btrue 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 |
|---|---|---|---|---|
| CN113326764A (en)* | 2021-05-27 | 2021-08-31 | 北京百度网讯科技有限公司 | Method and device for training image recognition model and image recognition |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| EP3345129A4 (en)* | 2015-08-31 | 2019-07-24 | Cape Analytics, Inc. | SYSTEMS AND METHODS FOR ANALYZING REMOTE DETECTION IMAGING |
| US10817779B2 (en)* | 2017-08-30 | 2020-10-27 | 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 |
| US11600113B2 (en)* | 2019-11-13 | 2023-03-07 | Nec Corporation | Deep face recognition based on clustering over unlabeled face data |
| CN111582185B (en)* | 2020-05-11 | 2023-06-30 | 北京百度网讯科技有限公司 | Method and device for recognizing images |
| CN113283388B (en)* | 2021-06-24 | 2024-05-24 | 中国平安人寿保险股份有限公司 | Training method, device, equipment and storage medium of living body face detection model |
| CN113989549B (en)* | 2021-10-21 | 2025-03-07 | 神思电子技术股份有限公司 | A pseudo-label-based semi-supervised learning image classification optimization method and system |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113326764A (en)* | 2021-05-27 | 2021-08-31 | 北京百度网讯科技有限公司 | Method and device for training image recognition model and image recognition |
| Publication number | Publication date |
|---|---|
| CN114529993A (en) | 2022-05-24 |
| CN119479084A (en) | 2025-02-18 |
| Publication | Publication Date | Title |
|---|---|---|
| CN116386104A (en) | Self-supervision facial expression recognition method combining contrast learning and mask image modeling | |
| CN108665441A (en) | A kind of Near-duplicate image detection method and device, electronic equipment | |
| CN110321537B (en) | Method and device for generating file | |
| CN112632248B (en) | Question and answer method, device, computer equipment and storage medium | |
| WO2020207079A1 (en) | Image recognition-based desensitization processing method and device | |
| US20170116521A1 (en) | Tag processing method and device | |
| CN118155199A (en) | Bill identification method, bill identification device, computer equipment and storage medium | |
| CN115640401B (en) | Text content extraction method and device | |
| CN115481246A (en) | Text detection model training method and device | |
| CN114373106A (en) | Weakly-supervised semantic segmentation method and device based on context decoupling and data augmentation | |
| CN114519863A (en) | Human body weight recognition method, human body weight recognition apparatus, computer device, and medium | |
| CN114882507A (en) | Document image information structuring processing method and device | |
| CN114818718A (en) | Contract text recognition method and device | |
| CN119904786A (en) | Method, device and apparatus for generating event description text based on video data | |
| CN116453023A (en) | Video summarization system, method, electronic device and medium for 5G rich media information | |
| CN114241495B (en) | Data enhancement method for off-line handwritten text recognition | |
| Ali et al. | Context awareness based sketch-deepnet architecture for hand-drawn sketches classification and recognition in aiot | |
| CN118153564B (en) | Script processing method, device, computer equipment, storage medium and program product | |
| CN114529993B (en) | Image recognition method and device | |
| CN111209414B (en) | Method for realizing cold-hot separation storage of data based on image data calling business scene | |
| CN114491010A (en) | Training method and device for information extraction model | |
| WO2024016945A1 (en) | Training method for image classification model, image classification method, and related device | |
| CN115206296B (en) | Speech recognition method and device | |
| US10762607B2 (en) | Method and device for sensitive data masking based on image recognition | |
| CN113221690A (en) | Video classification 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 |