The application is a divisional application, the original application number is 201911274628.X, the application date is 12 months and 12 days in 2019, and the invention name is 'product function durability test self-learning method and system based on machine vision'.
Detailed Description
In order to make the technical problems, technical solutions and advantageous effects solved by the present invention more clearly apparent, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
When embodiments of the present invention refer to the ordinal numbers "first", "second" (if present), etc., it is to be understood that the words are merely used for distinguishing between them unless they literally indicate the order in which they are used.
In the description of the present invention, it is to be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected" (if present) are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
The first embodiment:
referring to fig. 1, an embodiment of the invention discloses a product function durability test self-learning method based on machine vision, which includes S11-S16, wherein:
and S11, expanding the feature identifier set into a scale feature identifier set according to a preset method, wherein the feature identifiers comprise pattern identifiers, character identifiers or combined identifiers.
In order to ensure that the machine vision has strong adaptability to the feature identification under different scenes, the embodiment of the invention acquires a feature identification set in a manner of font library, network downloading and object shooting, and then expands the feature identification set into a scale feature identification set, wherein in the embodiment, the scale feature identification set comprises a printing font set corresponding to the font library, a real font set corresponding to the network downloading and the object shooting and a pattern identification set; the preset method comprises an acquisition method of a printing font set, an acquisition method of a real font set and an acquisition method of a pattern identification set, wherein the acquisition methods comprise a printing font set acquisition method, a real font set acquisition method and a pattern identification set acquisition method.
Referring to fig. 2, the method for acquiring the printing font set includes:
s1111, performing gray scale inversion on the original font in the pre-selected printing font library to obtain a first set, wherein the first set comprises the original font and the printing font after gray scale inversion.
As an example and not by way of limitation, the present embodiment selects four commonly used fonts from the open-source chinese typographical font library, including microsoft majestic font (msyhl), microsoft majestic font (msyh), isocontour font (Arial), and chinese clerical Script (STLITI), each of which covers 3503 different words, and expands the first set to 28024 words by grayscale flipping in order to expand the data set.
And S1112, performing rotation transformation of a preset angle on the first set to obtain a second set, wherein the second set comprises the first set and fonts after clockwise rotation and anticlockwise rotation transformation.
In order to simulate the situation that the picture cannot be aligned to the characters in the actual shooting scene, in this step, the characters in the first set are subjected to angle transformation, the preset angle in this embodiment is selected to be 5 °, and through rotation transformation, the number of the characters in the second set is 84072.
And S1113, adding salt-pepper noise to the second set, and performing mean value filtering to obtain a third set, wherein the third set comprises the second set and the correspondingly processed fonts.
In order to simulate the situation that noise exists in the actual photographing scene, the step adds salt and pepper noise to the characters in the second set, and performs mean filtering processing to obtain a third set containing 168144 characters.
And S1114, performing gamma conversion on the third set to obtain the printing font set, wherein the printing font set comprises the third set, the fonts after high gamma value conversion and low gamma value conversion.
In order to simulate the situation that the environment is slightly bright or dark in the actual photographing scene, salt and pepper noise is added to the characters in the third set, and mean value filtering processing is performed, so that a printing font set containing 504432 characters is finally obtained.
It should be noted that the selection of the font library can be performed as needed, and is not limited to the above four font libraries, and the number of the printing font sets is not limited to 504432.
Referring to fig. 3, the method for acquiring a real font set and a pattern identifier set includes:
and S1121, acquiring the real font and the pattern identification in a mode of downloading the network picture and shooting the real object picture.
As a specific scheme but not limited thereto, in this embodiment, by downloading 210 types of real fonts and pattern identifiers related to the home appliance, the number of the real fonts is 10500, and the number of the pattern identifiers is 3100, wherein the number of fonts of the nixie tube serving as state feedback in the real fonts is 1710, these selected real fonts and pattern identifiers have different distortions, inclinations, distortions, overexposure, and the like, and the features are targeted, real, and reliable, and various feature forms can enhance the generalization capability of the machine learning algorithm, thereby well reducing the overfitting phenomenon.
And S1122, carrying out gray scale turnover on the reality fonts and the pattern identifications to obtain a fourth set, wherein the fourth set comprises the reality fonts after the reality fonts and the gray scale turnover, and the pattern identifications after the pattern identifications and the gray scale turnover.
After the grayscale inversion, the number of the real fonts in the fourth set is 21000, the number of the pattern identifiers is 6200, and the number of the fonts of the nixie tubes serving as the state feedback in the real fonts is 3420.
S1123, converting the fourth set into a single-channel and 8-bit gray image.
In order to facilitate data storage, the step performs single-channel 8-bit dimensionality reduction processing on the fourth set, the grayscale image after dimensionality reduction processing is easier to store, and the operation speed of the subsequent CNN (convolutional neural network) can be improved.
And S1124, adjusting the size of the gray image to a preset size to obtain a real font set and a pattern identification set.
In this step, the size of the grayscale image is adjusted to a preset size, so that the real font set and the pattern identifier set can be input into a grid with a fixed number of cells, and the preset size of this embodiment is 32 × 32 pixels by way of example and not limitation.
In the scale feature identification set of the present embodiment, the training set accounts for 70% and the test set accounts for 30%.
In this embodiment, the combination identifier includes a first combination identifier, a second combination identifier and a third combination identifier, the first combination identifier is a character identifier and a point contact pattern identifier whose intervals are smaller than a preset distance, the second combination identifier is a character identifier and a sliding pattern identifier whose intervals are smaller than the preset distance, and the third combination identifier is a point contact pattern identifier and a sliding pattern identifier whose intervals are smaller than the preset distance.
And S12, obtaining the ROI image of the product to be detected, and matching and positioning the feature identifier in the ROI image according to the scale feature identifier set.
In this embodiment, the ROI image may be an entire image of the test panel of the product to be tested, or the test panel may be divided into functional regions through self-learning, and then a corresponding ROI image is acquired for each functional region. The step mainly realizes the function of matching and positioning the characteristic identification in the test panel and the scale characteristic identification set. In the pairing process, the meaning of the feature identification in the test panel can also be acquired by machine vision, so that the subsequent sequencing is facilitated according to the priority.
Referring to fig. 4 and 5, when the product to be tested includes the character identifier, S12 includes:
s1211, determining an ROI image in the test panel image of the product to be tested.
In this step, the ROI image usually includes a plurality of function keys corresponding to the character identifiers.
And S1212, inputting the composition characters of the corresponding character identifications in the ROI image and the number K of the character identifications in the ROI image.
The embodiment of the invention can complete automatic recognition of the characters, and in order to improve the recognition accuracy and the recognition efficiency, the characters contained in the ROI image and the number K of the character identifications in the ROI image are input in advance by a tester.
S1213, gridding the ROI image to obtain a plurality of grid images, analyzing all the grid images by using a convolutional neural network, determining a first matching coefficient of each grid image content and the composition character, and acquiring a central point of a group of corresponding grid images when the first matching coefficient is larger than a first correlation threshold.
And after the ROI image is gridded, matching the image in each grid with the composition characters input by a user in the scale characteristic identification set through a convolutional neural network, judging that the probability of the image in the corresponding grid containing the composition characters is higher when the first matching coefficient is larger than a first relevance threshold, and acquiring and storing the central point of the image in the corresponding grid.
Referring to fig. 6, the convolutional neural network of this embodiment adopts a structure of one output layer, two convolutional layers, two pooling layers and three full-connected layers, the convolutional layers adopt convolutional kernels with a size of 5 × 5 and a step size of 1, and filters with a size of 2 × 2 and a step size of 2, and the convolutional layers and the pooling layers both adopt ReLU activation functions (g (Z) ═ max (0, Z)), and g (Z) is a function taking a maximum value between 0 and input. In the output layer, Softmax regression is adopted, and the probability distribution of the character types to which the input data belong can be obtained through the last Softmax layer.
At present, the weight parameters in the convolution kernel in the forward propagation process of the convolutional neural network are continuously updated in an iterative manner through the backward propagation of the convolutional neural network, and for the problem of image classification, the accuracy of the classifier is quantized by adopting a logarithmic cost function and punishing wrong classification through the logarithmic cost function. Minimizing the logarithmic cost is basically equivalent to maximizing the accuracy of the classifier. In the back propagation, the weight parameters of the interlayer connection are continuously adjusted by calculating the cost function, so that the cost function is minimized, and the optimal parameters are obtained. The weight value is updated by using a gradient descent principle, in the machine learning process, the learning rate is equivalent to the gradient descent step length, the larger the learning rate is, the larger the step length for searching the optimal value is, and the optimal value is not easy to converge although the learning speed is high; conversely, the smaller the learning rate, the slower the iterative update speed of the parameters, increasing the time cost. Therefore, the learning rate of training needs to be adjusted continuously when the neural network is trained, and the final learning rate α is 0.001 through debugging.
Through forward and backward propagation of the convolutional neural network, the weight and bias of each layer are optimized, all parameters are trained to be optimal, and finally the optimal image classification effect is obtained, namely 3503 characters can be accurately classified.
S1214, reducing the grid size and repeating the previous step at least once to obtain the central point of at least another group of corresponding grid images.
The repeating operation of S1214 in this embodiment is twice by repeating step S1213 repeatedly so that the character in the ROI image is selected a central point a plurality of times.
And S1215, segmenting all the acquired central points by adopting a K-means clustering algorithm to obtain K types of regions, and selecting the central coordinates of each type of region as a positioning target corresponding to the character identifier.
In the step, the central coordinate points are clustered by adopting a K-means clustering algorithm, so that the segmentation of different keys is realized, and the central coordinates of the character identifications of the keys K with the specified number are output at the same time.
S1211-S1215 realize rapid matching and positioning of the character identification based on the CNN, and due to the adoption of a method that the user inputs the composition character and the ROI image in advance for grid for multiple times, the accuracy of machine vision is greatly improved, the recognition efficiency is improved, and the positioning accuracy of the character identification is improved.
Referring to fig. 7, when the product to be tested includes the pattern identifier, S12 includes:
and S1221, determining an ROI image in the test panel image of the product to be tested.
In this step, the ROI image usually includes a plurality of function keys corresponding to the pattern identifiers.
S1222, selecting the non-character mark in the ROI image.
And S1223, screening the non-character marks in the preset size as undetermined pattern marks.
The non-character marks screened by the step comprise patterns, textures and pattern marks which are collectively called undetermined pattern marks.
And S1224, determining a second matching coefficient of the undetermined pattern identifier by using the convolutional neural network and the pattern identifier set in the scale feature identifier set, and determining the undetermined pattern identifier with the second matching coefficient larger than a second correlation threshold as the pattern identifier.
And matching the to-be-determined pattern identifier with the pattern identifier in the scale characteristic identifier set by using the convolutional neural network, and obtaining the pattern identifier when the second matching coefficient is greater than the second correlation threshold.
And S1225, acquiring the annotations of all the pattern identifications in the scale characteristic identification set, and dividing all the pattern identifications into point-touch pattern identifications or sliding pattern identifications according to the annotations.
In the present embodiment, the pattern mark distinguishes the dot-touch pattern mark and the sliding pattern mark by the annotation, which is generally implemented in S11. The click pattern identification is usually triggered by clicking, and the sliding pattern identification is usually triggered by sliding at the central axis of the scale.
And S1226, singly gridding the point touch pattern identification, and acquiring a single gridding central coordinate as a positioning target corresponding to the point touch pattern identification.
The single gridding mode in the step is to take two end points of the x-direction point touch pattern identification, take the other two end points of the y-direction point touch pattern identification, and obtain a single gridding central coordinate by connecting the four end points to calculate the geometric center, wherein the x direction and the y direction are mutually vertical.
And S1227, determining the scale of the sliding pattern mark, and acquiring a central axis of the scale as a positioning target corresponding to the sliding pattern mark.
In the embodiment of the present invention, all scales refer to the minimum unit scale. The two end points of the central axis of the scale are corresponding midpoint positions of the scales at the two ends in the sliding pattern mark.
S1221-S1227 realize rapid classification, matching and positioning of CNN-based pattern identifications, scale feature identifications are generated by adopting scale-integrated sliding pattern identifications, and a scheme of determining central axes according to scales is adopted, so that the embodiment has higher recognition rate and positioning accuracy for different types of sliding pattern identifications.
Referring to fig. 8 to 11, when the product to be tested simultaneously includes the first combination identifier, the second combination identifier, and the third combination identifier, the step of obtaining the ROI image of the product to be tested, and matching and positioning the feature identifier in the ROI image according to the scaled feature identifier set includes:
and S1231, determining an ROI image in the test panel image of the product to be tested.
In this step, the ROI image usually includes a plurality of function keys corresponding to the combination identifiers.
And S1232, determining whether the character mark or the point contact pattern mark in the first combined mark in the ROI image contains a peripheral frame.
In general, the positioning of the combined identifier has a great difficulty, the positioning target may be at the character identifier, the pattern identifier, or the middle of the character identifier and the pattern identifier, in order to realize the positioning of the combined identifier by the machine, in this embodiment, it is determined whether the character identifier or the point-touch pattern identifier is a functional key or not, and in this case, the product manufacturer usually selects the frame by using the peripheral frame with a high recognition degree.
And S1233, if yes, acquiring a positioning target containing the character identifier or the point-touch pattern identifier of the peripheral frame, and taking the positioning target as the positioning target of the first combined identifier.
When the character mark or the point touch pattern mark is singly selected, the character mark or the point touch pattern mark which is selected is judged to be a positioning target of the combined mark. The determination manner of the positioning target in this step is the same as the corresponding manner of S1212-S1215 or S1226, and is not described herein again.
S1234, if not, respectively acquiring the positioning targets corresponding to the character identifiers and the point-touch pattern identifiers, and determining a connection line central point of the positioning targets of the character identifiers and the pattern identifiers as the positioning target of the first combined identifier.
And when the character identifier or the point-touch pattern identifier is not selected independently, judging that the connecting line central point of the positioning targets of the character identifier and the pattern identifier is the positioning target of the combined identifier. In this step, the positioning targets of the character identifier and the pattern identifier are respectively obtained in the manners of S1212 to S1215 and S1226, and then the connection center point of the two positioning targets is taken as the positioning target of the first combined identifier.
And S1235, determining that the positioning target of the second combined identifier is the positioning target of the sliding pattern identifier.
In this embodiment, the positioning target identified by the sliding pattern is taken as the positioning target identified by the second combination.
And S1236, determining the positioning target of the third combined identifier as the positioning target of the sliding pattern identifier and the positioning target of the point-touch pattern identifier.
When the combined mark includes both the point-touch pattern mark and the sliding pattern mark, the positioning target of the sliding pattern mark and the positioning target of the point-touch pattern mark are both used as the positioning targets of the third combined mark, and in the subsequent durability test, the tests of the sliding pattern mark and the point-touch pattern mark need to be completed respectively.
According to the embodiment, the combination identifiers are classified, and the acquisition modes of various combination identifier positioning targets are provided respectively, so that the accuracy of the positioning targets is improved, and meanwhile, the efficiency of the durability test method is greatly improved.
S13, sequentially touching and controlling the corresponding characteristic identification of the product to be detected according to the preset priority, marking the touched characteristic identification as a function identification after detecting the state feedback, and marking the corresponding characteristic identification of the state feedback as an undetermined identification, wherein the state feedback comprises the on/off of a light source.
The light source of the embodiment comprises the nixie tube, an LED lamp, a display screen and the like. And when the quantitative extinguishing state/display state of the nixie tube, the LED lamp and the display screen is changed, judging that state feedback is detected.
And S14, when the pending mark corresponding to the touch control is detected and the state feedback is detected, marking the corresponding pending mark as a function mark.
Referring to fig. 12, with respect to the scheme of the sliding pattern identifier, S14 further includes:
and S141, controlling the test contact to slide from one end of the central axis of the scale to the other end.
In this step, the test contact is used to test the durability of the product function, and the test contact usually slides to the other end of the central axis in a slow moving manner.
And S142, acquiring corresponding state feedback of the test contact at each scale.
In the sliding process, state feedback corresponding to each scale is obtained and recorded as state feedback, and the state feedback is usually recorded and distinguished in an algebraic form.
And S143, establishing a matching relation library of the scales and the state feedback.
And storing the matching relation of each scale and the state feedback corresponding to each scale in the matching relation library.
And S15, when the pending mark corresponding to the touch control is not detected and the state feedback is not detected, marking the corresponding pending mark as an indication mark.
In this step, when the undetermined mark touched by the test contact does not trigger any state feedback, it is determined that the undetermined mark only plays an indicating role, and the undetermined mark is marked as an indicating mark.
And S16, carrying out durability test on the functional identification.
With respect to the scheme of sliding pattern identification described above, S16 further includes:
s161, according to the formula
Controlling the test contact to start sliding at one end of the central axis of the scale at a speed V, wherein V
oFor testing the initial minimum moving speed of the stylus, rand () is a random number from 0 to 1 when
Then, rand () is refreshed again, d is the real-time distance of the test contact moving, s is the axial length in the scale,
is composed of
Taking an integer part, wherein n is a natural number.
In this embodiment, the test contact randomly changes speed at the midpoint of the central axis of the scale when sliding, and the test contact is in a random speed change state in the sliding process, so that the sensitivity of the sliding pattern mark is convenient to detect, and continuous durability and reliability test of the sliding pattern mark is realized by the test contact sliding back and forth in the central axis of the scale.
S162, recording corresponding instant speed V of the M groups of test contacts at each scaleiAnd feeding back the actual state to generate a test data set.
The instantaneous speed is the absolute value of the speed correspondingly determined by the formula in S161 for the current rand (). In the step, the position of the test contact is immediately tracked, the instant speed of the test contact and the actual state feedback of the corresponding scale are recorded when each corresponding scale is marked, and a test data set is generated.
S163, comparing the validation test data set according to the pairing relation library to generate a test result, wherein the test result comprises key yield, NG scale and instant speed V when the NG scale does not trigger state feedbacki。
In this step, according to whether the actual state feedback of each scale is consistent with the corresponding state feedback in the pairing relation library or not, whether the scale is an NG scale or not can be judged, illustratively, the sliding pattern mark comprises a first scale and a second scale, the state feedback corresponding to the first scale and the second scale in the pairing relation library is 100 ℃ and 120 ℃ respectively, that is, when the test contact slides from the first scale to the second scale, the numerical value of the nixie tube or the display screen in the tested product should be changed from 100 ℃ to 120 ℃. If the numerical value of the digital tube sliding to the second scale is still 100 ℃ (inconsistent with the state feedback corresponding to the second scale in the pairing relationship library) in the positive sliding process (sliding from the first scale to the second scale) of a certain test contact, the second scale is an NG scale at this time.
It should be noted that, the probability that the same scale becomes NG scale is not 100%, and the sliding speed, the sliding direction, the temperature and the humidity of the tested contact are affected by the quality of the touch panel, so that there is a problem of the yield of the key, as an example and not by limitation, in this embodiment, the key yield can be determined according to the ratio of the NG scale times to the total scale testing times (the total testing times is M · L, and L is the total number of scales identified by the sliding pattern). The embodiment of the invention can test the sensitivity of the sliding pattern mark and the critical speed of the trigger response, can accurately identify the scale with high NG rate, is convenient for subsequent maintenance, improves the reliability of the durability test self-learning method of the embodiment of the invention, and expands the practicability.
The method comprises the steps of acquiring a feature identifier set associated with a product in advance, expanding the feature identifier set into a scale feature identifier set, matching feature identifiers associated with the scale feature identifier set in the product to be tested by acquiring an ROI image of the product to be tested, extracting relevant contents in the scale feature identifier set, sequentially touching all feature identifiers according to the matching contents according to priorities, determining function identifiers corresponding to keys, and only playing indication identifiers for state display, so that the functions of self-learning of key identifiers of different products and locking of key positions of a testing device are realized; manpower participation is reduced as much as possible in the durability test process, the automation level is improved, and the efficiency is improved; meanwhile, the embodiment can automatically distinguish the function identifier and the indication identifier according to the state feedback of the product to be detected, thereby avoiding the condition that the product pattern is detected as the function key, and further improving the detection efficiency.
Second embodiment:
referring to fig. 13 to 14, an embodiment of the invention discloses a product function durability test self-learning system based on machine vision, including:
the positioning test bench comprises abench surface 1 and apositioning seat 3 which is arranged on thebench surface 1 and used for fixing aproduct 2 to be tested;
the camera shooting assembly 4 comprises abracket 41 which is arranged on the positioning test bench and can slide along the x direction, asuspension arm 42 which is arranged on thebracket 41 and can slide along the z direction of the bracket, and acamera 43 which is arranged on thesuspension arm 42 and can slide along the y direction of the suspension arm;
thetest assembly 5 comprises amechanical arm 51 arranged on the positioning test bench and atest contact 52 connected to the tail end of themechanical arm 51, wherein themechanical arm 51 is used for controlling thetest contact 52 to move in a three-dimensional space;
and thedisplay component 6 is arranged on thetable board 1 and used for displaying the ROI image of the test panel of the product to be tested, the position information of the test contact and the moving speed of the test contact.
In this embodiment, a plurality of screw holes are formed on the surface of the positioning seat for fixing the product to be tested or the display panel of the product to be tested, and afastening device 31 is further formed on one side of the positioning seat for fixing the upper surface of the product to be tested, so as to prevent the product to be tested from moving in the touch process, and effectively improve the reliability of the durability test self-learning system of the invention.
Thetest assembly 5 of this embodiment still includespedestal 53, the pedestal includes a horizontal slewing mechanism,arm 51 passes through horizontal slewing mechanism sets up onmesa 1 and can berelative mesa 1 horizontal rotation,arm 51 includes thepostbrachium 511 that is connected with horizontal slewing mechanism to and be connected withpostbrachium 511 and can be relative postbrachium pivotedforearm 512,test contact 52 sets up onforearm 512,arm 51 controls atleast test contact 52 is followed horizontal slewing mechanism is radial and z to the motion.
As a preferred embodiment, thepositioning seat 3 includes a fixed positioning seat and a rotating positioning seat, and the fixed positioning seat and the rotating positioning seat are alternatively mounted on the table top. The rotation positioning seat is installed in the pivot of the table board in a pivot mode, the rotation positioning seat is used for clamping a product to be tested with a special-shaped surface, the product to be tested is driven to rotate through the rotation of the pivot of thetable board 1, and thetest contact 52 can touch different positions of the product to be tested with the special-shaped surface.
As an improvement, but not limited to, thetest contact 52 includes atouch end 521 and adriving end 522, the drivingend 522 is provided with a voice coil motor, the positioning test board controls the touch force and the extension stroke of the touch end by changing the power supply current of the voice coil motor, and thetest contact 52 of this embodiment is provided with the drivingend 522 with the voice coil motor, so that thetouch end 521 has characteristics of stroke adjustability, high speed, high acceleration response speed, and the like, and the touch end can be switched between point contact and sliding contact by changing the power supply current of the voice coil motor, and meanwhile, advantages of rapidness, smoothness, no cog, no lag response, and the like are brought to thetouch end 521.
According to the durability testing self-learning system, the testing assembly and the camera shooting assembly are arranged in a split mode, so that the testing assembly and the camera shooting assembly can move independently, testing efficiency is improved, the camera shooting assembly can move in a three-dimensional space through the matching of the support and the suspension arm, the camera shooting assembly has better compatibility with testing panels of different products, the work of the testing assembly cannot be influenced, and the efficiency and the reliability of the durability testing self-learning system are improved.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.