WO2020006881A1 - 蝴蝶识别网络构建方法、装置、计算机设备及存储介质 - Google Patents

蝴蝶识别网络构建方法、装置、计算机设备及存储介质 Download PDF

Info

Publication number
WO2020006881A1
WO2020006881A1 PCT/CN2018/106395 CN2018106395W WO2020006881A1 WO 2020006881 A1 WO2020006881 A1 WO 2020006881A1 CN 2018106395 W CN2018106395 W CN 2018106395W WO 2020006881 A1 WO2020006881 A1 WO 2020006881A1
Authority
WO
WIPO (PCT)
Prior art keywords
butterfly
network
capsule
loss function
image
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.)
Ceased
Application number
PCT/CN2018/106395
Other languages
English (en)
French (fr)
Inventor
刘奡智
夏子敏
王健宗
肖京
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Publication of WO2020006881A1 publication Critical patent/WO2020006881A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02TCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
    • Y02T10/00Road transport of goods or passengers
    • Y02T10/10Internal combustion engine [ICE] based vehicles
    • Y02T10/40Engine management systems

Definitions

  • the present application relates to the field of computer technology, and in particular, to a method, a device, a computer device, and a storage medium for constructing a butterfly recognition network.
  • CNN convolutional neural network
  • butterfly recognition can be used as a study of biological diversity and species analysis. Due to the limited number of butterfly images in the existing image databases, there are few butterfly species, and the size of butterfly images is too small, which is not conducive to traditional convolutional neural networks to identify butterflies. Because the traditional convolutional neural network requires a large number of training images, and lacks the observation position and perspective information, that is, it cannot handle the polysemous expression of the image well. Because the traditional convolutional neural network cannot distinguish the same butterfly species based on different perspectives of the same butterfly, the accuracy of butterfly recognition is low.
  • the embodiments of the present application provide a method, a device, a computer device, and a storage medium for constructing a butterfly recognition network, so as to solve the problem that the traditional butterfly convolutional neural network recognizes the same type of butterflies from different perspectives as different kinds of butterflies, resulting in the accuracy of butterfly recognition Low problem.
  • a method for constructing a butterfly recognition network includes:
  • the target butterfly image used for training in the butterfly species is input into a capsule network, and passes through a first convolution calculation of a convolution layer of the capsule network and the capsule network. Calculation of the second convolution of the capsule layer to obtain the output vector of the butterfly species;
  • each capsule neuron in the capsule network is updated by back propagation to obtain the updated capsule network, and each type of the butterfly species is updated.
  • the target butterfly image used in training is re-input to the updated capsule network, and the first convolution calculation, the second convolution calculation, and the loss function calculation are performed until the loss function The value is less than or equal to the preset loss threshold, wherein the capsule neuron represents the attribute of the butterfly species.
  • a butterfly recognition network construction device includes:
  • An acquisition module for acquiring an original butterfly image corresponding to each butterfly species from a preset butterfly database
  • a resampling module for resampling the original butterfly image to obtain a target butterfly image
  • a convolution module for each of the butterfly species, inputting the target butterfly image used for training in the butterfly species into a capsule network, and passing a first convolution calculation of a convolution layer of the capsule network And a second convolution calculation of a capsule layer of the capsule network to obtain an output vector of the butterfly species;
  • a loss calculation module configured to perform a loss function calculation on the output vector of each of the butterfly species in a loss function layer in the capsule network to obtain a loss function value of each of the output vectors;
  • a training module configured to use the capsule network as a training network for identifying a butterfly when the loss function value of each of the output vectors is less than or equal to a preset loss threshold;
  • An update module is configured to update each capsule neuron in the capsule network by back propagation when the loss function value is greater than the preset loss threshold, obtain the updated capsule network, and update each capsule network.
  • the target butterfly image used for training among the butterfly species is re-input into the updated capsule network, and performs the first convolution calculation, the second convolution calculation, and the loss function calculation, Until the value of the loss function is less than or equal to the preset loss threshold, wherein the capsule neuron represents the attribute of the butterfly species.
  • a computer device includes a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, and the processor implements the computer-readable instructions to implement the above-mentioned butterfly recognition network construction Method steps.
  • One or more non-volatile readable storage media storing computer-readable instructions that, when executed by one or more processors, cause the one or more processors to execute the butterfly recognition network described above Steps in building the method.
  • FIG. 1 is a schematic diagram of an application environment of a method for constructing a butterfly recognition network according to an embodiment of the present application
  • FIG. 2 is an implementation flowchart of a method for constructing a butterfly recognition network according to an embodiment of the present application
  • step S2 in a method for constructing a butterfly recognition network according to an embodiment of the present application
  • step S3 is an implementation diagram of step S3 in a method for constructing a butterfly recognition network according to an embodiment of the present application
  • FIG. 5 is an implementation diagram of a training network for testing and identifying butterflies in a method for constructing a butterfly recognition network according to an embodiment of the present application
  • FIG. 6 is a schematic diagram of an apparatus for constructing a butterfly recognition network according to an embodiment of the present application.
  • FIG. 7 is a schematic diagram of a computer device in an embodiment of the present application.
  • the method for constructing a butterfly recognition network can be applied in the application environment shown in FIG. 1, in which a server and a client are connected through a network, and the server performs a first convolution of a target butterfly image in a capsule network
  • the training, the second convolution calculation, and the loss function calculation process are used to obtain the training network for identifying the butterfly.
  • the user modifies the training parameters of the capsule network through the client.
  • the client can specifically, but not limited to, various personal computers, laptops, smartphones, tablets
  • the server can be implemented by an independent server or a server cluster composed of multiple servers.
  • a method for constructing a butterfly recognition network is provided.
  • the method is applied to the server in FIG. 1 as an example, and includes the following steps:
  • the preset butterfly database stores all original butterfly images in the existing butterfly database.
  • the preset butterfly database includes, but is not limited to, the Leeds butterfly database, the Ecuador butterfly database, and Costarica (Costa Marie). Butterfly database.
  • the preset butterfly database can also use the Fine-Grained (fine-grained) butterfly database, of which the Leeds butterfly database includes 14,270 original butterfly images corresponding to 636 butterfly species, and the Ecuador butterfly database includes 10 Butterfly types: 832 original butterfly images corresponding to butterfly types, Costarica (Costa Rica) includes 2120 original butterfly images corresponding to 675 butterfly types, and Fine-Grained (fine-grained) butterfly database includes 3,224 original butterfly images corresponding to 331 butterfly types
  • the butterfly database is not limited here.
  • resampling is resampling a digital image composed of discrete data formed after sampling according to a preset pixel position or pixel interval to form a new image after geometric transformation.
  • one part of the target butterfly image is used as training sample data for training the capsule network, and the other part of the butterfly image is used for training to identify the butterfly Test sample data for the network.
  • a target butterfly image of the same size is obtained, and the target butterfly image carries the corresponding butterfly type mark, which is beneficial for subsequent training or testing the training network that recognizes the butterfly.
  • the output result and the original input are obtained.
  • the target butterfly image is compared with the corresponding butterfly species mark to determine whether the output result is correct.
  • the target butterfly image used for training in this butterfly type is input into the capsule network, and passes through the first convolution calculation of the convolution layer of the capsule network and the second volume of the capsule layer of the capsule network. Product calculation to get the output vector of this butterfly species.
  • the capsule network consists of a parse tree.
  • the neurons in each layer of the neuron layer in the capsule network will be divided into multiple neuron groups.
  • Each neuron group is called a capsule.
  • Each node in the parse tree will correspond to an activated capsule ( active capsule).
  • An activated capsule is composed of multiple activated capsule neurons.
  • Each capsule neuron contains a convolution kernel.
  • the convolution kernel is a type of (filter) matrix or feature detector.
  • the weight in the convolution kernel is the characteristic expression of the attribute, that is, the capsule neuron represents the attribute of a certain butterfly species, among which the attributes can be different perspectives corresponding to each butterfly species such as different angles, positions and directions.
  • the training network for butterfly recognition improves the accuracy of butterfly recognition by continuously modifying the weights in the convolution kernel in the capsule neurons and other training parameters, among which other training parameters include coupling coefficients.
  • a target butterfly image of the butterfly species used for training is input to a convolution layer in a capsule network to perform a first convolution calculation.
  • the first convolution calculation is to calculate the target butterfly image and the convolution kernel in the convolution layer.
  • the convolution kernel calculation refers to the element value at each position in the convolution kernel and the corresponding point on the target butterfly image.
  • a second convolution calculation is performed in the layer, where the second convolution calculation is a convolution calculation of the result obtained by the first convolution calculation with the activated capsule neuron to obtain an output vector of the butterfly species.
  • the vector length in the output vector indicates the probability that the target butterfly image is recognized as the corresponding butterfly type in the capsule network
  • the vector direction of the output vector indicates the attributes of the butterfly type, such as different perspectives of the butterfly.
  • the loss function describes the loss of the training model under different parameter values, and is used to estimate the degree of inconsistency between the predicted value and the true value of the training model.
  • the loss function calculation is performed on the output vector of each butterfly species, and the loss function value of the output vector is a non-negative function value.
  • adjusting the training parameters of the training network for identifying the butterfly can reduce the value of the loss function.
  • the training parameters include convolution. Weights in the kernel.
  • the loss function value of each output vector obtained in step S4 is less than or equal to a preset loss threshold, that is, the robustness of the training network for butterfly recognition at this time has reached the expected effect of butterfly recognition
  • the current capsule network is used as the training network for the final recognition of butterflies.
  • the preset loss threshold may be 0.3 or a decimal from 0 to 1.
  • each capsule neuron in the capsule network is updated by back propagation to obtain the updated capsule network, and the butterfly image used as a training target in each butterfly species Re-enter the updated capsule network and perform the first convolution calculation, the second convolution calculation, and the loss function calculation until the loss function value is less than or equal to the preset loss threshold, where the capsule neuron represents the butterfly species. Attributes.
  • each capsule neuron in the capsule network is updated by back propagation, where the back propagation is to obtain the loss function for each neuron layer by layer.
  • the partial derivative of the weight value so as to obtain the ladder function of the loss function to the output vector.
  • the ladder function is used as a basis for modifying the weight value in each capsule neuron, so that the developer can adjust each capsule neuron in the capsule network according to the ladder
  • the capsule network is updated, and the target butterfly image used for training in each butterfly species is re-entered into the updated capsule network, and step S3 is continued until the loss function value is less than or equal to the loss threshold.
  • the attributes of capsule neurons representing butterfly species include different perspectives corresponding to each butterfly species.
  • the original butterfly image corresponding to each butterfly type is obtained from a preset butterfly database, and the original butterfly image is resampled to obtain a target butterfly image;
  • the target butterfly image used for training in this butterfly type is input Into the capsule network, and after the first convolution calculation of the convolution layer of the capsule network and the second convolution calculation of the capsule layer of the capsule network, the output vector of the butterfly species is calculated by the loss function to obtain the loss function value; when the loss When the function value is greater than a preset value, each capsule neuron in the capsule network is updated by back propagation, thereby obtaining an updated capsule network.
  • the target butterfly image used as training is input to the updated capsule network for the first time.
  • step S2 the original butterfly image is resampled to obtain the target butterfly image, which specifically includes the following steps:
  • S21 Determine the zoom ratio of the original butterfly image according to the preset target size.
  • the scaling ratio of the original butterfly image is determined according to a preset target size, so that the obtained target butterfly image has the same size, which is beneficial for the capsule network to identify butterfly species, and reduces interference factors caused by inconsistent size. Prevent overfitting.
  • all original butterfly images are resampled to obtain a size of 32 ⁇ 32 ⁇ 3, where 32 pixels are in the row direction, 32 pixels are in the column direction, and 3 refers to three channels of RGB.
  • 3 refers to three channels of RGB.
  • a channel is used to represent a certain composition of an image.
  • an image taken by a standard digital camera will have three channels-red, green, and blue. Think of them as a two-dimensional matrix stacked on top of each other.
  • Each channel represents a color, and the pixel value of each channel ranges from 0 to In the range of 255.
  • step S21 starting from the target image, the original pixel points of the original butterfly image are divided according to the zoom ratio 2 to obtain each target pixel point of the target butterfly image corresponding to the original butterfly image.
  • the RGB values of each original pixel point are accumulated and averaged to obtain an average RGB value, and according to the correspondence between the original pixel point and each pixel point of the target butterfly image , Taking the average RGB value as the RGB value of the target pixel corresponding to the set of original pixels, where the average RGB value is a positive integer. For example, referring to the example of step S22, if the RGB values of 4 pixels are ⁇ 215,0,64,0 ⁇ , the average RGB value is
  • the scaling ratio of the original butterfly image is determined according to a preset target size, a set of original pixels corresponding to each target pixel point of the target butterfly image in the original butterfly image is obtained, and the set of original pixels is calculated.
  • the average RGB value of each original pixel in the image, and use the average RGB value as the RGB value of the target pixel corresponding to the set of original pixels, to achieve the goal of scaling all original butterfly images of different sizes to a uniform standard size Butterfly images are beneficial to provide good training sample data for the capsule network in the future, and avoid overfitting problems caused by the different sizes of the original butterfly images.
  • step S3 for each of the butterfly species, the target butterfly image used for training in the butterfly species is input into a capsule network and passes through the capsule.
  • the first convolution calculation of the convolution layer of the network and the second convolution calculation of the capsule layer of the capsule network to obtain the output vector of the butterfly species include the following steps:
  • S31 Perform the first convolution calculation on the convolution layer of the capsule network by using the target butterfly image input into the butterfly species for training to obtain a feature vector.
  • a target butterfly image used for training in a butterfly species is input to a convolution layer of a capsule network, and a first convolution calculation is performed on a convolution kernel of the target butterfly image and each capsule neuron in the convolution layer,
  • the first convolution calculation is to multiply the element value at each position in the convolution kernel with the element value of the corresponding point on the target butterfly image, and the resulting feature vector is called a Convolved Feature or a feature map ( Feature map).
  • the depth is 256 and the convolution window size is 9 * 9, that is, a convolution kernel of 256 9 * 9 matrices is constructed.
  • zero supplementation is used, which is also called zero-padding.
  • the modified linear activation function namely the ReLU (Rectified Linear Unit) activation function
  • the ReLU Rectified Linear Unit activation function
  • the neuron activation function is a neuron activation function and a piecewise linear function. It can set all the pixel values less than 0 in the feature map to zero. While leaving other pixels with positive values, this operation is called unilateral suppression, so that the relevant features can be better mined in the sparse capsule network to avoid overfitting.
  • the feature vector is substituted into the modified linear activation function, that is, the pixel gray value of the feature map is converted into the activation value of the local feature.
  • the capsule layer of the capsule network in this embodiment is a 32-channel capsule, and each capsule includes 8 capsule neurons, and each capsule neuron includes 9 ⁇ 9 Convolution kernel with stride of 2.
  • the second convolution calculation refers to the convolution calculation of each capsule neuron and all local feature vectors of the convolution layer, and by using an iterative routing process, it is finally output by 32 ⁇ 32 ⁇ n capsules, and each capsule is 8-dimensional output vector, that is, each capsule actually outputs a set of output vectors.
  • an iterative routing process can obtain an output vector through formulas (1) to (4).
  • the output vector represents the probability of each butterfly species from different perspectives, including:
  • b ij refers to the softmax activation function between the i-th capsule neuron and the j-th capsule neuron.
  • a softmax activation function is a method that maps each value of a multidimensional vector into (0, 1) The function of the interval is used for classification here, c ij is the coupling coefficient, Is the local feature vector, W ij is the weight matrix, and S j is all the local feature vectors Weighted sum, V j is the output vector of the j-th capsule neuron.
  • c ij is the coupling coefficient determined by the iterative routing process.
  • the sum of the coupling coefficient between Capsule and the capsules in the previous layer is 1. This coefficient, along with other weights, is determined during training and depends on the position and type of the two capsules.
  • each capsule neuron in the capsule layer has the same coupling coefficient to each capsule neuron in the convolution layer; each capsule neuron in the capsule layer is calculated for each possible parent node
  • the local feature vector is used as the input of the parent node. If the inner product of the local feature vector and the output vector of a parent node is large, the coupling coefficient of the parent node will be increased through a top-down feedback, and at the same time it will be reduced. The coupling coefficient of the other parent nodes is small, and the result of dynamic selection is achieved. In addition, the sum of all coupling coefficients of a capsule neuron is 1.
  • low-level capsule neurons tend to be aligned with high-level capsule neurons, that is, a high coupling coefficient indicates a large tendency to predict the local characteristics of the butterfly species, and a low coupling coefficient indicates a local tendency to predict the butterfly characteristics.
  • the coupling coefficient c ij of capsule neuron i to capsule neuron j is 1. Since all the coupling coefficients of capsule neuron i are 1, the coupling coefficient of capsule neuron i to other capsule neurons is zero. That is, all local feature vectors of the capsule neuron i are only passed to the capsule neuron j.
  • V j is a probability value
  • a non-linear "squeeze" function is used to ensure that the short output vector is “compressed” to a length close to 0, The long vector is "compressed” to a value close to one in length.
  • the target butterfly image inputted into the butterfly species is used for training.
  • the first convolution calculation is performed in the convolution layer of the capsule network, and the obtained feature vector is substituted into the modified linear activation function to obtain local features.
  • Vector by using an iterative routing process, a second convolution calculation is performed on the local feature vector with each capsule neuron in the capsule layer of the capsule network to obtain an output vector.
  • the prediction tendency is more obvious, and the generalization of the target butterfly image is achieved, for example, the generalization includes perspective information such as likelihood, direction, and size, thereby improving the discrimination ability of different butterfly perspectives of the same butterfly species.
  • a loss function calculation is performed on an output vector of each butterfly species, and a specific implementation process of obtaining a loss function value of the output vector is obtained. Details are as follows:
  • c is the butterfly type
  • L c is the loss function value
  • T c is the indicator function of the butterfly type
  • ) 2 is taken as 0 and m + -
  • -m -) 2 is set to 0 and
  • is the vector length of the output vector V c
  • is the preset parameter value
  • m - is the lower boundary of the preset vector length.
  • the indication function is also called a feature function.
  • the indication function is to customize each butterfly type into a set, and the set includes a subset of various attributes of the butterfly type.
  • the target butterfly corresponding to the butterfly type The images belong to a certain subset in the collection, and the subset can be a certain attribute of the butterfly species.
  • the instruction function judges that the output vector is the same as the actual target butterfly image, the output is 1, otherwise it is 0.
  • the total length of a column vector is used to identify the total number of butterfly species, and the element of the column vector is 1.
  • the position represents the classification result of the butterfly species corresponding to the position, and 0 in the column vector indicates that it is not the butterfly species.
  • the output vector belongs to a certain subset, and the subset belongs to a set of certain butterfly species, the number of column items corresponding to the species is 1, however, in actual classification, the value in the column vector is the corresponding butterfly species.
  • Probability For example, the length of the output vector
  • the loss function value is calculated by calculating the loss function layer of each output vector in the capsule network, and the prediction effect of the capsule network on the butterfly species is measured according to the size of the loss function value, which is beneficial to further adjustment. Parameters in the capsule network.
  • step S6 the method for constructing a butterfly recognition network further includes the following steps:
  • the target butterfly image used as a test is input into a training network for recognition of a butterfly, and the loss function value of the test output vector is obtained through the first convolution calculation, the second convolution calculation, and the loss function calculation.
  • the target butterfly image used as the test that is, the test sample data is input into the training network for identifying the butterfly obtained in steps S1 to S5, and according to step S3, the first convolution calculation, the second Convolution calculation and loss function calculation, output the loss function value of the test output vector.
  • a test output vector corresponding to a loss function value that is greater than or equal to a preset upper boundary of the vector length is obtained. For example, if a type c butterfly type exists and the preset vector length is 0.9, the type c butterfly type When an output vector with a vector length of at least 0.9 is output, it can be indicated that the target butterfly image corresponding to the output vector belongs to the type c butterfly category, where 0.9 represents the upper boundary of the vector length.
  • test output vector is reconstructed through a decoder network.
  • the decoder network is composed of three fully connected layers, and an output image is obtained through the decoder network reconstruction.
  • Reconstruction refers to reconstructing a test output vector into an actual image corresponding to the test output vector, thereby constructing a complete output image.
  • the reconstruction method all test output vectors are obtained through the decoder network to obtain the output image, and the image comparison method is used to filter out the same output image as the target butterfly image used for testing.
  • the image comparison method includes but is not limited to perception Hash algorithm, gray-scale histogram similarity comparison method, or PSNR (Peak Signal-to-Noise Ratio) method, and calculate the total number of output images that are the same as the target butterfly image used for testing and the total of the target butterfly image used for testing
  • the proportion of the amount is the accuracy rate of the training network for butterfly recognition. If the accuracy rate obtained is less than the preset accuracy rate, it indicates that the recognition effect of the training network for butterfly recognition is not good, and the recognition butterfly needs to be further improved. Otherwise, there is no need to adjust the training network for butterfly recognition.
  • the preset accuracy rate can be set to 95% or a percentage value greater than 95%.
  • a target butterfly image used as a test is input to a training network that recognizes butterflies, and a test output vector corresponding to a loss function value that is greater than or equal to the upper boundary of the vector length is obtained.
  • the test output vector is reconstructed to obtain the output image, and then the accuracy rate of the training network for butterfly recognition is obtained.
  • the accuracy rate can intuitively determine the recognition effect of the butterfly recognition training network on the butterfly species, and determine whether to recognize the butterfly based on the recognition effect. Training network to make further improvements.
  • a device for constructing a butterfly recognition network corresponds to the method for constructing a butterfly recognition network in the above-mentioned embodiment.
  • the apparatus for constructing a butterfly recognition network includes an acquisition module 61, a resampling module 62, a convolution module 63, a calculation module 64, a training module 65, and an update module 66.
  • the detailed description of each function module is as follows:
  • An obtaining module 61 configured to obtain an original butterfly image corresponding to each butterfly type from a preset butterfly database
  • a resampling module 62 configured to resample the original butterfly image to obtain a target butterfly image
  • a convolution module 63 for each butterfly species, inputs a butterfly image used for training in the butterfly species into a capsule network, and passes the first convolution calculation of the convolution layer of the capsule network and the capsules of the capsule network The second convolution calculation of the layer to obtain the output vector of the butterfly species;
  • a loss calculation module 64 is configured to perform a loss function calculation on an output vector of each butterfly species in a loss function layer in the capsule network to obtain a loss function value of each output vector;
  • a training module 65 configured to use the capsule network as a training network for identifying butterflies when the loss function value of each output vector is less than or equal to a preset loss threshold;
  • An update module 66 is configured to update each capsule neuron in the capsule network by back propagation when the loss function value is greater than a preset loss threshold, to obtain the updated capsule network, and use each butterfly species as training
  • the target butterfly image is re-input into the updated capsule network, and the first convolution calculation, the second convolution calculation, and the loss function calculation are performed until the loss function value is less than or equal to a preset loss threshold, where the capsule neuron Attributes representing butterfly species.
  • the resampling module 62 includes:
  • a scaling unit 621 configured to determine a scaling ratio of the original butterfly image according to a preset target size
  • An obtaining unit 622 is configured to obtain the original pixel points of the original butterfly image according to the scaling ratio, obtain a set of original pixel points corresponding to each target pixel point of the target butterfly image in the original butterfly image, and establish each original pixel point. A correspondence between a set of pixels and each pixel of the target butterfly image;
  • a calculation unit 623 is configured to calculate an average RGB value of each original pixel in the set of original pixels, and use the average RGB value as an RGB value of a target pixel corresponding to the set of original pixels according to a corresponding relationship.
  • the convolution module 63 includes:
  • a first convolution unit 631 configured to perform a first convolution calculation in a convolution layer of a capsule network on a target butterfly image input into a butterfly species for training, to obtain a feature vector;
  • An activation unit 632 configured to substitute the feature vector into a modified linear activation function to obtain a local feature vector
  • a second convolution unit 633 is configured to perform a second convolution calculation using a local feature vector with each capsule neuron in a capsule layer of the capsule network by using an iterative routing processing method to obtain an output vector of a butterfly type.
  • calculation loss module 64 includes:
  • a formula unit 641 is configured to calculate each loss vector of the output vector in a loss function layer in the capsule network according to formula (6):
  • c is the butterfly type
  • L c is the loss function value
  • T c is the indicator function of the butterfly type
  • ) 2 is taken as 0 and m + -
  • -m -) 2 is taken and
  • is the vector length of the output vector V c
  • is the preset parameter value
  • m - is the lower boundary of the preset vector length.
  • the apparatus for constructing a butterfly recognition network further includes:
  • a test calculation module 67 is configured to input a target butterfly image used as a test into a training network for recognition of a butterfly, and obtain a loss function value of a test output vector through a first convolution calculation, a second convolution calculation, and a loss function calculation. ;
  • a reconstruction module 68 is configured to take a test output vector corresponding to a loss function value that is greater than or equal to a preset upper boundary of the vector length, and reconstruct the test output vector through a decoder network to obtain an output image, and compare the output image with The target butterfly images used for testing are compared to get the accuracy of the training network for butterfly recognition.
  • Each module in the above-mentioned butterfly recognition network construction device may be implemented in whole or in part by software, hardware, and a combination thereof.
  • the above-mentioned modules may be embedded in the hardware in or independent of the processor in the computer device, or may be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
  • a computer device is provided.
  • the computer device may be a server, and its internal structure diagram may be as shown in FIG. 7.
  • the computer device includes a processor, a memory, a network interface, and a database connected through a system bus.
  • the processor of the computer device is used to provide computing and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system, computer-readable instructions, and a database.
  • the internal memory provides an environment for the operation of the operating system and computer-readable instructions in a non-volatile storage medium.
  • the computer equipment database is used to store the original butterfly image.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • the computer-readable instructions are executed by a processor to implement a method for constructing a butterfly recognition network.
  • a computer device including a memory, a processor, and computer-readable instructions stored on the memory and executable on the processor.
  • the processor executes the computer-readable instructions
  • the butterfly recognition of the foregoing embodiment is implemented. Steps of the network construction method, for example, steps S1 to S6 shown in FIG. 2 or, when the processor executes computer-readable instructions, the functions of each module / unit of the butterfly recognition network construction device in the above embodiment are implemented, as shown in FIG. 6 Modules 61 to 66 function. To avoid repetition, we will not repeat them here.
  • one or more non-volatile readable storage media are provided, and computer-readable instructions are stored thereon.
  • the computer-readable instructions are executed by one or more processors, the butterfly in the foregoing method embodiment is implemented.
  • Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory can include random access memory (RAM) or external cache memory.
  • RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Multimedia (AREA)
  • Image Analysis (AREA)

Abstract

本申请公开了一种蝴蝶识别网络构建方法、装置、计算机设备及存储介质,所述方法包括:将原始蝴蝶影像重采样处理后得到的用作训练的目标蝴蝶影像,若经过胶囊网络的卷积层的第一卷积计算、胶囊层的第二卷积计算得到的输出向量在损失函数层中计算得到的损失函数值不大于预设阈值,则将胶囊网络作为识别蝴蝶的训练网络,否则,通过反向传播更新胶囊网络中的每个胶囊神经元,得到更新后的胶囊网络,并将用作训练的目标蝴蝶影像重新在更新后的胶囊网络中,进行第一卷积计算、第二卷积计算和损失函数计算,直到损失函数值不大于损失阈值为止,实现了蝴蝶影像的多义性表达,即能分辨不同视角的同一蝴蝶种类,从而提高胶囊网络识别蝴蝶的准确率。

Description

蝴蝶识别网络构建方法、装置、计算机设备及存储介质
本申请以2018年7月6日提交的申请号为201810735895.1,名称为“蝴蝶识别网络构建方法、装置、计算机设备及存储介质”的中国发明专利申请为基础,并要求其优先权。
技术领域
本申请涉及计算机技术领域,尤其涉及一种蝴蝶识别网络构建方法、装置、计算机设备及存储介质。
背景技术
近几年,随着人工智能的发展,深度学习在语音识别、自然语言处理以及图像与视频分析等诸多领域获得了巨大的成功。目前,深度学习是一种从端到端机器学习系统,深度学习方法中的卷积神经网络(convolutional neural network,CNN)模型在大规模图像识别任务中表现出色,与传统模式识别方法最大不同在于它从图像中能自动逐层提取特征,可以包含成千上万的参数,这些良好的特征表达在深度学习中起到至关重要的作用。
提高蝴蝶识别率对实际的生物研究有着很大的实际意义,例如通过蝴蝶识别可用作生物多样性的学习和物种的分析等。由于目前已有的影像数据库中存在的蝴蝶影像数量有限,蝴蝶种类少,蝴蝶影像的尺寸太小,不利于传统卷积神经网络对蝴蝶进行识别。因为传统卷积神经网络需要大量的训练影像,而且缺少观测位置和视角信息,即不能很好地处理图像的多义性表达。因为传统卷积神经网络无法根据同一种蝴蝶的不同视角去区分得到同一蝴蝶种类的分类结果,所以导致蝴蝶识别准确率低。
发明内容
本申请实施例提供一种蝴蝶识别网络构建的方法、装置、计算机设备及存储介质,以解决由于传统卷积神经网络将不同视角的同一类蝴蝶识别为不同种类的蝴蝶,而导致识别蝴蝶准确率低的问题。
一种蝴蝶识别网络构建方法,包括:
从预设的蝴蝶数据库中获取每种蝴蝶种类对应的原始蝴蝶影像;
对所述原始蝴蝶影像进行重采样处理,得到目标蝴蝶影像;
针对每种所述蝴蝶种类,将该蝴蝶种类中用作训练的所述目标蝴蝶影像输入到胶囊网络中,并经过所述胶囊网络的卷积层的第一卷积计算和所述胶囊网络的胶囊层的第二卷积计算,得到该蝴蝶种类的输出向量;
在所述胶囊网络中的损失函数层中,对每种所述蝴蝶种类的所述输出向量进行损失函数计算,得到每个所述输出向量的损失函数值;
当每个所述输出向量的所述损失函数值均小于或者等于预设的损失阈值时,将所述胶囊网络作为识别蝴蝶的训练网络;
当所述损失函数值大于所述预设的损失阈值时,通过反向传播更新所述胶囊网络中的每个胶囊神经元,得到更新后的所述胶囊网络,并将每种所述蝴蝶种类中用作训练的所述目标蝴蝶影像重新输入到更新后的所述胶囊网络中,进行所述第一卷积计算、所述第二卷积计算和所述损失函数计算,直到所述损失函数值小于或者等于所述预设的损失阈值为止,其中,所述胶囊神经元代表所述蝴蝶种类的属性。
一种蝴蝶识别网络构建装置,包括:
获取模块,用于从预设的蝴蝶数据库中获取每种蝴蝶种类对应的原始蝴蝶影像;
重采样模块,用于对所述原始蝴蝶影像进行重采样处理,得到目标蝴蝶影像;
卷积模块,用于针对每种所述蝴蝶种类,将该蝴蝶种类中用作训练的所述目标蝴蝶影像输入到胶囊网络中,并经过所述胶囊网络的卷积层的第一卷积计算和所述胶囊网络的胶囊层的第二卷积计算,得到该蝴蝶种类的输出向量;
计算损失模块,用于在所述胶囊网络中的损失函数层中,对每种所述蝴蝶种类的所述输出向量进行损失函数计算,得到每个所述输出向量的损失函数值;
训练模块,用于当每个所述输出向量的所述损失函数值均小于或者等于预设的损失阈值时,将所述胶囊网络作为识别蝴蝶的训练网络;
更新模块,用于当所述损失函数值大于所述预设的损失阈值时,通过反向传播更新所述胶囊网络中的每个胶囊神经元,得到更新后的所述胶囊网络,并将每种所述蝴蝶种类中用作训练的所述目标蝴蝶影像重新输入到更新后的所述胶囊网络中,进行所述第一卷积计算、所述第二卷积计算和所述损失函数计算,直到所述损失函数值小于或者等于所述预设的损失阈值为止,其中,所述胶囊神经元代表所述蝴蝶种类的属性。
一种计算机设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现上述蝴蝶识别网络构建方法的步骤。
一个或多个存储有计算机可读指令的非易失性可读存储介质,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行上述蝴蝶识别网络构建方法的步骤。
本申请的一个或多个实施例的细节在下面的附图和描述中提出,本申请的其他特征和优点将从说明书、附图以及权利要求变得明显。
附图说明
为了更清楚地说明本申请实施例的技术方案,下面将对本申请实施例的描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1是本申请一实施例中蝴蝶识别网络构建方法的一应用环境示意图;
图2是本申请一实施例中蝴蝶识别网络构建方法的实现流程图;
图3是本申请一实施例中蝴蝶识别网络构建方法中步骤S2的一实现流程图;
图4是本申请一实施例中蝴蝶识别网络构建方法中步骤S3的的一实现图;
图5是本申请一实施例中蝴蝶识别网络构建方法中测试识别蝴蝶的训练网络的一实现图;
图6是本申请一实施例中蝴蝶识别网络构建装置的一示意图;
图7是本申请一实施例中计算机设备的一示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请提供的蝴蝶识别网络构建方法,可应用在如图1的应用环境中,其中,服务端和客户端之间通过网络进行连接,服务端将目标蝴蝶影像在胶囊网络中执行第一卷积计算,第二卷积计算以及损失函数计算处理得到识别蝴蝶的训练网络,用户通过客户端修 改胶囊网络的训练参数,客户端具体可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑和便携式可穿戴设备,服务端具体可以用独立的服务器或者多个服务器组成的服务器集群实现。
在一实施例中,如图2所示,提供一种蝴蝶识别网络构建方法,以该方法应用在图1中的服务器为例进行说明,包括如下步骤:
S1:从预设的蝴蝶数据库中获取每种蝴蝶种类对应的原始蝴蝶影像。
具体地,预设的蝴蝶数据库存储着现有的蝴蝶数据库中的所有原始蝴影像,预设的蝴蝶数据库包括但不限于Leeds(利兹)蝴蝶数据库、Ecuador(厄瓜多尔)蝴蝶数据库、以及Costarica(哥斯达黎加)蝴蝶数据库。另外,预设的蝴蝶数据库还可以采用Fine-Grained(细粒度)蝴蝶数据库,其中,Leeds(利兹)蝴蝶数据库包括636个蝴蝶种类对应的14270张原始蝴蝶影像、Ecuador(厄瓜多尔)蝴蝶数据库包括10个蝴蝶种类蝴蝶种类对应的832张原始蝴蝶影像、Costarica(哥斯达黎加)包括675个蝴蝶种类对应的2120张原始蝴蝶影像、Fine-Grained(细粒)蝴蝶数据库包括331个蝴蝶种类对应的3224张原始蝴蝶影像,此处蝴蝶数据库不做限制。
S2:对原始蝴蝶影像进行重采样处理,得到目标蝴蝶影像。
具体地,在图像领域中,重采样是对采样后形成的由离散数据组成的数字图像按照预设的像元位置或像元间距重新采样,以构成几何变换后的新图像。
对每张原始蝴蝶影像进行重采样处理,并将得到的目标蝴蝶影像分成两部分,其中,一部分目标蝴蝶影像用作训练胶囊网络的训练样本数据,另一部分目标蝴蝶影像用作测试识别蝴蝶的训练网络的测试样本数据。
进一步地,原始蝴蝶影像经过重采样处理后得到尺寸大小一致的目标蝴蝶影像,并且目标蝴蝶影像都携带对应的蝴蝶种类标记,利于后续训练或者测试识别蝴蝶的训练网络时得到的输出结果与原来输入的目标蝴蝶影像携带对应的蝴蝶种类标记进行比较,以便判断输出结果是否正确。
S3:针对每种蝴蝶种类,将该蝴蝶种类中用作训练的目标蝴蝶影像输入到胶囊网络中,并经过胶囊网络的卷积层的第一卷积计算和胶囊网络的胶囊层的第二卷积计算,得到该蝴蝶种类的输出向量。
具体地,胶囊网络由解析树组成。胶囊网络中的每一层神经元层的神经元将会被划分为多个神经元组,每一个神经元组称为胶囊(capsule),解析树的每一个节点将对应于一个激活的胶囊(active capsule)。一个激活的胶囊中由多个激活的胶囊神经元组成,每个胶囊神经元包含了卷积核,卷积核是一种滤波器((filter))矩阵或者叫特征检测器(feature detector),卷积核中的权值是属性的特征表达,也就是说胶囊神经元代表了某个蝴蝶种类的属性,其中,属性可是不同角度、位置以及方向等每种蝴蝶种类对应的不同视角。总而言之,识别蝴蝶的训练网络是通过不断修改胶囊神经元中的卷积核中的权值以及其他训练参数来提高识别蝴蝶的准确率,其中,其他训练参数包括耦合系数。
进一步地,针对每种蝴蝶种类,将用作训练的该蝴蝶种类的目标蝴蝶影像输入到胶囊网络中的卷积层中执行第一卷积计算。其中,第一卷积计算是将目标蝴蝶影像与卷积层中的卷积核计算,卷积核计算是指将卷积核中的每个位置上的元素值与目标蝴蝶图像上对应的点的元素值相乘累加,即两个矩阵间的点的元素值分别进行相乘叠加后,得到输出矩阵中的每一个元素的值,并将第一卷积计算得到的结果在胶囊网络的胶囊层中执行第二卷积计算,其中,第二卷积计算是将第一卷积计算得到的结果与激活的胶囊神经元进行卷积计算,得到该蝴蝶种类的输出向量。
需要说明的是,输出向量中的向量长度表示目标蝴蝶影像在胶囊网络中被识别为对应蝴蝶种类的概率,输出向量的向量方向表示蝴蝶种类的属性,例如蝴蝶的不同视角。
S4:在胶囊网络中的损失函数层中,对每种蝴蝶种类的输出向量进行损失函数计 算,得到每个输出向量的损失函数值。
具体地,损失函数(loss function)是描述训练模型在不同参数(parameter)值之下的损失,用来估量训练模型的预测值与真实值的不一致程度。对每种蝴蝶种类的输出向量执行损失函数计算,得到输出向量的损失函数值是一个非负函数值。根据损失函数值的大小,调整识别蝴蝶的训练网络的训练参数,能使损失函数值变小,损失函数值越小,识别蝴蝶的训练网络的鲁棒性越好,其中,训练参数包括卷积核中的权值。
S5:当每个输出向量的损失函数值均小于或者等于预设的损失阈值时,将胶囊网络作为识别蝴蝶的训练网络。
具体地,根据步骤S4中得到每个输出向量的的损失函数值均小于或者等于预设的损失阈值时,即此时的识别蝴蝶的训练网络的鲁棒性达到了预期的识别蝴蝶的效果,将当前的胶囊网络作为最终识别蝴蝶的训练网络。其中,预设的损失阈值可以是0.3或者是0至1的小数。
S6:当损失函数值大于预设的损失阈值时,通过反向传播更新胶囊网络中的每个胶囊神经元,得到更新后的胶囊网络,并将每种蝴蝶种类中用作训练的目标蝴蝶影像重新输入到更新后的胶囊网络中,进行第一卷积计算、第二卷积计算和损失函数计算,直到损失函数值小于或者等于预设的损失阈值为止,其中,胶囊神经元代表蝴蝶种类的属性。
具体地,当根据步骤S4中得到的损失函数值大于损失阈值时,通过反向传播更新胶囊网络中的每个胶囊神经元,其中,反向传播是通过逐层求出损失函数对各神经元权值的偏导数,从而得到损失函数对输出向量的梯量,将梯量作为修改每个胶囊神经元中的的权值的依据,使开发人员根据梯量调整胶囊网络中的各个胶囊神经元的权值,从而更新了胶囊网络,并将每种蝴蝶种类中用作训练的目标蝴蝶影像重新输入到更新后的胶囊网络中,并继续执行步骤S3,直到损失函数值小于或者等于损失阈值为止,其中,胶囊神经元代表蝴蝶种类的属性包括每个蝴蝶种类对应的不同视角。
本实施例中,通过从预设的蝴蝶数据库中获取每种蝴蝶种类对应的原始蝴蝶影像,将原始蝴蝶影像重采样处理后得到目标蝴蝶影像;将该蝴蝶种类中用作训练的目标蝴蝶影像输入到胶囊网络中,并经过胶囊网络的卷积层的第一卷积计算和胶囊网络的胶囊层的第二卷积计算,得到该蝴蝶种类的输出向量经过损失函数计算得到损失函数值;当损失函数值大于预设值时,通过反向传播更新胶囊网络中的每个胶囊神经元,从而得到更新后的胶囊网络,将用作训练的目标蝴蝶影像输入到更新后的胶囊网络中进行第一卷积计算、第二卷积计算和损失函数计算,直到损失函数值小于或者等于损失阈值为止,实现了采用少量的目标蝴蝶影像处理了蝴蝶影像的多义性表达,也就是将目标蝴蝶影像与胶囊网络中表示蝴蝶种类的属性的每个胶囊神经元进行训练处理得到的损失值满足损失阈值时,即无论输入的目标蝴蝶影像的实际属性是否为不同视角,最终得到该目标蝴蝶影像的分类结果对应的蝴蝶种类,从而实现了能分辨不同视角的同一蝴蝶种类,从而提高了胶囊网络识别蝴蝶的准确率。
在一实施例中,如图3所示,步骤S2中,即原始蝴蝶影像进行重采样处理,得到目标蝴蝶影像,具体包括如下步骤:
S21:根据预设的目标尺寸确定原始蝴蝶影像的缩放比例。
具体地,根据预设的目标尺寸确定原始蝴蝶影像的缩放比例,使得获取得到的目标蝴蝶影像具有相同的尺寸,利于胶囊网路对蝴蝶种类的识别,减少因尺寸不一致带来的干扰因素,同时防止过拟合。
例如,将所有原始蝴蝶影像全部重采样得到尺寸为32×32×3的大小,其中,沿行方向32像素,沿列方向32像素,3指RGB三个通道。当一个原始蝴蝶影像为64×64×3时, 得到的缩放比例为
Figure PCTCN2018106395-appb-000001
也就是将该原始蝴蝶影像缩小两倍尺寸大小。
具体地,通道用于表示图像的某种组成。例如,一个标准数字相机拍摄的图像会有三通道——红、绿和蓝,把它们看作是互相堆叠在一起的二维矩阵,每一个通道代表一个颜色,每个通道的像素值在0到255的范围内。
S22:按照缩放比例,获取对原始蝴蝶影像的原始像素点进行划分,得到目标蝴蝶影像的每个目标像素点在原始蝴蝶影像中对应的原始像素点的集合,并建立每个原始像素点的集合与所述目标蝴蝶影像的每个像素点之间的对应关系。
具体地,继续引用步骤S21中的例子,从目标影像出发,按照缩放比例2,获取对原始蝴蝶影像的原始像素点进行划分,得到目标蝴蝶影像的每个目标像素点在原始蝴蝶影像中对应的原始像素点的集合,并建立每个原始像素点的集合与所述目标蝴蝶影像的每个像素点之间的对应关系,例如,目标影像的左上角第一个像素,对应的是原始蝴蝶影像的左上角为2×2=4个像素,即这4个像素为原始像素点的集合。
S23:计算原始像素点的集合中的每个原始像素点的平均RGB值,并根据对应关系,将该平均RGB值作为原始像素点的集合对应的目标像素点的RGB值。
具体地,根据步骤S22获取的原始像素点的集合,将每个原始像素点的RGB值进行累加求平均得到的平均RGB值,并根据原始像素点与目标蝴蝶影像的每个像素点的对应关系,将平均RGB值作为原始像素点的集合对应的目标像素点的RGB值,其中,平均RGB值为正整数。例如,继续引用步骤S22的例子,若4个像素的RGB值为{215,0,64,0}得平均RGB值为
Figure PCTCN2018106395-appb-000002
在本实施例中,根据预设的目标尺寸确定原始蝴蝶影像的缩放比例,获取目标蝴蝶影像的每个目标像素点在原始蝴蝶影像中对应的原始像素点的集合,并计算原始像素点的集合中的每个原始像素点的平均RGB值,并将该平均RGB值作为原始像素点的集合对应的目标像素点的RGB值,实现了将所有不同尺寸的原始蝴蝶影像缩放到统一标准尺寸的目标蝴蝶影像,有利于后续对胶囊网络提供良好的训练样本数据,同时避免了因原始蝴蝶影像的尺寸不同引起的过拟合问题。
在一实施例中,如图4所示,步骤S3中,即针对每种所述蝴蝶种类,将该蝴蝶种类中用作训练的所述目标蝴蝶影像输入到胶囊网络中,并经过所述胶囊网络的卷积层的第一卷积计算和所述胶囊网络的胶囊层的第二卷积计算,得到该蝴蝶种类的输出向量,具体包括如下步骤:
S31:将输入到蝴蝶种类中用作训练的目标蝴蝶影像在胶囊网络的卷积层中执行第一卷积计算,得到特征向量。
具体地,将蝴蝶种类中用作训练的目标蝴蝶影像输入到胶囊网络的卷积层,并将该目标蝴蝶影像与卷积层中每个胶囊神经元的卷积核执行第一卷积计算,第一卷积计算是将卷积核中的每个位置上的元素值与目标蝴蝶图像上对应的点的元素值相乘叠加,得到的特征向量叫做卷积特征(Convolved Feature)或者特征图(Feature Map)。例如,深度为256,卷积窗口大小为9*9,即构建了256个9*9矩阵的卷积核。
需要说明的是,当第一卷积计算过程中出现越界问题时,使用0补充,也叫零填充(Zero-padding)。在目标蝴蝶图像的边缘使用零值进行填充,可以对输入目标蝴蝶图像的边缘进行滤波,方便控制特征图的大小。
S32:将特征向量代入到修正线性激活函数中,得到局部特征向量。
具体地,修正线性激活函数,即ReLU(Rectified linear unit)激活函数,是一种神经元的激活函数,也是一种分段线性函数,能将特征图中的所有小于0的像素值设置为零,而使其他像素值为正值的值不变,这种操作被称为单侧抑制,从而实现了在稀疏后的胶囊 网络中能够更好地挖掘相关特征,避免过拟合。
进一步地,将特征向量代入到修正线性激活函数中,也就是将特征图的像素灰度值转化为局部特征的激活值。
S33:通过使用迭代路由处理方式,将局部特征向量与胶囊网络的胶囊层中的每个胶囊神经元进行第二卷积计算,得到蝴蝶种类的输出向量。
具体地,在本实施例中的胶囊网络的胶囊层是一个32通道(channels)的胶囊(capsule),每个胶囊(capsule)均包含8个胶囊神经元,每个胶囊神经元包括9×9的卷积核,并且步长(stride)为2。第二卷积计算是指将每个胶囊神经元与卷积层的所有局部特征向量进行卷积计算,并通过采用迭代路由处理方式,最终由32×32×n个胶囊输出,每个胶囊为8维的输出向量,即每个胶囊实质输出的是一组输出向量。
进一步地,迭代路由处理方式(iterative dynamic routing process)通过公式(1)至公式(4)可求得输出向量,该输出向量代表了不同视角的每种蝴蝶种类出现的概率大小,具体包括:
Figure PCTCN2018106395-appb-000003
Figure PCTCN2018106395-appb-000004
Figure PCTCN2018106395-appb-000005
Figure PCTCN2018106395-appb-000006
其中,b ij指第i个胶囊神经元和第j个胶囊神经元之间的softmax(柔性最大)激活函数,softmax激活函数是一种将多维向量的每一个值都映射成(0,1)区间的函数,在此处用于分类,c ij为耦合系数,
Figure PCTCN2018106395-appb-000007
为局部特征向量,W ij为权矩阵,S j是所有局部特征向量
Figure PCTCN2018106395-appb-000008
的加权和,V j是第j个胶囊神经元的输出向量。
c ij是由迭代路由处理决定的耦合系数,Capsule与上一层的capsules之间的耦合系数和为1。该系数和其他权值一同在训练中决定,取决于两个capsules的位置和种类。迭代路由处理初始化时,胶囊层中的每个胶囊神经元对卷积层中的每个胶囊神经元都有相同的耦合系数;胶囊层中的每个胶囊神经元对每一个可能的父节点计算局部特征向量并作为父节点的输入,如果这个局部特征向量和某一个父节点的输出向量的内积很大,那么会通过一个自顶向下的反馈增大这个父节点的耦合系数,同时减小其他父节点的耦合系数,达到动态选择的结果。另外,一个胶囊神经元的所有的耦合系数的和为1。
需要说明的是,低级别的胶囊神经元倾向于向与高级别的胶囊神经元,即耦合系数高表示对蝴蝶种类的局部特征的预测倾向大,耦合系数低表示对蝴蝶种类的局部特征预测倾向小。假设胶囊神经元i对胶囊神经元j的的耦合系数c ij为1,由于胶囊神经元i的所有耦合系数和为1,那么该胶囊神经元i对其他胶囊神经元的耦合系数为0了,也就是说, 胶囊神经元i的所有局部特征向量都只传入到胶囊神经元j。
进一步地,由于向量长度代表了每种蝴蝶种类出现的概率大小,即V j是一个概率值,因此利用一个非线性“挤压”函数来保证将短的输出向量“压缩”成长度接近0、将长的向量“压缩”成长度接近1的值。
在本实施例中,将输入到蝴蝶种类中用作训练的目标蝴蝶影像在在胶囊网络的卷积层中执行第一卷积计算,得到的特征向量代入到修正线性激活函数中,得到局部特征向量;通过使用迭代路由处理方式,将局部特征向量与胶囊网络的胶囊层中的每个胶囊神经元进行第二卷积计算,得到输出向量,利用迭代路由处理方式使得对蝴蝶种类的局部特征的预测倾向更加明显,实现了目标蝴蝶影像的泛化,例如泛化包括似度、方向以及大小等视角信息,从而提高了对同一蝴蝶种类的不同蝴蝶视角的分辨能力。
进一步地,在一实施例中,对步骤S4中提及的在胶囊网络中的损失函数层中,对每种蝴蝶种类的输出向量进行损失函数计算,得到输出向量的损失函数值的具体实现过程详述如下:
将每一个输出向量在胶囊网络中的损失函数层中,按照公式(5)计算输出向量的损失函数值:
L c=T c max(0,m +-||V c||) 2+λ(1-T c)max(0,||V c||-m -) 2  (5)
其中,c为蝴蝶种类,L c为损失函数值,T c为蝴蝶种类的指示函数,max(0,m +-||V c||) 2为取0和m +-||V c||两个数值中的最大值的平方,max(0,||V c||-m -) 2为取0和||Vc||-m -两个数值中的最大值的平方,m +为预设的向量长度上边界,||V c||为输出向量V c的向量长度,λ为预设参数值,m -为预设的向量长度下边界。
具体地,指示函数又称为特征函数,在本实施例中指示函数是将每个蝴蝶种类各自定义为一个集合,集合中包括蝴蝶种类的各个属性的子集,当蝴蝶种类对应的的目标蝴蝶影像属于该集合中的某一个子集,子集可以是蝴蝶种类的某个属性。
进一步地,若指示函数判断输出向量与实际的目标蝴蝶影像一样时,则输出为1,否则为0,例如,用一个列向量的总长度标识为蝴蝶种类的总数,列向量的元素为1的位置代表该位置对应的蝴蝶种类的分类结果,列向量中的0代表不是该蝴蝶种类。当输出向量属于某个子集,并且该子集属于某个蝴蝶种类的集合时,则在该种类对应的列项量为1,然而在实际分类中,列向量中的值是对应的蝴蝶种类的概率大小。例如,胶囊的输出向量||V c||的长度对应于它属于第c种蝴蝶种类的概率。
在本申请实施例中,通过将每一个输出向量在胶囊网络中的损失函数层计算得到损失函数值,根据损失函数值的大小来衡量胶囊网络对蝴蝶种类的预测效果好坏,有利于进一步调整胶囊网络中的参数。
在一实施例中,如图5所示,步骤S6之后,该蝴蝶识别网络构建方法还包括如下步骤:
S7:将用作测试的目标蝴蝶影像输入到识别蝴蝶的训练网络中,并通过第一卷积计算、第二卷积计算以及损失函数计算,得到测试输出向量的损失函数值。
具体地,将用作测试的目标蝴蝶影像,也就是将测试样本数据输入到由步骤S1至步骤S5中得到的识别蝴蝶的训练网络中,并根据步骤S3,通过第一卷积计算、第二卷积计 算以及损失函数计算,输出测试输出向量的损失函数值。
S8:取大于或者等于预设的向量长度上边界的损失函数值对应的测试输出向量,并通过解码器网络将测试输出向量进行重构,得到输出图像,并将输出图像与用作测试的目标蝴蝶影像进行比较,得到识别蝴蝶的训练网络的准确率。
具体地,获取大于或者等于预设的向量长度上边界的损失函数值对应的测试输出向量,例如,若存在第c类蝴蝶种类,规定预设的向量长度为0.9,则第c类蝴蝶种类的输出一个向量长度至少为0.9的输出向量时,才能表示该输出向量对应的目标蝴蝶影像属于第c类蝴蝶种类,其中,0.9表示向量长度上边界。
进一步地,将测试输出向量通过解码器网络进行重构,解码器网络由3个全连接层组成,通过解码器网络重构得到输出图像。重构是指将测试输出向量重新构建出与该测试输出向量对应的实际图像,从而构建一个完整的输出图像。根据重构的方式,将所有测试输出向量通过解码器网络得到输出图像,并采用图像比较方式,筛选出与用作测试的目标蝴蝶影像相同的输出图像,其中,图像比较方式包括但不限于感知哈希算法、灰度直方图相似比较法或者PSNR(峰值信噪比)方法,并计算筛选出的与用作测试的目标蝴蝶影像相同的输出图像的总数与用作测试的目标蝴蝶影像的总量的占比值,该占比值就是就是识别蝴蝶的训练网络的准确率,若得到的准确率小于预设的准确率,则说明识别蝴蝶的训练网络的识别效果不佳,需要进一步改进该识别蝴蝶的训练网络,否则,无需对识别蝴蝶的训练网络进行调整。其中,预设的准确率可以设置为95%或者95%以上的百分比值。
在本实施例中,将用作测试的目标蝴蝶影像输入到识别蝴蝶的训练网络中进行测试,并取得大于或者等于向量长度上边界的损失函数值对应的测试输出向量,通过解码器网络将该测试输出向量进行重构,得到输出图像,进而得到识别蝴蝶的训练网络的准确率,通过准确率能直观地判断该识别蝴蝶的训练网络对蝴蝶种类的识别效果,根据识别效果决定是否对识别蝴蝶的训练网络做进一步的改进。
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
在一实施例中,提供一种蝴蝶识别网络构建的装置,该蝴蝶识别网络构建装置与上述实施例中蝴蝶识别网络构建方法一一对应。如图6所示,该蝴蝶识别网络构建装置包括获取模块61、重采样模块62、卷积模块63、计算模块64、训练模块65和更新模块66。各功能模块详细说明如下:
获取模块61,用于从预设的蝴蝶数据库中获取每种蝴蝶种类对应的原始蝴蝶影像;
重采样模块62,用于对原始蝴蝶影像进行重采样处理,得到目标蝴蝶影像;
卷积模块63,用于针对每种蝴蝶种类,将该蝴蝶种类中用作训练的目标蝴蝶影像输入到胶囊网络中,并经过胶囊网络的卷积层的第一卷积计算和胶囊网络的胶囊层的第二卷积计算,得到该蝴蝶种类的输出向量;
计算损失模块64,用于在胶囊网络中的损失函数层中,对每种蝴蝶种类的输出向量进行损失函数计算,得到每个输出向量的损失函数值;
训练模块65,用于当每个输出向量的损失函数值均小于或者等于预设的损失阈值时,将胶囊网络作为识别蝴蝶的训练网络;
更新模块66,用于当损失函数值大于预设的损失阈值时,通过反向传播更新胶囊网络中的每个胶囊神经元,得到更新后的胶囊网络,并将每种蝴蝶种类中用作训练的目标蝴蝶影像重新输入到更新后的胶囊网络中,进行第一卷积计算、第二卷积计算和损失函数计算,直到损失函数值小于或者等于预设的损失阈值为止,其中,胶囊神经元代表蝴蝶种类的属性。
进一步地,重采样模块62包括:
缩放单元621,用于根据预设的目标尺寸确定原始蝴蝶影像的缩放比例;
获取单元622,用于按照缩放比例,获取对原始蝴蝶影像的原始像素点进行划分,得到目标蝴蝶影像的每个目标像素点在原始蝴蝶影像中对应的原始像素点的集合,并建立每个原始像素点的集合与所述目标蝴蝶影像的每个像素点之间的对应关系;
计算单元623,用于计算原始像素点的集合中的每个原始像素点的平均RGB值,并根据对应关系,将该平均RGB值作为原始像素点的集合对应的目标像素点的RGB值。
进一步地,卷积模块63包括:
第一卷积单元631,用于将输入到蝴蝶种类中用作训练的目标蝴蝶影像在胶囊网络的卷积层中执行第一卷积计算,得到特征向量;
激活单元632,用于将特征向量代入到修正线性激活函数中,得到局部特征向量;
第二卷积单元633,用于通过使用迭代路由处理方式,将局部特征向量与胶囊网络的胶囊层中的每个胶囊神经元进行第二卷积计算,得到蝴蝶种类的输出向量。
进一步地,计算损失模块64包括:
公式单元641,用于将每一个输出向量在胶囊网络中的损失函数层中,按照公式(6)计算输出向量的损失函数值:
L c=T c max(0,m +-||V c||) 2+λ(1-T c)max(0,||V c||-m -) 2  公式(6)
其中,c为蝴蝶种类,L c为损失函数值,T c为蝴蝶种类的指示函数,max(0,m +-||V c||) 2为取0和m +-||V c||两个数值中的最大值的平方,max(0,||V c||-m -) 2为取0和||V c||-m -两个数值中的最大值的平方,m +为预设的向量长度上边界,||V c||为输出向量V c的向量长度,λ为预设参数值,m -为预设的向量长度下边界。
进一步地,蝴蝶识别网络构建装置还包括:
测试计算模块67,用于将用作测试的目标蝴蝶影像输入到识别蝴蝶的训练网络中,并通过第一卷积计算、第二卷积计算以及损失函数计算,得到测试输出向量的损失函数值;
重构模块68,用于取大于或者等于预设的向量长度上边界的损失函数值对应的测试输出向量,并通过解码器网络将测试输出向量进行重构,得到输出图像,并将输出图像与用作测试的目标蝴蝶影像进行比较,得到识别蝴蝶的训练网络的准确率。
关于蝴蝶识别网络构建装置的具体限定可以参见上文中对于蝴蝶识别网络构建方法的限定,在此不再赘述。上述蝴蝶识别网络构建装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图7所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机可读指令和数据库。该内存储器为非易失性存储介质中的操作系统和计算机可读指令的运行提供环境。该计算机设备的数据库用于存储原始蝴蝶影像。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机可读指令被处理器执行时以实现一种 蝴蝶识别网络构建方法。
在一个实施例中,提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机可读指令,处理器执行计算机可读指令时实现上述实施例蝴蝶识别网络构建方法的步骤,例如图2所示的步骤S1至步骤S6或者,处理器执行计算机可读指令时实现上述实施例中蝴蝶识别网络构建装置的各模块/单元的功能,例如图6所示模块61至模块66功能。为避免重复,这里不再赘述。
在一个实施例中,提供了一个或多个非易失性可读存储介质,其上存储有计算机可读指令,计算机可读指令被一个或多个处理器执行时实现上述方法实施例中蝴蝶识别网络构建方法,或者,该计算机可读指令被一个或多个处理器执行时实现上述装置实施例中蝴蝶识别网络构建装置中各模块/单元的功能。为避免重复,这里不再赘述。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一个或多个非易失性可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。
以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。

Claims (20)

  1. 一种蝴蝶识别网络构建方法,其特征在于,包括:
    从预设的蝴蝶数据库中获取每种蝴蝶种类对应的原始蝴蝶影像;
    对所述原始蝴蝶影像进行重采样处理,得到目标蝴蝶影像;
    针对每种所述蝴蝶种类,将该蝴蝶种类中用作训练的所述目标蝴蝶影像输入到胶囊网络中,并经过所述胶囊网络的卷积层的第一卷积计算和所述胶囊网络的胶囊层的第二卷积计算,得到该蝴蝶种类的输出向量;
    在所述胶囊网络中的损失函数层中,对每种所述蝴蝶种类的所述输出向量进行损失函数计算,得到每个所述输出向量的损失函数值;
    当每个所述输出向量的所述损失函数值均小于或者等于预设的损失阈值时,将所述胶囊网络作为识别蝴蝶的训练网络;
    当所述损失函数值大于所述预设的损失阈值时,通过反向传播更新所述胶囊网络中的每个胶囊神经元,得到更新后的所述胶囊网络,并将每种所述蝴蝶种类中用作训练的所述目标蝴蝶影像重新输入到更新后的所述胶囊网络中,进行所述第一卷积计算、所述第二卷积计算和所述损失函数计算,直到所述损失函数值小于或者等于所述预设的损失阈值为止,其中,所述胶囊神经元代表所述蝴蝶种类的属性。
  2. 如权利要求1所述的蝴蝶识别网络构建方法,其特征在于,所述对所述原始蝴蝶影像进行重采样处理,得到目标蝴蝶影像包括:
    根据预设的目标尺寸确定所述原始蝴蝶影像的缩放比例;
    按照所述缩放比例对所述原始蝴蝶影像的原始像素点进行划分,得到原始像素点的集合,并建立每个所述原始像素点的集合与所述目标蝴蝶影像的每个像素点之间的对应关系;
    计算所述原始像素点的集合中的每个所述原始像素点的平均RGB值,并根据所述对应关系,将该平均RGB值作为所述原始像素点的集合对应的所述目标像素点的RGB值。
  3. 如权利要求1所述的蝴蝶识别网络构建的方法,其特征在于,所述针对每种所述蝴蝶种类,将该蝴蝶种类中用作训练的所述目标蝴蝶影像输入到胶囊网络中,并经过所述胶囊网络的卷积层的第一卷积计算和所述胶囊网络的胶囊层的第二卷积计算,得到该蝴蝶种类的输出向量包括:
    将输入到所述蝴蝶种类中用作训练的所述目标蝴蝶影像在所述胶囊网络的所述卷积层中执行所述第一卷积计算,得到特征向量;
    将所述特征向量代入到修正线性激活函数中,得到局部特征向量;
    通过使用迭代路由处理方式,将所述局部特征向量与所述胶囊网络的所述胶囊层中的每个所述胶囊神经元进行所述第二卷积计算,得到所述蝴蝶种类的输出向量。
  4. 如权利要求1所述的蝴蝶识别网络构建方法,其特征在于,所述在所述胶囊网络中的损失函数层中,对每种所述蝴蝶种类的所述输出向量进行损失函数计算,得到每个所述输出向量的损失函数值包括:
    将每一个所述输出向量在所述胶囊网络中的损失函数层中,按照如下公式计算所述输出向量的所述损失函数值:
    L c=T cmax(0,m +-||V c||) 2+λ(1-T c)max(0,||V c||-m -) 2
    其中,c为所述蝴蝶种类,L c为所述损失函数值,T c为所述蝴蝶种类的指示函数,max(0,m +-||V c||) 2为取0和m +-||V c||两个数值中的最大值的平方,max(0,||V c||-m -) 2为取0 和||V c||-m -两个数值中的最大值的平方,m +为预设的向量长度上边界,||V c||为所述输出向量V c的所述向量长度,λ为预设参数值,m -为预设的向量长度下边界。
  5. 如权利要求4所述的蝴蝶识别网络构建方法,其特征在于,所述当每个所述输出向量的所述损失函数值均小于或者等于预设的损失阈值时,将所述胶囊网络作为识别蝴蝶的训练网络之后,所述方法还包括:
    将用作测试的所述目标蝴蝶影像输入到所述识别蝴蝶的训练网络中,并通过所述第一卷积计算、所述第二卷积计算以及所述损失函数计算,得到测试输出向量的所述损失函数值;
    取大于或者等于所述预设的向量长度上边界的所述损失函数值对应的所述测试输出向量,并通过解码器网络将所述测试输出向量进行重构,得到输出图像,并将所述输出图像与所述用作测试的所述目标蝴蝶影像进行比较,得到所述识别蝴蝶的训练网络的准确率。
  6. 一种蝴蝶识别网络构建装置,其特征在于,所述蝴蝶识别网络构建装置包括:
    获取模块,用于从预设的蝴蝶数据库中获取每种蝴蝶种类对应的原始蝴蝶影像;
    重采样模块,用于对所述原始蝴蝶影像进行重采样处理,得到目标蝴蝶影像;
    卷积模块,用于针对每种所述蝴蝶种类,将该蝴蝶种类中用作训练的所述目标蝴蝶影像输入到胶囊网络中,并经过所述胶囊网络的卷积层的第一卷积计算和所述胶囊网络的胶囊层的第二卷积计算,得到该蝴蝶种类的输出向量;
    计算损失模块,用于在所述胶囊网络中的损失函数层中,对每种所述蝴蝶种类的所述输出向量进行损失函数计算,得到每个所述输出向量的损失函数值;
    训练模块,用于当每个所述输出向量的所述损失函数值均小于或者等于预设的损失阈值时,将所述胶囊网络作为识别蝴蝶的训练网络;
    更新模块,用于当所述损失函数值大于所述损预设的失阈值时,通过反向传播更新所述胶囊网络中的每个胶囊神经元,得到更新后的所述胶囊网络,并将每种所述蝴蝶种类中用作训练的所述目标蝴蝶影像重新输入到更新后的所述胶囊网络中,进行所述第一卷积计算、所述第二卷积计算和所述损失函数计算,直到所述损失函数值小于或者等于所述预设的损失阈值为止,其中,所述胶囊神经元代表所述蝴蝶种类的属性。
  7. 如权利要求6所述的蝴蝶识别网络构建装置,其特征在于,所述重采样模块包括:
    缩放单元,用于根据预设的目标尺寸确定所述原始蝴蝶影像的缩放比例;
    获取单元,用于按照所述缩放比例,获取对所述原始蝴蝶影像的原始像素点进行划分,得到目标蝴蝶影像的每个目标像素点在所述原始蝴蝶影像中对应的原始像素点的集合,并建立每个所述原始像素点的集合与所述目标蝴蝶影像的每个像素点之间的对应关系;
    计算单元,用于计算所述原始像素点的集合中的每个所述原始像素点的平均RGB值,并根据所述对应关系,将该平均RGB值作为所述原始像素点的集合对应的所述目标像素点的RGB值。
  8. 如权利要求6所述的蝴蝶识别网络构建装置,其特征在于,所述卷积模块包括:
    第一卷积单元,用于将输入到所述蝴蝶种类中用作训练的所述目标蝴蝶影像在所述胶囊网络的所述卷积层中执行所述第一卷积计算,得到特征向量;
    激活单元,用于将所述特征向量代入到修正线性激活函数中,得到局部特征向量;
    第二卷积单元,用于通过使用迭代路由处理方式,将所述局部特征向量与所述胶囊网络的所述胶囊层中的每个所述胶囊神经元进行所述第二卷积计算,得到所述蝴蝶种类的输出向量。
  9. 如权利要求6所述的蝴蝶识别网络构建装置,其特征在于,所述计算损失模块包 括:
    公式单元,用于将每一个所述输出向量在所述胶囊网络中的损失函数层中,按照如下公式计算所述输出向量的所述损失函数值:
    L c=T cmax(0,m +-||V c||) 2+λ(1-T c)max(0,||V c||-m -) 2
    其中,c为所述蝴蝶种类,L c为所述损失函数值,T c为所述蝴蝶种类的指示函数,max(0,m +-||V c||) 2为取0和m +-||V c||两个数值中的最大值的平方,max(0,||V c||-m -) 2为取0和||V c||-m -两个数值中的最大值的平方,m +为预设的向量长度上边界,||V c||为所述输出向量V c的所述向量长度,λ为预设参数值,m -为预设的向量长度下边界。
  10. 如权利要求9所述的蝴蝶识别网络构建装置,其特征在于,所述蝴蝶识别网络构建装置还包括:
    测试计算模块,用于将用作测试的所述目标蝴蝶影像输入到所述识别蝴蝶的训练网络中,并通过所述第一卷积计算、所述第二卷积计算以及所述损失函数计算,得到测试输出向量的所述损失函数值;
    重构模块,用于取大于或者等于所述预设的向量长度上边界的所述损失函数值对应的所述测试输出向量,并通过解码器网络将所述测试输出向量进行重构,得到输出图像,并将所述输出图像与所述用作测试的所述目标蝴蝶影像进行比较,得到所述识别蝴蝶的训练网络的准确率。
  11. 一种计算机设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现如下步骤:
    从预设的蝴蝶数据库中获取每种蝴蝶种类对应的原始蝴蝶影像;
    对所述原始蝴蝶影像进行重采样处理,得到目标蝴蝶影像;
    针对每种所述蝴蝶种类,将该蝴蝶种类中用作训练的所述目标蝴蝶影像输入到胶囊网络中,并经过所述胶囊网络的卷积层的第一卷积计算和所述胶囊网络的胶囊层的第二卷积计算,得到该蝴蝶种类的输出向量;
    在所述胶囊网络中的损失函数层中,对每种所述蝴蝶种类的所述输出向量进行损失函数计算,得到每个所述输出向量的损失函数值;
    当每个所述输出向量的所述损失函数值均小于或者等于预设的损失阈值时,将所述胶囊网络作为识别蝴蝶的训练网络;
    当所述损失函数值大于所述预设的损失阈值时,通过反向传播更新所述胶囊网络中的每个胶囊神经元,得到更新后的所述胶囊网络,并将每种所述蝴蝶种类中用作训练的所述目标蝴蝶影像重新输入到更新后的所述胶囊网络中,进行所述第一卷积计算、所述第二卷积计算和所述损失函数计算,直到所述损失函数值小于或者等于所述预设的损失阈值为止,其中,所述胶囊神经元代表所述蝴蝶种类的属性。
  12. 如权利要求11所述的计算机设备,其特征在于,所述对所述原始蝴蝶影像进行重采样处理,得到目标蝴蝶影像包括:
    根据预设的目标尺寸确定所述原始蝴蝶影像的缩放比例;
    按照所述缩放比例对所述原始蝴蝶影像的原始像素点进行划分,得到原始像素点的集合,并建立每个所述原始像素点的集合与所述目标蝴蝶影像的每个像素点之间的对应关系;
    计算所述原始像素点的集合中的每个所述原始像素点的平均RGB值,并根据所述对应关系,将该平均RGB值作为所述原始像素点的集合对应的所述目标像素点的RGB值。
  13. 如权利要求11所述的计算机设备,其特征在于,所述针对每种所述蝴蝶种类,将该蝴蝶种类中用作训练的所述目标蝴蝶影像输入到胶囊网络中,并经过所述胶囊网络的卷积层的第一卷积计算和所述胶囊网络的胶囊层的第二卷积计算,得到该蝴蝶种类的输出向量包括:
    将输入到所述蝴蝶种类中用作训练的所述目标蝴蝶影像在所述胶囊网络的所述卷积层中执行所述第一卷积计算,得到特征向量;
    将所述特征向量代入到修正线性激活函数中,得到局部特征向量;
    通过使用迭代路由处理方式,将所述局部特征向量与所述胶囊网络的所述胶囊层中的每个所述胶囊神经元进行所述第二卷积计算,得到所述蝴蝶种类的输出向量。
  14. 如权利要求11所述的计算机设备,其特征在于,所述在所述胶囊网络中的损失函数层中,对每种所述蝴蝶种类的所述输出向量进行损失函数计算,得到每个所述输出向量的损失函数值包括:
    将每一个所述输出向量在所述胶囊网络中的损失函数层中,按照如下公式计算所述输出向量的所述损失函数值:
    L c=T cmax(0,m +-||V c||) 2+λ(1-T c)max(0,||V c||-m -) 2
    其中,c为所述蝴蝶种类,L c为所述损失函数值,T c为所述蝴蝶种类的指示函数,max(0,m +-||V c||) 2为取0和m +-||V c||两个数值中的最大值的平方,max(0,||V c||-m -) 2为取0和||V c||-m -两个数值中的最大值的平方,m +为预设的向量长度上边界,||V c||为所述输出向量V c的所述向量长度,λ为预设参数值,m -为预设的向量长度下边界。
  15. 如权利要求14所述的计算机设备,其特征在于,所述当每个所述输出向量的所述损失函数值均小于或者等于预设的损失阈值时,将所述胶囊网络作为识别蝴蝶的训练网络之后,所述处理器执行所述计算机可读指令时还实现如下步骤:
    将用作测试的所述目标蝴蝶影像输入到所述识别蝴蝶的训练网络中,并通过所述第一卷积计算、所述第二卷积计算以及所述损失函数计算,得到测试输出向量的所述损失函数值;
    取大于或者等于所述预设的向量长度上边界的所述损失函数值对应的所述测试输出向量,并通过解码器网络将所述测试输出向量进行重构,得到输出图像,并将所述输出图像与所述用作测试的所述目标蝴蝶影像进行比较,得到所述识别蝴蝶的训练网络的准确率。
  16. 一个或多个存储有计算机可读指令的非易失性可读存储介质,其特征在于,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行如下步骤:
    从预设的蝴蝶数据库中获取每种蝴蝶种类对应的原始蝴蝶影像;
    对所述原始蝴蝶影像进行重采样处理,得到目标蝴蝶影像;
    针对每种所述蝴蝶种类,将该蝴蝶种类中用作训练的所述目标蝴蝶影像输入到胶囊网络中,并经过所述胶囊网络的卷积层的第一卷积计算和所述胶囊网络的胶囊层的第二卷积计算,得到该蝴蝶种类的输出向量;
    在所述胶囊网络中的损失函数层中,对每种所述蝴蝶种类的所述输出向量进行损失函数计算,得到每个所述输出向量的损失函数值;
    当每个所述输出向量的所述损失函数值均小于或者等于预设的损失阈值时,将所述胶囊网络作为识别蝴蝶的训练网络;
    当所述损失函数值大于所述预设的损失阈值时,通过反向传播更新所述胶囊网络中的每个胶囊神经元,得到更新后的所述胶囊网络,并将每种所述蝴蝶种类中用作训练的所述目标蝴蝶影像重新输入到更新后的所述胶囊网络中,进行所述第一卷积计算、所述第二卷积计算和所述损失函数计算,直到所述损失函数值小于或者等于所述预设的损失阈值为止,其中,所述胶囊神经元代表所述蝴蝶种类的属性。
  17. 如权利要求16所述的非易失性可读存储介质,其特征在于,所述对所述原始蝴蝶影像进行重采样处理,得到目标蝴蝶影像包括:
    根据预设的目标尺寸确定所述原始蝴蝶影像的缩放比例;
    按照所述缩放比例对所述原始蝴蝶影像的原始像素点进行划分,得到原始像素点的集合,并建立每个所述原始像素点的集合与所述目标蝴蝶影像的每个像素点之间的对应关系;
    计算所述原始像素点的集合中的每个所述原始像素点的平均RGB值,并根据所述对应关系,将该平均RGB值作为所述原始像素点的集合对应的所述目标像素点的RGB值。
  18. 如权利要求16所述的非易失性可读存储介质,其特征在于,所述针对每种所述蝴蝶种类,将该蝴蝶种类中用作训练的所述目标蝴蝶影像输入到胶囊网络中,并经过所述胶囊网络的卷积层的第一卷积计算和所述胶囊网络的胶囊层的第二卷积计算,得到该蝴蝶种类的输出向量包括:
    将输入到所述蝴蝶种类中用作训练的所述目标蝴蝶影像在所述胶囊网络的所述卷积层中执行所述第一卷积计算,得到特征向量;
    将所述特征向量代入到修正线性激活函数中,得到局部特征向量;
    通过使用迭代路由处理方式,将所述局部特征向量与所述胶囊网络的所述胶囊层中的每个所述胶囊神经元进行所述第二卷积计算,得到所述蝴蝶种类的输出向量。
  19. 如权利要求16所述的非易失性可读存储介质,其特征在于,所述在所述胶囊网络中的损失函数层中,对每种所述蝴蝶种类的所述输出向量进行损失函数计算,得到每个所述输出向量的损失函数值包括:
    将每一个所述输出向量在所述胶囊网络中的损失函数层中,按照如下公式计算所述输出向量的所述损失函数值:
    L c=T cmax(0,m +-||V c||) 2+λ(1-T c)max(0,||V c||-m -) 2
    其中,c为所述蝴蝶种类,L c为所述损失函数值,T c为所述蝴蝶种类的指示函数,max(0,m +-||V c||) 2为取0和m +-||V c||两个数值中的最大值的平方,max(0,||V c||-m -) 2为取0和||V c||-m -两个数值中的最大值的平方,m +为预设的向量长度上边界,||V c||为所述输出向量V c的所述向量长度,λ为预设参数值,m -为预设的向量长度下边界。
  20. 如权利要求19所述的非易失性可读存储介质,其特征在于,所述当每个所述输出向量的所述损失函数值均小于或者等于预设的损失阈值时,将所述胶囊网络作为识别蝴蝶的训练网络之后,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器还执行如下步骤:
    将用作测试的所述目标蝴蝶影像输入到所述识别蝴蝶的训练网络中,并通过所述第一卷积计算、所述第二卷积计算以及所述损失函数计算,得到测试输出向量的所述损失函数 值;
    取大于或者等于所述预设的向量长度上边界的所述损失函数值对应的所述测试输出向量,并通过解码器网络将所述测试输出向量进行重构,得到输出图像,并将所述输出图像与所述用作测试的所述目标蝴蝶影像进行比较,得到所述识别蝴蝶的训练网络的准确率。
PCT/CN2018/106395 2018-07-06 2018-09-19 蝴蝶识别网络构建方法、装置、计算机设备及存储介质 Ceased WO2020006881A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810735895.1 2018-07-06
CN201810735895.1A CN109063742B (zh) 2018-07-06 2018-07-06 蝴蝶识别网络构建方法、装置、计算机设备及存储介质

Publications (1)

Publication Number Publication Date
WO2020006881A1 true WO2020006881A1 (zh) 2020-01-09

Family

ID=64818940

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/106395 Ceased WO2020006881A1 (zh) 2018-07-06 2018-09-19 蝴蝶识别网络构建方法、装置、计算机设备及存储介质

Country Status (2)

Country Link
CN (1) CN109063742B (zh)
WO (1) WO2020006881A1 (zh)

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111626361A (zh) * 2020-05-28 2020-09-04 辽宁大学 一种改进胶囊网络优化分层卷积的轴承亚健康识别方法
CN111814592A (zh) * 2020-03-31 2020-10-23 同济大学 一种基于可叠加胶囊网络的植物叶片识别方法
CN111898743A (zh) * 2020-06-02 2020-11-06 深圳市九天睿芯科技有限公司 一种cnn加速方法及加速器
CN112348038A (zh) * 2020-11-30 2021-02-09 江苏海洋大学 一种基于胶囊网络的视觉定位方法
CN112633362A (zh) * 2020-12-21 2021-04-09 华中科技大学 一种旋转机械自适应故障诊断方法、装置、设备及介质
CN113011243A (zh) * 2021-01-13 2021-06-22 苏州元启创人工智能科技有限公司 基于胶囊网络的面部表情分析方法
US20210374471A1 (en) * 2020-05-27 2021-12-02 Hon Hai Precision Industry Co., Ltd. Image recognition method and computing device
CN114217014A (zh) * 2021-11-18 2022-03-22 广州杰赛科技股份有限公司 一种大气污染物的污染源定位方法、装置、介质及设备
CN114338093A (zh) * 2021-12-09 2022-04-12 上海大学 一种通过胶囊网络进行多信道秘密信息传输的方法
CN114638984A (zh) * 2022-02-17 2022-06-17 南京邮电大学 一种基于胶囊网络的恶意网站url检测方法
CN114648657A (zh) * 2022-02-14 2022-06-21 南京邮电大学 一种基于稀疏约束重构胶囊网络的图像识别方法、装置及介质
CN114861803A (zh) * 2022-05-16 2022-08-05 华南农业大学 基于改进的双网络识别模型的蝴蝶细粒度识别方法
US20220277502A1 (en) * 2018-11-15 2022-09-01 Preferred Networks, Inc. Apparatus and method for editing data and program
CN115187862A (zh) * 2022-07-14 2022-10-14 中国人民解放军国防科技大学 基于对比学习的地面目标sar图像鲁棒识别方法及装置
CN115208552A (zh) * 2022-05-20 2022-10-18 中国银行股份有限公司 一种数据加密方法、装置及电子设备

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110020624B (zh) * 2019-04-08 2023-04-18 石家庄铁道大学 图像识别方法、终端设备及存储介质
CN110084320A (zh) * 2019-05-08 2019-08-02 广东工业大学 甲状腺乳头状癌超声图像识别方法、装置、系统及介质
CN112784652B (zh) * 2019-11-11 2024-08-13 中强光电股份有限公司 图像识别方法及装置
CN111340096A (zh) * 2020-02-24 2020-06-26 北京工业大学 一种基于对抗互补学习的弱监督蝴蝶目标检测方法
CN112235434B (zh) * 2020-10-16 2021-10-26 重庆理工大学 融合k-means及其胶囊网络的DGA网络域名检测识别系统
CN112465141B (zh) * 2020-12-18 2024-06-28 平安科技(深圳)有限公司 模型压缩方法、装置、电子设备及介质
CN113408488B (zh) * 2021-07-19 2022-11-25 中南大学 基于胶囊网络的火焰目标识别方法、设备及介质
CN115032602B (zh) * 2022-04-14 2025-01-17 杭州电子科技大学 一种基于多尺度卷积胶囊网络的雷达目标识别方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101008980A (zh) * 2007-02-01 2007-08-01 沈佐锐 蝴蝶自动鉴定的方法及系统
WO2017055412A1 (en) * 2015-09-30 2017-04-06 Siemens Healthcare Gmbh Method and system for classification of endoscopic images using deep decision networks
CN106778657A (zh) * 2016-12-28 2017-05-31 南京邮电大学 基于卷积神经网络的新生儿疼痛表情分类方法
CN108229543A (zh) * 2017-12-22 2018-06-29 中国科学院深圳先进技术研究院 图像分类模型设计方法及装置

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108229298A (zh) * 2017-09-30 2018-06-29 北京市商汤科技开发有限公司 神经网络的训练和人脸识别方法及装置、设备、存储介质
CN108229379A (zh) * 2017-12-29 2018-06-29 广东欧珀移动通信有限公司 图像识别方法、装置、计算机设备和存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101008980A (zh) * 2007-02-01 2007-08-01 沈佐锐 蝴蝶自动鉴定的方法及系统
WO2017055412A1 (en) * 2015-09-30 2017-04-06 Siemens Healthcare Gmbh Method and system for classification of endoscopic images using deep decision networks
CN106778657A (zh) * 2016-12-28 2017-05-31 南京邮电大学 基于卷积神经网络的新生儿疼痛表情分类方法
CN108229543A (zh) * 2017-12-22 2018-06-29 中国科学院深圳先进技术研究院 图像分类模型设计方法及装置

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220277502A1 (en) * 2018-11-15 2022-09-01 Preferred Networks, Inc. Apparatus and method for editing data and program
CN111814592A (zh) * 2020-03-31 2020-10-23 同济大学 一种基于可叠加胶囊网络的植物叶片识别方法
CN111814592B (zh) * 2020-03-31 2024-04-26 同济大学 一种基于可叠加胶囊网络的植物叶片识别方法
US20210374471A1 (en) * 2020-05-27 2021-12-02 Hon Hai Precision Industry Co., Ltd. Image recognition method and computing device
US11948081B2 (en) * 2020-05-27 2024-04-02 Hon Hai Precision Industry Co., Ltd. Image recognition method and computing device
CN111626361A (zh) * 2020-05-28 2020-09-04 辽宁大学 一种改进胶囊网络优化分层卷积的轴承亚健康识别方法
CN111626361B (zh) * 2020-05-28 2023-08-11 辽宁大学 一种改进胶囊网络优化分层卷积的轴承亚健康识别方法
CN111898743A (zh) * 2020-06-02 2020-11-06 深圳市九天睿芯科技有限公司 一种cnn加速方法及加速器
CN112348038A (zh) * 2020-11-30 2021-02-09 江苏海洋大学 一种基于胶囊网络的视觉定位方法
CN112633362A (zh) * 2020-12-21 2021-04-09 华中科技大学 一种旋转机械自适应故障诊断方法、装置、设备及介质
CN112633362B (zh) * 2020-12-21 2024-03-29 华中科技大学 一种旋转机械自适应故障诊断方法、装置、设备及介质
CN113011243A (zh) * 2021-01-13 2021-06-22 苏州元启创人工智能科技有限公司 基于胶囊网络的面部表情分析方法
CN114217014A (zh) * 2021-11-18 2022-03-22 广州杰赛科技股份有限公司 一种大气污染物的污染源定位方法、装置、介质及设备
CN114338093B (zh) * 2021-12-09 2023-10-20 上海大学 一种通过胶囊网络进行多信道秘密信息传输的方法
CN114338093A (zh) * 2021-12-09 2022-04-12 上海大学 一种通过胶囊网络进行多信道秘密信息传输的方法
CN114648657A (zh) * 2022-02-14 2022-06-21 南京邮电大学 一种基于稀疏约束重构胶囊网络的图像识别方法、装置及介质
CN114638984B (zh) * 2022-02-17 2024-03-15 南京邮电大学 一种基于胶囊网络的恶意网站url检测方法
CN114638984A (zh) * 2022-02-17 2022-06-17 南京邮电大学 一种基于胶囊网络的恶意网站url检测方法
CN114861803A (zh) * 2022-05-16 2022-08-05 华南农业大学 基于改进的双网络识别模型的蝴蝶细粒度识别方法
CN115208552A (zh) * 2022-05-20 2022-10-18 中国银行股份有限公司 一种数据加密方法、装置及电子设备
CN115187862A (zh) * 2022-07-14 2022-10-14 中国人民解放军国防科技大学 基于对比学习的地面目标sar图像鲁棒识别方法及装置

Also Published As

Publication number Publication date
CN109063742A (zh) 2018-12-21
CN109063742B (zh) 2023-04-18

Similar Documents

Publication Publication Date Title
WO2020006881A1 (zh) 蝴蝶识别网络构建方法、装置、计算机设备及存储介质
US12100192B2 (en) Method, apparatus, and electronic device for training place recognition model
JP7512262B2 (ja) 顔キーポイント検出方法、装置、コンピュータ機器及びコンピュータプログラム
WO2021227726A1 (zh) 面部检测、图像检测神经网络训练方法、装置和设备
WO2019228317A1 (zh) 人脸识别方法、装置及计算机可读介质
WO2020199931A1 (zh) 人脸关键点检测方法及装置、存储介质和电子设备
CN112085738B (zh) 一种基于生成对抗网络的图像分割方法
WO2021184902A1 (zh) 图像分类方法、装置、及其训练方法、装置、设备、介质
WO2020228446A1 (zh) 模型训练方法、装置、终端及存储介质
WO2022001805A1 (zh) 一种神经网络蒸馏方法及装置
CN110472489B (zh) 一种人脸美丽等级预测方法、装置及存储介质
WO2019120110A1 (zh) 图像重建方法及设备
CN111368672A (zh) 一种用于遗传病面部识别模型的构建方法及装置
CN110378372A (zh) 图数据识别方法、装置、计算机设备和存储介质
WO2019100724A1 (zh) 训练多标签分类模型的方法和装置
CN109033107A (zh) 图像检索方法和装置、计算机设备和存储介质
WO2021159748A1 (zh) 模型压缩方法、装置、计算机设备及存储介质
CN114926876A (zh) 图像关键点检测方法、装置、计算机设备和存储介质
WO2023178793A1 (zh) 双视角图神经网络模型的训练方法、装置、设备及介质
CN113179421B (zh) 视频封面选择方法、装置、计算机设备和存储介质
WO2020187029A1 (zh) 图像处理方法及装置、神经网络的训练方法、存储介质
CN116645700B (zh) 特征提取模型处理方法、装置和特征提取方法、装置
WO2023231796A1 (zh) 一种视觉任务处理方法及其相关设备
WO2026056842A1 (zh) 图像分类方法及装置、计算机程序产品、电子设备
CN115565051A (zh) 轻量级人脸属性识别模型训练方法、识别方法及设备

Legal Events

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

Ref document number: 18925633

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18925633

Country of ref document: EP

Kind code of ref document: A1