CN107220667A - Image classification method, device and computer-readable recording medium - Google Patents
Image classification method, device and computer-readable recording medium Download PDFInfo
- Publication number
- CN107220667A CN107220667A CN201710388824.4A CN201710388824A CN107220667A CN 107220667 A CN107220667 A CN 107220667A CN 201710388824 A CN201710388824 A CN 201710388824A CN 107220667 A CN107220667 A CN 107220667A
- Authority
- CN
- China
- Prior art keywords
- label
- target image
- image
- rnn
- feature
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/241—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
Landscapes
- Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Artificial Intelligence (AREA)
- Evolutionary Biology (AREA)
- Evolutionary Computation (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Image Analysis (AREA)
Abstract
本公开是关于一种图像分类方法、装置及计算机可读存储介质,属于图像处理技术领域。该方法包括:通过CNN模型确定目标图像的特征,并通过RNN模型对目标图像的特征进行处理,以得到目标图像的多个标签。由于目标图像的特征由CNN模型包括的最后一个池化层输出,也即,CNN模型在得到目标图像的特征之后,并没有根据该目标图像的特征确定该目标图像属于的各个类别的概率,而是直接将该目标图像的特征通过RNN模型进行处理,以得到该目标图像的多个标签,从而实现对对包括至少两种类别的内容的图像进行分类。
The disclosure relates to an image classification method, device and computer-readable storage medium, and belongs to the technical field of image processing. The method includes: determining the features of the target image through the CNN model, and processing the features of the target image through the RNN model to obtain multiple labels of the target image. Since the features of the target image are output by the last pooling layer included in the CNN model, that is, after the CNN model obtains the features of the target image, it does not determine the probability of each category that the target image belongs to according to the features of the target image, and The method is to directly process the features of the target image through the RNN model to obtain multiple labels of the target image, so as to classify images including at least two types of content.
Description
技术领域technical field
本公开涉及图像处理技术领域,尤其涉及一种图像分类方法、装置及计算机可读存储介质。The present disclosure relates to the technical field of image processing, and in particular to an image classification method, device and computer-readable storage medium.
背景技术Background technique
当计算机接收到一张图像时,通常需要对该图像进行分类,以确定该图像所属的类别,并将该图像所属的类别设置为该图像的标签,以便于使用者查找该图像。如当计算机接收到一张风景图像时,可以确定该图像的类别为风景,也即,将该图像的标签设置为风景。When a computer receives an image, it usually needs to classify the image to determine the category to which the image belongs, and set the category to which the image belongs as a label of the image, so that users can easily find the image. For example, when the computer receives a landscape image, it can determine that the category of the image is landscape, that is, set the label of the image as landscape.
相关技术中,计算机对图像进行分类主要是通过单标签分类方法来实现,也即,对于预先设置的多个类别,通过CNN(Convolutional Neural Networks,卷积神经网络)模型包括的至少一个卷积层和至少一个池化层确定该图像的特征,通过CNN模型包括的全连接层根据该图像的特征确定该图像分别属于该多个类别中的每个类别的概率,并将概率最大的类别确定为该图像所属的类别,以得到该图像的标签。In the related art, the classification of images by computers is mainly realized by a single-label classification method, that is, for multiple preset categories, at least one convolutional layer included in a CNN (Convolutional Neural Networks, Convolutional Neural Network) model and at least one pooling layer to determine the feature of the image, determine the probability that the image belongs to each category in the plurality of categories according to the feature of the image through the fully connected layer included in the CNN model, and determine the category with the greatest probability as The category to which the image belongs to get the label of the image.
发明内容Contents of the invention
为克服相关技术中存在的问题,本公开提供一种图像分类方法、装置及计算机可读存储介质,所述技术方案如下:In order to overcome the problems existing in related technologies, the present disclosure provides an image classification method, device, and computer-readable storage medium. The technical solutions are as follows:
根据本公开实施例的第一方面,提供一种图像分类方法,所述方法包括:According to a first aspect of an embodiment of the present disclosure, an image classification method is provided, the method comprising:
通过预先训练的CNN模型对需要进行分类的目标图像进行处理,以确定所述CNN模型包括的最后一个池化层输出的特征;Process the target image that needs to be classified through the pre-trained CNN model to determine the features of the last pooling layer output included in the CNN model;
将确定的特征作为所述目标图像的特征,通过预先训练的RNN(Recurrent NeuralNetwork,循环神经网络)模型对所述目标图像的特征进行处理,得到所述目标图像的多个标签,所述多个标签中的每个标签用于指示所述目标图像中的图像内容所属的类别。The determined features are used as the features of the target image, and the features of the target image are processed by a pre-trained RNN (Recurrent Neural Network, cyclic neural network) model to obtain multiple labels of the target image, and the multiple Each of the tags is used to indicate the category to which the image content in the target image belongs.
可选地,所述通过预先训练的RNN模型对所述目标图像的特征进行处理,得到所述目标图像的多个标签,包括:Optionally, the pre-trained RNN model is used to process the features of the target image to obtain multiple labels of the target image, including:
将所述目标图像的特征作为所述RNN模型的输入,并通过所述RNN模型对所述目标图像的特征进行处理,得到第一标签,所述第一标签为所述多个标签中的一个;Using the features of the target image as the input of the RNN model, and processing the features of the target image through the RNN model to obtain a first label, the first label is one of the multiple labels ;
将所述第一标签作为所述RNN模型的输入,并通过所述RNN模型对所述目标图像的特征和所述第一标签进行处理,得到第二标签,所述第二标签为所述多个标签中的一个;The first label is used as the input of the RNN model, and the features of the target image and the first label are processed by the RNN model to obtain a second label, and the second label is the multiple one of the tags;
确定循环次数,所述循环次数是指所述RNN模型循环对输入的标签和所述目标图像的特征进行处理的次数;Determine the number of cycles, the number of cycles refers to the number of times the RNN model cycles to process the input label and the features of the target image;
当所述循环次数小于或等于预设次数时,将所述第二标签继续作为所述RNN模型的输入,循环执行上述操作,直至所述循环次数大于所述预设次数时,得到所述多个标签。When the number of cycles is less than or equal to the preset number of times, continue to use the second label as the input of the RNN model, and perform the above operation in a loop until the number of cycles is greater than the preset number of times, and obtain the multiple tags.
可选地,所述通过预先训练的RNN模型对所述目标图像的特征进行处理,得到所述目标图像的多个标签,包括:Optionally, the pre-trained RNN model is used to process the features of the target image to obtain multiple labels of the target image, including:
将所述目标图像的特征作为所述RNN模型的输入,并通过所述RNN模型对所述目标图像的特征进行处理,得到第一标签,所述第一标签为所述多个标签中的一个;Using the features of the target image as the input of the RNN model, and processing the features of the target image through the RNN model to obtain a first label, the first label is one of the multiple labels ;
将所述第一标签作为所述RNN模型的输入,并通过所述RNN模型对所述目标图像的特征和所述第一标签进行处理,得到第二标签,所述第二标签为所述多个标签中的一个;The first label is used as the input of the RNN model, and the features of the target image and the first label are processed by the RNN model to obtain a second label, and the second label is the multiple one of the tags;
确定所述目标图像同时属于当前确定得到的所有标签对应的类别的概率;Determining the probability that the target image simultaneously belongs to the category corresponding to all the currently determined labels;
当所述概率大于或等于预设概率时,将所述第二标签继续作为所述RNN模型的输入,循环执行上述操作,直至所述概率小于所述预设概率时,得到所述多个标签。When the probability is greater than or equal to the preset probability, continue to use the second label as the input of the RNN model, and perform the above operations in a loop until the probability is less than the preset probability, and obtain the plurality of labels .
可选地,所述通过预先训练的CNN模型对目标图像进行处理之前,还包括:Optionally, before the pre-trained CNN model is used to process the target image, it also includes:
确定训练样本集,所述训练样本集包括多张图像和预先为每张图像设置的多个标签;Determine the training sample set, the training sample set includes a plurality of images and a plurality of labels pre-set for each image;
根据所述多张图像,对初始化CNN模型进行训练,得到训练后的CNN模型和所述多张图像中每张图像的特征;According to the multiple images, the initialization CNN model is trained to obtain the trained CNN model and the features of each image in the multiple images;
根据所述多张图像中每张图像的特征,对初始化RNN模型进行训练,得到训练后的RNN模型和所述多张图像中每张图像的多个标签;According to the feature of each image in the plurality of images, the initialization RNN model is trained to obtain the trained RNN model and a plurality of labels for each image in the plurality of images;
当通过训练得到的所述多张图像中每张图像的多个标签与预先为对应图像设置的多个标签之间的误差大于预设误差时,通过梯度下降法调整所述初始化CNN模型和所述初始化RNN模型,并返回根据所述多张图像,对初始化CNN模型进行训练的步骤,直至通过训练得到的所述多张图像中每张图像的多个标签与预先为对应图像设置的多个标签之间的误差小于或等于所述预设误差为止,并将最终训练得到的CNN模型确定为所述预先训练的CNN模型,将最终训练得到的RNN模型确定为所述预先训练的RNN模型。When the error between the plurality of labels of each image in the plurality of images obtained through training and the plurality of labels set for the corresponding image in advance is greater than the preset error, adjust the initialization CNN model and the set by gradient descent method Describe the initialization RNN model, and return to the step of training the initialization CNN model according to the multiple images, until the multiple labels of each image in the multiple images obtained through training and the multiple labels set in advance for the corresponding image Until the error between labels is less than or equal to the preset error, the final trained CNN model is determined as the pre-trained CNN model, and the final trained RNN model is determined as the pre-trained RNN model.
根据本公开实施例的第二方面,提供一种图像分类装置,所述装置包括:According to a second aspect of an embodiment of the present disclosure, an image classification device is provided, the device comprising:
第一处理模块,用于通过预先训练的CNN模型对需要进行分类的目标图像进行处理,以确定所述CNN模型包括的最后一个池化层输出的特征;The first processing module is used to process the target image that needs to be classified through the pre-trained CNN model, so as to determine the characteristics of the output of the last pooling layer included in the CNN model;
第二处理模块,用于将确定的特征作为所述目标图像的特征,通过预先训练的RNN模型对所述目标图像的特征进行处理,得到所述目标图像的多个标签,所述多个标签中的每个标签用于指示所述目标图像中的图像内容所属的类别。The second processing module is used to use the determined features as the features of the target image, process the features of the target image through the pre-trained RNN model, and obtain multiple labels of the target image, and the multiple labels Each label in is used to indicate the category to which the image content in the target image belongs.
可选地,所述第二处理模块包括:Optionally, the second processing module includes:
第一处理子模块,用于将所述目标图像的特征作为所述RNN模型的输入,并通过所述RNN模型对所述目标图像的特征进行处理,得到第一标签,所述第一标签为所述多个标签中的一个;The first processing submodule is configured to use the features of the target image as the input of the RNN model, and process the features of the target image through the RNN model to obtain a first label, and the first label is one of the plurality of tags;
第二处理子模块,用于将所述第一标签作为所述RNN模型的输入,并通过所述RNN模型对所述目标图像的特征和所述第一标签进行处理,得到第二标签,所述第二标签为所述多个标签中的一个;The second processing submodule is used to use the first label as the input of the RNN model, and process the features of the target image and the first label through the RNN model to obtain a second label, so The second tag is one of the plurality of tags;
第一确定子模块,用于确定循环次数,所述循环次数是指所述RNN模型循环对输入的标签和所述目标图像的特征进行处理的次数;The first determination submodule is used to determine the number of cycles, the number of cycles refers to the number of times the RNN model cycles to process the input label and the features of the target image;
第一循环子模块,用于当所述循环次数小于或等于预设次数时,将所述第二标签继续作为所述RNN模型的输入,循环执行上述操作,直至所述循环次数大于所述预设次数时,得到所述多个标签。The first loop submodule is configured to continue to use the second label as the input of the RNN model when the number of loops is less than or equal to a preset number of times, and perform the above operation in a loop until the number of loops is greater than the preset number of times. When the number of times is set, the multiple labels are obtained.
可选地,所述第二处理模块包括:Optionally, the second processing module includes:
第一处理子模块,用于将所述目标图像的特征作为所述RNN模型的输入,并通过所述RNN模型对所述目标图像的特征进行处理,得到第一标签,所述第一标签为所述多个标签中的一个;The first processing submodule is configured to use the features of the target image as the input of the RNN model, and process the features of the target image through the RNN model to obtain a first label, and the first label is one of the plurality of tags;
第二处理子模块,用于将所述第一标签作为所述RNN模型的输入,并通过所述RNN模型对所述目标图像的特征和所述第一标签进行处理,得到第二标签,所述第二标签为所述多个标签中的一个;The second processing submodule is used to use the first label as the input of the RNN model, and process the features of the target image and the first label through the RNN model to obtain a second label, so The second tag is one of the plurality of tags;
第二确定子模块,用于确定所述目标图像同时属于当前确定得到的所有标签对应的类别的概率;The second determining submodule is used to determine the probability that the target image belongs to the category corresponding to all the currently determined labels;
第二循环子模块,用于当所述概率大于或等于预设概率时,将所述第二标签继续作为所述RNN模型的输入,循环执行上述操作,直至所述概率小于所述预设概率时,得到所述多个标签。The second loop submodule is configured to continue to use the second label as the input of the RNN model when the probability is greater than or equal to the preset probability, and perform the above operations in a loop until the probability is less than the preset probability , get the multiple labels.
可选地,所述装置还包括:Optionally, the device also includes:
第一确定模块,用于确定训练样本集,所述训练样本集包括多张图像和预先为每张图像设置的多个标签;The first determination module is used to determine the training sample set, the training sample set includes a plurality of images and a plurality of labels pre-set for each image;
第一训练模块,用于根据所述多张图像,对初始化CNN模型进行训练,得到训练后的CNN模型和所述多张图像中每张图像的特征;The first training module is used to train the initialized CNN model according to the plurality of images, and obtain the trained CNN model and the features of each image in the plurality of images;
第二训练模块,用于根据所述多张图像中每张图像的特征,对初始化RNN模型进行训练,得到训练后的RNN模型和所述多张图像中每张图像的多个标签;The second training module is used to train the initialized RNN model according to the characteristics of each image in the plurality of images, and obtain the trained RNN model and a plurality of labels for each image in the plurality of images;
第二确定模块,用于当通过训练得到的所述多张图像中每张图像的多个标签与预先为对应图像设置的多个标签之间的误差大于预设误差时,通过梯度下降法调整所述初始化CNN模型和所述初始化RNN模型,并返回根据所述多张图像,对初始化CNN模型进行训练的步骤,直至通过训练得到的所述多张图像中每张图像的多个标签与预先为对应图像设置的多个标签之间的误差小于或等于所述预设误差为止,并将最终训练得到的CNN模型确定为所述预先训练的CNN模型,将最终训练得到的RNN模型确定为所述预先训练的RNN模型。The second determination module is used to adjust by the gradient descent method when the error between the multiple labels of each image in the multiple images obtained through training and the multiple labels pre-set for the corresponding image is greater than the preset error. The initializing CNN model and the initializing RNN model, and returning to the step of training the initializing CNN model according to the plurality of images, until the plurality of labels of each image in the plurality of images obtained through training and the prior For the error between a plurality of labels set corresponding to the image until the error is less than or equal to the preset error, and the final trained CNN model is determined as the pre-trained CNN model, and the final trained RNN model is determined as the Describe the pre-trained RNN model.
根据本公开实施例的第三方面,提供另一种图像分类装置,所述装置包括:According to a third aspect of the embodiments of the present disclosure, another image classification device is provided, and the device includes:
处理器;processor;
用于存储处理器可执行指令的存储器;memory for storing processor-executable instructions;
其中,所述处理器被配置为执行上述第一方面所述的图像分类方法。Wherein, the processor is configured to execute the image classification method described in the first aspect above.
根据本公开实施例的第四方面,提供一种计算机可读存储介质,所述计算机可读存储介质上存储有指令,所述指令被处理器执行时实现上述第一方面所述的图像分类方法。According to the fourth aspect of the embodiments of the present disclosure, there is provided a computer-readable storage medium, the computer-readable storage medium stores instructions, and when the instructions are executed by a processor, the image classification method described in the above-mentioned first aspect is implemented .
本公开的实施例提供的技术方案可以包括以下有益效果:The technical solutions provided by the embodiments of the present disclosure may include the following beneficial effects:
在本公开实施例中,通过CNN模型确定目标图像的特征,并通过RNN模型对目标图像的特征进行处理,以得到目标图像的多个标签。由于目标图像的特征由CNN模型包括的最后一个池化层输出,也即,CNN模型在得到目标图像的特征之后,并没有根据该目标图像的特征确定该目标图像属于的各个类别的概率,而是直接将该目标图像的特征通过RNN模型进行处理,以得到该目标图像的多个标签,从而实现对对包括至少两种类别的内容的图像进行分类。In the embodiment of the present disclosure, the CNN model is used to determine the features of the target image, and the RNN model is used to process the features of the target image to obtain multiple labels of the target image. Since the features of the target image are output by the last pooling layer included in the CNN model, that is, after the CNN model obtains the features of the target image, it does not determine the probability of each category that the target image belongs to according to the features of the target image, and The method is to directly process the features of the target image through the RNN model to obtain multiple labels of the target image, so as to classify images including at least two types of content.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本公开。It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本发明的实施例,并与说明书一起用于解释本发明的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description serve to explain the principles of the invention.
图1A是本公开实施例提供的一种CNN模型的架构示意图。FIG. 1A is a schematic diagram of the architecture of a CNN model provided by an embodiment of the present disclosure.
图1B是本公开实施例提供的一种图像的像素点分布示意图。FIG. 1B is a schematic diagram of pixel point distribution of an image provided by an embodiment of the present disclosure.
图1C是本公开实施例提供的一种池化处理过程示意图。FIG. 1C is a schematic diagram of a pooling process provided by an embodiment of the present disclosure.
图1D是本公开实施例提供的一种RNN模型的架构示意图。FIG. 1D is a schematic diagram of an architecture of an RNN model provided by an embodiment of the present disclosure.
图2为本公开实施例提供的一种图像分类方法流程图。Fig. 2 is a flowchart of an image classification method provided by an embodiment of the present disclosure.
图3为本公开实施例提供的另一种图像分类方法流程图。Fig. 3 is a flowchart of another image classification method provided by an embodiment of the present disclosure.
图4为本公开实施例提供的另一种图像分类方法流程图。Fig. 4 is a flowchart of another image classification method provided by an embodiment of the present disclosure.
图5A为本公开实施例提供的一种图像分类装置框图。Fig. 5A is a block diagram of an image classification device provided by an embodiment of the present disclosure.
图5B为本公开实施例提供的另一种图像分类装置框图。Fig. 5B is a block diagram of another image classification device provided by an embodiment of the present disclosure.
图6是本公开实施例提供的另一种图像分类装置框图。Fig. 6 is a block diagram of another image classification device provided by an embodiment of the present disclosure.
图7是本公开实施例提供的另一种图像分类装置框图。Fig. 7 is a block diagram of another image classification device provided by an embodiment of the present disclosure.
具体实施方式detailed description
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本发明相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本发明的一些方面相一致的装置和方法的例子。Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the present invention. Rather, they are merely examples of apparatuses and methods consistent with aspects of the invention as recited in the appended claims.
在对本公开实施例进行详细解释说明之前,先对本公开实施例涉及到的两个神经 网络模型进行介绍。Before explaining the embodiment of the present disclosure in detail, the two neural network models involved in the embodiment of the present disclosure will be introduced first.
(1)CNN模型(1) CNN model
CNN模型是指在传统的多层神经网络的基础上发展起来的一种针对图像分类和识别的一种神经网络,相对于传统的多层神经网络,CNN模型中引入了卷积算法和池化算法。其中,卷积算法是指将局部区域内的数据进行加权叠加的一种数学算法,池化算法是指将局部区域内的数据进行采样处理的一种数学算法。The CNN model refers to a neural network for image classification and recognition developed on the basis of the traditional multi-layer neural network. Compared with the traditional multi-layer neural network, the CNN model introduces convolutional algorithms and pooling algorithm. Among them, the convolution algorithm refers to a mathematical algorithm that performs weighted superposition of data in a local area, and the pooling algorithm refers to a mathematical algorithm that performs sampling processing on data in a local area.
下面将结合CNN模型的架构对CNN模型的功能进行详细说明。The function of the CNN model will be described in detail below in conjunction with the architecture of the CNN model.
图1A为本公开实施例提供的一种CNN模型101的架构示意图,如图1A所示,该CNN模型101包括输入层1011、卷积层1012和卷积层1014、池化层1013和池化层1015、以及全连接层1016。输入层1011和卷积层1012相连,卷积层1012和池化层1013相连,池化层1013和卷积层1014相连,卷积层1014和池化层1015相连,池化层1015和全连接层1016相连。FIG. 1A is a schematic diagram of the architecture of a CNN model 101 provided by an embodiment of the present disclosure. As shown in FIG. 1A , the CNN model 101 includes an input layer 1011, a convolutional layer 1012, a convolutional layer 1014, a pooling layer 1013, and a pooling layer. layer 1015, and fully connected layer 1016. The input layer 1011 is connected to the convolutional layer 1012, the convolutional layer 1012 is connected to the pooling layer 1013, the pooling layer 1013 is connected to the convolutional layer 1014, the convolutional layer 1014 is connected to the pooling layer 1015, and the pooling layer 1015 is connected to the full connection Layers 1016 are connected.
其中,输入层1011用于确定输入的图像包括的所有像素点的像素值,并将该图像的所有像素点的像素值传输至卷积层1012。卷积层1012根据接收到的所有像素点的像素值进行第一次卷积算法处理,得到第一层卷积处理后的像素点,并将第一次卷积处理后的像素点传输至池化层1013。池化层1013根据第一次卷积处理后的像素点的像素值进行第一次池化算法处理,得到第一次池化处理后的像素点,并将第一次池化处理后的像素点传输至下一个卷积层1014。Wherein, the input layer 1011 is used to determine the pixel values of all the pixels included in the input image, and transmit the pixel values of all the pixels of the image to the convolution layer 1012 . The convolutional layer 1012 performs the first convolution algorithm processing according to the received pixel values of all pixels, obtains the pixels after the first layer of convolution processing, and transmits the pixels after the first convolution processing to the pool layer 1013. The pooling layer 1013 performs the first pooling algorithm processing according to the pixel values of the pixels after the first convolution processing, obtains the pixels after the first pooling processing, and converts the pixels after the first pooling processing Points are passed to the next convolutional layer 1014.
卷积层1014对第一次池化处理后的像素点进行第二次卷积算法处理,得到第二次卷积处理后的像素点,并将第二次卷积处理后的像素点传输至下一个池化层1015。池化层1015对第二次卷积处理后的像素点进行第二次池化算法处理,得到第二次池化处理后的像素点,并将第二次池化处理后的像素点传输至全连接层1016。全连接层1016根据第二次池化处理后的像素点的像素值,确定该图像分别属于预先设置多个类别中的每个类别的概率,以得到该图像的标签。The convolution layer 1014 performs the second convolution algorithm processing on the pixels after the first pooling processing, obtains the pixels after the second convolution processing, and transmits the pixels after the second convolution processing to The next pooling layer 1015. The pooling layer 1015 performs the second pooling algorithm processing on the pixels after the second convolution processing, obtains the pixels after the second pooling processing, and transmits the pixels after the second pooling processing to Fully connected layer 1016. The fully connected layer 1016 determines the probability that the image belongs to each of the preset multiple categories according to the pixel values of the pixel points after the second pooling process, so as to obtain the label of the image.
需要说明的是,第一次卷积算法处理的过程和第二次卷积算法处理的过程基本相同,第一次池化算法处理的过程和第二次池化算法处理的过程基本相同,也即卷积层1012和卷积层1014对接收到的像素点的处理过程基本相同,池化层1013和池化层1015对接收到的像素点的处理过程基本相同。因此,下面以第一次卷积算法处理的过程和第一次池化算法处理的过程为例进行说明。It should be noted that the process of the first convolution algorithm is basically the same as that of the second convolution algorithm, and the process of the first pooling algorithm is basically the same as that of the second pooling algorithm. That is, the convolutional layer 1012 and the convolutional layer 1014 process the received pixels basically the same, and the pooling layer 1013 and the pooling layer 1015 process the received pixels basically the same. Therefore, the following takes the process of the first convolution algorithm processing and the first pooling algorithm processing process as examples for illustration.
图1B是本公开实施例提供的一种图像的像素点分布示意图,如图1B所示,当卷积层1012接收到该图像包括的所有像素点时,按照第一预设顺序和第一预设局部区域确定第一个局部区域的像素点,并将第一个局部区域内包括的所有像素点的像素值按照预设权重进行加权叠加,并将得到的像素值确定为第一次卷积处理后的第一个像素点的像素值。Fig. 1B is a schematic diagram of the pixel point distribution of an image provided by an embodiment of the present disclosure. As shown in Fig. 1B , when the convolutional layer 1012 receives all the pixels included in the image, the first preset order and the first preset Set the local area to determine the pixels of the first local area, and perform weighted superposition of the pixel values of all the pixels included in the first local area according to the preset weight, and determine the obtained pixel value as the first convolution The pixel value of the first pixel after processing.
之后,按照该第一预设顺序移动该第一预设局部区域,移动距离为一列或一行像素点,得到第二个局部区域的像素点,并将第二个局部区域内包括的所有像素点的像素值按照预设权重进行加权叠加,并将得到的像素值确定为第一次卷积处理后的第二个像素点的像素值。依次类推,直至最后一个局部区域包括该图像的最后一批像素点,并将最后一个局部区域内包括的所有像素点的像素值按照预设权重进行加权叠加,将得到的像素值确定为第一次卷积处理后的最后一个像素点的像素值。此时,卷积层1012得到第一次卷积处理后的所有像素点的像素值,并将第一次卷积处理后的所有像素点的像素值传输至池化层1013。Afterwards, move the first preset local area according to the first preset order, and the moving distance is one column or one row of pixels to obtain the pixels of the second partial area, and convert all the pixels included in the second partial area The pixel values of are weighted and superimposed according to the preset weight, and the obtained pixel value is determined as the pixel value of the second pixel after the first convolution process. And so on, until the last local area includes the last batch of pixels of the image, and the pixel values of all the pixels included in the last local area are weighted and superimposed according to the preset weight, and the obtained pixel value is determined as the first The pixel value of the last pixel after the second convolution process. At this time, the convolution layer 1012 obtains the pixel values of all pixels after the first convolution processing, and transmits the pixel values of all pixel points after the first convolution processing to the pooling layer 1013 .
其中,第一预设顺序可以为从左至右从上到下的顺序,也可以为从上到下从左至右的顺序。第一预设局部区域可以为5×5个像素点的区域,也可以为6×6个像素点的区域。Wherein, the first preset order may be from left to right and from top to bottom, or may be from top to bottom and from left to right. The first preset local area may be an area of 5*5 pixels, or may be an area of 6*6 pixels.
另外,预设权重为预先为预设区域内每个像素点设置的权重。例如,对于图1B所示的局部区域,该局部区域内包括的所有像素点的预设权重均为1/16,此时对于第一个局部区域内的像素点,将该第一个局部区域包括的每个像素点的像素值与该预设权重相乘,然后将相乘后的每个像素值相加,得到第一次卷积处理后的第一个像素点的像素值。In addition, the preset weight is a weight set in advance for each pixel in the preset area. For example, for the local area shown in Figure 1B, the preset weights of all pixels included in the local area are 1/16. At this time, for the pixels in the first local area, the first local area The pixel value of each included pixel is multiplied by the preset weight, and then the multiplied pixel values are added to obtain the pixel value of the first pixel after the first convolution process.
如图1C所示,当池化层1013接收到第一次卷积处理后的所有像素点的像素值时,按照第二预设顺序和第二预设局部区域,确定第一个局部区域内的像素点,选取第一个局部区域内包括的所有像素点的像素值中的最大像素值,并将该最大像素值确定为第一次池化处理后的第一个像素点的像素值。As shown in Figure 1C, when the pooling layer 1013 receives the pixel values of all pixels after the first convolution process, according to the second preset order and the second preset local area, determine Select the maximum pixel value among the pixel values of all the pixel points included in the first local area, and determine the maximum pixel value as the pixel value of the first pixel point after the first pooling process.
之后,按照该第二预设顺序移动该第二预设局部区域,移动距离为预设个像素点,该预设个像素点的个数和第二预设局部区域的列数或行数相同,得到第二个局部区域的像素点。将第二个局部区域内包括的所有像素点的像素值中的最大像素值确定为第一次池化处理后的第二个像素点的像素值。依此类推,直至最后一个局部区域包括该第一次卷积处理后的所有像素点中的最后一批像素点,并将最后一个局部区域内包括的所有像素点的像素值中的最大像素值确定为第一次池化处理后的最后一个像素点的像素值。此时,池化层1013得到第一次池化处理后的所有像素点的像素值,并将第一次池化处理后的所有像素点的像素值传输至卷积层1014。Afterwards, move the second preset local area according to the second preset order, the moving distance is preset pixels, and the number of the preset pixels is the same as the number of columns or rows of the second preset partial area , to get the pixels of the second local area. The maximum pixel value among the pixel values of all the pixel points included in the second local area is determined as the pixel value of the second pixel point after the first pooling process. And so on, until the last local area includes the last batch of pixels among all the pixels after the first convolution process, and the maximum pixel value among the pixel values of all the pixels included in the last local area Determined as the pixel value of the last pixel after the first pooling process. At this time, the pooling layer 1013 obtains the pixel values of all pixels after the first pooling process, and transmits the pixel values of all pixels after the first pooling process to the convolution layer 1014 .
其中,第二预设顺序可以为从左至右从上到下的顺序,也可以为从上到下从左至右的顺序。第二预设局部区域可以为2×2个像素点的区域,也可以为3×3个像素点的区域。Wherein, the second preset order may be from left to right and from top to bottom, or may be from top to bottom and from left to right. The second preset local area may be an area of 2×2 pixels, or may be an area of 3×3 pixels.
例如,第一预设顺序和第二预设顺序均为从左至右从上到下的顺序,第一预设区域为5×5个像素点的区域,第二预设区域为2×2个像素点。若输入层得到的图像为28×28个像素点的图像,此时,卷积层1012得到第一次卷积处理后的像素点为24×24个像素点,池化层1013得到的第一次池化处理后的像素点为12×12个像素点。For example, both the first preset order and the second preset order are from left to right and from top to bottom, the first preset area is an area of 5×5 pixels, and the second preset area is 2×2 pixels. If the image obtained by the input layer is an image of 28×28 pixels, at this time, the convolution layer 1012 obtains the pixels after the first convolution process as 24×24 pixels, and the first convolution layer obtained by the pooling layer 1013 The pixels after the secondary pooling process are 12×12 pixels.
另外,需要说明的是,池化层可以将选取的局部区域内的最大像素值确定为池化处理后对应的像素点的像素值,当然可以通过其他方式确定该池化处理后的像素点的像素值。例如,池化层可以将选取的局部区域内的所有像素点的像素值的平均值确定为池化处理后对应的像素点的像素值。In addition, it should be noted that the pooling layer can determine the maximum pixel value in the selected local area as the pixel value of the corresponding pixel after pooling processing. Of course, the pixel value of the pixel point after pooling processing can be determined in other ways. Pixel values. For example, the pooling layer may determine an average value of pixel values of all pixel points in the selected local area as the pixel value of the corresponding pixel point after pooling processing.
值得注意的是,本公开实施例提供的CNN模型可以包括多个卷积层和多个池化层,本公开实施例在此不做具体限定,在图1A中仅以两个卷积层和两个池化层为例进行说明。It is worth noting that the CNN model provided by the embodiment of the present disclosure may include multiple convolutional layers and multiple pooling layers, which are not specifically limited in this embodiment of the present disclosure. In FIG. 1A, only two convolutional layers and Two pooling layers are used as an example for illustration.
另外需要说明的是,由于像素点的像素值通常用RGB(RED/GREEN/BULE,三原色光模式)三个分量来表示,因此,在对像素点的像素值进行处理的过程中,需分别对RGB三个分量分别进行处理,因此在图1A所示的CNN模型101中,卷积层1012和卷积层1014、以及池化层1013和池化层1015均包括三个模块,以分别对像素点的RGB三个分量进行处理。In addition, it should be noted that since the pixel value of a pixel is usually represented by three components of RGB (RED/GREEN/BULE, three primary color light modes), therefore, in the process of processing the pixel value of a pixel, it is necessary to separately The three components of RGB are processed separately. Therefore, in the CNN model 101 shown in FIG. The RGB three components of the point are processed.
(2)RNN模型(2) RNN model
由于传统的神经网络没有记忆功能,也即,对于传统的神经网络而言,其输入为独立的没有上下文关联的数据。但是实际应用中,输入通常为一些有明显上下文特征的序列化输入。比如需要预测视频中下一帧的播放内容,此时神经网络的输出必须依赖上一次的输入。也即,要求神经网络应具有记忆功能,而RNN模型即为一种具有记忆功能的神经网络。Since the traditional neural network has no memory function, that is, for the traditional neural network, its input is independent data without context association. But in practical applications, the input is usually some serialized input with obvious context characteristics. For example, it is necessary to predict the playback content of the next frame in the video. At this time, the output of the neural network must depend on the previous input. That is, it is required that the neural network should have a memory function, and the RNN model is a neural network with a memory function.
图1D为本公开实施例提供的一种RNN模型102的架构示意图,如图1D左侧所示,该RNN模型包括输入层1021、隐藏层1022和输出层1023三层结构,隐藏层1022为环形结构。其中,输入层1021和隐藏层1022相连,隐藏层1022和输出层1023相连。Figure 1D is a schematic diagram of the architecture of a RNN model 102 provided by an embodiment of the present disclosure. As shown on the left side of Figure 1D, the RNN model includes a three-layer structure of an input layer 1021, a hidden layer 1022, and an output layer 1023, and the hidden layer 1022 is a ring structure. Wherein, the input layer 1021 is connected to the hidden layer 1022 , and the hidden layer 1022 is connected to the output layer 1023 .
为了便于说明该RNN模型102的功能,将图1D所示的RNN模型102的结构按照如图1D右侧所示的结构展开。由于RNN模型的输入层接收到的数据为按照一定时间序列排序的数据,也即输入层接收到的数据为序列数据,为了便于说明,将该序列数据标记为x1、x2、…、xn,该序列数据中的各个数据分别对应的时刻为t1、t2、…、tn。In order to illustrate the function of the RNN model 102, the structure of the RNN model 102 shown in FIG. 1D is expanded according to the structure shown on the right side of FIG. 1D . Since the data received by the input layer of the RNN model is sorted according to a certain time sequence, that is, the data received by the input layer is sequence data, for the convenience of explanation, the sequence data is marked as x 1 , x 2 , ..., x n , the times corresponding to each data in the sequence data are t 1 , t 2 , . . . , t n .
如图1D右侧所示,在展开之后的RNN模型中,t1时刻输入层1021接收到的数据为x1,并将该数据x1传输至隐藏层1022,隐藏层1022对该x1进行处理,并将处理后的数据传输至输出层1023,得到t1时刻的输出数据。t2时刻输入层1021接收到的数据为x2,并将该数据x2传输至隐藏层1022,此时隐藏层1022根据t1时刻的输出数据对该x2进行处理,并将处理后的数据传输至输出层1023,得到t2时刻的输出数据。也即,在任意时刻ti,隐藏层1022除了接收到ti时刻输入层1021传输的数据xi,还接收到ti-1时刻的输出数据,并根据ti-1时刻的输出数据对数据xi进行处理,得到ti时刻的输出数据。As shown on the right side of Figure 1D, in the expanded RNN model, the data received by the input layer 1021 at time t1 is x 1 , and the data x 1 is transmitted to the hidden layer 1022, and the hidden layer 1022 processes x 1 process, and transmit the processed data to the output layer 1023 to obtain the output data at time t1 . The data received by the input layer 1021 at time t2 is x2 , and the data x2 is transmitted to the hidden layer 1022. At this time, the hidden layer 1022 processes the x2 according to the output data at time t1 , and the processed data x2 The data is transmitted to the output layer 1023 to obtain the output data at time t2 . That is, at any time t i , the hidden layer 1022 not only receives the data x i transmitted by the input layer 1021 at time t i , but also receives the output data at time t i-1 , and according to the output data at time t i-1 Data x i is processed to obtain the output data at time t i .
下面对本公开实施例的应用场景进行介绍。现实生活中,当用户看到一张图像时,用户可以直接根据眼睛看到的结果确定该图像的类别,如看到一张猫的图像,确定该图像的类别为猫;看到一张狗的图像,确定该图像的类别为狗。但是对于计算机而言,当计算机接收到一张图像时,实际上接收到的是该图像包括的所有的像素点的像素值。因此,计算机需要根据接收到的该图像包括的所有的像素点的像素值确定该图像的类别,也即计算机需要对该图像进行分类。本公开实施例提供的图像分类方法就应用于计算机对该图像进行分类的场景中。为了后续便于说明,将需要进行分类的图像称为目标图像。 Application scenarios of the embodiments of the present disclosure are introduced below . In real life, when a user sees an image, the user can directly determine the category of the image based on the results seen by the eyes, such as seeing a cat image, determine the category of the image as a cat; seeing a dog , determine the category of the image as a dog. But for a computer, when the computer receives an image, it actually receives the pixel values of all the pixels included in the image. Therefore, the computer needs to determine the category of the image according to the received pixel values of all the pixels included in the image, that is, the computer needs to classify the image. The image classification method provided by the embodiments of the present disclosure is applied to a scenario where a computer classifies the image. For the convenience of subsequent description, the image that needs to be classified is called the target image.
由于相关技术中,计算机对图像进行分类主要是通过单标签分类方法来实现。当一个图像中包括至少两种类别的内容时,通过该单标签分类方法只能确定该图像的类别为该至少两种类别中的一种,而不能确定该图像同时属于该至少两种类别,也即上述单标签分类方法无法对包括至少两种类别的内容的图像进行分类。In the related art, the computer classifies images mainly through a single-label classification method. When an image includes content of at least two categories, the single-label classification method can only determine that the category of the image is one of the at least two categories, but cannot determine that the image belongs to the at least two categories at the same time, That is, the above-mentioned single-label classification method cannot classify images including at least two types of content.
因此,在本公开实施例中,在通过CNN模型确定目标图像的特征之后,通过RNN模型对目标图像的特征进行处理,以得到目标图像的多个标签。由于目标图像的特征由CNN模型包括的最后一个池化层输出,也即,CNN模型在得到目标图像的特征之后,并没有根据该目标图像的特征确定该目标图像属于的各个类别的概率,而是直接将该目标图像的特征通过RNN模型进行处理,以得到该目标图像的多个标签,从而实现对对包括至少两种类别的内容的图像进行分类。Therefore, in the embodiment of the present disclosure, after the features of the target image are determined by the CNN model, the features of the target image are processed by the RNN model to obtain multiple labels of the target image. Since the features of the target image are output by the last pooling layer included in the CNN model, that is, after the CNN model obtains the features of the target image, it does not determine the probability of each category that the target image belongs to according to the features of the target image, and The method is to directly process the features of the target image through the RNN model to obtain multiple labels of the target image, so as to classify images including at least two types of content.
下面将结合附图为本公开实施例提供的图像分类方法进行详细说明。The image classification method provided by the embodiment of the present disclosure will be described in detail below with reference to the accompanying drawings.
图2为本公开实施例提供的一种图像分类方法流程图,该方法应用于任何需要对图像进行分类的设备中,该设备可以为终端或服务器。如图2所示,该方法包括以下步骤。FIG. 2 is a flow chart of an image classification method provided by an embodiment of the present disclosure. The method is applied to any device that needs to classify images, and the device may be a terminal or a server. As shown in Figure 2, the method includes the following steps.
在步骤201中,通过预先训练的CNN模型对需要进行分类的目标图像进行处理,以确定该CNN模型包括的最后一个池化层输出的特征。In step 201, the pre-trained CNN model is used to process the target image to be classified, so as to determine the features output by the last pooling layer included in the CNN model.
在步骤202中,将确定的特征作为该目标图像的特征,通过预先训练的RNN模型对该目标图像的特征进行处理,得到该目标图像的多个标签,该多个标签中的每个标签用于指示该目标图像中的图像内容所属的类别。In step 202, the determined features are used as the features of the target image, and the features of the target image are processed by the pre-trained RNN model to obtain multiple labels of the target image, and each label in the multiple labels is used to indicate the category to which the image content in the target image belongs.
在本公开实施例中,通过CNN模型确定目标图像的特征,并通过RNN模型对目标图像的特征进行处理,以得到目标图像的多个标签。由于目标图像的特征由CNN模型包括的最后一个池化层输出,也即,CNN模型在得到目标图像的特征之后,并没有根据该目标图像的特征确定该目标图像属于的各个类别的概率,而是直接将该目标图像的特征通过RNN模型进行处理,以得到该目标图像的多个标签,从而实现对对包括至少两种类别的内容的图像进行分类。In the embodiment of the present disclosure, the CNN model is used to determine the features of the target image, and the RNN model is used to process the features of the target image to obtain multiple labels of the target image. Since the features of the target image are output by the last pooling layer included in the CNN model, that is, after the CNN model obtains the features of the target image, it does not determine the probability of each category that the target image belongs to according to the features of the target image, and The method is to directly process the features of the target image through the RNN model to obtain multiple labels of the target image, so as to classify images including at least two types of content.
可选地,通过预先训练的RNN模型对该目标图像的特征进行处理,得到该目标图像的多个标签,包括:Optionally, the features of the target image are processed by the pre-trained RNN model to obtain multiple labels of the target image, including:
将该目标图像的特征作为该RNN模型的输入,并通过该RNN模型对该目标图像的特征进行处理,得到第一标签,第一标签为该多个标签中的一个;The feature of the target image is used as the input of the RNN model, and the feature of the target image is processed by the RNN model to obtain a first label, and the first label is one of the multiple labels;
将第一标签作为该RNN模型的输入,并通过该RNN模型对该目标图像的特征和第一标签进行处理,得到第二标签,第二标签为多个标签中的一个;Using the first label as the input of the RNN model, and processing the features of the target image and the first label through the RNN model to obtain a second label, which is one of a plurality of labels;
确定循环次数,该循环次数是指该RNN模型循环对输入的标签和该目标图像的特征进行处理的次数;Determine the number of cycles, the number of cycles refers to the number of times the RNN model cycles to process the input label and the features of the target image;
当该循环次数小于或等于预设次数时,将第二标签继续作为该RNN模型的输入,循环执行上述操作,直至该循环次数大于预设次数时,得到多个标签。When the number of cycles is less than or equal to the preset number of times, the second label continues to be used as the input of the RNN model, and the above operations are performed cyclically until the number of cycles is greater than the preset number of times, and multiple labels are obtained.
可选地,通过预先训练的RNN模型对该目标图像的特征进行处理,得到该目标图像的多个标签,包括:Optionally, the features of the target image are processed by the pre-trained RNN model to obtain multiple labels of the target image, including:
将该目标图像的特征作为该RNN模型的输入,并通过该RNN模型对该目标图像的特征进行处理,得到第一标签,第一标签为该多个标签中的一个;The feature of the target image is used as the input of the RNN model, and the feature of the target image is processed by the RNN model to obtain a first label, and the first label is one of the multiple labels;
将第一标签作为该RNN模型的输入,并通过该RNN模型对该目标图像的特征和第一标签进行处理,得到第二标签,第二标签为该多个标签中的一个;The first label is used as the input of the RNN model, and the feature of the target image and the first label are processed by the RNN model to obtain a second label, and the second label is one of the plurality of labels;
确定该目标图像同时属于当前确定得到的所有标签对应的类别的概率;Determine the probability that the target image belongs to the categories corresponding to all the currently determined labels;
当该概率大于或等于预设概率时,将第二标签继续作为该RNN模型的输入,循环执行上述操作,直至该概率小于该预设概率时,得到该多个标签。When the probability is greater than or equal to the preset probability, the second label is continuously used as the input of the RNN model, and the above operations are performed cyclically until the probability is less than the preset probability, and the multiple labels are obtained.
可选地,通过预先训练的CNN模型对目标图像进行处理之前,还包括:Optionally, before processing the target image through the pre-trained CNN model, it also includes:
确定训练样本集,该训练样本集包括多张图像和预先为每张图像设置的多个标签;Determine a training sample set, the training sample set includes a plurality of images and a plurality of labels pre-set for each image;
根据该多张图像,对初始化CNN模型进行训练,得到训练后的CNN模型和该多张图像中每张图像的特征;According to the multiple images, the initialization CNN model is trained to obtain the trained CNN model and the features of each image in the multiple images;
根据该多张图像中每张图像的特征,对初始化RNN模型进行训练,得到训练后的RNN模型和该多张图像中每张图像的多个标签;According to the feature of each image in the plurality of images, the initialization RNN model is trained to obtain the trained RNN model and multiple labels of each image in the plurality of images;
当通过训练得到的该多张图像中每张图像的多个标签与预先为对应图像设置的多个标签之间的误差大于预设误差时,通过梯度下降法调整该初始化CNN模型和该初始化RNN模型,并返回根据该多张图像,对初始化CNN模型进行训练的步骤,直至通过训练得到的该多张图像中每张图像的多个标签与预先为对应图像设置的多个标签之间的误差小于或等于该预设误差为止,并将最终训练得到的CNN模型确定为该预先训练的CNN模型,将最终训练得到的RNN模型确定为该预先训练的RNN模型。When the error between the multiple labels of each image in the multiple images obtained through training and the multiple labels set for the corresponding image in advance is greater than the preset error, the initialization CNN model and the initialization RNN are adjusted by the gradient descent method model, and return to the step of training the initialized CNN model according to the multiple images until the error between the multiple labels of each image in the multiple images obtained through training and the multiple labels pre-set for the corresponding image is less than or equal to the preset error, and the final trained CNN model is determined as the pre-trained CNN model, and the final trained RNN model is determined as the pre-trained RNN model.
上述所有可选技术方案,均可按照任意结合形成本公开的可选实施例,本公开实施例对此不再一一赘述。All the above optional technical solutions may be combined in any way to form optional embodiments of the present disclosure, which will not be described in detail in the embodiments of the present disclosure.
图3为本公开实施例提供的另一种图像分类方法流程图,该方法应用于任何需要对图像进行分类的设备中,该设备可以为终端或服务器。如图3所示,该方法包括以下步骤。FIG. 3 is a flow chart of another image classification method provided by an embodiment of the present disclosure. The method is applied to any device that needs to classify images, and the device may be a terminal or a server. As shown in Figure 3, the method includes the following steps.
在步骤301中,确定预先训练的CNN模型和预先训练的RNN模型。In step 301, a pre-trained CNN model and a pre-trained RNN model are determined.
由于本公开实施例是通过CNN模型和RNN模型来对目标图像进行分类,因此,在对目标图像进行分类之前,需先对CNN模型和RNN模型进行训练,也即,确定预先训练的CNN模型和预先训练的RNN模型。Since the embodiment of the present disclosure classifies the target image through the CNN model and the RNN model, before classifying the target image, the CNN model and the RNN model need to be trained first, that is, the pre-trained CNN model and the RNN model must be determined. Pre-trained RNN models.
其中,步骤301的实现过程可以为:确定训练样本集,该训练样本集包括多张图像和预先为每张图像设置的多个标签。根据该多张图像,对初始化CNN模型进行训练,得到训练后的CNN模型和该多张图像中每张图像的特征。根据该多张图像中每张图像的特征,对初始化RNN模型进行训练,得到训练后的RNN模型和该多张图像中每张图像的多个标签。Wherein, the implementation process of step 301 may be: determine a training sample set, the training sample set includes a plurality of images and a plurality of labels pre-set for each image. According to the plurality of images, the initialized CNN model is trained to obtain the trained CNN model and the features of each image in the plurality of images. According to the feature of each image in the plurality of images, the initialized RNN model is trained to obtain the trained RNN model and multiple labels of each image in the plurality of images.
当通过训练得到的多张图像中每张图像的多个标签与预先为对应图像设置的多个标签之间的误差大于预设误差时,通过梯度下降法调整该初始化CNN模型和该初始化RNN模型,并返回根据该多张图像,对初始化CNN模型进行训练的步骤,直至通过训练得到的该多张图像中每张图像的多个标签与预先为对应图像设置的多个标签之间的误差小于或等于该预设误差为止,并将最终训练得到的CNN模型确定为该预先训练的CNN模型,将最终训练得到的RNN模型确定为该预先训练的RNN模型。When the error between the multiple labels of each image in the multiple images obtained through training and the multiple labels set for the corresponding image in advance is greater than the preset error, the initialization CNN model and the initialization RNN model are adjusted by the gradient descent method , and return to the step of training the initialized CNN model according to the multiple images until the error between the multiple labels of each image in the multiple images obtained through training and the multiple labels pre-set for the corresponding image is less than or equal to the preset error, and the final trained CNN model is determined as the pre-trained CNN model, and the final trained RNN model is determined as the pre-trained RNN model.
也即,在第一次对初始化CNN模型和初始化RNN模型训练之后,根据训练得到的该多张图像中的每张图像的多个标签和预先为对应图像设置的多个标签,判断是否需要继续对初始化CNN模型和初始化RNN继续进行训练。若确定需要继续对初始化CNN模型和初始化RNN继续进行训练,则按照上述方法对初始化CNN模型和初始化RNN进行调整,得到第一次调整后的CNN模型和RNN模型,并按照上述训练初始化CNN模型和初始化RNN模型的过程,训练第一次调整后的CNN模型和第一次调整后的RNN模型,得到此次训练得到的该多张图像中的每张图像的多个标签,返回执行根据训练得到的该多张图像中的每张图像的多个标签和预先为对应图像设置的多个标签,判断是否需要继续对初始化CNN模型和初始化RNN继续进行训练的操作,循环执行以上过程。直至判断出不需要对调整后的CNN模型和调整后的RNN继续进行训练。That is, after the first training of the initialized CNN model and the initialized RNN model, according to the plurality of labels of each image in the plurality of images obtained through training and the plurality of labels set in advance for the corresponding images, it is judged whether it is necessary to continue Continue training on the initialized CNN model and initialized RNN. If it is determined that it is necessary to continue training the initialized CNN model and initialized RNN, adjust the initialized CNN model and initialized RNN according to the above method to obtain the first adjusted CNN model and RNN model, and initialize the CNN model and RNN according to the above training. The process of initializing the RNN model, training the CNN model adjusted for the first time and the RNN model adjusted for the first time, and obtaining the multiple labels of each image in the multiple images obtained in this training, and returning to execute according to the training The multiple labels of each image in the multiple images and the multiple labels set in advance for the corresponding images, determine whether to continue the operation of training the initialized CNN model and initialized RNN, and execute the above process cyclically. Until it is judged that the adjusted CNN model and the adjusted RNN do not need to be continuously trained.
其中,训练样本集为预先确定的一个图像集合,该图像集合包括多张图像和预先为每张图像设置的多个标签。为每张图像设置多个标签可以通过管理人员添加的方式来实现,也即当接收到管理人员通过预设操作发送的标签添加指令时,将该标签添加指令中携带的多个标签设置为该每张图像的多个标签。Wherein, the training sample set is a predetermined set of images, and the set of images includes multiple images and multiple labels pre-set for each image. Setting multiple tags for each image can be achieved by adding the manager, that is, when receiving the tag adding instruction sent by the manager through the preset operation, the multiple tags carried in the tag adding instruction are set as the Multiple labels per image.
例如,当训练样本集包括1000张图像,管理人员可以预先为该1000张图像中的每张图像添加5个标签,也即该训练样本集包括1000张图像和预先为每张图像设置的5个标签。For example, when the training sample set includes 1000 images, the manager can pre-add 5 labels to each of the 1000 images, that is, the training sample set includes 1000 images and 5 labels pre-set for each image Label.
另外,通过梯度下降法调整该初始化CNN模型和该初始化RNN模型,也即,根据训练得到的多张图像中每张图像的多个标签与预先为对应图像设置的多个标签之间的误差,确定梯度向量,该梯度向量为训练得到的多张图像中每张图像的多个标签与预先为对应图像设置的多个标签之间的误差下降的方向向量。根据该梯度向量,对初始化CNN模型和RNN模型进行调整。In addition, the initialized CNN model and the initialized RNN model are adjusted by the gradient descent method, that is, according to the errors between the multiple labels of each image in the multiple images obtained through training and the multiple labels set in advance for the corresponding images, A gradient vector is determined, and the gradient vector is a direction vector in which errors between multiple labels of each image in the multiple images obtained through training and multiple labels pre-set for the corresponding images decrease. According to the gradient vector, the initialization CNN model and the RNN model are adjusted.
由于梯度向量为训练得到的多张图像中每张图像的多个标签与预先为对应图像设置的多个标签之间的误差下降的方向向量,因此当通过调整之后的CNN模型和调整之后的RNN模型重新对训练样本集进行训练时,相对于上一次训练得到的多张图像中每张图像的多个标签与预先为对应图像设置的多个标签之间的误差,此次训练得到的多张图像中每张图像的多个标签与预先为对应图像设置的多个标签之间的误差将会下降。Since the gradient vector is the direction vector of the error drop between the multiple labels of each image in the multiple images obtained through training and the multiple labels set for the corresponding image in advance, when the adjusted CNN model and the adjusted RNN When the model re-trains the training sample set, compared to the error between the multiple labels of each image in the multiple images obtained in the previous training and the multiple labels set for the corresponding images in advance, the multiple images obtained in this training The error between the multiple labels for each image in the image and the multiple labels pre-set for the corresponding image will drop.
在步骤302中,通过预先训练的CNN模型对需要进行分类的目标图像进行处理,以确定该CNN模型包括的最后一个池化层输出的特征。In step 302, the pre-trained CNN model is used to process the target image to be classified, so as to determine the features output by the last pooling layer included in the CNN model.
以图1A所示的CNN模型为例对步骤302进行详细说明。也即,该预先训练的CNN模型包括两对卷积—池化层,每对卷积—池化层包括一个卷积层和一个池化层。Step 302 is described in detail by taking the CNN model shown in FIG. 1A as an example. That is, the pre-trained CNN model includes two pairs of convolution-pooling layers, each pair of convolution-pooling layers includes a convolutional layer and a pooling layer.
如图1A所示,该预先训练的CNN模型包括的输入层1011将目标图像包括的所有像素点的像素值传输至CNN模型包括的第一对卷积—池化层。第一对卷积—池化层根据给目标图像包括的所有像素点的像素值对该目标图像进行处理,并将处理后的像素点传输至下一对卷积—池化层包括的卷积层,由下一对卷积—池化层对处理后的像素点继续进行处理,直至第二对卷积—池化层输出该目标图像的特征。As shown in FIG. 1A , the input layer 1011 included in the pre-trained CNN model transmits the pixel values of all pixels included in the target image to the first pair of convolution-pooling layers included in the CNN model. The first pair of convolution-pooling layers processes the target image according to the pixel values of all pixels included in the target image, and transmits the processed pixels to the next pair of convolution-pooling layers. The next pair of convolution-pooling layers continues to process the processed pixels until the second pair of convolution-pooling layers outputs the features of the target image.
其中,第一对卷积—池化层包括的第一卷积层1012对目标图像包括的所有像素点进行第一次卷积算法处理,得到第一次卷积处理后的像素点,并将第一次卷积处理后的像素点输入到第一对卷积—池化层包括的第一池化层1013。第一池化层1013对第一次卷积处理后的像素点进行第一次池化算法处理,得到第一次池化处理后的像素点,并将第一次池化处理后的像素点传输至第二对卷积—池化层,由第二对卷积—池化层按照上述同样的方法进行第二次卷积算法处理和第二次池化算法处理。。Wherein, the first convolution layer 1012 included in the first pair of convolution-pooling layers performs the first convolution algorithm processing on all the pixels included in the target image to obtain the pixels after the first convolution processing, and The pixels after the first convolution process are input to the first pooling layer 1013 included in the first pair of convolution-pooling layers. The first pooling layer 1013 performs the first pooling algorithm processing on the pixels after the first convolution processing, obtains the pixels after the first pooling processing, and converts the pixels after the first pooling processing It is transmitted to the second pair of convolution-pooling layers, and the second pair of convolution-pooling layers performs the second convolution algorithm processing and the second pooling algorithm processing in the same way as above. .
其中,第一次卷积算法处理和第二次卷积算法处理,以及第一次池化算法处理和第二次池化算法处理的详细过程可以参考图1A所示的CNN模型的卷积算法处理过程和池化算法处理过程,在此不再详细阐述。Among them, the detailed process of the first convolution algorithm processing and the second convolution algorithm processing, as well as the first pooling algorithm processing and the second pooling algorithm processing can refer to the convolution algorithm of the CNN model shown in Figure 1A The processing process and pooling algorithm processing process will not be described in detail here.
需要说明的是,与图1A所示的CNN模型对图像进行分类的过程相比,本公开实施例提供的预先训练的CNN模型在确定出该CNN模型包括的最后一个池化层输出的特征时,并没有将该最后一个池化层输出的特征传输至全连接层,而是将该最后一个池化层输出的特征传输至预先训练的RNN模型。It should be noted that, compared with the process of classifying images by the CNN model shown in FIG. 1A , when the pre-trained CNN model provided by the embodiment of the present disclosure determines the features output by the last pooling layer included in the CNN model, , the features output by the last pooling layer are not transferred to the fully connected layer, but the features output by the last pooling layer are transferred to the pre-trained RNN model.
也即,在确定出该CNN模型包括的最后一个池化层输出的特征时,将确定的特征作为该目标图像的特征,并通过预先训练的RNN模型对该目标图像的特征进行处理,得到该目标图像的多个标签,该多个标签中的每个标签用于指示该目标图像中的图像内容所属的类别。其中,通过预先训练的RNN模型对该目标图像的特征进行处理,得到该目标图像的多个标签可以通过下述步骤303至步骤306来实现。That is, when the features output by the last pooling layer included in the CNN model are determined, the determined features are used as the features of the target image, and the features of the target image are processed by the pre-trained RNN model to obtain the Multiple tags of the target image, each of the multiple tags is used to indicate the category to which the image content in the target image belongs. Wherein, the features of the target image are processed by the pre-trained RNN model, and multiple labels of the target image can be obtained through the following steps 303 to 306 .
在步骤303中,将该目标图像的特征作为该RNN模型的输入,并通过该RNN模型对该目标图像的特征进行处理,得到第一标签,第一标签为该多个标签中的一个。In step 303, the feature of the target image is used as an input of the RNN model, and the feature of the target image is processed by the RNN model to obtain a first label, and the first label is one of the multiple labels.
由步骤301可知,该预先训练的RNN模型是根据训练样本集中的多张图像和预先为每张图像设置的多个标签确定的,因此,当将该目标图像的特征作为该RNN模型的输入时,该RNN模型可以输出一个标签,也即得到该多个标签中的第一标签。It can be seen from step 301 that the pre-trained RNN model is determined according to multiple images in the training sample set and multiple labels pre-set for each image. Therefore, when the features of the target image are used as the input of the RNN model , the RNN model can output a label, that is, obtain the first label among the multiple labels.
以图1D所示的RNN模型为例进行说明,当t1时刻该RNN模型输入层接收到目标图像的特征时,输入层将该目标图像的特征传输至隐藏层,由隐藏层对该目标图像的特征进行处理,得到第一标签。也即第一标签为t1时刻的输出数据,隐藏层将该第一标签传输至输出层,由输出层输出该第一标签。Taking the RNN model shown in Figure 1D as an example for illustration, when the input layer of the RNN model receives the features of the target image at time t1 , the input layer transmits the features of the target image to the hidden layer, and the hidden layer takes the target image The features are processed to get the first label. That is, the first label is the output data at time t1 , the hidden layer transmits the first label to the output layer, and the output layer outputs the first label.
在步骤304中,将第一标签作为该RNN模型的输入,并通过该RNN模型对该目标图像的特征和第一标签进行处理,得到第二标签,第二标签为多个标签中的一个。In step 304, the first label is used as an input of the RNN model, and the features of the target image and the first label are processed through the RNN model to obtain a second label, which is one of multiple labels.
如图1D所示,由于t2时刻该RNN模型的输入层并没有接收到下一个数据,此时隐藏层继续将t1时刻该RNN模型输入层接收到目标图像的特征确定为t2时刻的输入数据x2,并根据t1时刻的输出数据第一标签,对该目标图像的特征继续进行处理,得到第二标签。As shown in Figure 1D, since the input layer of the RNN model did not receive the next data at time t2 , the hidden layer continues to determine the feature of the target image received by the input layer of the RNN model at time t1 as the time t2 Input data x 2 , and continue to process the features of the target image according to the first label of the output data at time t 1 to obtain the second label.
也即,在图1D所示的任一时刻ti,该RNN模型的隐藏层直接将t1时刻该RNN模型输入层接收到目标图像的特征确定为ti时刻的输入数据xi,并根据上一时刻得到的第i-1个标签,对该目标对象的特征继续进行处理,以得到第i个标签。That is, at any time t i shown in Figure 1D, the hidden layer of the RNN model directly determines the features of the target image received by the input layer of the RNN model at time t 1 as the input data xi at time t i , and according to The i-1th label obtained at the previous moment continues to process the characteristics of the target object to obtain the i-th label.
在步骤305中,确定循环次数,该循环次数是指该RNN模型循环对输入的标签和该目标图像的特征进行处理的次数。In step 305, the number of cycles is determined, and the number of cycles refers to the number of times the RNN model cycles to process the input labels and the features of the target image.
在图1D所示的RNN模型中,由于该RNN模型为循环的神经网络模型,因此,实际应用中为了避免该RNN模型无限循环下去,通常需要为该RNN模型设置循环终止条件。In the RNN model shown in FIG. 1D , since the RNN model is a cyclic neural network model, in order to prevent the RNN model from infinitely looping in practical applications, it is usually necessary to set a loop termination condition for the RNN model.
在一种可能的实现方式中,可以通过循环次数为该RNN模型设置终止条件。也即,在RNN模型进行如图1D所示的循环过程中,在得到一个标签之后,确定循环次数。并根据该循环次数,判断是否需要继续进行循环操作。其中,判断是否需要继续进行循环操作的过程可以通过下述步骤306来实现。In a possible implementation manner, a termination condition may be set for the RNN model through the number of cycles. That is, when the RNN model performs the cycle as shown in FIG. 1D , after obtaining a label, the number of cycles is determined. And according to the number of cycles, it is judged whether the cycle operation needs to be continued. Wherein, the process of judging whether the loop operation needs to be continued can be realized through the following step 306 .
在步骤306中,当该循环次数小于或等于预设次数时,将第二标签继续作为该RNN模型的输入,循环执行上述操作,直至该循环次数大于预设次数时,得到多个标签。In step 306, when the number of cycles is less than or equal to the preset number of times, the second label is continuously used as the input of the RNN model, and the above operations are performed cyclically until the number of cycles is greater than the preset number of times, and multiple labels are obtained.
其中,在得到第二个标签之后,确定循环次数为1;在得到第三个标签之后,确定循环次数为2;依次类推,在得到第i个标签之后,确定循环次数为i-1。Wherein, after the second label is obtained, the number of cycles is determined to be 1; after the third label is obtained, the number of cycles is determined to be 2; and so on, after the i-th label is obtained, the number of cycles is determined to be i-1.
预设次数为预先设置的次数,该预设次数可以为5、10或15等。例如,预设次数为10,在得到第i个标签之后,确定循环次数为i-1,并判断该循环次数i-1是否大于5,当i-1小于或等于大于5时,继续上述循环操作,直至判断出i-1大于5,此时,得到该目标图像的多个标签。The preset number of times is a preset number of times, and the preset number of times can be 5, 10 or 15, etc. For example, the preset number of times is 10. After getting the i-th label, determine the number of cycles to be i-1, and judge whether the number of cycles i-1 is greater than 5. When i-1 is less than or equal to greater than 5, continue the above cycle Operate until it is judged that i-1 is greater than 5, at this time, multiple labels of the target image are obtained.
在本公开实施例中,通过CNN模型确定目标图像的特征,并通过RNN模型对目标图像的特征进行处理,以得到目标图像的多个标签。由于目标图像的特征由CNN模型包括的最后一个池化层输出,也即,CNN模型在得到目标图像的特征之后,并没有根据该目标图像的特征确定该目标图像属于的各个类别的概率,而是直接将该目标图像的特征通过RNN模型进行处理,以得到该目标图像的多个标签,从而实现对对包括至少两种类别的内容的图像进行分类。In the embodiment of the present disclosure, the CNN model is used to determine the features of the target image, and the RNN model is used to process the features of the target image to obtain multiple labels of the target image. Since the features of the target image are output by the last pooling layer included in the CNN model, that is, after the CNN model obtains the features of the target image, it does not determine the probability of each category that the target image belongs to according to the features of the target image, and The method is to directly process the features of the target image through the RNN model to obtain multiple labels of the target image, so as to classify images including at least two types of content.
可选地,在RNN模型进行如图1D所示的循环过程中,除了可以通过图3实施例中的步骤305和步骤306为该RNN模型设置循环终止条件,也可以通过其他方式为该RNN模型设置循环终止条件,下述实施例将提供另一种设置循环终止条件的实现方式。Optionally, during the cycle process of the RNN model as shown in Figure 1D, in addition to setting the loop termination condition for the RNN model through steps 305 and 306 in the embodiment of Figure 3, it is also possible to set the cycle termination condition for the RNN model in other ways To set the loop termination condition, the following embodiment will provide another implementation manner of setting the loop termination condition.
图4为本公开实施例提供的另一种图像分类方法流程图,该方法应用于任何需要对图像进行分类的设备中,该设备可以为终端或服务器。如图4所示,该方法包括以下步骤。FIG. 4 is a flow chart of another image classification method provided by an embodiment of the present disclosure. The method is applied to any device that needs to classify images, and the device may be a terminal or a server. As shown in Figure 4, the method includes the following steps.
在步骤401中,确定预先训练的CNN模型和预先训练的RNN模型。In step 401, a pre-trained CNN model and a pre-trained RNN model are determined.
其中,步骤401的实现过程可以参考图3实施例中的步骤301的实现过程,在此不在详细阐述。For the implementation process of step 401, reference may be made to the implementation process of step 301 in the embodiment of FIG. 3 , which will not be described in detail here.
在步骤402中,通过预先训练的CNN模型对需要进行分类的目标图像进行处理,以确定该CNN模型包括的最后一个池化层输出的特征。In step 402, the pre-trained CNN model is used to process the target image to be classified, so as to determine the features output by the last pooling layer included in the CNN model.
其中,步骤402的实现过程可以参考图3实施例中的步骤302的实现过程,在此不在详细阐述。For the implementation process of step 402, reference may be made to the implementation process of step 302 in the embodiment of FIG. 3 , which will not be described in detail here.
此时,将确定的特征作为该目标图像的特征,并通过预先训练的RNN模型对该目标图像的特征进行处理,得到该目标图像的多个标签,该多个标签中的每个标签用于指示该目标图像中的图像内容所属的类别。其中,通过预先训练的RNN模型对该目标图像的特征进行处理,得到该目标图像的多个标签可以通过下述步骤403至步骤406来实现。At this time, the determined features are used as the features of the target image, and the features of the target image are processed through the pre-trained RNN model to obtain multiple labels of the target image, and each label in the multiple labels is used for Indicates the category to which the image content in this target image belongs. Wherein, the features of the target image are processed by the pre-trained RNN model to obtain multiple labels of the target image through the following steps 403 to 406 .
在步骤403中,将该目标图像的特征作为该RNN模型的输入,并通过该RNN模型对该目标图像的特征进行处理,得到第一标签,第一标签为该多个标签中的一个。In step 403, the feature of the target image is used as an input of the RNN model, and the feature of the target image is processed by the RNN model to obtain a first label, and the first label is one of the multiple labels.
其中,步骤403的实现过程可以参考图3实施例中的步骤303的实现过程,在此不在详细阐述。For the implementation process of step 403, reference may be made to the implementation process of step 303 in the embodiment of FIG. 3 , which will not be described in detail here.
在步骤404中,将第一标签作为该RNN模型的输入,并通过该RNN模型对该目标图像的特征和第一标签进行处理,得到第二标签,第二标签为该多个标签中的一个。In step 404, the first label is used as the input of the RNN model, and the features of the target image and the first label are processed through the RNN model to obtain a second label, which is one of the multiple labels .
其中,步骤404的实现过程可以参考图3实施例中的步骤304的实现过程,在此不在详细阐述。For the implementation process of step 404, reference may be made to the implementation process of step 304 in the embodiment of FIG. 3 , which will not be described in detail here.
在步骤405中,确定该目标图像同时属于当前确定得到的所有标签对应的类别的概率。In step 405, the probability that the target image belongs to categories corresponding to all currently determined tags is determined.
本公开实施例提供了另一种为该RNN模型设置循环终止条件的实现方式。也即,在RNN模型进行如图1D所示的循环过程中,在得到一个标签之后,确定该目标图像同时属于当前确定得到的所有标签对应的类别的概率。并根据该概率,判断是否需要继续进行循环操作。其中,判断是否需要继续进行循环操作的过程可以通过下述步骤406来实现。The embodiment of the present disclosure provides another implementation manner of setting a loop termination condition for the RNN model. That is, in the cyclic process shown in FIG. 1D by the RNN model, after obtaining a label, determine the probability that the target image belongs to the categories corresponding to all the currently determined labels. And according to the probability, it is judged whether to continue the loop operation. Wherein, the process of judging whether the loop operation needs to be continued can be realized through the following step 406 .
由于在现有的RNN模型中,RNN模型在任一时刻ti,确定出ti时刻的输出数据之后,均将确定当前得到的所有的输出数据同时出现的概率。因此,在本明实施例中,在每得到一个标签之后,RNN模型均会确定出当前得到的所有标签同时出现的概率,也即确定出该目标图像同时属于当前确定得到的所有标签对应的类别的概率。Because in the existing RNN model, at any time t i , the RNN model will determine the probability of simultaneous occurrence of all output data currently obtained after determining the output data at time t i . Therefore, in the embodiment of the present invention, after each label is obtained, the RNN model will determine the probability that all the currently obtained labels appear at the same time, that is, determine that the target image belongs to the category corresponding to all the currently determined labels at the same time The probability.
由于随着循环次数的增加,当前得到的所有的输出数据同时出现的概率将越来越小,也即随着循环次数的增加,该目标图像同时属于当前确定得到的所有标签对应的类别的概率也将越来越小。因此,可以将设置预设概率,并将该预设概率确定为循环终止条件。也即,在RNN模型循环的过程中,在得到一个标签之后,确定该概率。并根据该概率,判断是否需要继续进行循环操作。其中,判断是否需要继续进行循环操作的过程可以通过下述步骤306来实现。As the number of cycles increases, the probability that all output data currently obtained will appear at the same time will become smaller and smaller, that is, as the number of cycles increases, the probability that the target image belongs to the category corresponding to all the currently determined labels will also get smaller. Therefore, a preset probability may be set and determined as a loop termination condition. That is, during the cycle of the RNN model, after a label is obtained, the probability is determined. And according to the probability, it is judged whether to continue the loop operation. Wherein, the process of judging whether the loop operation needs to be continued can be realized through the following step 306 .
在步骤406中,当该概率大于或等于预设概率时,将第二标签继续作为该RNN模型的输入,循环执行上述操作,直至该概率小于该预设概率时,得到该多个标签。In step 406, when the probability is greater than or equal to the preset probability, the second label is continuously used as the input of the RNN model, and the above operations are performed cyclically until the probability is less than the preset probability, and the multiple labels are obtained.
其中,预设概率为预先设置的概率,该预设概率可以为0.01、0.02或0.03等。例如,预设概率为0.01,在得到第i个标签之后,确定该目标图像同时属于当前确定得到的所有标签对应的类别的概率,并判断该概率是否大于或等于0.01,当该概率大于或等于大于0.01时,继续上述循环操作,直至判断出该概率小于0.01,此时,得到该目标图像的多个标签。Wherein, the preset probability is a preset probability, and the preset probability may be 0.01, 0.02, or 0.03. For example, the preset probability is 0.01. After obtaining the i-th label, determine the probability that the target image belongs to the category corresponding to all the currently determined labels at the same time, and judge whether the probability is greater than or equal to 0.01. When the probability is greater than or equal to If it is greater than 0.01, continue the above loop operation until it is judged that the probability is less than 0.01, at this time, multiple labels of the target image are obtained.
需要说明的是,在本公开实施例中,可以通过图3实施例中的步骤305和步骤306为该RNN模型设置循环终止条件,也可以通过图4实施例中的步骤405和步骤406为该RNN模型设置循环终止条件。当然,实际应用中,也可以同时通过图3实施例中的步骤305和步骤306,以及图4实施例中的步骤405和步骤406为该RNN模型设置循环终止条件,也即,为该RNN模型设置有两个循环终止条件。此时,在RNN模型进行如图1D所示的循环过程中,在得到一个标签之后,同时确定循环次数和上述概率,当循环次数和上述概率中的一个满足对应的循环终止条件时,即可终止RNN模型的循环过程。It should be noted that, in the embodiment of the present disclosure, the loop termination condition can be set for the RNN model through steps 305 and 306 in the embodiment of FIG. The RNN model sets the loop termination condition. Of course, in practical applications, it is also possible to set the loop termination condition for the RNN model through steps 305 and 306 in the embodiment of FIG. 3, and steps 405 and 406 in the embodiment of FIG. Setup has two loop termination conditions. At this time, in the cyclic process of the RNN model as shown in Figure 1D, after obtaining a label, determine the number of cycles and the above-mentioned probability at the same time, when one of the number of cycles and the above-mentioned probability satisfies the corresponding cycle termination condition, you can Terminate the looping process of the RNN model.
在本公开实施例中,通过CNN模型确定目标图像的特征,并通过RNN模型对目标图像的特征进行处理,以得到目标图像的多个标签。由于目标图像的特征由CNN模型包括的最后一个池化层输出,也即,CNN模型在得到目标图像的特征之后,并没有根据该目标图像的特征确定该目标图像属于的各个类别的概率,而是直接将该目标图像的特征通过RNN模型进行处理,以得到该目标图像的多个标签,从而实现对对包括至少两种类别的内容的图像进行分类。In the embodiment of the present disclosure, the CNN model is used to determine the features of the target image, and the RNN model is used to process the features of the target image to obtain multiple labels of the target image. Since the features of the target image are output by the last pooling layer included in the CNN model, that is, after the CNN model obtains the features of the target image, it does not determine the probability of each category that the target image belongs to according to the features of the target image, and The method is to directly process the features of the target image through the RNN model to obtain multiple labels of the target image, so as to classify images including at least two types of content.
本公开实施例除了提供上述图像分类方法之外,还提供了一种图像分类装置,下面将对本公开实施例提供的图像分类装置进行详细说明。In addition to providing the above image classification method, the embodiment of the present disclosure also provides an image classification device, and the image classification device provided by the embodiment of the present disclosure will be described in detail below.
图5A为本公开实施例提供的一种图像分类装置500的框图,如图5A所示,该图像分类装置500包括第一处理模块501和第二处理模块502。FIG. 5A is a block diagram of an image classification apparatus 500 provided by an embodiment of the present disclosure. As shown in FIG. 5A , the image classification apparatus 500 includes a first processing module 501 and a second processing module 502 .
第一处理模块501,用于通过预先训练的CNN模型对需要进行分类的目标图像进行处理,以确定该CNN模型包括的最后一个池化层输出的特征;The first processing module 501 is used to process the target image that needs to be classified through the pre-trained CNN model, so as to determine the features output by the last pooling layer included in the CNN model;
第二处理模块502,用于将确定的特征作为该目标图像的特征,通过预先训练的RNN模型对该目标图像的特征进行处理,得到该目标图像的多个标签,该多个标签中的每个标签用于指示该目标图像中的图像内容所属的类别。The second processing module 502 is used to use the determined features as the features of the target image, process the features of the target image through the pre-trained RNN model, and obtain multiple labels of the target image, each of the multiple labels A tag is used to indicate the category to which the image content in the target image belongs.
可选地,该第二处理模块包括:Optionally, the second processing module includes:
第一处理子模块,用于将该目标图像的特征作为该RNN模型的输入,并通过该RNN模型对该目标图像的特征进行处理,得到第一标签,第一标签为该多个标签中的一个;The first processing submodule is used to use the feature of the target image as the input of the RNN model, and process the feature of the target image through the RNN model to obtain a first label, and the first label is one of the multiple labels one;
第二处理子模块,用于将第一标签作为该RNN模型的输入,并通过该RNN模型对该目标图像的特征和第一标签进行处理,得到第二标签,第二标签为该多个标签中的一个;The second processing submodule is used to use the first label as the input of the RNN model, and process the features of the target image and the first label through the RNN model to obtain a second label, and the second label is the plurality of labels one of the;
第一确定子模块,用于确定循环次数,该循环次数是指该RNN模型循环对输入的标签和该目标图像的特征进行处理的次数;The first determination submodule is used to determine the number of cycles, which refers to the number of times the RNN model cycles to process the input label and the features of the target image;
第一循环子模块,用于当该循环次数小于或等于预设次数时,将第二标签继续作为该RNN模型的输入,循环执行上述操作,直至该循环次数大于预设次数时,得到该多个标签。The first loop sub-module is used to continue to use the second label as the input of the RNN model when the number of loops is less than or equal to the preset number of times, and perform the above operations in a loop until the number of loops is greater than the preset number of times to obtain the multiple tags.
可选地,该第二处理模块502包括:Optionally, the second processing module 502 includes:
第一处理子模块,用于将该目标图像的特征作为该RNN模型的输入,并通过该RNN模型对该目标图像的特征进行处理,得到第一标签,第一标签为该多个标签中的一个;The first processing submodule is used to use the feature of the target image as the input of the RNN model, and process the feature of the target image through the RNN model to obtain a first label, and the first label is one of the multiple labels one;
第二处理子模块,用于将第一标签作为该RNN模型的输入,并通过该RNN模型对该目标图像的特征和第一标签进行处理,得到第二标签,第二标签为该多个标签中的一个;The second processing submodule is used to use the first label as the input of the RNN model, and process the features of the target image and the first label through the RNN model to obtain a second label, and the second label is the plurality of labels one of the;
第二确定子模块,用于确定该目标图像同时属于当前确定得到的所有标签对应的类别的概率;The second determining submodule is used to determine the probability that the target image belongs to the category corresponding to all the currently determined labels;
第二循环子模块,用于当该概率大于或等于预设概率时,将第二标签继续作为该RNN模型的输入,循环执行上述操作,直至该概率小于预设概率时,得到该多个标签。The second loop sub-module is used to continue to use the second label as the input of the RNN model when the probability is greater than or equal to the preset probability, and perform the above operations in a loop until the probability is less than the preset probability to obtain the plurality of labels .
可选地,参见图5B,该装置500还包括第一确定模块503、第一训练模块504、第二训练模块505和第二确定模块506:Optionally, referring to FIG. 5B, the apparatus 500 further includes a first determination module 503, a first training module 504, a second training module 505, and a second determination module 506:
第一确定模块503,用于确定训练样本集,该训练样本集包括多张图像和预先为每张图像设置的多个标签;The first determination module 503 is used to determine a training sample set, the training sample set includes a plurality of images and a plurality of labels pre-set for each image;
第一训练模块504,用于根据该多张图像,对初始化CNN模型进行训练,得到训练后的CNN模型和该多张图像中每张图像的特征;The first training module 504 is used to train the initialized CNN model according to the multiple images, and obtain the trained CNN model and the features of each image in the multiple images;
第二训练模块505,用于根据该多张图像中每张图像的特征,对初始化RNN模型进行训练,得到训练后的RNN模型和该多张图像中每张图像的多个标签;The second training module 505 is used to train the initialized RNN model according to the characteristics of each image in the plurality of images, and obtain the trained RNN model and a plurality of labels for each image in the plurality of images;
第二确定模块506,用于当通过训练得到的该多张图像中每张图像的多个标签与预先为对应图像设置的多个标签之间的误差大于预设误差时,通过梯度下降法调整该初始化CNN模型和该初始化RNN模型,并返回根据该多张图像,对初始化CNN模型进行训练的步骤,直至通过训练得到的该多张图像中每张图像的多个标签与预先为对应图像设置的多个标签之间的误差小于或等于该预设误差为止,并将最终训练得到的CNN模型确定为该预先训练的CNN模型,将最终训练得到的RNN模型确定为该预先训练的RNN模型。The second determination module 506 is used to adjust the values by gradient descent method when the error between the multiple labels of each image obtained through training and the multiple labels pre-set for the corresponding image is greater than the preset error. The initialized CNN model and the initialized RNN model, and return to the step of training the initialized CNN model according to the plurality of images, until the plurality of labels of each image in the plurality of images obtained through training and the corresponding image settings in advance Until the errors between multiple labels are less than or equal to the preset error, the final trained CNN model is determined as the pre-trained CNN model, and the final trained RNN model is determined as the pre-trained RNN model.
在本公开实施例中,通过CNN模型确定目标图像的特征,并通过RNN模型对目标图像的特征进行处理,以得到目标图像的多个标签。由于目标图像的特征由CNN模型包括的最后一个池化层输出,也即,CNN模型在得到目标图像的特征之后,并没有根据该目标图像的特征确定该目标图像属于的各个类别的概率,而是直接将该目标图像的特征通过RNN模型进行处理,以得到该目标图像的多个标签,从而实现对对包括至少两种类别的内容的图像进行分类。In the embodiment of the present disclosure, the CNN model is used to determine the features of the target image, and the RNN model is used to process the features of the target image to obtain multiple labels of the target image. Since the features of the target image are output by the last pooling layer included in the CNN model, that is, after the CNN model obtains the features of the target image, it does not determine the probability of each category that the target image belongs to according to the features of the target image, and The method is to directly process the features of the target image through the RNN model to obtain multiple labels of the target image, so as to classify images including at least two types of content.
关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。Regarding the apparatus in the foregoing embodiments, the specific manner in which each module executes operations has been described in detail in the embodiments related to the method, and will not be described in detail here.
图6是本公开实施例提供的另一种图像分类装置600的框图。例如,装置600可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等。Fig. 6 is a block diagram of another image classification apparatus 600 provided by an embodiment of the present disclosure. For example, the apparatus 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, and the like.
参照图6,装置600可以包括以下一个或多个组件:处理组件602,存储器604,电源组件606,多媒体组件608,音频组件610,输入/输出(I/O)的接口612,传感器组件614,以及通信组件616。6, device 600 may include one or more of the following components: processing component 602, memory 604, power supply component 606, multimedia component 608, audio component 610, input/output (I/O) interface 612, sensor component 614, and communication component 616 .
处理组件602通常控制装置600的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件602可以包括一个或多个处理器620来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件602可以包括一个或多个模块,便于处理组件602和其他组件之间的交互。例如,处理组件602可以包括多媒体模块,以方便多媒体组件608和处理组件602之间的交互。The processing component 602 generally controls the overall operations of the device 600, such as those associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to complete all or part of the steps of the above method. Additionally, processing component 602 may include one or more modules that facilitate interaction between processing component 602 and other components. For example, processing component 602 may include a multimedia module to facilitate interaction between multimedia component 608 and processing component 602 .
存储器604被配置为存储各种类型的数据以支持在装置600的操作。这些数据的示例包括用于在装置600上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器604可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。The memory 604 is configured to store various types of data to support operations at the device 600 . Examples of such data include instructions for any application or method operating on device 600, contact data, phonebook data, messages, pictures, videos, and the like. The memory 604 can be implemented by any type of volatile or non-volatile storage device or their combination, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic or Optical Disk.
电源组件606为装置600的各种组件提供电源。电源组件606可以包括电源管理系统,一个或多个电源,及其他与为装置600生成、管理和分配电源相关联的组件。Power component 606 provides power to various components of device 600 . Power components 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to device 600 .
多媒体组件608包括在所述装置600和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件608包括一个前置摄像头和/或后置摄像头。当装置600处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。The multimedia component 608 includes a screen that provides an output interface between the device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense a boundary of a touch or swipe action, but also detect duration and pressure associated with the touch or swipe action. In some embodiments, the multimedia component 608 includes a front camera and/or a rear camera. When the device 600 is in an operation mode, such as a shooting mode or a video mode, the front camera and/or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capability.
音频组件610被配置为输出和/或输入音频信号。例如,音频组件610包括一个麦克风(MIC),当装置600处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器604或经由通信组件616发送。在一些实施例中,音频组件610还包括一个扬声器,用于输出音频信号。The audio component 610 is configured to output and/or input audio signals. For example, the audio component 610 includes a microphone (MIC) configured to receive external audio signals when the device 600 is in operation modes, such as call mode, recording mode and voice recognition mode. Received audio signals may be further stored in memory 604 or sent via communication component 616 . In some embodiments, the audio component 610 also includes a speaker for outputting audio signals.
I/O接口612为处理组件602和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。The I/O interface 612 provides an interface between the processing component 602 and a peripheral interface module. The peripheral interface module may be a keyboard, a click wheel, a button, and the like. These buttons may include, but are not limited to: a home button, volume buttons, start button, and lock button.
传感器组件614包括一个或多个传感器,用于为装置600提供各个方面的状态评估。例如,传感器组件614可以检测到装置600的打开/关闭状态,组件的相对定位,例如所述组件为装置600的显示器和小键盘,传感器组件614还可以检测装置600或装置600一个组件的位置改变,用户与装置600接触的存在或不存在,装置600方位或加速/减速和装置600的温度变化。传感器组件614可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件614还可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件614还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。Sensor assembly 614 includes one or more sensors for providing status assessments of various aspects of device 600 . For example, the sensor component 614 can detect the open/closed state of the device 600, the relative positioning of components, such as the display and keypad of the device 600, and the sensor component 614 can also detect a change in the position of the device 600 or a component of the device 600 , the presence or absence of user contact with the device 600 , the device 600 orientation or acceleration/deceleration and the temperature change of the device 600 . The sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact. Sensor assembly 614 may also include optical sensors, such as CMOS or CCD image sensors, for use in imaging applications. In some embodiments, the sensor component 614 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor or a temperature sensor.
通信组件616被配置为便于装置600和其他设备之间有线或无线方式的通信。装置600可以接入基于通信标准的无线网络,如WiFi,2G或3G,或它们的组合。在一个示例性实施例中,通信组件616经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件616还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。The communication component 616 is configured to facilitate wired or wireless communication between the apparatus 600 and other devices. The device 600 can access wireless networks based on communication standards, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 616 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BT) technology and other technologies.
在示例性实施例中,装置600可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述图2、图3和图4所示实施例提供的图像分类方法。In an exemplary embodiment, apparatus 600 may be programmed by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable Realized by a gate array (FPGA), a controller, a microcontroller, a microprocessor or other electronic components, it is used to execute the image classification method provided by the embodiments shown in the above-mentioned Fig. 2 , Fig. 3 and Fig. 4 .
在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器604,上述指令可由装置600的处理器620执行以完成上述方法。例如,所述非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In an exemplary embodiment, there is also provided a non-transitory computer-readable storage medium including instructions, such as the memory 604 including instructions, which can be executed by the processor 620 of the device 600 to implement the above method. For example, the non-transitory computer readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, and the like.
一种非临时性计算机可读存储介质,当所述存储介质中的指令由终端的处理器执行时,使得终端能够执行上述图2、图3和图4所示实施例提供的图像分类方法。A non-transitory computer-readable storage medium. When the instructions in the storage medium are executed by the processor of the terminal, the terminal can execute the image classification method provided by the embodiments shown in FIG. 2 , FIG. 3 and FIG. 4 .
图7是本公开实施例提供的另一种图像分类装置700的框图。例如,装置700可以被提供为一服务器。参照图7,装置700包括处理器722,其进一步包括一个或多个处理器,以及由存储器732所代表的存储器资源,用于存储可由处理器722的执行的指令,例如应用程序。存储器732中存储的应用程序可以包括一个或一个以上的每一个对应于一组指令的模块。此外,处理器722被配置为执行指令,以执行上述图2、图3和图4所示实施例提供的图像分类方法。Fig. 7 is a block diagram of another image classification apparatus 700 provided by an embodiment of the present disclosure. For example, the apparatus 700 may be provided as a server. 7, the apparatus 700 includes a processor 722, which further includes one or more processors, and a memory resource represented by a memory 732 for storing instructions executable by the processor 722, such as application programs. The application program stored in memory 732 may include one or more modules each corresponding to a set of instructions. In addition, the processor 722 is configured to execute instructions to execute the image classification method provided in the above embodiments shown in FIG. 2 , FIG. 3 and FIG. 4 .
装置700还可以包括一个电源组件726被配置为执行装置700的电源管理,一个有线或无线网络接口750被配置为将装置700连接到网络,和一个输入输出(I/O)接口758。装置700可以操作基于存储在存储器732的操作系统,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM或类似。Device 700 may also include a power component 726 configured to perform power management of device 700 , a wired or wireless network interface 750 configured to connect device 700 to a network, and an input-output (I/O) interface 758 . The apparatus 700 can operate based on an operating system stored in the memory 732, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™ or the like.
在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器732,上述指令可由装置700的处理器722执行以完成上述方法。例如,所述非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In an exemplary embodiment, there is also provided a non-transitory computer-readable storage medium including instructions, such as the memory 732 including instructions, which can be executed by the processor 722 of the device 700 to implement the above method. For example, the non-transitory computer readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, and the like.
一种非临时性计算机可读存储介质,当所述存储介质中的指令由服务器的处理器执行时,使得服务器能够执行上述图2、图3和图4所示实施例提供的图像分类方法。A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by the processor of the server, the server can execute the image classification method provided by the above-mentioned embodiments shown in FIG. 2 , FIG. 3 and FIG. 4 .
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本发明的其它实施方案。本申请旨在涵盖本发明的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本发明的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本发明的真正范围和精神由下面的权利要求指出。Other embodiments of the invention will be readily apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present invention, these modifications, uses or adaptations follow the general principles of the present invention and include common knowledge or conventional technical means in the technical field not disclosed in this disclosure . The specification and examples are to be considered exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
应当理解的是,本发明并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本发明的范围仅由所附的权利要求来限制。It should be understood that the present invention is not limited to the precise constructions which have been described above and shown in the accompanying drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710388824.4A CN107220667B (en) | 2017-05-24 | 2017-05-24 | Image classification method, apparatus, and computer-readable storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710388824.4A CN107220667B (en) | 2017-05-24 | 2017-05-24 | Image classification method, apparatus, and computer-readable storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN107220667A true CN107220667A (en) | 2017-09-29 |
| CN107220667B CN107220667B (en) | 2020-10-30 |
Family
ID=59946959
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201710388824.4A Active CN107220667B (en) | 2017-05-24 | 2017-05-24 | Image classification method, apparatus, and computer-readable storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN107220667B (en) |
Cited By (18)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107832368A (en) * | 2017-10-26 | 2018-03-23 | 广东欧珀移动通信有限公司 | Picture classification method, device, terminal and storage medium |
| CN107993191A (en) * | 2017-11-30 | 2018-05-04 | 腾讯科技(深圳)有限公司 | A kind of image processing method and device |
| CN108171268A (en) * | 2018-01-02 | 2018-06-15 | 联想(北京)有限公司 | A kind of image processing method and electronic equipment |
| CN108229535A (en) * | 2017-12-01 | 2018-06-29 | 百度在线网络技术(北京)有限公司 | Relate to yellow image audit method, apparatus, computer equipment and storage medium |
| CN108509781A (en) * | 2018-03-27 | 2018-09-07 | 百度在线网络技术(北京)有限公司 | Method and device for unlock |
| CN108833313A (en) * | 2018-07-12 | 2018-11-16 | 北京邮电大学 | A method and device for wireless channel estimation based on convolutional neural network |
| CN108876726A (en) * | 2017-12-12 | 2018-11-23 | 北京旷视科技有限公司 | Method, apparatus, system and the computer storage medium of image procossing |
| CN108921811A (en) * | 2018-04-03 | 2018-11-30 | 阿里巴巴集团控股有限公司 | Detect method and apparatus, the article damage detector of article damage |
| CN109909998A (en) * | 2017-12-12 | 2019-06-21 | 北京猎户星空科技有限公司 | A kind of method and device controlling manipulator motion |
| CN110160210A (en) * | 2019-05-15 | 2019-08-23 | 北京上格云技术有限公司 | Fault detection method, device, storage medium and the electronic equipment of fan coil |
| WO2019184471A1 (en) * | 2018-03-27 | 2019-10-03 | 北京达佳互联信息技术有限公司 | Image tag determination method and device, and terminal |
| CN110874771A (en) * | 2018-08-29 | 2020-03-10 | 北京京东尚科信息技术有限公司 | A method and device for product matching |
| CN111401464A (en) * | 2020-03-25 | 2020-07-10 | 北京字节跳动网络技术有限公司 | Classification method, classification device, electronic equipment and computer-readable storage medium |
| CN111414966A (en) * | 2020-03-25 | 2020-07-14 | 北京字节跳动网络技术有限公司 | Classification method, classification device, electronic equipment and computer storage medium |
| WO2021061045A3 (en) * | 2019-09-27 | 2021-05-20 | 商汤国际私人有限公司 | Stacked object recognition method and apparatus, electronic device and storage medium |
| CN113109666A (en) * | 2021-04-09 | 2021-07-13 | 河南省博海大数据科技有限公司 | Track circuit fault diagnosis method based on deep convolutional neural network |
| CN113537339A (en) * | 2021-07-14 | 2021-10-22 | 中国地质大学(北京) | Method and system for identifying symbiotic or associated minerals based on multi-label image classification |
| CN115937562A (en) * | 2021-09-30 | 2023-04-07 | 北京新氧科技有限公司 | Image classification method, device, equipment and storage medium |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20170032224A1 (en) * | 2015-07-31 | 2017-02-02 | Xiaomi Inc. | Method, device and computer-readable medium for sensitive picture recognition |
| CN106548208A (en) * | 2016-10-28 | 2017-03-29 | 杭州慕锐科技有限公司 | A kind of quick, intelligent stylizing method of photograph image |
-
2017
- 2017-05-24 CN CN201710388824.4A patent/CN107220667B/en active Active
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20170032224A1 (en) * | 2015-07-31 | 2017-02-02 | Xiaomi Inc. | Method, device and computer-readable medium for sensitive picture recognition |
| CN106548208A (en) * | 2016-10-28 | 2017-03-29 | 杭州慕锐科技有限公司 | A kind of quick, intelligent stylizing method of photograph image |
Non-Patent Citations (5)
| Title |
|---|
| JIANG WANG等: "CNN-RNN: A Unified Framework for Multi-label Image Classification", 《2016 IEEE CONFERENCE ON COMPUTER VISION AND PATTERN RECOGNITION》 * |
| 张慧娜等: "基于Haar-CNN模型的自然场景图像分类的研究", 《四川师范大学学报》 * |
| 李军等: "结合视觉注意机制与递归神经网络的图像检索", 《中国图象图形学报》 * |
| 汪鸿翔等: "单目标跟踪算法综述", 《海峡科学》 * |
| 陈锐等: "基于级联卷积神经网络的人脸关键点定位", 《四川理工学院学报》 * |
Cited By (26)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107832368A (en) * | 2017-10-26 | 2018-03-23 | 广东欧珀移动通信有限公司 | Picture classification method, device, terminal and storage medium |
| CN107993191B (en) * | 2017-11-30 | 2023-03-21 | 腾讯科技(深圳)有限公司 | Image processing method and device |
| CN107993191A (en) * | 2017-11-30 | 2018-05-04 | 腾讯科技(深圳)有限公司 | A kind of image processing method and device |
| CN108229535B (en) * | 2017-12-01 | 2019-07-23 | 百度在线网络技术(北京)有限公司 | Relate to yellow image audit method, apparatus, computer equipment and storage medium |
| CN108229535A (en) * | 2017-12-01 | 2018-06-29 | 百度在线网络技术(北京)有限公司 | Relate to yellow image audit method, apparatus, computer equipment and storage medium |
| CN108876726A (en) * | 2017-12-12 | 2018-11-23 | 北京旷视科技有限公司 | Method, apparatus, system and the computer storage medium of image procossing |
| CN109909998A (en) * | 2017-12-12 | 2019-06-21 | 北京猎户星空科技有限公司 | A kind of method and device controlling manipulator motion |
| CN109909998B (en) * | 2017-12-12 | 2020-10-02 | 北京猎户星空科技有限公司 | Method and device for controlling movement of mechanical arm |
| CN108171268A (en) * | 2018-01-02 | 2018-06-15 | 联想(北京)有限公司 | A kind of image processing method and electronic equipment |
| CN108509781A (en) * | 2018-03-27 | 2018-09-07 | 百度在线网络技术(北京)有限公司 | Method and device for unlock |
| WO2019184471A1 (en) * | 2018-03-27 | 2019-10-03 | 北京达佳互联信息技术有限公司 | Image tag determination method and device, and terminal |
| US11436449B2 (en) | 2018-03-27 | 2022-09-06 | Beijing Dajia Internet Information Tech. Co., Ltd. | Method and electronic apparatus for processing image and training image tag classification model |
| CN108921811A (en) * | 2018-04-03 | 2018-11-30 | 阿里巴巴集团控股有限公司 | Detect method and apparatus, the article damage detector of article damage |
| US10929717B2 (en) | 2018-04-03 | 2021-02-23 | Advanced New Technologies Co., Ltd. | Article damage detection |
| CN108833313A (en) * | 2018-07-12 | 2018-11-16 | 北京邮电大学 | A method and device for wireless channel estimation based on convolutional neural network |
| CN110874771A (en) * | 2018-08-29 | 2020-03-10 | 北京京东尚科信息技术有限公司 | A method and device for product matching |
| CN110160210A (en) * | 2019-05-15 | 2019-08-23 | 北京上格云技术有限公司 | Fault detection method, device, storage medium and the electronic equipment of fan coil |
| WO2021061045A3 (en) * | 2019-09-27 | 2021-05-20 | 商汤国际私人有限公司 | Stacked object recognition method and apparatus, electronic device and storage medium |
| CN111414966A (en) * | 2020-03-25 | 2020-07-14 | 北京字节跳动网络技术有限公司 | Classification method, classification device, electronic equipment and computer storage medium |
| CN111401464A (en) * | 2020-03-25 | 2020-07-10 | 北京字节跳动网络技术有限公司 | Classification method, classification device, electronic equipment and computer-readable storage medium |
| CN111414966B (en) * | 2020-03-25 | 2023-08-15 | 抖音视界有限公司 | Classification method, classification device, electronic equipment and computer storage medium |
| CN113109666A (en) * | 2021-04-09 | 2021-07-13 | 河南省博海大数据科技有限公司 | Track circuit fault diagnosis method based on deep convolutional neural network |
| CN113109666B (en) * | 2021-04-09 | 2024-03-15 | 河南省博海大数据科技有限公司 | A track circuit fault diagnosis method based on deep convolutional neural network |
| CN113537339A (en) * | 2021-07-14 | 2021-10-22 | 中国地质大学(北京) | Method and system for identifying symbiotic or associated minerals based on multi-label image classification |
| CN113537339B (en) * | 2021-07-14 | 2023-06-02 | 中国地质大学(北京) | A method and system for identifying paragenetic or associated minerals based on multi-label image classification |
| CN115937562A (en) * | 2021-09-30 | 2023-04-07 | 北京新氧科技有限公司 | Image classification method, device, equipment and storage medium |
Also Published As
| Publication number | Publication date |
|---|---|
| CN107220667B (en) | 2020-10-30 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN107220667B (en) | Image classification method, apparatus, and computer-readable storage medium | |
| CN109670397B (en) | Method and device for detecting key points of human skeleton, electronic equipment and storage medium | |
| US11436449B2 (en) | Method and electronic apparatus for processing image and training image tag classification model | |
| CN106557768B (en) | Method and device for recognizing text in pictures | |
| CN111050076B (en) | Shooting processing method and electronic equipment | |
| EP4047549B1 (en) | Method and device for image detection, and electronic device | |
| US9674395B2 (en) | Methods and apparatuses for generating photograph | |
| TW202113757A (en) | Target object matching method and apparatus, electronic device and storage medium | |
| CN106651955A (en) | Method and device for positioning object in picture | |
| CN107944447B (en) | Image classification method and device | |
| WO2020114236A1 (en) | Keypoint detection method and apparatus, electronic device, and storage medium | |
| CN106339680A (en) | Human face key point positioning method and device | |
| CN107145904A (en) | Method, device and storage medium for determining image category | |
| CN107527053A (en) | Object detection method and device | |
| CN107845062A (en) | image generating method and device | |
| CN107967459B (en) | Convolution processing method, device and storage medium | |
| CN107784279A (en) | Method for tracking target and device | |
| CN107194464A (en) | The training method and device of convolutional neural networks model | |
| CN115035596A (en) | Behavior detection method and apparatus, electronic device, and storage medium | |
| CN107563994A (en) | The conspicuousness detection method and device of image | |
| CN107527024A (en) | Face face value appraisal procedure and device | |
| CN107832746A (en) | Expression recognition method and device | |
| CN113347372A (en) | Shooting light supplement method, mobile terminal and readable storage medium | |
| CN111242205A (en) | Image sharpness detection method, device and storage medium | |
| KR101979650B1 (en) | Server and operating method thereof |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |