Accurate expression recognition based on ant colony algorithm and opencv face angle

Optimizing the hyperparameters of the face recognition model through the ant colony algorithm solves the problem of inefficiency of traditional methods, achieving higher recognition accuracy and robustness, and is suitable for security monitoring, identity verification and sentiment analysis and other fields.

CN120496142APending Publication Date: 2025-08-15JIANGSU ZHIYUE INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510490041.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-18
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

The traditional face recognition model hyperparameter tuning method is inefficient and is easily trapped in the local optimal solution, making it difficult to achieve efficient recognition accuracy and robustness.

Method used

Ant colony algorithm is used to simulate ant foraging behavior, automatically adjust the hyperparameters of the face recognition model, and combine it with OpenCV library to accurately recognize face angles and expressions.

Benefits of technology

It significantly improves the recognition accuracy and convergence speed of the face recognition model, and improves the robustness of the model at different angles and expressions.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The invention provides a face angle expression accurate recognition method based on an ant colony algorithm and OpenCV. By simulating the foraging behavior of ants, the hyper-parameters of the face recognition model, such as the learning rate, the convolution kernel size and the number of network layers, are optimized, so that the recognition accuracy is improved. The method comprises the following specific steps: initializing an ant colony, and setting a hyper-parameter range and an ant colony scale; calling a face recognition model by using the position of the current ant, and calculating a fitness value (recognition accuracy); updating the pheromone concentration according to the fitness value, and adjusting the ant position; and the process is repeated until the maximum number of iterations or fitness value convergence is achieved. Experimental results show that on the FER2013 data set and the AFLW2000 data set, the recognition accuracy of the optimized model is improved by about 5%, the convergence speed is improved by about 30%, and better robustness is shown on face images with different angles and expressions. The method can be widely applied to the fields of security monitoring, identity verification, sentiment analysis, smart home and the like, and the performance and efficiency of a face recognition system are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of computer vision and machine learning, and in particular to a method for optimizing hyperparameters of a face recognition model using an ant colony optimization algorithm. Background Art

[0002] Facial recognition technology has been widely used in security monitoring, identity verification, and other fields. The performance of facial recognition models often depends on the settings of their hyperparameters. Traditional hyperparameter tuning methods typically rely on manual experience or grid search, which is inefficient and prone to getting stuck in local optimal solutions. Therefore, it is particularly important to develop an efficient hyperparameter optimization method. Summary of the Invention

[0003] This paper provides a hyperparameter optimization method based on the ant colony algorithm. By simulating ant foraging behavior, it automatically adjusts the hyperparameters of the face recognition model to improve recognition accuracy. Combined with the OpenCV library, it achieves accurate recognition of facial angles and expressions. The specific steps are as follows: 1. Initialization Set dimension: Determine the number of hyperparameters to be optimized and set it to dim, for example, 3 hyperparameters.

[0004] Set the size of the ant colony: Set the number of ants participating in the optimization, set to n_ants, for example 20 ants.

[0005] Set the maximum number of iterations: Set the maximum number of iterations of the algorithm, set to max_iter, for example 100 times.

[0006] Set parameter upper and lower bounds: Define the lower bound lb and upper bound ub of the hyperparameters, for example lb = [0.1, 0.1, 0.1] and ub = [1.0, 1.0, 1.0].

[0007] 2. Fitness Evaluation Call the face recognition model: Use the current ant position (hyperparameter combination) as input and call the face recognition model for evaluation.

[0008] Calculate the fitness value: The fitness value is calculated based on the model's output (such as recognition accuracy). A higher fitness value indicates a better hyperparameter combination.

[0009] 3. Update location Pheromone update: Update the pheromone concentration according to the ant's path and fitness value.

[0010] Position selection: Based on the pheromone concentration and heuristic information, a probabilistic selection mechanism is used to update the position of each ant.

[0011] 4. Iteration and Termination Iterative process: Repeat the fitness evaluation and position update steps until the maximum number of iterations max_iter is reached or the fitness value converges to an acceptable range.

[0012] Termination condition: When the maximum number of iterations is reached, the algorithm terminates and outputs the current optimal hyperparameter combination. 5. Experimental Results and Applications Experimental setup To verify the effectiveness of our method for accurately recognizing facial expressions from different angles based on the ant colony algorithm and OpenCV, we conducted several experiments using publicly available face datasets such as FER2013 and AFLW2000, which contain facial images with a variety of expressions and angles.

[0013] Data preprocessing: Use OpenCV to preprocess the image, including grayscale conversion, histogram equalization, and face alignment.

[0014] Model training: A convolutional neural network (CNN) is used as the basic model, and the ant colony algorithm is used to optimize the model's hyperparameters, such as learning rate, convolution kernel size, and number of layers.

[0015] Experimental Environment: The experiments are conducted on computers with GPU acceleration to improve training speed and model performance.

[0016] Result Analysis Experimental results show that the model optimized using the ant colony algorithm has significantly improved recognition accuracy and efficiency: Recognition accuracy: On the FER2013 dataset, the optimized model's recognition accuracy increased by approximately 5%, from 85% to 90%. On the AFLW2000 dataset, the accuracy increased from 78% to 83%.

[0017] Convergence speed: Compared with traditional grid search methods, the ant colony algorithm is more efficient in searching in the hyperparameter space, with a convergence speed of about 30%, significantly reducing training time.

[0018] Robustness: The optimized model shows better robustness when processing facial images of different angles and expressions, and can effectively cope with lighting changes and partial occlusion.

[0019] These results show that the ant colony algorithm has significant advantages in hyperparameter optimization and can improve the overall performance of the face recognition model. field

[0020] The accurate facial angle and expression recognition technology based on ant colony algorithm and OpenCV has broad application prospects: Security monitoring: In security systems, this technology can be used to monitor and identify potential threats in real time, and to judge people’s emotional state and behavioral intentions by analyzing facial expressions and angles.

[0021] Identity verification: In the financial and public service sectors, this technology can be used in identity verification systems to improve system security and user experience through accurate facial recognition.

[0022] Sentiment analysis: In market research and human-computer interaction, this technology can be used for sentiment analysis to help companies understand users' emotional reactions and thus optimize their products and services.

[0023] Smart home: In smart home devices, this technology can be used for user identification and emotion perception to achieve personalized home environment adjustment.

Claims

1. A method for accurate face angle recognition and transformation based on ant colony algorithm and OpenCV, characterized in that: This method combines the optimization capabilities of the ant colony algorithm with the image processing functions of OpenCV to achieve accurate recognition and transformation of facial angles. It includes the following steps: a) Image acquisition and preprocessing: using a camera or image sensor to acquire facial images, and performing preprocessing operations such as grayscale conversion, noise removal, and edge detection using OpenCV; b) Face detection and feature point extraction: using the face detection algorithm in OpenCV to identify the face area in the image and extract key feature points; c) Ant colony algorithm optimization: the ant colony algorithm is used to optimize the extracted feature points to improve the accuracy and stability of feature point matching; d) Face angle calculation: Based on the optimized feature points, the three-dimensional rotation angle of the face is calculated, including pitch, yaw, and roll angles; e) Image transformation and correction: Use OpenCV’s transformation function to perform angle correction and transformation on the original image to achieve standardized display of the face. The method according to claim 1, characterized in that The image acquisition and preprocessing steps include: a) Adaptive threshold segmentation, used to accurately segment the face region under different lighting conditions and improve the robustness of preprocessing. The method according to claim 1, characterized in that The face detection and feature point extraction steps include: a) Multi-scale feature detection: improving the recognition capability of faces of different sizes by detecting features at different scales; b) Key point positioning: accurately positioning key points of the face such as eyes, nose, and mouth. The method according to claim 1, characterized in that The ant colony algorithm optimization step includes: a) Pheromone update mechanism, which improves the global search capability of feature point matching by dynamically adjusting pheromone concentration; b) Path selection strategy, optimizing the connection path of feature points to improve matching accuracy. The method according to claim 1, characterized in that The face angle calculation step includes: a) Triangulation method, which calculates the three-dimensional angle of the face based on the spatial position of the feature points; b) Pose estimation model, which uses mathematical models to estimate the rotation angle of the face. The method according to claim 1, characterized in that The image transformation and correction steps include: a) Affine transformation, which is used to rotate, scale, and translate facial images to achieve angle correction; b) Perspective transformation, which is used to correct perspective distortion caused by the shooting angle. The method according to claim 1, characterized in that Further including: a) Real-time processing module, used to identify and change the angle of human faces in real time in the video stream to ensure the real-time performance and response speed of the system. The method according to claim 1, characterized in that Further including: a) Anomaly detection and processing module, which is used to detect and process anomalies that may occur during the recognition process, such as feature point loss or recognition errors, to ensure the stability of the system.