Pupil edge recognition method and system based on pseudo-twin network of unet
Patent Information
- Application Number
- CN202111451895.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-01
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2041-12-01
AI Technical Summary
可变形模板法也能对瞳孔进行识别,但该方法计算复杂、运算量大、处理速度慢,模板初始参数和位置的选择也是该方法的一个制约因素
[0018] The present invention also proposes a pupil edge identification system, which includes a processor and a memory. The processor is communicatively connected to the memory. The memory is used to store at least one executable instruction. The executable instruction causes the processor to execute The operations corresponding to the above-mentioned pupil edge identification method are as follows.
Smart Images

Figure CN114093016B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to a pupil edge recognition method and system based on a pseudo-twin network of UNET. Background Art
[0002] Research related to the human eye involves multiple disciplines such as artificial intelligence, cognitive psychology, virtual reality, and image processing. The application of the human eye involves identity recognition, medical diagnosis, virtual technology, and emotional analysis. Many of these applications are inseparable from the iris and the pupil in the center. Under ideal conditions, professional equipment is often used to collect eye information such as fixation time and pupil diameter. In reality, although the boundary between the pupil and the iris is very clear, due to the influence of light distribution, occlusion of eyelids and eyelashes, and light spots, the eye image obtained by ordinary equipment is not as clear as under ideal conditions. At the same time, the state of the eye itself will also affect the relevant recognition effect. There is a Hough transform method for pupil recognition. The disadvantage of this method is that the pupil cannot be covered too much by the upper and lower eye sockets, and the performance is related to the set binary edge image threshold. Unlike the Hough transform method, the active contour method does not use edge detection and binarization, and operates directly on the grayscale image. Its speed and positioning accuracy are better than the Hough transform method. The disadvantage of this method is that during rough positioning, the pseudo-center must fall within the pupil area. The deformable template method can also identify the pupil, but this method is complex, has a large amount of calculations, and has a slow processing speed. The selection of the initial parameters and position of the template is also a limiting factor of this method. Directly using the Canny edge detection algorithm can identify the iris or pupil, but the threshold of edge segmentation is related to the viewing direction and face posture. If a fixed threshold is used for processing, it is difficult to obtain ideal results. Summary of the invention
[0003] In order to overcome the defects existing in the above-mentioned prior art, the purpose of the present invention is to provide a pupil edge recognition method and system based on a pseudo-twin network of UNET.
[0004] In order to achieve the above-mentioned object of the present invention, the present invention provides a pupil edge recognition method based on a pseudo-twin network of unet, comprising the following steps:
[0005] Input the eye image data into the cross-model feature fusion network;
[0006] The cross-model feature fusion network includes two sub-networks, each of which includes an encoder and a decoder. The output result of the encoder of each sub-network is fused with the output result of the decoder of another sub-network. The encoder extracts feature information of different scales from the image, and the decoder fuses the feature information across the network and outputs it.
[0007] The feature map output by the cross-model feature fusion network is processed, edge detection is performed, and the result is fused with the original image.
[0008] This method fuses features across networks and aggregates features from different encoding stages, allowing the network to maintain detailed information of the original image, enhancing the network's expressiveness and improving the accuracy of pupil edge recognition.
[0009] The preferred solution of the pupil edge recognition method is:
[0010] Each sub-network includes N-level encoders and N-level decoders. The output result of the i-th level encoder of each sub-network is fused with the output result of the Ni-th level decoder of another sub-network, and the output result of the N-th level encoder is input into the 1st level decoder.
[0011] In the preferred embodiment of the pupil edge recognition method, the output result of the encoder of each sub-network is down-sampled and activated by a relu function, and then fused with the output result of the decoder of another sub-network after up-sampling and activation by a relu function;
[0012] A blurpool layer is added after maxpooling in the downsampling part of each encoder.
[0013] Adding the blurpool layer improves the translation invariance of the network to address the pupil target offset problem caused by eye rotation.
[0014] The preferred solution of the pupil edge recognition method is to perform deep supervision on the features after cross-network fusion. In the process of deep supervision, two kinds of losses are used, namely the loss of pupil edge and the loss of pupil as a whole. The problem of imbalance between positive and negative samples is solved.
[0015] The preferred solution of the pupil edge recognition method uses the binary image output by the canny detection processing network to obtain the pupil edge and the original image for fusion to complete the recognition. This is more convenient, without considering the threshold selection under different face poses and viewing angles, and finally directly adding the result to the original image.
[0016] The preferred solution of the pupil edge recognition method is that the cross-model feature fusion network is Denoted as the output of the i-th level encoder of sub-network s, Denoted as the output of the i-th level decoder of sub-network s, It is represented as the input of the i-th level decoder of sub-network s, relu represents relu activation, H up represents upsampling, H down represents downsampling, and ⊕ represents element-wise addition.
[0017] The preferred solution of the pupil edge recognition method, the total loss function of the cross-model feature fusion network j represents the deep supervision layer, where represents the overall loss of the output pupil under the j-th deep supervision, represents the loss of pupil edge under the jth depth supervision, is the overall pupil loss of the last layer of the cross-model feature fusion network output, It represents the loss of the pupil edge output by the last layer of the cross-model feature fusion network, and γ is a constant coefficient.
[0018] The present invention also proposes a pupil edge recognition system, including a processor and a memory, wherein the processor and the memory are communicatively connected, and the memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the pupil edge recognition method as described above.
[0019] The beneficial effects of the present invention are as follows: the present invention aggregates features from different encoding stages across models in the decoding stage, so that the network can maintain the detailed information of the original image. Because it is based on the UNET structure, the network can achieve good training results with fewer training images. At the same time, in order to enhance the translation invariance of the model, a blurpool layer is added in the downsampling stage to enhance the network's anti-translation ability to address the pupil shift problem caused by eye rotation in actual situations. At the same time, as the network depth increases, in order to solve the problems of "gradient disappearance" and "gradient explosion", as well as slow convergence, deep supervision is used in the decoder part. The loss function used not only calculates the overall loss of the pupil, but also calculates the loss of the pupil edge, so that the final segmentation result can better fit the pupil edge.
[0020] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0022] Figure 1 This is the overall architecture diagram of the pseudo-twin network based on unet;
[0023] Figure 2 It is a decomposition diagram shown by the sub-network;
[0024] Figure 3 It is the mIoU record graph of the validation set during network training;
[0025] Figure 4It is the loss decrease curve during network training;
[0026] Figure 5 It is the recognition result of the pupil edge. DETAILED DESCRIPTION
[0027] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0028] In the description of the present invention, unless otherwise specified and limited, it should be noted that the terms "installed", "connected" and "connected" should be understood in a broad sense. For example, it can be a mechanical connection or an electrical connection, or it can be the internal connection of two components. It can be a direct connection or an indirect connection through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to the specific circumstances.
[0029] The present application provides an embodiment of a pupil edge recognition method based on a pseudo-twin network of a unet. The embodiment specifically includes the following steps:
[0030] First, the eye image data is input into the cross-model feature fusion network.
[0031] In this embodiment, Figure 1 As shown, the cross-model feature fusion network has two sub-networks, each of which includes N-level encoders and N-level decoders, where N is a positive integer. The output result of the encoder of each sub-network is fused with the output result of the decoder of another sub-network. The encoder extracts feature information of different scales from the image, and the decoder outputs the feature information across the network, that is, the output result of the i-th level encoder of each sub-network is fused with the output result of the Ni-th level decoder of another sub-network, and the output result of the N-th level encoder is input into the 1st level decoder.
[0032] Specifically, in this embodiment, the encoding part of each sub-network includes five levels of encoders, namely, the first to fifth level encoders; the decoding part of each sub-network includes five levels of decoders, namely, the first to fifth level decoders, that is, N is equal to 5. The encoder part is used to extract feature information of different scales from the eye image; the decoder part is used to aggregate the feature information across the network.
[0033] In the decoder part, cross-network feature fusion is achieved between sub-networks: the output results of the first-level encoder of each of the two sub-networks are down-sampled and activated by the relu function, and are fused with the output results of the fourth-level decoder of the other sub-network after up-sampling and activation by the relu function. And so on. The cross-processing is performed between the second-level encoder and the third-level decoder, the third-level encoder and the second-level decoder, and the fourth-level encoder and the first-level decoder.
[0034] The cross-model feature fusion network is expressed as:
[0035] Denoted as the output of the i-th level encoder of sub-network s, Denoted as the output of the i-th level decoder of sub-network s, It is represented as the input of the i-th level decoder of sub-network s, relu represents relu activation, H up represents upsampling, H down represents downsampling, and ⊕ represents element-wise addition.
[0036] The fusion method is element-wise addition, and the fusion formula is: in, Represents the value of the i-th row and j-th column in a certain dimension of feature A. It represents the value of the i-th row and j-th column in a certain dimension of feature B. H is the height of the feature map, W is the width of the image, and each element corresponding to each channel on the output feature map is the sum of the elements at the corresponding position of the input feature map. The number of channels between the fused features is the same.
[0037] like Figure 2 As shown in the figure, the dimension sizes of the output feature maps of each encoder level of each sub-network are 32, 64, 128, 256, 512 respectively, and the dimension sizes of the output feature maps of the decoder are 256, 128, 64, 32, 2 respectively. The last 2 represents the target and background output by the network, the target is 1, and the background is 0. The encoder is a convolution operation, followed by a downsampling operation, followed by a relu activation function. The corresponding decoder is a convolution operation, followed by an upsampling operation, followed by a relu activation function.
[0038] Specifically, in order to improve the translation invariance of the network, a blurpool layer is added after the Maxpooling in the downsampling part of each encoder, making it Figure 2The MaxBlurpool2d layer in . In the previous pooling process, neural networks often used maximum pooling and average pooling techniques. In actual situations, when the input image has a small translation, it will cause a large fluctuation in the network output. For the collected eye images, there are often blinking, rotation, etc., which will cause the pupil to be identified to translate, making the network output unstable. The addition of the blurpool layer improves the translation invariance of the network and improves the accuracy of the model. Compared with the traditional unet, the increased computational effort is negligible. The formula for the translation invariance of the neural network is expressed as follows: Let X represent a picture with a resolution of H×W, then: A CNN with L layers can be represented by a feature extractor as C is the channel of the feature map, and each feature map F can be upsampled to the same resolution as X: If the output remains unchanged after the input is translated, then the translation is unchanged, which can be expressed by the following formula:
[0039] The specific implementation method is to first perform maximum pooling and then access the blurpool layer, that is, MaxBlurPool2d = Maxpool2d + blurpool, where the padding of the blurpool layer is (pad): ReflectionPad2d ([0, 1, 0, 1]). The parameters of MaxBlurPool2d of each different encoder are slightly different, as shown in Table 1.
[0040] Table 1 Structural parameters and hierarchical layout of the pseudo-twin network based on UNET
[0041]
[0042]
[0043]
[0044] Specifically, before deep supervision, the feature map output by the decoder needs to be adjusted in channels. Corresponding to the map structure block in Table 1, 1×1 convolution is used to adjust the channels, followed by upsampling, and the mode is bilinear interpolation, which is adjusted to the label Figure 1 The size of the image is 480×496, and the sigmoid function is used to activate the image and map the value to (0,1). Adding sigmoid during upsampling facilitates deep supervision.
[0045] refer to Figure 1, respectively, perform deep supervision on the features after cross-network fusion. The feature maps for deep supervision are the inputs of the second, third, and fourth level decoders in each sub-network. The losses calculated for the fused feature maps include the loss of the entire pupil and the loss of its edge. In the label, the pixel points of the pupil object are positive samples and are set to 1, while the others are background and are set to 0. Positive and negative samples are unbalanced. To solve this problem, the loss function used is Tversky loss. The loss of masks and edges is calculated using the formula Generally, A is the final output of the network, B is the label, |A∩B| is TP (true positive), |AB| is FP (false positive), and |BA| is FN (false negative). β is set to 0.7 and α is set to 0.3. The canny operator is used to extract the edge information of the result output by the map block, and the loss is calculated with the edge of the label. The total loss is the loss of the mask plus the loss of the edge, that is, L total =L mask +L edge , L total is the total loss, L mask is the loss of the mask, L edge is the loss of the edge. Specifically, the formula is expanded into Wherein, j refers to the depth supervision layer. Since in this embodiment, N=5, the total number of the depth supervision layers is N-2, so the total number of the depth supervision layers here is only three. represents the overall loss of the output pupil under the j-th deep supervision layer, represents the loss of pupil edge under the jth depth supervision, is the overall pupil loss of the last layer of the cross-model feature fusion network output, It represents the loss of the pupil edge of the last layer output of the cross-model feature fusion network. γ is a constant coefficient. In this embodiment, it is preferably but not limited to 0.33. After every 40 epochs, γ is multiplied by 0.8 to reduce the impact of deep supervision on the loss. Finally, the final network output still dominates the loss.
[0046] Reference to the mIoU curve of the validation set during training Figure 3 , TN means that the true negative result is found in the output result, the label is marked as 0, and the output result is also judged as 0; FP means false positive, the output result is 1, but the label is 0, which is the wrong positive class in the output result; FN means false negative, the output result is 0, but the label is 1, which is judged as a negative sample, but in fact it is a positive sample. IoU represents the ratio of the intersection and union of the predicted result and the true value of a certain category. The ideal value is 1. mIoU is the result of averaging the sum of IoUs of each category, which can be expressed as k is the category of IoU. Here, IoU has two categories, namely the non-pupil part and the pupil part. k is 2, and α is 1, 2, indicating category 1 and category 2. It can be seen from the figure that the curve rises rapidly after the start of training, and then slowly stabilizes, indicating that the network is slowly approaching the segmentation target on the validation set.
[0047] The loss function decline curve during training is as follows Figure 4 As shown in , the loss function drops rapidly after the training starts, and then slowly stabilizes, indicating that the network is converging and the data is being fitted continuously. Figure 3 The comparison shows that while the loss function decreases, mIou is constantly increasing.
[0048] like Figure 5 As shown in the figure, the output of the twin network is the segmentation result of the entire pupil object. Then the canny method is used to extract the pupil edge on the output binary image. Compared with directly using the canny method, it is more convenient and does not need to consider different face poses and threshold selection under different viewing angles. Finally, the result is added to the original image.
[0049] In order to easily and accurately identify the edge of the pupil, the present invention proposes a pupil edge recognition method based on a pseudo-twin network of unet. This method takes into account the phenomenon that the pupil target in the collected image will be offset in actual situations, and uses a blurpool layer in the downsampling process. Deep supervision is used in the decoder part to solve the problems of convergence and gradient. In the calculation process of the loss function, the problem of imbalance between positive and negative samples is taken into account. At the same time, in order to better fit the edge of the pupil, the edge information is extracted from the output feature map, and the loss is calculated with the edge information of the label. First, the eye image is input into the network, and then the encoder part extracts feature information of different scales from the image. Secondly, in the decoding process, feature information of different levels is aggregated across the network. The network outputs a binary mask map, and finally edge detection is performed. In this embodiment, canny edge detection is preferably used to obtain the edge of the binary image, that is, the edge of the identified pupil, and finally it is fused with the original image to obtain the final result.
[0050] The present application also proposes an embodiment of a pupil edge recognition system, which includes a processor and a memory, wherein the processor and the memory are communicatively connected, and the memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the above-mentioned pupil edge recognition method.
[0051] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0052] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. A pupil edge recognition method based on a pseudo-twin network of unet, characterized in that: The following steps are involved: Input the eye image data into the cross-model feature fusion network; The cross-model feature fusion network includes two sub-networks, each of which includes an N-level encoder and an N-level decoder. The output result of the i-th level encoder of each sub-network is fused with the output result of the Ni-th level decoder of another sub-network after upsampling and relu function activation after downsampling and relu function activation, and the output result of the N-th level encoder is input into the 1st level decoder; a blurpool layer is added after the Maxpooling in the downsampling part of each encoder; The cross-model feature fusion network is: Denoted as the output of the i-th level encoder of sub-network s, Denoted as the output of the i-th level decoder of sub-network s, It represents the input of the i-th level decoder of sub-network s, relu represents relu activation, H up represents upsampling, H down represents downsampling, It means element-wise addition; The encoder extracts feature information of different scales from the image, and the decoder fuses the feature information across the network and outputs it; The feature map output by the cross-model feature fusion network is processed, edge detection is performed, and the result is fused with the original image.
2. The pupil edge recognition method based on the pseudo-twin network of unet according to claim 1 is characterized in that: The features after cross-network fusion are deeply supervised. During the deep supervision process, two types of losses are used, namely the loss of the pupil edge and the loss of the entire pupil.
3. The pupil edge recognition method based on the pseudo-twin network of unet according to claim 1 is characterized in that: The binary image output by the canny detection processing network is used to obtain the pupil edge and the original image for fusion to complete the recognition.
4. The pupil edge recognition method based on the pseudo-twin network of unet according to claim 2 is characterized in that: The total loss function of the cross-model feature fusion network j represents the deep supervision layer, where represents the overall loss of the output pupil under the j-th deep supervision, represents the loss of pupil edge under the jth depth supervision, is the overall pupil loss of the last layer of the cross-model feature fusion network output, It represents the loss of the pupil edge output by the last layer of the cross-model feature fusion network, and γ is a constant coefficient.
5. A pupil edge recognition system, characterized in that: It includes a processor and a memory, the processor and the memory are communicatively connected, the memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the pupil edge recognition method based on the pseudo-twin network of UNET as described in any one of claims 1-4.
