Eye pupil and light spot detection method and system based on deep learning
By adding the CBAM attention mechanism to the YOLOv5 model and using the FocalLoss loss function, the recognition accuracy of the model in small size, low contrast and complex backgrounds was optimized, and the problem of low recognition accuracy of the YOLOv5 model in these scenarios was solved.
Patent Information
- Application Number
- CN202411802018.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-04-25
Smart Images

Figure CN119888826A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of sight tracking, and discloses a method and system for detecting eye pupil and light spot based on deep learning. Background Art
[0002] Gaze tracking is an important way to obtain information and interact with humans and computers. It has become a hot research direction in the field of computer vision. The core of gaze tracking is gaze estimation. There are many different gaze estimation methods, among which pupil-corneal reflection technology is the most commonly used technology in gaze tracking systems. Gaze tracking systems require a calibration process to eliminate the inherent physiological deviation between the visual axis and the optical axis of the human eye and obtain the true direction of the gaze or the position of the gaze point.
[0003] The traditional method is to extract the positional relationship between the pupil and the light spot, i.e., the corneal reflection point, in the eyeball image through image processing technology. For example, the commonly used two-dimensional fixation point calibration algorithm calculates the two-dimensional coordinate information of the pupil center and the corresponding calibration point, and then establishes a mapping relationship between the two to obtain the position information of the fixation point on the computer screen. This method requires a large number of images to calculate, which is time-consuming and labor-intensive, and the human subjective factors make it difficult to guarantee the accuracy and reliability of the data, which will have a negative impact on the subsequent processing of the mapping relationship between the pupil center and the calibration point.
[0004] Object recognition algorithms based on deep learning have been widely used in various fields. The YOLOv5 model has fast and efficient real-time object detection capabilities and low computing costs, making it a mainstream object detection model. However, when processing small-size, low-contrast, and complex background images, YOLOv5 also has problems with insufficient detection accuracy and poor stability. Summary of the invention
[0005] The purpose of the present invention is to provide an eye pupil and light spot detection method and system based on deep learning, which can improve the detection accuracy and effectively solve the problem of low recognition accuracy of the existing YOLOv5 model when dealing with scenes with small size, low contrast and complex background.
[0006] In order to achieve the above technical effects, the technical solution adopted by the present invention is:
[0007] A method for detecting eye pupil and light spot based on deep learning, comprising:
[0008] Obtain an eye region image and construct an eye region image data set containing an eye target to be identified, wherein the target to be identified includes a pupil and a light spot of the eye;
[0009] Annotating the target to be identified in the eye area image in the image data set to generate a data file containing the category label of the target to be identified and the position information of the target to be identified;
[0010] Two CBAM attention modules are added to each CSP module in the backbone network of the YOLOv5 model, one of which is added after the stacked residual block structure, and the other is added after the connection layer of the cross-stage hierarchy structure, to obtain the YOLOv5 initial model with the CBAM attention mechanism added;
[0011] The FocalLoss loss function is used to optimize the YOLOv5 initial model to obtain an optimized YOLOv5 detection model;
[0012] Using all or part of the data file as a training set, and using the training set to train the optimized YOLOv5 detection model until convergence, to obtain an eye region target recognition model;
[0013] The trained eye region target recognition model is used to detect the image to be analyzed, and the detection results of the pupil and the light spot in the image to be analyzed are obtained.
[0014] Furthermore, the method for obtaining the eye area image includes: collecting a large number of face images illuminated by an infrared camera, initially marking the position of the eyes, cropping and segmenting the marked eye area image, and taking the area of 80 pixels above, below, left and right of the eye center point coordinates as the eye area.
[0015] Furthermore, in the process of constructing an eye area image data set containing eye targets to be identified, data enhancement processing is performed on part or all of the eye area images, and the data enhancement processing method includes one or more combinations of horizontal flipping, vertical flipping, brightness adjustment, and saturation adjustment.
[0016] Furthermore, before labeling the target to be identified in the eye area image in the image data set, the eye area image in the image data set is preprocessed in advance to enhance the contrast between the target to be identified in the eye area image and the image background.
[0017] Furthermore, the FocalLoss loss function is:
[0018] FL(p t )=-α t (1-p t ) γ log p t
[0019]
[0020] Among them, α t is the balance factor, α t∈[0, 1], used to adjust the ratio of positive samples and negative samples, the positive sample is the pupil or spot in an eye area image, and the negative sample is the background in an eye area image; p is the estimated probability that the predicted box is the target label, p t ∈[0, 1]; y is the actual label value, y∈{-1, 1}, y=-1 represents the background, y=1 represents the foreground containing the target to be identified; γ is a parameter for adjusting the difficulty of samples, and the value range of γ is 0~5.
[0021] Furthermore, in the process of training the optimized YOLOv5 detection model using the training set, if the loss function value of the recognition model fluctuates within a preset range and the decrease amplitude is less than a preset threshold, it is determined that the recognition model has converged.
[0022] In order to achieve the above technical effects, the present invention also provides an eye pupil and light spot detection system based on deep learning, which is used to implement the eye pupil and light spot detection method based on deep learning, including:
[0023] A data acquisition module, used to obtain an eye region image and construct an eye region image data set containing an eye target to be identified, wherein the target to be identified includes a pupil and a light spot of the eye;
[0024] A labeling module, used for labeling the target to be identified in the eye area image in the image data set, and generating a data file containing the category label of the target to be identified and the position information of the target to be identified;
[0025] An initial model building module is used to add two CBAM attention modules to each CSP module in the backbone network of the YOLOv5 model, wherein one of the CBAM attention modules is added after the stacked residual block structure, and the other is added after the connection layer of the cross-stage hierarchy structure, to obtain a YOLOv5 initial model with the CBAM attention mechanism added;
[0026] A model optimization module, used to optimize the YOLOv5 initial model using a FocalLoss loss function to obtain an optimized YOLOv5 detection model;
[0027] A model training module, used to use all or part of the data file as a training set, and use the training set to train the optimized YOLOv5 detection model until convergence, so as to obtain an eye area target recognition model;
[0028] The detection module is used to detect the image to be analyzed using the trained eye area target recognition model to obtain the detection results of the pupil and the light spot in the image to be analyzed.
[0029] Furthermore, it also includes a preprocessing module, which preprocesses the eye area image in the image data set before marking the target to be identified in the eye area image in the image data set to enhance the contrast between the target to be identified in the eye area image and the image background.
[0030] Furthermore, the FocalLoss loss function in the model optimization module is:
[0031] FL(p t )=-α t (1-p t ) γ log p t
[0032]
[0033] Among them, α t is the balance factor, α t ∈[0, 1], used to adjust the ratio of positive samples and negative samples, the positive sample is the pupil or spot in an eye area image, and the negative sample is the background in an eye area image; p is the estimated probability that the predicted box is the target label, p t ∈[0, 1]; y is the actual label value, y∈{-1, 1}, y=-1 represents the background, y=1 represents the foreground containing the target to be identified; γ is a parameter for adjusting the difficulty of samples, and the value range of γ is 0~5.
[0034] Furthermore, in the model training module, during the process of training the optimized YOLOv5 detection model using the training set, if the loss function value of the recognition model fluctuates within a preset range and the decrease amplitude is less than a preset threshold, it is judged that the recognition model has converged.
[0035] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention optimizes the OLOv5 detection model by adding a CBAM attention mechanism module to the backbone network part of the YOLOv5 network model, and adopts the FocalLoss loss function instead of the original cross entropy loss function; then the optimized YOLOv5 detection network model is trained using an eye area image data set including the pupil and light spot in the eye area to obtain an eye area target recognition model; not only can the proportion of the sample background area be reduced to ensure that the detection is focused on the eye target to be identified, but also the feature extraction capability of the network can be enhanced, thereby improving the detection accuracy, and effectively solving the problem of low recognition accuracy of the existing YOLOv5 model when processing scenes such as small size, low contrast and complex background. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1This is a flow chart of the eye pupil and light spot detection method based on deep learning in Example 1 or 2;
[0037] Figure 2 This is a structural block diagram of the eye pupil and light spot detection system based on deep learning in Example 1;
[0038] Figure 3 This is the eye pupil and light spot marking result diagram in Example 2;
[0039] Figure 4 This is a structural diagram of the CBAM attention mechanism module in Example 2;
[0040] Figure 5 This is a schematic diagram of a CSP module with the CBAM attention mechanism added in Example 2;
[0041] Figure 6 This is a diagram of the improved model training result in Example 2;
[0042] Figure 7 This is a diagram of the eye pupil and light spot detection results in Example 2;
[0043] Among them, 1. Data acquisition module; 2. Labeling module; 3. Initial model building module; 4. Model optimization module; 5. Model training module; 6. Detection module; 7. Preprocessing module. DETAILED DESCRIPTION
[0044] The present invention is further described in detail below in conjunction with the embodiments and drawings. However, it should not be understood that the scope of the above subject matter of the present invention is limited to the following embodiments, and all technologies realized based on the content of the present invention belong to the scope of the present invention.
[0045] Example 1
[0046] See also Figure 1 and Figure 2 , an eye pupil and light spot detection method based on deep learning, comprising:
[0047] Obtain an eye region image and construct an eye region image data set containing an eye target to be identified, wherein the target to be identified includes a pupil and a light spot of the eye;
[0048] Annotating the target to be identified in the eye area image in the image data set to generate a data file containing the category label of the target to be identified and the position information of the target to be identified;
[0049] Two CBAM attention modules are added to each CSP module in the backbone network of the YOLOv5 model, one of which is added after the stacked residual block structure, and the other is added after the connection layer of the cross-stage hierarchy structure, to obtain the YOLOv5 initial model with the CBAM attention mechanism added;
[0050] The FocalLoss loss function is used to optimize the YOLOv5 initial model to obtain an optimized YOLOv5 detection model;
[0051] Using all or part of the data file as a training set, and using the training set to train the optimized YOLOv5 detection model until convergence, to obtain an eye region target recognition model;
[0052] The trained eye region target recognition model is used to detect the image to be analyzed, and the detection results of the pupil and the light spot in the image to be analyzed are obtained.
[0053] In this embodiment, by collecting eye area images, screening and annotating the eye area images, an eye area image dataset including the pupil and light spot of the eye area is constructed; a CBAM attention mechanism module is added to the backbone network part of the YOLOv5 network model to enhance the feature extraction capability of the network, thereby improving the detection accuracy; the FocalLoss loss function is used instead of the original cross entropy loss function to reduce the proportion of the sample background area, ensuring that the detection is focused on the eye target to be identified, and using the trained improved YOLOv5 detection network model for detection to obtain more accurate detection results, improve the detection accuracy, and effectively solve the problem of low recognition accuracy of the existing YOLOv5 model when dealing with scenes such as small size, low contrast and complex background.
[0054] Based on the same inventive concept, this embodiment also provides an eye pupil and light spot detection system based on deep learning, including:
[0055] Data acquisition module 1, used to obtain an eye region image and construct an eye region image data set containing an eye target to be identified, wherein the target to be identified includes a pupil and a light spot of the eye;
[0056] A labeling module 2 is used to label the target to be identified in the eye area image in the image data set, and generate a data file containing the category label of the target to be identified and the position information of the target to be identified;
[0057] An initial model building module 3 is used to add two CBAM attention modules to each CSP module in the backbone network of the YOLOv5 model, wherein one of the CBAM attention modules is added after the stacked residual block structure, and the other is added after the connection layer of the cross-stage hierarchy structure, so as to obtain a YOLOv5 initial model with the CBAM attention mechanism added;
[0058] A model optimization module 4 is used to optimize the YOLOv5 initial model using a FocalLoss loss function to obtain an optimized YOLOv5 detection model;
[0059] A model training module 5 is used to use all or part of the data file as a training set, and use the training set to train the optimized YOLOv5 detection model until convergence, so as to obtain an eye area target recognition model;
[0060] The detection module 6 is used to detect the image to be analyzed using the trained eye region target recognition model to obtain the detection results of the pupil and the light spot in the image to be analyzed.
[0061] In addition, the detection system in this embodiment also includes a preprocessing module 7, which preprocesses the eye area image in the image data set before marking the target to be identified in the eye area image in the image data set to enhance the contrast between the target to be identified in the eye area image and the image background.
[0062] Example 2
[0063] See also Figure 1 ,as well as Figure 3-Figure 7 , an eye pupil and light spot detection method based on deep learning, comprising:
[0064] Step 1: Collect face images, segment the eye area, preprocess the eye area, and construct the pupil and spot data set of the eye area.
[0065] In this embodiment, two infrared cameras are placed at both ends below the screen to emit infrared rays to illuminate the face. A total of 25 calibration points are set in 5 rows and 5 columns to cover the entire screen. The human eye looks at each calibration point for 5 seconds, and two face pictures are collected at each point, and a total of 50 face pictures with different angles are collected. 22 groups of 1,100 face pictures are collected. The eye area on the face is marked and segmented using the Labelme tool. The area of 80 pixels above, below, left and right of the eye center coordinates is taken to generate 2,200 160*160 eye area images.
[0066] Step 2: preprocessing the eye area image;
[0067] Usually, the color of the pupil is darker than that of the iris, and the color of the light spot is lighter and closer to white. In this embodiment, the pupil and the light spot can be made more obvious by enhancing the contrast of the image, and then the eye image is grayed to enhance the contrast between the recognition target and the background.
[0068] Step 3: annotate the objects in the preprocessed eye region image, where the objects include pupils and light spots, and generate a json format file containing the categories and location information of the pupils and light spots;
[0069] In this embodiment, the Labelme tool is used to label the image, and the labeling result is as follows: Figure 3 As shown. Set the label category: set the pupil to category 0 and the light spot to category 1; generate a json format file containing the category and location information of the pupil and light spot. The image information mainly includes the path, name, size and source of the image, and the target information includes the annotated true bounding box and class label information.
[0070] Step 4: Use the Mosaic data enhancement method to perform data enhancement processing on the annotated image;
[0071] In this embodiment, the eye region image is processed by horizontal or vertical flipping, brightness adjustment, saturation adjustment, etc. Performing multiple transformations on the eye image here can enhance the richness of the eye image dataset, allowing the model to learn more complex scenes and target combinations, thereby enhancing the robustness and generalization ability of the model.
[0072] Step 5: After completing the image label annotation of the dataset, divide the dataset into 8 training sets, 1 validation set, and 1 test set in a ratio of 8:1:1. Convert the annotated data file in json data format to YOLO data format for YOLOv5 model training.
[0073] Step 6: Build a YOLOv5 initial model with CBAM attention mechanism, and optimize the YOLOv5 initial model using FocalLoss loss function to obtain an optimized YOLOv5 detection model.
[0074] Since there are many noise points in the collected eye images, it will affect the features of target detection extraction to a certain extent. The attention mechanism is a mechanism that simulates human vision for signal processing. It uses network learning to obtain weight coefficients, and then adjusts the input features in a dynamic weighted manner, so that it can focus on the area of interest of the network while suppressing other areas. The CBAM attention mechanism is a hybrid attention mechanism that combines the channel attention mechanism and the spatial attention mechanism. It is added to the network in serial order for training, and can adjust the mapping of features in both channel and spatial dimensions, thereby improving the detection accuracy of the network.
[0075] Therefore, in order to suppress the impact of noise on detection, this embodiment adds the CBAM attention mechanism to the YOLOv5 backbone module to improve the model's detection accuracy for damage.
[0076] The channel attention module compresses the input feature map in the spatial dimension: Figure 4 As shown in the figure, the input feature F is of size H×W×C, where H×W is the size of feature F and C is the number of channels of feature F. In the channel attention module, feature F is first subjected to global maximum pooling and global average pooling to generate two feature maps of size 1×1×C, which are then input into the multi-layer perceptron MLP operation. In the MLP, dimensionality reduction is first performed to generate a feature map of size 1×1×C / r, where r is the channel compression ratio, and then restored to a size of 1×1×C. Through the Sigmoid activation function operation, the feature map output by the MLP obtains the channel attention map. Finally, the channel attention map is multiplied by the feature F to output a new channel attention feature F′.
[0077] The spatial attention mechanism compresses the feature map based on the number of channels: feature F′ is also pooled to obtain two feature maps with a size of H×W×1. The two feature maps are fused on the channel and the number of channels is reduced to 1 through a 7×7 convolution operation to obtain a feature map of H×W×1. The new feature map is activated by the Sigmoid function to obtain the spatial attention map. Finally, the spatial attention map is multiplied by the feature F′ to output a reconstructed feature F″ with a size of H×W×C.
[0078] The specific calculation process of the CBAM module is as follows:
[0079]
[0080] In the above formula, F is the input feature; M c is the operation process of the channel attention module; F′ is the feature output by the channel attention module; M s is the operation process of the spatial attention module; F″ is the feature output by the spatial attention module, that is, the reconstructed feature.
[0081] The specific addition process is as follows: add two CBAM attention modules to each CSP module in the backbone network, one after the stacked residual block structure and the other after the connection layer of the cross-stage hierarchy. The specific addition method is as follows: Figure 5 As shown in the figure, CBM is a sub-module in the residual module, and Conv+BN+Mish activation function is the smallest component in the network structure.
[0082] As a one-stage algorithm, the YOLOv5 algorithm lacks the screening process of the prior frames in order to improve the detection speed, and needs to directly process a large number of prior frames. When there are few real targets (i.e. positive samples) in an image, a large number of prior frames will be in the background area (i.e. negative samples), which will lead to an imbalance between positive and negative samples.
[0083] However, the spot part of the eye caused by infrared irradiation accounts for a small proportion of the entire image, so there is a high possibility that the number of positive and negative samples will be unbalanced during the training process. In order to solve this problem, this embodiment uses the FocalLoss loss function instead of the original cross entropy loss function. The FocalLoss loss function can reduce the proportion of the sample background area, focus on the target object during detection, and improve the accuracy of detection. The definition of the FocalLoss loss function is as follows:
[0084] FL(p t )=-α t (1-p t ) γ log p t
[0085]
[0086] Among them, α t is the balance factor, α t ∈[0, 1], used to adjust the ratio of positive samples and negative samples, the positive sample is the pupil or spot in an eye area image, and the negative sample is the background in an eye area image; p is the estimated probability that the predicted box is the target label, p t ∈[0, 1]; y is the actual label value, y∈{-1, 1}, y=-1 represents the background, y=1 represents the foreground containing the target to be identified; γ is a parameter for adjusting the difficulty of easy samples, and the value range of γ is 0-5; the larger the γ value, the smaller the loss of easy-to-classify samples, and the model can focus on difficult-to-classify samples. When γ=0, the expression is equivalent to the cross entropy loss function. This embodiment sets αt The optimal value is 0.5, and the optimal value is 2 after adjusting γ experimentally.
[0087] Step 7: Use the trained eye region target recognition model to detect the image to be analyzed, and obtain the detection results of the pupil and the light spot in the image to be analyzed.
[0088] The hardware resources of this embodiment are:
[0089] GPU: NVIDIA GeForce RTX3080;
[0090] CPU: Intel(R)Xeon(R)W-2223CPU@3.60GHz;
[0091] Software resources: operating system: linux; Python: 3.7.13; PyTorch1.10.1+cu111.
[0092] Hyperparameter settings: Batchsize: 64; Epoch: 200. The data set comes from the constructed eye area pupil and light spot data set, and after screening, there are 1434 sample images in total. This embodiment divides the training set, validation set and test set in a ratio of 8:1:1. The detection target of each image includes 1 pupil and no more than 2 light spots. The eye area pupil and light spot data set is trained with the improved YOLOv5 detection network model until convergence to obtain the eye area target recognition model. In an embodiment of the present application, if during the training process, the loss value of the recognition model tends to be stable for a period of time and no longer decreases significantly, it can be considered that the recognition model has converged.
[0093] In this embodiment, the accuracy of the eye area target recognition model can be measured by the average precision AP of a single type of target and the average precision mAP of all types of targets. AP is the area enclosed by the horizontal and vertical coordinates with different accuracy and recall rates, and the relevant formula is as follows:
[0094]
[0095] AP = ∫0 T P(R)dR
[0096]
[0097] Where: TP represents the probability of a positive sample being predicted correctly; FP represents the probability of a negative sample being predicted incorrectly; and FN represents the probability of a positive sample being predicted incorrectly.
[0098] The model training results are shown in the figure Figure 6 As shown in Figure 1, the trained eye region target recognition model generates the best indicator evaluation weight file best.pt. Figure 6 It can be seen that the trained eye area target recognition model has a recognition accuracy of 99.5% for type 0 pupils and 98.2% for type 1 light spots. The average precision mAP of the two types of targets is 98.9%, which illustrates the recognition accuracy of the improved eye area target recognition model.
[0099] Finally, the eye area image to be tested is input into the above eye area target recognition model for model inference, and the eye pupil and light spot detection results are obtained as shown in the figure. Figure 7 As shown in the figure, label 0 represents a through hole and label 1 represents a light spot. It can be seen from the figure that the model can accurately distinguish the pupil and the light spot.
[0100] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for detecting eye pupil and light spot based on deep learning, characterized in that: include: Obtain an eye region image and construct an eye region image data set containing an eye target to be identified, wherein the target to be identified includes a pupil and a light spot of the eye; Annotating the target to be identified in the eye area image in the image data set to generate a data file containing the category label of the target to be identified and the position information of the target to be identified; Two CBAM attention modules are added to each CSP module in the backbone network of the YOLOv5 model, one of which is added after the stacked residual block structure, and the other is added after the connection layer of the cross-stage hierarchy structure, to obtain the YOLOv5 initial model with the CBAM attention mechanism added; The FocalLoss loss function is used to optimize the YOLOv5 initial model to obtain an optimized YOLOv5 detection model; Using all or part of the data file as a training set, and using the training set to train the optimized YOLOv5 detection model until convergence, to obtain an eye region target recognition model; The trained eye region target recognition model is used to detect the image to be analyzed, and the detection results of the pupil and the light spot in the image to be analyzed are obtained.
2. The eye pupil and light spot detection method based on deep learning according to claim 1, characterized in that: The method for obtaining an eye area image includes: collecting a large number of face images illuminated by an infrared camera, initially marking the position of the eyes, cropping and segmenting the marked eye area image, and taking the area of 80 pixels above, below, left and right of the eye center coordinate as the eye area.
3. The eye pupil and light spot detection method based on deep learning according to claim 1, characterized in that: In the process of constructing an eye area image data set containing eye targets to be identified, data enhancement processing is performed on part or all of the eye area images, and the data enhancement processing method includes one or more combinations of horizontal flipping, vertical flipping, brightness adjustment, and saturation adjustment.
4. The eye pupil and light spot detection method based on deep learning according to claim 1, characterized in that: Before marking the target to be identified in the eye region image in the image data set, the eye region image in the image data set is preprocessed in advance to enhance the contrast between the target to be identified in the eye region image and the image background.
5. The eye pupil and light spot detection method based on deep learning according to claim 1, characterized in that: The FocalLoss loss function is: FL(p t )=-α t (1-p t ) γ logp t Among them, α t is the balance factor, α t ∈[0, 1], used to adjust the ratio of positive samples and negative samples, the positive sample is the pupil or spot in an eye area image, and the negative sample is the background in an eye area image; p is the estimated probability that the predicted box is the target label, p t ∈[0, 1]; y is the actual label value, y∈{-1, 1}, y=-1 represents the background, y=1 represents the foreground containing the target to be identified; γ is a parameter for adjusting the difficulty of samples, and the value range of γ is 0~5.
6. The eye pupil and light spot detection method based on deep learning according to claim 1, characterized in that: In the process of training the optimized YOLOv5 detection model using the training set, if the loss function value of the recognition model fluctuates within a preset range and the decrease amplitude is less than a preset threshold, it is judged that the recognition model has converged.
7. A deep learning-based eye pupil and light spot detection system, used to implement the deep learning-based eye pupil and light spot detection method according to claim 1, characterized in that: include: A data acquisition module, used to obtain an eye region image and construct an eye region image data set containing an eye target to be identified, wherein the target to be identified includes a pupil and a light spot of the eye; A labeling module, used for labeling the target to be identified in the eye area image in the image data set, and generating a data file containing the category label of the target to be identified and the position information of the target to be identified; An initial model building module is used to add two CBAM attention modules to each CSP module in the backbone network of the YOLOv5 model, wherein one of the CBAM attention modules is added after the stacked residual block structure, and the other is added after the connection layer of the cross-stage hierarchy structure, to obtain a YOLOv5 initial model with the CBAM attention mechanism added; A model optimization module, used to optimize the YOLOv5 initial model using a FocalLoss loss function to obtain an optimized YOLOv5 detection model; A model training module, used to use all or part of the data file as a training set, and use the training set to train the optimized YOLOv5 detection model until convergence, so as to obtain an eye area target recognition model; The detection module is used to detect the image to be analyzed using the trained eye area target recognition model to obtain the detection results of the pupil and the light spot in the image to be analyzed.
8. The eye pupil and light spot detection system based on deep learning according to claim 7, characterized in that: It also includes a preprocessing module, which preprocesses the eye area image in the image data set before marking the target to be identified in the eye area image in the image data set to enhance the contrast between the target to be identified in the eye area image and the image background.
9. The eye pupil and light spot detection system based on deep learning according to claim 7, characterized in that: The FocalLoss loss function in the model optimization module is: FL(p t )=-α t (1-p t ) γ logp t Among them, α t is the balance factor, α t ∈[0, 1], used to adjust the ratio of positive samples and negative samples, the positive sample is the pupil or spot in an eye area image, and the negative sample is the background in an eye area image; p is the estimated probability that the predicted box is the target label, p t ∈[0, 1]; y is the actual label value, y∈{-1, 1}, y=-1 represents the background, y=1 represents the foreground containing the target to be identified; γ is a parameter for adjusting the difficulty of samples, and the value range of γ is 0~5.
10. The eye pupil and light spot detection system based on deep learning according to claim 7, characterized in that: In the model training module, during the process of training the optimized YOLOv5 detection model using the training set, if the loss function value of the recognition model fluctuates within a preset range and the decrease amplitude is less than a preset threshold, it is judged that the recognition model has converged.