Image-based identity distinction method, device, electronic device, and storage medium
Through image detection model and clustering algorithm, teachers and students are automatically distinguished, and the problems of low manual identification efficiency and pre-stored information deviation in the prior art are solved, achieving fast, accurate and low-cost identity distinction.
Patent Information
- Application Number
- CN202210298569.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-16
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2042-03-16
AI Technical Summary
The lack of effective image-based means in the prior art automatically distinguishes teachers and students, resulting in low efficiency, high cost, and information deviation problems of methods of pre-storing facial information.
The image-based identity distinction method is adopted, by obtaining the image data set, using a preset image detection model to detect the standing target image, extract feature vectors, and classifying using clustering algorithms to achieve automatic distinction between teachers and students.
It realizes fast, simple and low-cost automatic distinction, with high accuracy and does not rely on manual and prior knowledge.
Smart Images

Figure CN114792428B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to an image-based identity differentiation method, device, electronic device and storage medium. Background Art
[0002] In teaching analysis, cameras are usually used to capture images to obtain behavioral information of students and teachers. An important part of this is to distinguish between teachers and students in the classroom. Currently, there is no effective image-based solution to automatically distinguish between teachers and students. Most of them are judged by manual observation of images, or by pre-storing teacher facial information. Therefore, there is an urgent need for an effective image-based method that can automatically distinguish between teachers and students.
[0003] Disadvantages of manual screening:
[0004] Although the manual recognition method has high accuracy, it has low efficiency and high labor costs;
[0005] Disadvantages of pre-storing teacher face information:
[0006] It is necessary to collect teachers' facial information in advance, which is a cumbersome procedure. Moreover, after a long time, there will be a deviation between the predicted information and the real teacher's information, which will affect the result judgment. Summary of the invention
[0007] The present invention provides an image-based identity differentiation method, device, electronic device and storage medium, which uses an image-based approach to differentiate between teachers and students. It does not require manual work or prior knowledge, and can use a program to automatically differentiate between teachers and students. It has high speed, simple operation, cost savings and high accuracy.
[0008] In a first aspect, an embodiment of the present invention provides an identity differentiation method based on an image, the differentiation method comprising:
[0009] Acquire an image data set; wherein the image data set includes classroom teacher and student image data;
[0010] Using a preset image detection model to detect the images in the image data set to obtain a standing target image in the image; wherein the standing target image includes a standing frame and a head frame;
[0011] Performing feature extraction on the standing target image to obtain a feature vector of the standing target image;
[0012] Clustering the feature vectors using a clustering algorithm;
[0013] The clustering results are classified using the preset discrimination algorithm.
[0014] Optionally, acquiring the image data set includes:
[0015] Acquire images taken by the teacher's camera and the student's camera at the same moment;
[0016] Performing a mask operation on the image; wherein the image taken by the teacher's lens only retains the teacher's area, and the image taken by the student's lens only retains the student's area;
[0017] Optionally, the method for constructing the image detection model includes:
[0018] Obtain standing samples and head samples; wherein the standing samples and head samples are prepared according to the format of the PASCAL VOC data set and annotated using the LableImg annotation tool;
[0019] The Torch architecture, Yolo-v5 network and Adam optimization algorithm are used to train the standing samples and head samples to obtain the image detection model.
[0020] Optionally, extracting features from the standing target image to obtain a feature vector of the standing target image includes:
[0021] Acquire the standing information of the standing frame and the head information of the head frame;
[0022] According to the standing information and the head information, the standing frame and the head frame are matched to obtain a standing target frame;
[0023] The upper half of the standing target frame after expanding half the width of the head to the left and right starting from the bottom of the head is used as the feature area;
[0024] Dividing the feature area into a plurality of different areas and setting different weights;
[0025] The two color spaces of BGR+HSV are combined to cluster the multiple different regions to obtain color histograms of the multiple different regions, and the overall features of the feature regions are obtained by adding them according to the weights.
[0026] Optionally, matching the standing frame and the head frame according to the standing information and the head information to obtain a standing target frame includes:
[0027] The upper half of the standing frame and all the head frames are matched for cross-area; wherein the head frame having the largest cross-area with the upper half of the standing frame is the head frame corresponding to the standing target.
[0028] Optionally, clustering the feature vectors using a clustering algorithm includes clustering the feature vectors using a BIRCH clustering algorithm, and clustering the feature vectors using the BIRCH clustering algorithm includes:
[0029] Get feature vector;
[0030] After setting the number of categories and the sample spacing threshold, the feature vectors are clustered; wherein, the Calinski-Harabaz index is used to evaluate the clustering effect, and after setting the number of categories to 2 and setting two or more sample spacing thresholds for clustering, the one with the highest Calinski-Harabaz index is selected as the clustering result output.
[0031] Optionally, the adopting a preset differentiation algorithm to classify the clustering results includes:
[0032] Get the number of standing frames under the teacher's lens in the two categories in the clustering results;
[0033] Compare the number of standing frames captured by the teacher in the two categories; the larger number is for the teacher category, and the rest are for the student category.
[0034] In a second aspect, an embodiment of the present invention provides an identity distinguishing device based on an image, the distinguishing device comprising:
[0035] A data acquisition module acquires an image data set; wherein the image data set includes classroom teacher and student image data;
[0036] An image detection module, using a preset image detection model to detect the images in the image data set to obtain a standing target image in the image; wherein the standing target image includes a standing frame and a head frame;
[0037] A feature extraction module performs feature extraction on the standing target image to obtain a feature vector of the standing target image;
[0038] A clustering module, clustering the feature vectors using a clustering algorithm;
[0039] The differentiation module uses a preset differentiation algorithm to classify the clustering results.
[0040] In a third aspect, an embodiment of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the program, the method described in any one of the first aspects is implemented.
[0041] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method as described in any one of the first aspects.
[0042] Beneficial Effects
[0043] The present invention provides an identity differentiation method, device, electronic device and storage medium based on images. The differentiation method first obtains an image data set; wherein the image data set includes classroom teacher and student image data; then uses a preset image detection model to detect the image in the image data set to obtain a standing target image in the image; wherein the standing target image includes a standing frame and a head frame; then extracts features from the standing target image to obtain a feature vector of the standing target image; then uses a clustering algorithm to cluster the feature vector; and finally uses a preset differentiation algorithm to classify the clustering results. The image-based method is used to differentiate between teachers and students, which does not require manual work or prior knowledge. The program can be used to automatically differentiate between teachers and students, which is fast, simple to operate, cost-saving and highly accurate.
[0044] It should be understood that the contents described in the summary of the invention are not intended to limit the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The above and other features, advantages and aspects of the embodiments of the present invention will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements.
[0046] Figure 1 A flow chart of an image-based identity differentiation method according to an embodiment of the present invention is shown;
[0047] Figure 2 A flow chart of standing target detection according to an embodiment of the present invention is shown;
[0048] Figure 3 A flow chart of a clustering algorithm according to an embodiment of the present invention is shown;
[0049] Figure 4 A schematic diagram of the structure of an image-based identity differentiation device according to an embodiment of the present invention is shown;
[0050] Figure 5 A structural diagram of an electronic device according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0051] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the technical solutions in one or more embodiments of this specification will be clearly and completely described below in conjunction with the drawings in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.
[0052] It should be noted that the description of the embodiments of the present invention is only for more clearly illustrating the technical solutions of the embodiments of the present invention, and does not constitute a limitation on the technical solutions provided by the embodiments of the present invention.
[0053] Figure 1 A flowchart of an image-based identity differentiation method according to an embodiment of the present invention is shown; see Figure 1 , the distinguishing method includes:
[0054] S20, obtaining an image data set;
[0055] Wherein, the image data set includes classroom teacher and student image data;
[0056] Specifically, acquiring the image data set includes:
[0057] Acquire images taken by the teacher's camera and the student's camera at the same moment;
[0058] Performing a mask operation on the image; wherein the image taken by the teacher's lens only retains the teacher's area, and the image taken by the student's lens only retains the student's area;
[0059] S40, using a preset image detection model to detect the images in the image data set to obtain images of standing targets in the images;
[0060] Wherein, the standing target image includes a standing frame and a head frame;
[0061] Specifically, standing object detection is to automatically identify standing people from the image and mark their location. The deep learning algorithm Yolo-v5 is used to perform standing object detection and head detection on the input image.
[0062] The detection model training method is as follows:
[0063] Sample collection:
[0064] 100,000 standing samples and 800,000 head samples were collected from real classrooms. The samples were prepared in the format of the PASCAL VOC dataset. The LableImg annotation tool was used for annotation. The samples included both teacher standing samples and student standing samples.
[0065] Model training:
[0066] The Torch architecture was used for training, using the Yolo-v5 network and the adam optimization algorithm. The training parameters were as follows: number of iterations: 40, Lr: 0.01, Gamma: 0.0, and Weight_decay: 0.0;
[0067] Predictions and data storage:
[0068] The trained model is used to detect standing targets and human heads. The images of the two lenses are detected separately, and the detection results are stored in the database. The database stores the following information:
[0069] stamp:real image timestamp (used for teacher lens and student lens time synchronization)
[0070] imgid: int image number imgid (teacher's lens uses odd numbers, student's lens uses even numbers)
[0071] x1:int upper left x coordinate of the standing frame
[0072] y1:int upper left y coordinate of the standing frame
[0073] x2: int x coordinate of the lower right corner of the standing frame
[0074] y2: int The lower right y coordinate of the standing frame
[0075] image_frac_jpeg: blob standing frame image, cut out and compressed to jpeg for storage
[0076] heads:json All head frame position information in the image
[0077] The advantages of using Yolo-v5 are as follows:
[0078] Mosaic (Mixup, Cutout, CutMix) data enhancement, yolov5 uses Mosaic data enhancement method, passes each batch of training data through the data loader, and performs enhanced training on it, such as random cropping, random scaling, random arrangement, etc., which significantly improves the prediction effect;
[0079] Yolo-v5 can adaptively obtain the best anchor box value for different training sets, and generally uses a fixed anchor box value;
[0080] Two CSP (Cross Stage Partial Network) structures are designed in Yolo-v5. The CSP structure is used in both the Backbone network and Neck. The CSP structure can reduce computational pressure and memory consumption while ensuring accuracy.
[0081] S60, extracting features from the standing target image to obtain a feature vector of the standing target image;
[0082] Specifically, the BIRTCH (Balanced Iterative Reducing and Clustering Using Hierarchies) clustering algorithm is used. Clustering requires the extraction of certain features of the image, and clustering is performed using improved color histogram features;
[0083] The specific steps are as follows:
[0084] Acquire the standing information of the standing frame and the head information of the head frame;
[0085] According to the standing information and the head information, the standing frame and the head frame are matched to obtain a standing target frame;
[0086] The upper half of the standing target frame after expanding half the width of the head to the left and right starting from the bottom of the head is used as the feature area;
[0087] Dividing the feature area into a plurality of different areas and setting different weights;
[0088] The two color spaces of BGR+HSV are combined to cluster the multiple different areas to obtain the color histograms of the multiple different areas and then add them according to the weights to obtain the overall features of the feature area; wherein the feature is set to 320 dimensions, and the proportion of each channel is: R:60+G:60+B:60+H:60+S:40+V:40; the weight value of the area directly below the head is set to 1.0, and the weight of the area on both sides is set to 0.75.
[0089] In the above technical solution, using the upper body of the standing target for cross-area calculation can make the result more accurate; the adopted feature area positioning method can reduce the influence of classroom background and teacher raising hands and other actions, and improve the accuracy of feature extraction; combining the two color spaces of BGR+HSV, a total of six channels, the effect is much better than the previous single color space clustering effect, reducing the influence of ambient light on the clustering results.
[0090] S80, clustering the feature vectors using a clustering algorithm;
[0091] Specifically, clustering the feature vectors using a clustering algorithm includes clustering the feature vectors using a BIRCH clustering algorithm, and clustering the feature vectors using the BIRCH clustering algorithm includes:
[0092] Get feature vector;
[0093] After setting the number of categories and the sample spacing threshold, the feature vectors are clustered; wherein, the Calinski-Harabaz index is used to evaluate the clustering effect, and after setting the number of categories to 2 and setting two or more sample spacing thresholds for clustering, the one with the highest Calinski-Harabaz index is selected as the clustering result output.
[0094] The advantages of using the BIRCH algorithm are as follows:
[0095] To save memory, CF Tree (clustering feature tree) only stores CF nodes and corresponding pointers;
[0096] The clustering speed is fast, and the CF Tree (clustering feature tree) can be established by scanning the training set once;
[0097] BIRCH is an incremental clustering because its clustering decision for each data point is based on the currently processed data points rather than on global data points.
[0098] S90: Classify the clustering results using a preset differentiation algorithm.
[0099] Specifically, all standing targets are divided into two categories through the BIRCH clustering algorithm, and then it is determined which of the two categories are students and which are teachers. Because there are basically more teachers than students in the standing targets in the teacher's lens images, the number of teacher lens targets in the two categories obtained by clustering is used to determine which category is the teacher. The one with more numbers is the teacher class, and the rest are the student class. All standing objects are divided into teachers and students.
[0100] The present invention provides an identity differentiation method, device, electronic device and storage medium based on images. The differentiation method first obtains an image data set; wherein the image data set includes classroom teacher and student image data; then uses a preset image detection model to detect the image in the image data set to obtain a standing target image in the image; wherein the standing target image includes a standing frame and a head frame; then extracts features from the standing target image to obtain a feature vector of the standing target image; then uses a clustering algorithm to cluster the feature vector; and finally uses a preset differentiation algorithm to classify the clustering results. The image-based method is used to differentiate between teachers and students, which does not require manual work or prior knowledge. The program can be used to automatically differentiate between teachers and students, which is fast, simple to operate, cost-saving and highly accurate.
[0101] The beneficial effects of the present invention are described below with a preferred embodiment;
[0102] Figure 2 FIG. 4 shows a flow chart of standing target detection according to an embodiment of the present invention; Figure 2 As shown:
[0103] First, the image is collected, then the mask operation is performed on the image, and then the standing target is detected, and the information obtained from the detection is stored in the database;
[0104] Specifically, two cameras are installed in the classroom, a teacher lens and a student lens. The teacher lens is installed at the back of the classroom to shoot the podium area, and the student lens is installed at the front of the classroom to shoot the student area. The two lenses are time-stamped and synchronized to obtain two images at the same time.
[0105] After acquiring the image, the program is used to perform mask operations on the image. The teacher lens only retains the teacher area, and the student lens only retains the student area, so as to prevent mutual interference and avoid affecting the judgment.
[0106] During image acquisition, images are collected every 3 seconds, and real-time standing behavior detection and head detection are performed on the collected images. The detection frame information and image information are stored in the database. At the same time, the database also stores the corresponding timestamp, image index number and other information for subsequent analysis.
[0107] Standing object detection is to automatically identify standing people from the image and mark their location. The deep learning algorithm Yolo-v5 is used to perform standing object detection and head detection on the input image.
[0108] Among them, the detection model training method is as follows:
[0109] Sample collection:
[0110] 100,000 standing samples and 800,000 head samples were collected from real classrooms. The samples were prepared in the format of the PASCAL VOC dataset. The LableImg annotation tool was used for annotation. The samples included both teacher standing samples and student standing samples.
[0111] Model training:
[0112] The Torch architecture was used for training, using the Yolo-v5 network and the adam optimization algorithm. The training parameters were as follows: number of iterations: 40, Lr: 0.01, Gamma: 0.0, and Weight_decay: 0.0;
[0113] Predictions and data storage:
[0114] The trained model is used to detect standing targets and human heads. The images of the two lenses are detected separately, and the detection results are stored in the database. The database stores the following information:
[0115] stamp:real image timestamp (used for teacher lens and student lens time synchronization)
[0116] imgid: int image number imgid (teacher's lens uses odd numbers, student's lens uses even numbers)
[0117] x1:int upper left x coordinate of the standing frame
[0118] y1:int upper left y coordinate of the standing frame
[0119] x2: int x coordinate of the lower right corner of the standing frame
[0120] y2: int The lower right y coordinate of the standing frame
[0121] image_frac_jpeg: blob standing frame image, cut out and compressed to jpeg for storage
[0122] heads:json All head frame position information in the image
[0123] Figure 3 The clustering algorithm flow chart of the embodiment of the present invention is shown; as shown in the figure:
[0124] Now all the standing information and head information in the teacher's lens image and the student's lens image have been saved in the database. Then we use a certain strategy to separate the standing teachers from the standing students. The BIRTCH (Balanced Iterative Reducing and Clustering Using Hierarchies) clustering algorithm is used. At the same time, clustering needs to extract certain features of the image, so the improved color histogram feature is used for clustering. Finally, a certain strategy is used to distinguish teachers from students based on the clustering results. The specific steps are as follows:
[0125] Standing target and head position matching:
[0126] Use the upper half of the standing target and all the head frames to match the intersection area, and find the head frame with the largest intersection area with the standing frame, which is the head frame corresponding to the standing target;
[0127] Feature extraction:
[0128] Clustering is performed by extracting the color histogram of a specific area. The specific steps are as follows:
[0129] Feature area determination: After matching the standing target and the head frame in the previous step, expand half the head width to the left and right starting from the bottom of the head, and only take the upper half of the standing frame downward.
[0130] Feature extraction: The feature here uses color histogram, and clustering is performed by combining BGR+HSV two color spaces. There are a total of six channels, and the feature is set to 320 dimensions, where the proportion of each channel is: R: 60+G: 60+B: 60+H: 60+S: 40+V: 40;
[0131] Merge overall features: Divide the feature area into multiple different areas and set different weights. For example, divide the feature area into a middle area and two side areas, extract the color histograms of these three parts, which are 320 dimensions respectively, and finally add them according to the preset weights to obtain the overall features; wherein, the weight value of the middle area is set to 1.0, and the weight value of the two side areas is set to 0.75;
[0132] Clustering using the BIRCH algorithm:
[0133] The number of categories is set to 2, and 4 thresholds are set at the same time. Four thresholds of 0.3, 0.4, 0.5 and 0.6 are selected for prediction respectively. The Calinski-Harabaz index is used to evaluate the quality of clustering. The higher the index, the more accurate the clustering, and vice versa.
[0134] The difference between teachers and students:
[0135] All standing objects are divided into two categories through the BIRCH clustering algorithm, and then it is determined which of the two categories are students and which are teachers. Because there are basically more teachers than students in the teacher's lens images, the number of standing objects belonging to the teacher's lens in the two categories obtained by clustering is used to determine which category is the teacher. The one with more objects is the teacher class, and the rest is the student class. All standing objects are divided into teachers and students.
[0136] In the above embodiment, performing mask operation on the image can prevent mutual interference and affect the determination;
[0137] The advantages of using Yolo-v5 in the above embodiment are as follows:
[0138] Mosaic (Mixup, Cutout, CutMix) data enhancement, yolov5 uses Mosaic data enhancement method, passes each batch of training data through the data loader, and performs enhanced training on it, such as random cropping, random scaling, random arrangement, etc., which significantly improves the prediction effect;
[0139] Yolo-v5 can adaptively obtain the best anchor box value for different training sets, and generally uses a fixed anchor box value;
[0140] Two CSP (Cross Stage Partial Network) structures are designed in Yolo-v5. The CSP structure is used in both the Backbone network and Neck. The CSP structure can reduce computational pressure and memory consumption while ensuring accuracy.
[0141] In the above embodiment, the upper body of the standing target is selected for cross-area calculation to make the result more accurate; the feature area positioning method adopted can reduce the influence of classroom background and teacher raising hand and other actions, and improve the accuracy of feature extraction; the two color spaces of BGR+HSV are combined, with a total of six channels, which is much better than the previous single color space clustering effect, and reduces the influence of ambient light on the clustering results;
[0142] The advantages of using the BIRCH algorithm in the above embodiment are as follows:
[0143] To save memory, CF Tree (clustering feature tree) only stores CF nodes and corresponding pointers;
[0144] The clustering speed is fast, and the CF Tree (clustering feature tree) can be established by scanning the training set once;
[0145] BIRCH is an incremental clustering because its clustering decision for each data point is based on the currently processed data points rather than on global data points.
[0146] In the above embodiment, an image-based method is used to distinguish between teachers and students. It does not require manual work or prior knowledge. Teachers and students can be automatically distinguished by a program, which is fast, simple to operate, cost-effective, and highly accurate.
[0147] Based on the same inventive concept, an embodiment of the present invention also provides an image-based identity distinction device, which can be used to implement an image-based identity distinction method described in the above embodiment, as described in the following embodiment: Since the principle of solving the problem of an image-based identity distinction device is similar to that of an image-based identity distinction method, the implementation of an image-based identity distinction device can refer to the implementation of an image-based identity distinction method, and the repeated parts will not be repeated. As used below, the term "unit" or "module" can be a combination of software and / or hardware that implements a predetermined function. Although the system described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0148] Figure 4 FIG. 2 shows a structural block diagram of an image-based identity differentiation device according to an embodiment of the present invention. Figure 4 As shown, the distinguishing device includes:
[0149] The data acquisition module 20 acquires an image data set; wherein the image data set includes classroom teacher and student image data;
[0150] An image detection module 40 detects the images in the image data set using a preset image detection model to obtain a standing target image in the image; wherein the standing target image includes a standing frame and a head frame;
[0151] A feature extraction module 60 performs feature extraction on the standing target image to obtain a feature vector of the standing target image;
[0152] A clustering module 80, clustering the feature vectors using a clustering algorithm;
[0153] The distinguishing module 90 uses a preset distinguishing algorithm to classify the clustering results.
[0154] The embodiment of the present invention provides an identity differentiation device based on images, wherein the differentiation device first obtains an image data set 20 through a data acquisition module; wherein the image data set includes classroom teacher and student image data; then, through an image detection module 40, a preset image detection model is used to detect the image in the image data set to obtain a standing target image in the image; wherein the standing target image includes a standing frame and a head frame; then, through a feature extraction module 60, feature extraction is performed on the standing target image to obtain a feature vector of the standing target image; then, through a clustering module 80, a clustering algorithm is used to cluster the feature vector; finally, through a differentiation module 90, a preset differentiation algorithm is used to classify the clustering results. The above technical solution of the present invention uses an image-based method to distinguish between teachers and students, which does not require manual work or prior knowledge, and can use a program to automatically distinguish between teachers and students, with fast speed, simple operation, cost savings, and high accuracy.
[0155] An embodiment of the present invention further provides a computer electronic device, Figure 5 FIG. 1 shows a schematic diagram of the structure of an electronic device to which an embodiment of the present invention can be applied. Figure 5 As shown, the computer electronic device includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 502 or the program loaded from the storage part 508 to the random access memory (RAM) 503. In the RAM 503, various programs and data required for system operation are also stored. The CPU 501, the ROM 502 and the RAM 503 are connected to each other through a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0156] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.
[0157] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a different order from the order marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0158] The units or modules involved in the embodiments of the present invention may be implemented by software or hardware. The units or modules described may also be set in a processor, for example, may be described as: a processor includes a data acquisition module 20, an image detection module 40, a feature extraction module 60, a clustering module 80 and a distinction module 90, wherein the names of these modules do not constitute a limitation on the modules themselves in certain cases, for example, the feature extraction module 60 may also be described as "a feature extraction module 60 that extracts features from the standing target image to obtain a feature vector of the standing target image".
[0159] As another aspect, the present invention further provides a computer-readable storage medium, which may be a computer-readable storage medium included in the image-based identity distinction device described in the above embodiment; or a computer-readable storage medium that exists independently and is not assembled into an electronic device. The computer-readable storage medium stores one or more programs, and the programs are used by one or more processors to execute the image-based identity distinction method described in the present invention.
[0160] The above description is only a preferred embodiment of the present invention and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present invention is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present invention (but not limited to) to form a technical solution.
Claims
1. An image-based identity identification method, characterized in that: The distinguishing method includes: Acquire an image data set; wherein the image data set includes classroom teacher and student image data; use a preset image detection model to detect the images in the image data set to acquire a standing target image in the image; wherein the standing target image includes a standing frame and a head frame; Performing feature extraction on the standing target image to obtain a feature vector of the standing target image; Clustering the feature vectors using a clustering algorithm; Use the preset differentiation algorithm to classify the clustering results; The method for constructing the image detection model includes: Obtain standing samples and head samples; wherein the standing samples and head samples are prepared according to the format of the PASCAL VOC data set and annotated using the LableImg annotation tool; The image detection model is obtained by training the standing sample and the head sample using the Torch architecture, Yolo-v5 network and the adam optimization algorithm; The extracting features of the standing target image to obtain a feature vector of the standing target image comprises: Acquire the standing information of the standing frame and the head information of the head frame; According to the standing information and the head information, the standing frame and the head frame are matched to obtain a standing target frame; The upper half of the standing target frame after expanding half the width of the head to the left and right starting from the bottom of the head is used as the feature area; Dividing the feature area into a plurality of different areas and setting different weights; The two color spaces BGR+HSV are combined to cluster the multiple different regions to obtain color histograms of the multiple different regions and then the overall features of the feature regions are obtained by adding the color histograms according to the weights; The matching the standing frame and the head frame according to the standing information and the head information to obtain a standing target frame includes: The upper half of the standing frame and all the head frames are matched for cross-area; wherein the head frame having the largest cross-area with the upper half of the standing frame is the head frame corresponding to the standing target.
2. The distinguishing method according to claim 1, characterized in that: The acquiring of the image data set comprises: Acquire images taken by the teacher's camera and the student's camera at the same moment; A mask operation is performed on the image; wherein, the image taken by the teacher's lens only retains the teacher's area, and the image taken by the student's lens only retains the student's area.
3. The distinguishing method according to claim 1, characterized in that: The clustering of the feature vectors using a clustering algorithm includes clustering the feature vectors using a BIRCH clustering algorithm, and clustering the feature vectors using the BIRCH clustering algorithm includes: Get feature vector; After setting the number of categories and the sample spacing threshold, the feature vectors are clustered; wherein, the Calinski-Harabaz index is used to evaluate the clustering effect, and after setting the number of categories to 2 and setting two or more sample spacing thresholds for clustering, the one with the highest Calinski-Harabaz index is selected as the clustering result output.
4. The distinguishing method according to claim 1, characterized in that: The method of using a preset differentiation algorithm to classify the clustering results includes: Get the number of standing frames under the teacher's lens in the two categories in the clustering results; Compare the number of standing frames captured by the teacher in the two categories; the larger number is for the teacher category, and the rest are for the student category.
5. An identity distinguishing device based on an image, characterized in that: The distinguishing device comprises: a data acquisition module, which acquires an image data set; wherein the image data set comprises classroom teacher and student image data; An image detection module detects the images in the image data set using a preset image detection model to obtain a standing target image in the image; wherein the standing target image includes a standing frame and a head frame; obtains a standing sample and a head sample; wherein the standing sample and the head sample are prepared in the format of the PASCAL VOC data set and annotated using the LabelImg annotation tool; and uses the Torch architecture, Yolo-v5 network and adam optimization algorithm to train the standing sample and the head sample to obtain the image detection model; A feature extraction module is provided for extracting features of the standing target image to obtain a feature vector of the standing target image; obtaining standing information of the standing frame and head information of the head frame; matching the standing frame and the head frame according to the standing information and the head information to obtain a standing target frame; taking the upper half of the standing target frame after extending half the head width to the left and right from the bottom of the head as a feature region; dividing the feature region into a plurality of different regions and setting different weights; combining the two color spaces of BGR+HSV to cluster the plurality of different regions to obtain color histograms of the plurality of different regions and adding them according to the weights to obtain the overall features of the feature region; matching the upper half of the standing frame with all head frames for cross-area; wherein the head frame with the largest cross-area with the upper half of the standing frame is the head frame corresponding to the standing target. The clustering module uses a clustering algorithm to cluster the feature vectors; the distinguishing module uses a preset distinguishing algorithm to classify the clustering results.
6. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 4 is implemented.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Real-time monitoring method, device and equipment for student discipline violation based on visual perception
CN113298005A
Teaching process evaluation method based on non-verbal behaviors of teachers
CN113792626A
State expression analysis method, device and equipment for students in class
CN113947797A
Intelligent analysis method for class attending state of student
CN114168714A
Education assisting robot and control method thereof
US20210060787A1
