Camera module detection method, model training method and device

By preprocessing the images captured by the camera module and detecting the slug detection model, the problems of high error judgment rate and low testing efficiency in the prior art are solved, and efficient and accurate slug treatment performance detection is achieved.

CN112991317BActive Publication Date: 2025-06-13KUNSHAN QIUTI PHOTOELECTRIC TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202110343263.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-30
Publication Date
2025-06-13
Estimated Expiration
2041-03-30

AI Technical Summary

Technical Problem

The prior art has problems in detecting the matte processing performance of the camera module with uncontrollable error rate and low testing efficiency.

Method used

By acquiring the image to be tested by the camera module to be tested, performing pre-processing, the target image is detected using the pre-trained riff detection model to determine the riff processing performance of the camera module to be tested.

Benefits of technology

The stunning processing performance of the automatic detection camera module is realized, which improves the accuracy and efficiency of testing, and reduces the dependence of artificial visual inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112991317B_ABST
    Figure CN112991317B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for detecting a camera module, a method for training a model, and an apparatus, which are applied to the field of detection. An image to be measured captured by the camera module to be measured is obtained; the image to be measured is preprocessed to obtain a target image; the target image is detected by a stray light detection model to obtain a detection result of the target image; and the stray light processing performance of the camera module to be measured is determined based on the detection result. By means of the present invention, the test efficiency and accuracy of detecting the camera module are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of detection, and particularly relates to a detection method for a camera module, a model training method and a device thereof. Background Art

[0002] When a camera module forms a real image of an object, in addition to imaging light, there are other non-imaging lights diffusing on the image plane of the optical system. For example, when photographing a light source or a strong light object, a complete shadow of the object appears at the edge. This is because the light is refracted and reflected due to the lens material, and it will be more obvious when the distance between the lens surface and the protective lens is large, that is, the flare phenomenon. Therefore, it is necessary to detect the flare processing performance of the camera module before leaving the factory.

[0003] Currently, the flare processing performance of camera modules is basically detected visually. The flare phenomenon changes with the intensity of the light source brightness, the relative attitude between the light source and the camera module, and is also affected by the interference of external natural light and the subjectivity of the detection personnel. Therefore, there will be certain misjudgments when detecting the flare of the camera module, and the misjudgment rate is uncontrollable, and the test efficiency is very low. Summary of the Invention

[0004] In view of the technical problems in the prior art that there will be certain misjudgments when detecting the flare of the camera module, the misjudgment rate is uncontrollable, and the test efficiency is very low, the embodiments of the present invention provide a detection method for a camera module, a model training method and a device thereof.

[0005] In a first aspect, an embodiment of the present invention provides a detection method for a camera module, including:

[0006] Obtaining a to-be-detected image captured by a to-be-detected camera module;

[0007] Preprocessing the to-be-detected image to obtain a target image;

[0008] Detecting the target image through a flare detection model to obtain a detection result of the target image;

[0009] Determining the flare processing performance of the to-be-detected camera module based on the detection result.

[0010] Optionally, the flare detection model is obtained through pre-training, wherein the pre-training includes:

[0011] Collecting a flare test picture set, where the flare test picture set includes flare test pictures that have passed the flare test and flare test pictures that have not passed the flare test;

[0012] Preprocessing the flare test pictures in the flare test picture set to obtain a training sample set and a test sample set;

[0013] Train the target neural network using the training sample set, and determine the actual prediction accuracy of the trained target neural network using the test sample set. When the actual prediction accuracy of the target neural network reaches the expected prediction accuracy, obtain the stray light detection model.

[0014] Optionally, the preprocessing of the stray light test images in the stray light test image set to obtain a training sample set and a test sample set includes:

[0015] Perform image preprocessing on the stray light test images in the stray light test image set to obtain a sample image set;

[0016] Mark test labels for each sample image in the sample image set;

[0017] Divide the sample image set and the corresponding test labels according to a preset ratio to obtain the training sample set and the test sample set.

[0018] Optionally, the image preprocessing of the stray light test images in the stray light test image set includes:

[0019] Convert the stray light test image into a first grayscale image;

[0020] Perform noise reduction processing and adaptive thresholding on the first grayscale image to obtain the sample image corresponding to the first grayscale image. Among them, the noise reduction processing of the first grayscale image includes Gaussian filtering before the adaptive thresholding and / or opening operation after the adaptive thresholding.

[0021] Optionally, after performing noise reduction processing and adaptive thresholding on the first grayscale image, it further includes:

[0022] Shrink the first grayscale image after the noise reduction processing and adaptive thresholding according to a preset shrinking ratio to obtain the sample image corresponding to the first grayscale image.

[0023] Optionally, the preprocessing of the image to be measured to generate a target image includes:

[0024] Convert the image to be measured into a second grayscale image;

[0025] Perform noise reduction processing and adaptive thresholding on the second grayscale image to obtain the target image.

[0026] Optionally, the noise reduction processing of the second grayscale image includes:

[0027] Gaussian filtering processing before the adaptive threshold processing, and / or

[0028] Opening operation processing after the adaptive threshold processing.

[0029] Optionally, before detecting the target image through the stray light detection model, it further includes:

[0030] Reducing the length and width of the target image according to a preset reduction ratio.

[0031] In a second aspect, an embodiment of the present invention provides a camera module detection device, including:

[0032] An acquisition unit for acquiring a to-be-tested image captured by a to-be-tested camera module;

[0033] A preprocessing unit for preprocessing the to-be-tested image to obtain a target image;

[0034] A stray light detection unit for detecting the target image through a stray light detection model to obtain a detection result of the target image;

[0035] A performance determination unit for determining the stray light processing performance of the to-be-tested camera module based on the detection result.

[0036] In a third aspect, an embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements the steps of any method in the first aspect.

[0037] One or more technical solutions provided by the embodiments of the present invention at least achieve the following technical effects or advantages:

[0038] By acquiring a to-be-tested image captured by a to-be-tested camera module; preprocessing the to-be-tested image to obtain a target image; detecting the target image through a stray light detection model to obtain a detection result of the target image; and determining the stray light processing performance of the to-be-tested camera module based on the detection result. The trained stray light detection model is used to automatically detect the stray light of the to-be-tested image captured by the to-be-tested camera module, thereby automatically judging the stray light processing performance of the to-be-tested camera module, and no longer requiring manual visual inspection, thus improving the test efficiency and accuracy. Description of the Drawings

[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can also be obtained based on the provided drawings.

[0040] Figure 1 It is a flowchart of the camera module detection method in the embodiment of the present invention;

[0041] Figure 2 It shows a schematic structural diagram of the target neural network in the embodiment of the present invention;

[0042] Figure 3 It is a flowchart of pre-training the stray light detection model in the embodiment of the present invention;

[0043] Figure 4 It is a functional module diagram of the camera module detection device in the embodiment of the present invention;

[0044] Figure 5 It is a schematic structural diagram of the electronic device in the embodiment of the present invention. Specific embodiments

[0045] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.

[0046] In a first aspect, the embodiments of the present invention provide a camera module detection method for detecting the stray light processing performance of a camera module when photographing objects such as a light source or a strong light object. Specifically, it can be used to detect any kind of camera module, such as: a mobile phone camera, a vehicle-mounted camera, a security camera, etc.

[0047] Refer to Figure 1 As shown, the camera module detection method provided by the embodiments of the present invention includes the following steps:

[0048] First, execute step S101: Obtain a to-be-tested image captured by the to-be-tested camera module.

[0049] To detect the stray light processing performance of the camera module, the image to be tested is a bright light picture taken by the camera module to be tested. Specifically, the bright light picture is a picture taken by the camera module to be tested facing a light source or a strong light object, and one or more bright light pictures are required. Of course, to improve the accuracy, multiple images to be tested can be obtained; and to improve the detection efficiency, only one image to be tested can be obtained.

[0050] S102. Preprocess the obtained image to be tested to obtain a target image.

[0051] To detect the stray light processing performance of the camera module to be tested, preprocessing the image to be tested taken by the camera module to be tested is at least to remove the noise points on the image to be tested that affect the detection of stray light.

[0052] Specifically, preprocessing the image to be tested includes: converting the image to be tested into a second grayscale image; performing noise reduction processing and adaptive thresholding processing on the converted second grayscale image. Among them, in order to fully remove the noise points that affect the detection of stray light, the noise reduction processing of the second grayscale image includes Gaussian filtering processing before the adaptive threshold processing and / or opening operation processing after the adaptive threshold processing. Gaussian filtering processing is to perform linear smoothing on the second grayscale image to remove the details of the second grayscale image, thereby eliminating the noise on the second grayscale image. The opening operation processing after the adaptive threshold processing is to eliminate the small white dots on the second grayscale image, thereby removing small interference blocks. Of course, in specific implementation, only the opening operation processing or Gaussian filtering processing can also be used to perform noise reduction processing on the second grayscale image.

[0053] Since the second grayscale image formed after the conversion of the image to be tested has a large difference in brightness and darkness, in the embodiment of the present invention, through the adaptive threshold processing, a variable threshold is used to perform threshold processing on the image, thereby retaining more brightness and darkness detail information, avoiding the stray light area being erased, thereby obtaining a second grayscale image with better effect, and thus ensuring the reliability of the subsequent stray light detection model for detection.

[0054] In an optional implementation manner, in order to reduce the processing complexity of the stray light detection model, both the length and width of the target image are reduced according to a preset reduction ratio. In order to balance the processing complexity and accuracy of the stray light detection model, both the length and width of the target image are reduced by half, thereby retaining the stray light area on the image and reducing the processing complexity of the model to a certain extent.

[0055] S103. Detect the target image through the stray light detection model to obtain the detection result of the target image.

[0056] The detection result of the target image can represent the binary classification result of whether the target image passes or fails the stray light test, or it can directly be the detection score, thus representing the numerical value of the stray light processing performance of the camera module to be tested.

[0057] Specifically, the stray light detection model in the embodiments of the present invention is trained through deep learning using a target neural network, and the target neural network is constructed by a convolutional neural network and a fully connected neural network. Among them, the target neural network includes an input layer, multiple convolutional layers and multiple pooling layers arranged crosswise, and a fully connected neural network. The last layer of the fully connected neural network is connected to the output layer. The target image is input through the input layer, the convolutional layer is used to extract the hidden layer features of the target image, and the pooling layer is used to reduce the extracted hidden layer features, thereby reducing the training time. The fully connected neural network is used to perform classification prediction based on the finally extracted hidden layer features.

[0058] Reference Figure 2 For example, the target neural network includes three convolutional layers and two pooling layers arranged crosswise, and the last convolutional layer is connected to the fully connected neural network. The target image is input into the target neural network, and the hidden layer features of the target image are extracted through three convolutional layers and two pooling layers arranged crosswise. Then, the fully connected neural network uses the extracted hidden layer features to perform binary classification prediction to obtain the binary classification result of the target image. The output layer connected to the back of the fully connected neural network is a softmax layer, and the softmax layer is used to normalize the binary classification result to obtain the normalization result.

[0059] Specifically, the normalization result includes the probability value that there is stray light in the image to be tested and the probability value that there is no stray light. Both probability values are decimals between (0, 1), and the sum of the two probability values is 1. For example, in the normalization result: if the probability value of having stray light is 0.95, then the probability value of not having stray light is 0.05. A stray light detection specification is preset, that is, the classification confidence, to discriminate the normalization result. The value of the stray light detection specification can be set according to actual needs. For example, the stray light detection specification is set as follows: for the stray light detection model to determine that the image to be tested passes the stray light test, it is required that the probability of having stray light is less than 0.1; for the stray light detection model to determine that the image to be tested fails the stray light test, it is required that the probability of having stray light is greater than 0.9. If the probability of having stray light and the probability of not having stray light in the normalization result are both between 0.1 and 0.9, it means that the stray light detection model cannot distinguish whether there is stray light in the image to be tested, that is, the normalization result does not meet the stray light detection specification.

[0060] If the normalization result meets the stray light detection specification, round the normalization result to obtain the detection result for the image to be tested. If the normalization result does not meet the stray light detection specification, use the image to be tested to optimize the stray light detection model until the optimized stray light detection model can detect the image to be tested and obtain the detection result indicating whether the image to be tested passes the stray light test.

[0061] The stray light detection model used in step S103 is obtained through pre-training. Specifically, the stray light detection model is obtained by pre-training a target neural network. Refer to Figure 3 As shown, the pre-training process includes the following steps S301 to S304:

[0062] S301. Collect a set of stray light test pictures.

[0063] Specifically, the set of stray light test pictures includes stray light test pictures that pass the stray light test and stray light test pictures that do not pass the stray light test. For example, the set of stray light test pictures includes: stray light test pictures obtained by using a camera module to photograph a light source or a strong light object. Among these stray light test pictures in the set of stray light test pictures, at least the following differences exist between any two different stray light test pictures: the relative pose between the camera module and the photographed object is different, the intensity of the light source is different, the camera module used for photographing is different, and so on.

[0064] In the embodiment of the present invention, whether the stray light test pictures in the set of stray light test pictures pass the stray light test is determined through visual inspection.

[0065] Step S302. Preprocess the stray light test pictures in the set of stray light test pictures to obtain a training sample set and a test sample set.

[0066] For example, if the set of collected stray light test pictures contains 100,000 stray light test pictures, preprocess these 100,000 stray light test pictures respectively to obtain 100,000 corresponding sample pictures, that is, a training sample set and a test sample set are obtained.

[0067] Specifically, in step S302, perform image preprocessing on the stray light test pictures in the set of stray light test pictures to obtain a set of sample pictures; mark test labels for each sample picture in the set of sample pictures; divide the set of sample pictures and the corresponding test labels according to a preset ratio to obtain a training sample set and a test sample set.

[0068] The number of samples in the training sample set is greater than the number of samples in the test sample set. For example, for the set of 100,000 sample pictures mentioned above, divide 90,000 sample pictures and the corresponding test labels into the training sample set, and divide the remaining 10,000 sample pictures and the corresponding test labels into the test sample set.

[0069] In specific implementation, the image preprocessing for each stray light test image in the stray light test image set is as follows: converting the stray light test image into a first grayscale image; performing noise reduction processing and adaptive thresholding processing on the first grayscale image to obtain a sample image corresponding to the first grayscale image, wherein the noise reduction processing of the first grayscale image includes Gaussian filtering processing before the adaptive threshold processing and / or opening operation processing after the adaptive threshold processing. Each sample image is also encoded to facilitate storing the sample images one by one in the first specified folder in the encoding order.

[0070] To reduce the complexity of model training, after performing noise reduction processing and adaptive thresholding processing on the first grayscale image obtained by converting the stray light test image, the first grayscale image after the noise reduction processing and adaptive thresholding processing is scaled down according to a preset scaling ratio. In specific implementation, to balance the complexity and accuracy of the training model, the length and width of the target image are each reduced by half, thereby not only retaining the stray light area on the stray light test image but also reducing the complexity of model training to a certain extent.

[0071] Specifically, the test label corresponding to each sample image represents the stray light test result of the corresponding stray light test image. For example, the test label of a stray light test image that passes the stray light test is marked as "0", and the test label of a stray light test image that fails the stray light test is "1".

[0072] According to the storage order of the sample images in the first specified folder in the sample image set, the corresponding test labels are stored in the second specified file, so that the storage of the sample images in the first specified folder and the storage of the test labels in the second specified folder are in sequential correspondence. For example: if the storage order of a certain sample image in the first specified file is the 10th, then the test label of this sample image is the 10th in the second specified folder.

[0073] S303. Use the training sample set to train the target neural network, and use the test sample set to determine the actual prediction accuracy of the trained target neural network; until the actual prediction accuracy of the target neural network reaches the expected prediction accuracy, obtain the stray light detection model.

[0074] Specifically, in step S303, the target neural network is trained for multiple rounds using the training sample set. During this round of training, the training samples are randomly divided into multiple batches of training samples and a verification set. Multiple batches of training samples and a verification set are divided in an even manner. For example, the training sample set can be randomly divided into 10 batches of training samples with equal sample numbers, and 9 batches of training samples are used to train the target neural network using a permutation and combination method, and the remaining 1 batch of training samples is used to detect whether the training accuracy of the target neural network reaches the preset training accuracy. For example, the 10 batches of training samples are numbered as batches 0 to 9 of training samples in sequence, and the target neural network is trained using batches 0 to 8 of training samples using a permutation and combination method, and the remaining 9th batch of training samples is used to detect whether the training accuracy of the current round of training of the target neural network reaches the preset training accuracy.

[0075] Of course, in specific implementation, the training of the target neural network is not limited to being divided into 10 batches of training samples, and the batches for dividing the training sample set can be determined according to actual needs.

[0076] The target neural network used in this embodiment is constructed by a convolutional neural network and a fully connected neural network. Please refer to the description in the previous camera module detection method embodiment for details. For the sake of brevity of the specification, it will not be repeated here.

[0077] Specifically, to determine whether the training accuracy of the target neural network in this round of training reaches the preset training accuracy, the target neural network is verified using a verification set to obtain the training accuracy of this round of training, and to determine whether the training accuracy reaches the preset training accuracy. After the training accuracy of this round of training reaches the preset training accuracy, the actual prediction accuracy of the trained target neural network is determined using a test sample set.

[0078] If the actual prediction accuracy reaches the expected prediction accuracy, the stray light detection model is obtained and saved; otherwise, the next round of training is continued: the target neural network is continuously trained using the training sample set.

[0079] The trained stray light detection model can be used to detect whether there is stray light in the images of light sources and strong light objects taken by the camera module, thereby detecting the stray light processing performance of the camera module.

[0080] In order to make the training process of the stray light detection model clearer, a more detailed description of the model training process in the embodiment of the present invention is given by way of example to facilitate understanding of the embodiment of the present invention:

[0081] Step 1: Preprocess each stray light test image in the collected set of stray light test images to obtain sample images containing a preset order of magnitude. Specifically, the preprocessing of each stray light test image is to convert the stray light test image into a corresponding first grayscale image, and then sequentially perform Gaussian filtering, adaptive thresholding, opening operation, and reducing the length and width to half, after which the corresponding sample image is obtained;

[0082] Step 3: Store the preset order of magnitude of sample images in sequence in the first specified folder to obtain a set of sample images;

[0083] Step 4: Mark test labels for each sample image respectively. Among them, the sample image with stray light is marked with a test label of 1, and the sample image without stray light is marked with a test label of 0. And according to the storage order of the sample images, each test label is correspondingly stored in the second specified folder.

[0084] Step 5: Divide the preset order of magnitude of sample images and the test label corresponding to each sample image into a training sample set and a test sample set according to a preset ratio.

[0085] Step 6: Randomly divide the training sample set into M batches of training samples equally, and in the way of permutation and combination, use M - 1 batches of training samples to train the target neural network;

[0086] Step 7: Use the remaining 1 batch of training samples as a verification set to detect whether the training of the target neural network reaches the preset training accuracy. If it reaches the preset training accuracy, execute Step 8; otherwise, return to continue executing Step 6;

[0087] Step 8: Use the test sample set to detect whether the prediction accuracy of the target neural network reaches the preset prediction accuracy. If it reaches the preset prediction accuracy, end the entire model training process and save the trained target neural network as a stray light detection model; otherwise, return to continue executing Steps 6 - 7.

[0088] S104: Determine the stray light processing performance of the camera module to be measured based on the detection result.

[0089] Specifically, the detection result of the target image is a detection score. According to the preset corresponding relationship between the detection score and the stray light processing performance, the stray light processing performance of the camera module to be measured can be determined. If the detection result of the target image is a binary classification result of passing or failing the stray light test; correspondingly, it is determined that the stray light processing performance of the camera module to be measured is passing or failing. The automatic detection of the stray light processing performance of the camera module to be measured is realized through the stray light detection model, improving the test efficiency.

[0090] In order to further improve the accuracy of the stray light detection model, after S104, it further includes optimizing the model parameters of the stray light detection model based on the detection result of detecting the target image by the stray light detection model, so as to continuously improve the detection accuracy of the stray light detection model and ultimately exceed the human recognition limit.

[0091] In a second aspect, based on the same inventive concept, an embodiment of the present invention provides a camera module detection device. Refer to Figure 4 As shown, the camera module detection device includes:

[0092] An acquisition unit 401, configured to acquire a to-be-tested image captured by a to-be-tested camera module;

[0093] A preprocessing unit 402, configured to preprocess the to-be-tested image to obtain a target image;

[0094] A stray light detection unit 403, configured to detect the target image through a stray light detection model to obtain a detection result of the target image;

[0095] A performance determination unit 404, configured to determine the stray light processing performance of the to-be-tested camera module based on the detection result.

[0096] In some embodiments, the camera module detection device further includes units for pre-training the stray light detection model:

[0097] A sample acquisition unit, configured to acquire a stray light test picture set, where the stray light test picture set includes stray light test pictures that pass the stray light test and stray light test pictures that do not pass the stray light test;

[0098] A sample processing unit, configured to preprocess the stray light test pictures in the stray light test picture set to obtain a training sample set and a test sample set;

[0099] A model training unit, configured to train a target neural network using the training sample set, and determine the actual prediction accuracy of the trained target neural network using the test sample set, until the actual prediction accuracy of the target neural network reaches the expected prediction accuracy, to obtain a stray light detection model.

[0100] In some embodiments, the sample processing unit includes:

[0101] An image preprocessing subunit, configured to perform image preprocessing on the stray light test pictures in the stray light test picture set to obtain a sample picture set;

[0102] A marking subunit, configured to mark test labels for each sample picture in the sample picture set;

[0103] Divide the sample image set and the corresponding test labels according to a preset ratio to obtain a training sample set and a test sample set.

[0104] In some embodiments, the image preprocessing subunit is specifically configured to:

[0105] Convert the stray light test image into a first grayscale image;

[0106] Perform noise reduction processing and adaptive thresholding processing on the first grayscale image to obtain a sample image corresponding to the first grayscale image, wherein the noise reduction processing of the first grayscale image includes Gaussian filtering processing before the adaptive thresholding processing and / or opening operation processing after the adaptive thresholding processing.

[0107] In some embodiments, the camera module detection device further includes:

[0108] A first reduction unit for reducing the first grayscale image after noise reduction processing and adaptive thresholding processing according to a preset reduction ratio to obtain a sample image corresponding to the first grayscale image.

[0109] In some embodiments, the preprocessing unit 402 is specifically configured to:

[0110] Convert the image to be measured into a second grayscale image;

[0111] Perform noise reduction processing and adaptive thresholding processing on the second grayscale image to obtain a target image.

[0112] In some embodiments, the preprocessing unit 402 is specifically configured to:

[0113] Gaussian filtering processing before the adaptive thresholding processing, and / or

[0114] Opening operation processing after the adaptive thresholding processing.

[0115] In some embodiments, the camera module detection device further includes:

[0116] A second reduction unit for reducing the length and width of the target image according to a preset reduction ratio.

[0117] The camera module detection device provided by the embodiments of the present invention is a device for implementing the camera module detection method embodiments described above. Therefore, the specific implementation details of this device can refer to the specific implementation content described in the camera module detection method embodiments above. For the sake of simplicity of the specification, it will not be repeated here.

[0118] In a third aspect, based on the same inventive concept as the foregoing method embodiments, the present invention further provides an electronic device. As Figure 5As shown, the electronic device includes a memory 504, a processor 502, and a computer program stored on the memory 504 and executable on the processor 502. When the processor 502 executes the program, it implements any one of the embodiments of the camera module detection method described above.

[0119] Among them, in Figure 5 the bus architecture (represented by bus 500), bus 500 may include any number of interconnected buses and bridges. Bus 500 links together various circuits including one or more processors represented by processor 502 and memory represented by memory 504. Bus 500 may also link together various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and thus will not be further described herein. Bus interface 505 provides an interface between bus 500 and receiver 501 and transmitter 503. Receiver 501 and transmitter 503 may be the same element, i.e., a transceiver, providing a unit for communicating with various other devices over a transmission medium. Processor 502 is responsible for managing bus 500 and general processing, while memory 504 may be used to store data used by processor 502 when performing operations.

[0120] In the embodiment of the present invention, a to-be-tested image captured by a to-be-tested camera module is obtained; the to-be-tested image is preprocessed to obtain a target image; the target image is detected by a stray light detection model to obtain a detection result of the target image; and the stray light processing performance of the to-be-tested camera module is determined based on the detection result. The trained stray light detection model is used to automatically detect the stray light of the to-be-tested image captured by the to-be-tested camera module, thereby automatically determining the stray light processing performance of the to-be-tested camera module, and there is no need for manual visual inspection, thus improving the test efficiency and accuracy.

[0121] Although the preferred embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concept. Therefore, the appended claims are intended to be construed to include the preferred embodiments as well as all changes and modifications falling within the scope of the present invention.

[0122] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention is also intended to include these changes and modifications.

Claims

1. A method for detecting a camera module, characterized in that, it includes: Obtaining a to-be-detected image captured by the to-be-detected camera module; Preprocessing the to-be-detected image to obtain a target image; Detecting the target image through a stray light detection model to obtain a detection result of the target image, wherein the stray light detection model is pre-trained through deep learning using a target neural network, and the target neural network is constructed by a convolutional neural network and a fully connected neural network, and the detection result represents a binary classification result or a detection score indicating whether the target image passes the stray light test; The pre-training of the stray light detection model includes: collecting a set of stray light test pictures, which includes stray light test pictures that pass the stray light test and stray light test pictures that do not pass the stray light test; preprocessing the stray light test pictures in the set of stray light test pictures to obtain a training sample set and a test sample set; using the training sample set to train the target neural network, and using the test sample set to determine the actual prediction accuracy of the trained target neural network. The set of stray light test pictures includes: stray light test pictures obtained by using a camera module to photograph a light source or a strong light object. Among the different two stray light test pictures in the set of stray light test pictures, there is at least one of the following differences: the relative pose between the camera module and the photographed object is different, the intensity of the light source is different, and the camera module used for photographing is different; Determining the stray light processing performance of the to-be-detected camera module based on the detection result, including: when the detection result of the target image is a detection score, determining the stray light processing performance of the to-be-detected camera module according to a preset corresponding relationship between the detection score and the stray light processing performance; Optimizing the model parameters of the stray light detection model through the detection result of the target image by the stray light detection model to improve the detection accuracy of the stray light detection model.

2. The method for detecting a camera module according to claim 1, characterized in that, The preprocessing of the stray light test pictures in the set of stray light test pictures to obtain a training sample set and a test sample set includes: Performing image preprocessing on the stray light test pictures in the set of stray light test pictures to obtain a set of sample pictures; Marking test labels for each sample picture in the set of sample pictures; Dividing the set of sample pictures and the corresponding test labels according to a preset ratio to obtain the training sample set and the test sample set.

3. The method for detecting a camera module according to claim 2, characterized in that, The image preprocessing of the stray light test pictures in the set of stray light test pictures includes: Converting the stray light test pictures into first grayscale images; Performing noise reduction processing and adaptive thresholding processing on the first grayscale images to obtain sample pictures corresponding to the first grayscale images, wherein the noise reduction processing of the first grayscale images includes Gaussian filtering processing before the adaptive thresholding processing and / or opening operation processing after the adaptive thresholding processing.

4. The method for detecting a camera module according to claim 3, characterized in that, After performing noise reduction processing and adaptive thresholding processing on the first grayscale image, the following steps are further included: For the first grayscale image after the noise reduction processing and adaptive thresholding processing, perform a reduction processing according to a preset reduction ratio to obtain a sample picture corresponding to the first grayscale image.

5. The camera module detection method according to any one of claims 1-4, characterized in that The preprocessing of the to-be-detected image to generate a target image includes: Convert the to-be-detected image into a second grayscale image; Perform noise reduction processing and adaptive thresholding processing on the second grayscale image to obtain the target image.

6. The camera module detection method according to claim 5, characterized in that The noise reduction processing of the second grayscale image includes: Gaussian filtering processing before the adaptive threshold processing, and / or Opening operation processing after the adaptive threshold processing.

7. The camera module detection method according to any one of claims 1-4, characterized in that Before detecting the target image through the stray light detection model, the following steps are further included: Reduce the length and width of the target image according to a preset reduction ratio.

8. A camera module detection device, characterized in that it includes: An acquisition unit for acquiring a to-be-detected image captured by a to-be-detected camera module; A preprocessing unit for preprocessing the to-be-detected image to obtain a target image; A stray light detection unit for detecting the target image through a stray light detection model to obtain a detection result of the target image, wherein the stray light detection model is pre-trained by deep learning using a target neural network, the target neural network is constructed by a convolutional neural network and a fully connected neural network, and the detection result represents a binary classification result or a detection score indicating whether the target image passes the stray light test; the pre-training of the stray light detection model includes: collecting a stray light test picture set, the stray light test picture set includes stray light test pictures that pass the stray light test and stray light test pictures that do not pass the stray light test; preprocessing the stray light test pictures in the stray light test picture set to obtain a training sample set and a test sample set; training the target neural network using the training sample set, and using the test sample set to determine the actual prediction accuracy of the trained target neural network, the stray light test picture set includes: stray light test pictures obtained by using a camera module to photograph a light source or a strong light object, and at least one of the following differences exists between two different stray light test pictures in the stray light test picture set: the relative pose between the camera module and the photographed object is different, the intensity of the light source is different, and the camera module used for photographing is different; A performance determination unit for determining the stray light processing performance of the camera module to be measured based on the detection result, including: when the detection result of the target image is a detection score, determining the stray light processing performance of the camera module to be measured according to a preset correspondence between the detection score and the stray light processing performance; and optimizing the model parameters of the stray light detection model through the detection result of the target image by the stray light detection model to improve the detection accuracy of the stray light detection model.

9. An electronic device, characterized in that it includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the program, it implements the steps of any one of the methods recited in claims 1-7.

Citation Information

Patent Citations

  • Stray light detection method, stray light detection device and stray light detection system for camera module

    CN109741307A

  • Image quality detection model training method and device and computer equipment

    CN112287965A

  • Method of removing stray light from a vehicle window in a camera arrangement, camera arrangement for using said method and computer programs

    EP3696722A1

  • Detecting visual artifacts in image sequences using a neural network model

    US20200050923A1