Object detection and model training method, apparatus, device, and storage medium
By combining a mixture of Gaussian models and a target detection model, the problem of high false detection rate in the existing technology for debris identification is solved, and accurate identification of different types of debris is achieved, which can meet the safety requirements of urban roads and highway scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 山西省交通科技研发有限公司
- Filing Date
- 2022-03-25
- Publication Date
- 2026-04-17
AI Technical Summary
Existing technologies are unable to effectively identify and distinguish different types of debris on roads, resulting in a high false detection rate and failing to meet the safety requirements of urban roads and highways.
A Gaussian mixture model group is used to process the pixels in the image to distinguish between stationary and moving categories. By combining the trained Gaussian mixture model group with the object detection model, the debris in the target area is identified.
It reduces the false detection rate of debris and improves the accuracy of object detection. It can identify a variety of different types of debris and adapt to the actual needs of urban roads and highway scenarios.
Smart Images

Figure CN114627423B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the technical fields of big data, computer vision, and deep learning in the field of image processing technology, and in particular to an object detection and model training method, apparatus, device, and storage medium. Background Technology
[0002] Spilled material refers to objects that fall off a vehicle while it is traveling on the road, such as boxes, apples, and sand.
[0003] In urban roads and highways, debris can significantly impact vehicle safety, increasing the probability of traffic accidents. It can also disrupt traffic flow and cause congestion. Therefore, a solution is needed to effectively detect debris on vehicle lanes. Summary of the Invention
[0004] This disclosure provides an object detection and model training method, apparatus, device, and storage medium.
[0005] According to a first aspect of this disclosure, an object detection method is provided, comprising:
[0006] Determine the first image to be detected;
[0007] Obtain a Gaussian mixture model group, wherein the Gaussian mixture model group includes multiple Gaussian mixture models corresponding to multiple pixels in the first image;
[0008] The pixels in the first image are processed according to the Gaussian mixture model group to obtain a second image corresponding to the first image. The pixel values of the pixels in the second image indicate the pixel category of the pixels in the first image. The pixel category is either a static category or a motion category.
[0009] A target region is determined in the first image based on the second image, the target region including the target object.
[0010] According to a second aspect of this disclosure, a method for training a Gaussian mixture model is provided, comprising:
[0011] Acquire a first video, which is a video captured from a preset area;
[0012] Obtain multiple video frames based on the first video;
[0013] The Gaussian mixture model group is trained based on the multi-frame video images to obtain the trained Gaussian mixture model group.
[0014] According to a third aspect of this disclosure, a method for training an object detection model is provided, comprising:
[0015] Obtain training samples, which include sample images and labeled images of the sample images;
[0016] The sample image is input into the target detection model to obtain the sample detection image output by the target detection model;
[0017] The parameters of the target detection model are updated based on the sample detection image and the labeled image.
[0018] According to a fourth aspect of this disclosure, an object detection apparatus is provided, comprising:
[0019] A determining unit is used to determine the first image to be detected;
[0020] An acquisition unit is used to acquire a Gaussian mixture model group, wherein the Gaussian mixture model group includes multiple Gaussian mixture models corresponding to multiple pixels in the first image;
[0021] The processing unit is configured to process the pixels in the first image according to the Gaussian mixture model group to obtain a second image corresponding to the first image. The pixel values of the pixels in the second image indicate the pixel category of the pixels in the first image, and the pixel category is either a static category or a motion category.
[0022] A detection unit is configured to determine a target region in the first image based on the second image, wherein the target region includes a target object.
[0023] According to a fifth aspect of this disclosure, a Gaussian mixture model training apparatus is provided, comprising:
[0024] The first acquisition unit is used to acquire a first video, wherein the first video is a video obtained by shooting a preset area;
[0025] The second acquisition unit is used to acquire multiple frames of video images based on the first video;
[0026] The training unit is used to train the Gaussian mixture model group based on the multi-frame video images to obtain the trained Gaussian mixture model group.
[0027] According to a sixth aspect of this disclosure, an apparatus for training an object detection model is provided, comprising:
[0028] An acquisition unit is used to acquire training samples, wherein the training samples include sample images and labeled images of the sample images;
[0029] The processing unit is used to input the sample image into the target detection model to obtain the sample detection image output by the target detection model;
[0030] The update unit is used to update the parameters of the target detection model based on the sample detection image and the labeled image.
[0031] According to a seventh aspect of this disclosure, an electronic device is provided, comprising:
[0032] At least one processor; and
[0033] A memory communicatively connected to the at least one processor; wherein,
[0034] The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the method described in any one of the first to third aspects.
[0035] According to an eighth aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause the computer to perform the method of any one of the first to third aspects.
[0036] According to a ninth aspect of this disclosure, a computer program product is provided, the computer program product comprising: a computer program stored in a readable storage medium, wherein at least one processor of an electronic device can read the computer program from the readable storage medium, and the at least one processor executes the computer program to cause the electronic device to perform the methods described in the first to third aspects.
[0037] The object detection and model training method, apparatus, device, and storage medium disclosed herein first determine a first image to be detected, then acquire a Gaussian mixture model group, which includes multiple Gaussian mixture models corresponding to multiple pixels in the first image. The pixels in the first image are processed according to the Gaussian mixture model group to obtain a second image corresponding to the first image. The pixel values of the pixels in the second image indicate the pixel category of the pixels in the first image, which can be either static or dynamic. After obtaining the second image, a target region, including the target object, can be determined in the first image based on the second image. Since the target object is usually a static object, the second image can be used to determine both static and dynamic objects in the first image. Therefore, when determining the target region based on the second image, the probability of misidentifying a dynamic object in the first image as the target object can be reduced, improving the accuracy of object detection and lowering the false detection rate.
[0038] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0039] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0040] Figure 1 This is a schematic diagram illustrating an application scenario provided by an embodiment of this disclosure;
[0041] Figure 2 A schematic flowchart of the object detection method provided in this embodiment of the disclosure;
[0042] Figure 3 A schematic flowchart illustrating the Gaussian mixture model training method provided in this embodiment of the disclosure;
[0043] Figure 4 This is a schematic diagram of the process for obtaining a second image provided in an embodiment of this disclosure;
[0044] Figure 5 This is a schematic diagram comparing the first image and the second image provided in an embodiment of the present disclosure;
[0045] Figure 6 A flowchart illustrating the target detection model training method provided in this embodiment of the disclosure;
[0046] Figure 7 A schematic diagram illustrating the acquisition of training samples provided in an embodiment of this disclosure;
[0047] Figure 8 This is a schematic diagram of target detection provided in an embodiment of the present disclosure;
[0048] Figure 9 This is a schematic diagram of the structure of the object detection device provided in the embodiments of this disclosure;
[0049] Figure 10 A schematic diagram of the structure of the Gaussian mixture model training device provided in the embodiments of this disclosure;
[0050] Figure 11 This is a schematic diagram of the structure of the target detection model training device provided in the embodiments of this disclosure;
[0051] Figure 12 A block diagram of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0052] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0053] Spilled material refers to objects that fall from vehicles while they are traveling on roads due to overloading or failure to comply with safe transportation requirements, such as boxes, apples, sand, etc. In urban roads and highways, spilled material can significantly impact vehicle safety and traffic flow. Therefore, timely detection of spilled material on roads is of great importance.
[0054] For example, it can be combined Figure 1 The application scenarios of this disclosure are introduced. Figure 1 This is a schematic diagram illustrating an application scenario provided by an embodiment of this disclosure, such as... Figure 1 As shown, vehicles, such as vehicle 11, vehicle 12, etc., are traveling on road 10. Vehicle 11 is carrying a large quantity of goods. Figure 1 In the example, a box 15 is dropped from vehicle 11 and becomes a piece of debris on road 10 after it falls onto road 10.
[0055] To detect debris on the road, a number of cameras or roadside units are typically installed. Figure 1 Taking cameras as an example, a first camera 13 and a second camera 14 are installed on road 10. The first camera 13 can capture a portion of the road 10, such as vehicle 11 and box 15, which are both within its field of view. The second camera 14 can capture another portion of the road 10, such as vehicle 12 and apple 16, which are both within its field of view. After capturing videos or images, the first camera 13 and the second camera 14 can send the captured videos or images to server 17. Server 17 uses the videos or images to detect debris on road 10.
[0056] In related technologies, object detection models are primarily used to detect debris in videos or images. For example, for debris such as boxes, a sample image and its labeled image can be obtained. The sample image includes the box, and the labeled image is the image obtained by annotating the box in the sample image. Then, the sample image is input into the object detection model, which outputs a detected image. Based on the difference between the detected image and the labeled image, the parameters of the object detection model are adjusted. After multiple rounds of training, the object detection model acquires the ability to detect objects such as boxes. Then, the video or images captured by the first camera 13 and the second camera 14 are input into the object detection model to obtain the corresponding detection results.
[0057] The above-described object detection model, trained for a specific type of object, can only identify that specific type of object. For example, an object detection model trained for litter such as boxes can only identify boxes in an image and cannot identify other types of objects, such as... Figure 1 The Apple 16 in the image is an object detection model that cannot recognize. In reality, the types and shapes of debris on roads vary greatly, and the aforementioned object detection model cannot identify all the different types and shapes of debris.
[0058] Furthermore, for some objects, they may be considered litter in some situations and not in others. Figure 1 Taking box 15 as an example, when box 15 is not dropped from vehicle 11, box 15 is not considered a piece of debris. Only after box 15 is dropped from vehicle 11 does it become a piece of debris. The aforementioned object detection model can only detect objects of a specific category. Using box 15 as an example, regardless of whether box 15 is on vehicle 11 or road 10, the object detection model will detect box 15 and treat it as a target object, which leads to a relatively high false detection rate.
[0059] Based on this, this disclosure provides an object detection method, apparatus, device, and storage medium to reduce the false detection rate of target objects and to achieve the identification of different types of target objects. The solution of this disclosure will be described below with reference to the accompanying drawings.
[0060] It should be noted that the execution subject in each embodiment of this disclosure can be a device with data processing capabilities, such as a server, processor, microprocessor, or chip. It can also include roadside equipment, terminal equipment, etc. The specific execution subject in each embodiment is not limited; it can be selected and set according to actual needs. Any device with data processing and data transmission / reception capabilities can serve as the execution subject in each embodiment of this disclosure. In the following embodiments, a server is used as the execution subject for description.
[0061] Figure 2 This is a flowchart illustrating the object detection method provided in the embodiments of this disclosure, as shown below. Figure 2 As shown, the method may include:
[0062] S21, Determine the first image to be detected.
[0063] The first image is the image to be detected, and the shooting area corresponding to the first image is the preset area to be detected. When it is necessary to detect the preset area, the first image can be acquired. For example, the preset area can be photographed using a camera to obtain the first image, and then the server acquires the first image from the camera. Alternatively, the preset area can be photographed using a camera to obtain a corresponding video, and then the server acquires the first image based on the captured video.
[0064] S22, Obtain a Gaussian mixture model group, which includes multiple Gaussian mixture models corresponding to multiple pixels in the first image.
[0065] The Gaussian mixture model group includes the Gaussian mixture model corresponding to each pixel in the first image, and each Gaussian mixture model includes one or more Gaussian models.
[0066] S23, the pixels in the first image are processed according to the Gaussian mixture model group to obtain the second image corresponding to the first image. The pixel value of the pixel in the second image indicates the pixel category of the pixel in the first image. The pixel category is either static or dynamic.
[0067] After obtaining the Gaussian mixture model group, the pixels in the first image can be processed according to the Gaussian mixture model to obtain the corresponding second image. The pixels in the second image correspond one-to-one with the pixels in the first image, and the pixel values of the pixels in the second image are determined according to the pixel values of the pixels in the first image and the corresponding Gaussian mixture model. This can indicate the category of the pixels in the first image, which is helpful for distinguishing between moving objects and stationary objects in the first image.
[0068] S24, determine the target region in the first image based on the second image, the target region including the target object.
[0069] The target object is the object that needs to be identified. The target object is usually stationary; for example, if the target object is debris on a road, the debris is typically stationary. The first image may contain multiple objects. By obtaining the pixel category of each pixel in the first image, the stationary and moving objects in the first image can be identified.
[0070] After obtaining the second image, since the pixel values of the pixels in the second image indicate the pixel category of the pixels in the first image, and this pixel category divides the pixels in the first image into pixels of stationary objects and pixels of moving objects, the stationary objects and moving objects in the first image can be determined based on the second image. In this embodiment of the disclosure, the target object is usually a stationary object; therefore, by using the pixel categories of the pixels in the first image, the possibility of detecting a moving object as the target object can be reduced.
[0071] After identifying stationary and moving objects in the first image, the first image is then processed to determine the target region. Since the target object is usually a stationary object, moving objects in the first image can be excluded. The target region, which includes the target object, is then determined from the stationary objects in the first image, thus achieving recognition of the first image.
[0072] The object detection method provided in this disclosure first determines a first image to be detected, then obtains a Gaussian mixture model group, which includes multiple Gaussian mixture models corresponding to multiple pixels in the first image. The pixels in the first image are processed according to the Gaussian mixture model group to obtain a second image corresponding to the first image. The pixel values of the pixels in the second image indicate the pixel category of the pixels in the first image, which can be either a stationary category or a moving category. After obtaining the second image, a target region can be determined in the first image based on the second image. This target region includes a target object. Since the target object is usually a stationary object, the second image can be used to determine both stationary and moving objects in the first image. Therefore, when determining the target region based on the second image, the probability of identifying a moving object in the first image as the target object can be reduced, improving the accuracy of object detection and lowering the false detection rate.
[0073] To help readers gain a deeper understanding of the implementation principles of this disclosure, the following will be discussed in conjunction with... Figures 3-8 right Figure 2 The illustrated embodiments are further refined.
[0074] In this embodiment, a Gaussian mixture model (Gaussian model group) is used to classify the pixels in the first image. Before classifying the pixels in the first image using the Gaussian mixture model group, the Gaussian mixture model group must first be trained. The following describes the process... Figure 3 The training process will be described.
[0075] Figure 3 This is a flowchart illustrating the Gaussian mixture model training method provided in this embodiment of the disclosure, as shown below. Figure 3 As shown, the method may include:
[0076] S31, acquire the first video, which is a video obtained by shooting a preset area.
[0077] The first video can be a video captured by a camera within a preset area, or a video captured by a roadside unit within the preset area. Taking a camera as an example, the camera remains stationary while capturing the video of the preset area. After capturing the first video, the camera can send it to the server.
[0078] S32, acquire multiple frames of video images based on the first video.
[0079] After acquiring the first video, the server can obtain multiple frames of video images based on the first video. For example, the first video can be sampled to obtain multiple frames of video images. The sampling frequency can be determined according to actual needs of the device, and this embodiment does not limit this.
[0080] S33, train the Gaussian mixture model group based on multiple frames of video images to obtain the trained Gaussian mixture model group.
[0081] After obtaining multiple frames of video images, a background modeling process can be performed based on these frames, i.e., training a Gaussian mixture model (GaJM) set. Specifically, a GaJM is first constructed, which includes at least one Gaussian model, for example, 3-5 Gaussian models. The number of Gaussian models included in the GaJM can be adjusted as needed, and this embodiment does not impose a particular limitation on this. After constructing the GaJM, it can be used as the Gaussian mixture model corresponding to each pixel in the video image, thereby obtaining a Gaussian mixture model set.
[0082] For any Gaussian mixture model in a Gaussian mixture model set, the Gaussian mixture model includes corresponding parameters, such as the mean and variance of each Gaussian model included in the Gaussian mixture model set. When constructing the Gaussian mixture model set, the parameters of each Gaussian mixture model can be initially set.
[0083] Then, based on the first video frame and the Gaussian mixture model group (Gaussian mixture model group) from the multi-frame video images, the Gaussian mixture model group corresponding to the first video frame is obtained. Specifically, after obtaining the first video frame, the pixel values of the pixels in the first video frame can be obtained, and the initialization parameters of the Gaussian mixture model group can be obtained based on the pixel values of the pixels in the first video frame. Optionally, the initialization parameters may include the mean of each Gaussian model. For any first pixel in the first video frame, the pixel value of the first pixel can be used as the mean of each Gaussian model in the Gaussian mixture model corresponding to the first pixel. After obtaining the initialization parameters of the Gaussian mixture model, the Gaussian mixture model group corresponding to the first video frame can be obtained based on these initialization parameters.
[0084] After obtaining the Gaussian mixture model group corresponding to the first frame of the video image, the first operation can be performed: based on the pixel values of the pixels in the i-th frame of the video image, the Gaussian mixture model group corresponding to the (i-1)-th frame of the video image is updated to obtain the Gaussian mixture model group corresponding to the i-th frame of the video image, and i is updated to i+1. Here, i is initially 2, and i is a positive integer.
[0085] Specifically, for the i-th frame of video image, the classification result of the pixels in the i-th frame of video image can be obtained based on the pixel value of the pixels in the i-th frame of video image and the Gaussian mixture model group corresponding to the (i-1)-th frame of video image. The classification result indicates whether the corresponding pixel belongs to the Gaussian distribution corresponding to the (i-1)-th frame of video image, or does not belong to the Gaussian distribution corresponding to the (i-1)-th frame of video image.
[0086] The Gaussian mixture model group corresponding to the (i-1)th frame of video image includes the Gaussian mixture model corresponding to each pixel in the (i-1)th frame of video image. Since the N frames of video images are sampled from the first video, the pixels in any two frames of video images are in one-to-one correspondence. N is the number of multiple frames of video images, and N is a positive integer.
[0087] For any first sample pixel in the i-th frame of the video image, the Gaussian mixture model corresponding to the second sample pixel can be determined from the Gaussian mixture model group corresponding to the (i-1)-th frame of the video image. The position of the first sample pixel in the i-th frame of the video image is the same as the position of the second sample pixel in the (i-1)-th frame of the video image.
[0088] After determining the Gaussian mixture model (GMM) corresponding to the second sample pixel, the value range can be determined based on the mean and variance of the multiple Gaussian models within that GMM. For example, if the GMM corresponding to the second sample pixel includes three Gaussian models, Gaussian model A, Gaussian model B, and Gaussian model C, each of these three models has its own mean and variance. Based on the mean and variance of these three Gaussian models, the value ranges corresponding to the three Gaussian models can be obtained. For instance, based on the mean and variance of Gaussian model A, the range within three times the variance of the mean can be determined as the value range of Gaussian model A. Similarly, the value range of Gaussian model B can be determined based on its mean and variance, and the value range of Gaussian model C can be determined based on its mean and variance. Then, the union of the value ranges corresponding to each Gaussian model is taken as the final value range, and it is determined whether the pixel value of the first sample pixel falls within this final value range.
[0089] When the pixel value of the first sample pixel falls within this range, it is determined that the first sample pixel belongs to the Gaussian distribution corresponding to the (i-1)th frame of the video image. At this time, the parameters of the Gaussian mixture model corresponding to the second sample pixel can be updated based on the pixel value of the first sample pixel to obtain the updated Gaussian mixture model.
[0090] When the pixel value of the first sample pixel is not within the specified range, it is determined that the first sample pixel does not belong to the Gaussian distribution corresponding to the (i-1)th frame of the video image. At this time, a new Gaussian model can be obtained based on the pixel value of the first sample pixel. Then, the new Gaussian model can be used to replace a certain Gaussian model in the Gaussian mixture model corresponding to the second sample pixel, resulting in an updated Gaussian mixture model.
[0091] For any pixel in the i-th frame of the video image, the Gaussian mixture model corresponding to that pixel can be updated using the method described above, resulting in an updated Gaussian mixture model. Based on the updated Gaussian mixture models corresponding to each pixel in the i-th frame of the video image, the Gaussian mixture model set corresponding to the i-th frame of the video image can be obtained.
[0092] In the above embodiment, the process of performing the first operation, obtaining the Gaussian mixture model group corresponding to the i-th video image based on the Gaussian mixture model group corresponding to the (i-1)-th video image, is described. When i is less than N, the first operation is repeated until i equals N, at which point the Gaussian mixture model group corresponding to the N-th video image is determined as the trained Gaussian mixture model group, where N is the number of video images and N is a positive integer greater than 1.
[0093] By training a Gaussian mixture model group using multiple frames of video images, the pixels in the first image can be processed based on the trained Gaussian mixture model group, thereby reducing the likelihood of moving objects in the first image being detected as target objects and lowering the false detection rate of target objects.
[0094] After the Gaussian mixture model group is trained, it has the ability to classify pixel categories. The pixels in the first image can be processed using the Gaussian mixture model group to obtain the second image. The following section combines... Figure 4 This process will be described.
[0095] Figure 4 A schematic diagram of the process for acquiring a second image provided in an embodiment of this disclosure includes:
[0096] S41, determine the pixel values of the pixels in the second image based on the pixel values of the pixels in the first image and the corresponding Gaussian mixture model of the pixels.
[0097] Gaussian mixture model group is based on Figure 3 The example method trains a set of Gaussian mixture models, which includes Gaussian mixture models corresponding to each pixel in the first image. Each Gaussian mixture model includes one or more Gaussian models. Optionally, the first image is a frame from a video image.
[0098] Specifically, for any first pixel in the first image, the first Gaussian mixture model corresponding to the first pixel can be determined from the Gaussian mixture model group. Then, based on the pixel value of the first pixel and the first Gaussian mixture model corresponding to the first pixel, the Gaussian distribution result of the first pixel is obtained. The Gaussian distribution result of the first pixel indicates whether the first pixel belongs to the Gaussian distribution of the first Gaussian mixture model, or whether it does not belong to the Gaussian distribution of the first Gaussian mixture model.
[0099] When the first pixel belongs to the Gaussian distribution of the first Gaussian mixture model, the pixel value of the corresponding second pixel is determined to be the first pixel value; when the first pixel does not belong to the Gaussian distribution of the first Gaussian mixture model, the pixel value of the corresponding second pixel is determined to be the second pixel value. The position of the second pixel in the second image is the same as the position of the first pixel in the first image. The first pixel value and the second pixel value are not equal.
[0100] S42, obtain the second image based on the pixel values of the pixels in the second image.
[0101] For any first pixel in the first image, the pixel value of the second pixel in the second image can be obtained based on the pixel value of the first pixel and the corresponding first Gaussian mixture model. The second image can then be obtained based on the pixel values of each pixel in the second image. In this embodiment, the pixels in the first image and the pixels in the second image are in one-to-one correspondence, and the pixel values of the pixels in the second image are used to indicate the pixel category of the corresponding pixel in the first image. For any first pixel in the first image, if the second pixel in the second image corresponds to the first pixel value, then the pixel category of the first pixel is determined to be static; if the second pixel in the second image corresponds to the second pixel value, then the pixel category of the first pixel is determined to be dynamic. Since the pixels in the second image correspond one-to-one with the pixels in the first image, and the pixel values of the pixels in the second image are determined based on the pixel values of the pixels in the first image and the corresponding Gaussian mixture model, they can indicate the category of the pixels in the first image, thereby facilitating the differentiation between dynamic and static objects in the first image.
[0102] Figure 5 This is a schematic diagram comparing the first image and the second image provided in an embodiment of this disclosure, such as... Figure 5 As shown, the first image 51 includes objects such as roads, vehicles, and boxes. After processing the pixels in the first image using a Gaussian mixture model group, the corresponding second image 52 is obtained.
[0103] The second image 52 includes objects with two types of pixel values: a stationary object corresponding to the first pixel value and a moving object corresponding to the second pixel value. Figure 5 In the example, the color corresponding to the first pixel value is white and the color corresponding to the second pixel value is black. It can be understood that the color corresponding to the first pixel value and the color corresponding to the second pixel value can be any color other than black and white, as long as the first pixel value and the second pixel value are not equal.
[0104] The pixel values of the pixels in the second image 52 are either the first pixel value or the second pixel value. For any first pixel in the first image 51, the second pixel is determined in the second image 52 based on the position of the first pixel in the first image 51. The pixel category of the first pixel can be determined based on the pixel value of the second pixel. The position of the second pixel in the second image 52 is the same as the position of the first pixel in the first image 51. For example, in... Figure 5 In the first pixel 53, the pixel value of the corresponding second pixel 54 is the first pixel value, so the pixel category of the first pixel 53 can be determined as the static category.
[0105] After obtaining the second image corresponding to the first image, the pixel category of the pixels in the first image can be determined based on the second image. Thus, the first image can be detected based on the pixel category of the pixels in the first image, and the target region can be determined in the first image.
[0106] In this embodiment of the disclosure, the first image can be detected using an object detection model. Before detecting the first image, the object detection model needs to be trained. The following section will first combine... Figure 6 The training process of the object detection model is introduced.
[0107] Figure 6 This is a flowchart illustrating the target detection model training method provided in the embodiments of this disclosure, as shown below. Figure 6 As shown, the method may include:
[0108] S61, Obtain training samples, which include sample images and labeled images of the sample images.
[0109] Before training the object detection model, multiple sets of training samples need to be obtained. Each set of training samples includes a sample image and a labeled image of that sample image. The sample image includes a sample object, which is the object to be detected. The labeled image is the image obtained by annotating the sample object in the sample image. For example, a rectangular bounding box can be marked on the sample object in the sample image to obtain the labeled image.
[0110] For sample images in multiple training samples, the types and shapes of the sample objects included in different sample images can vary. For example, some sample images may contain apples, some may contain boxes, and some may contain sand. Taking apples as an example, some sample images may contain whole apples, some may contain half apples, some may contain crushed apples, and so on.
[0111] S62, input the sample image into the target detection model to obtain the sample detection image output by the target detection model.
[0112] After obtaining multiple sets of training samples, for any set of training samples, the sample image can be input into the object detection model, which processes the sample image to obtain the sample detection image output by the object detection model. The sample detection image may include a sample detection box, which contains the sample object detected by the object detection model.
[0113] S63, update the parameters of the target detection model based on the sample detection image and the labeled image.
[0114] After obtaining the sample detection image, the sample detection image and the labeled image can be compared. Based on the differences between the sample detection image and the labeled image, the parameters of the target detection model can be updated.
[0115] For any set of training samples, the object detection model can be updated using steps S62-S63. After the model training termination condition is met, the trained object detection model is obtained. The model training termination condition may include, for example, reaching the maximum number of training iterations, the difference between the detected image and the labeled image being less than or equal to a preset value, etc.
[0116] In some embodiments, a large number of training samples can be obtained by fusing images from the original training set and images from an open-source image library. Multiple first sample images are images from the original training set, and multiple second sample images are images from the open-source image library. Each second sample image includes a sample object, and different second sample images include different sample images.
[0117] After acquiring multiple first sample images and multiple second sample images, a preset object in the first and second sample images can be fused to obtain a sample image, which includes at least one sample object. The following section combines... Figure 7 The process of obtaining training samples will be introduced.
[0118] Figure 7This is a schematic diagram illustrating the acquisition of training samples provided in an embodiment of this disclosure, as shown below. Figure 7 As shown, taking two first sample images (first sample image A and first sample image B) and two second sample images (second sample image C and second sample image D) as examples, the second sample image C includes an apple and the second sample image D includes a box.
[0119] Fusing the apples in the first sample image A and the second sample image C yields sample image E, which includes the background of the first sample image A and the apples in the second sample image C. Fusing the boxes in the first sample image A and the second sample image D yields sample image F, which includes the background of the first sample image A and the boxes in the second sample image D. Fusing the apples in the first sample image B and the second sample image C yields sample image G, which includes the background of the first sample image B and the apples in the second sample image C. Fusing the boxes in the first sample image B and the second sample image D yields sample image H, which includes the background of the first sample image B and the boxes in the second sample image D. Then, labeling the sample objects in each sample image yields the training samples.
[0120] The above method enables the acquisition of a large number of training samples from a limited original training set. These training samples include various types and shapes of objects, allowing the target detection model trained on these samples to detect a wide variety of objects. For example, in... Figure 7 In the example, the object detection model trained based on the above training samples can detect both apples and boxes, making the object detection model more flexible.
[0121] After the object detection model is trained, it has the ability to detect target objects in an image. At this point, the first image can be detected based on the object detection model.
[0122] Figure 8 This is a schematic diagram of target detection provided in an embodiment of the present disclosure, such as... Figure 8 As shown, after obtaining the target detection model, the first image 51 and the second image 52 can be input into the target detection model, and the first image 51 and the second image 52 can be processed by the target detection model.
[0123] Since the pixel values of the pixels in the second image 52 indicate the pixel category of the pixels in the first image 51, the objects in the first image 51 are divided into stationary objects and moving objects, thus enabling the filtering of most moving objects. The final object detection model outputs a detection image 80, which includes detection boxes (such as...). Figure 8(The dashed box in the image is a schematic diagram). The target area can be determined based on the detection box, and the target area includes the target object.
[0124] In summary, the solution provided in this disclosure, after training a Gaussian mixture model group using multiple frames of video images, classifies the pixels in the first image using the Gaussian mixture model group to obtain a second image. The pixel values of each pixel in the second image indicate the pixel category of each pixel in the first image, thereby distinguishing between stationary and moving objects in the first image, reducing the probability of detecting moving objects as target objects, and lowering the false detection rate of target objects. In subsequent object detection, by fusing the open-source second sample image and the first sample image, a large number of training samples can be quickly obtained. The training samples include sample objects of various types and shapes, enabling the object detection model to recognize objects of various types and shapes, broadening the applicable scenarios of the object detection model, and further improving the detection accuracy of the object detection model.
[0125] Figure 9 This is a schematic diagram of the structure of the object detection device provided in the embodiments of this disclosure, such as... Figure 9 As shown, the object detection device 90 includes:
[0126] Determining unit 91 is used to determine the first image to be detected;
[0127] Acquisition unit 92 is used to acquire a Gaussian mixture model group, wherein the Gaussian mixture model group includes multiple Gaussian mixture models corresponding to multiple pixels in the first image;
[0128] Processing unit 93 is used to process the pixels in the first image according to the Gaussian mixture model group to obtain a second image corresponding to the first image. The pixel value of the pixel in the second image indicates the pixel category of the pixel in the first image. The pixel category is either a static category or a motion category.
[0129] The detection unit 94 is used to determine a target region in the first image based on the second image, wherein the target region includes a target object.
[0130] In one possible implementation, the processing unit 93 includes:
[0131] The first processing module is used to determine the pixel value of the pixel in the second image based on the pixel value of the pixel in the first image and the Gaussian mixture model corresponding to the pixel.
[0132] The second processing module is used to obtain the second image based on the pixel values of the pixels in the second image.
[0133] In one possible implementation, the first processing module includes:
[0134] The first processing submodule is configured to, for any first pixel in the first image, obtain the Gaussian distribution result of the first pixel based on the pixel value of the first pixel and the first Gaussian mixture model corresponding to the first pixel, wherein the Gaussian distribution result indicates whether the first pixel belongs to the Gaussian distribution of the first Gaussian mixture model or does not belong to the Gaussian distribution of the first Gaussian mixture model.
[0135] The second processing submodule is used to determine the pixel value of the second pixel corresponding to the first pixel when the first pixel belongs to the Gaussian distribution of the first Gaussian mixture model, wherein the position of the second pixel in the second image is the same as the position of the first pixel in the first image;
[0136] The third processing submodule is used to determine the pixel value of the second pixel when the first pixel does not belong to the Gaussian distribution of the first Gaussian mixture model.
[0137] In one possible implementation, if the pixel value of the second pixel is the first pixel value, then the pixel category of the first pixel is the static category;
[0138] If the pixel value of the second pixel is the second pixel value, then the pixel category of the first pixel is the motion category.
[0139] In one possible implementation, the detection unit 94 includes:
[0140] The second acquisition module is used to acquire the target detection model;
[0141] The first detection module is used to input the first image and the second image into the target detection model to obtain a detection image output by the target detection model, wherein the detection image includes a detection box;
[0142] The second detection module is used to determine the target area based on the detection frame.
[0143] The object detection device provided in this embodiment is used to execute the above method embodiment. Its implementation principle and technical effect are similar, and will not be described again here.
[0144] Figure 10 This is a schematic diagram of the structure of the Gaussian mixture model training device provided in the embodiments of this disclosure, as shown below. Figure 10 As shown, the Gaussian mixture model training device 100 includes:
[0145] The first acquisition unit 101 is used to acquire a first video, wherein the first video is a video obtained by shooting a preset area;
[0146] The second acquisition unit 102 is used to acquire multiple frames of video images based on the first video;
[0147] Training unit 103 is used to train the Gaussian mixture model group based on the multi-frame video images to obtain the trained Gaussian mixture model group.
[0148] In one possible implementation, the training unit 103 includes:
[0149] The acquisition module is used to acquire the Gaussian mixture model group corresponding to the first frame video image based on the first frame video image in the multi-frame video images and the Gaussian mixture model group;
[0150] The processing module is used to perform a first operation, which includes: updating the Gaussian mixture model group corresponding to the (i-1)th frame video image according to the pixel value of the pixel point in the i-th frame video image, to obtain the Gaussian mixture model group corresponding to the i-th frame video image, and updating i to i+1; wherein i is initially 2 and i is a positive integer;
[0151] The training module is used to repeatedly execute the first operation when i is less than N, until i is equal to N, and then determine the Gaussian mixture model group corresponding to the Nth frame video image as the trained Gaussian mixture model group, where N is the number of the multiple frames of video images and N is a positive integer.
[0152] In one possible implementation, the acquisition module includes:
[0153] The first acquisition submodule is used to acquire the pixel values of the pixels in the first frame of the video image;
[0154] The second acquisition submodule is used to acquire the initialization parameters of the Gaussian mixture model group based on the pixel values of the pixels in the first frame video image;
[0155] The third acquisition submodule is used to acquire the Gaussian mixture model group corresponding to the first frame video image according to the initialization parameters.
[0156] In one possible implementation, the processing module includes:
[0157] The processing submodule is used to obtain the classification result of the pixel in the i-th frame video image based on the pixel value of the pixel in the i-th frame video image and the Gaussian mixture model group corresponding to the i-1-th frame video image. The classification result indicates that the corresponding pixel belongs to the Gaussian distribution corresponding to the i-1-th frame video image, or does not belong to the Gaussian distribution.
[0158] The update submodule is used to update the Gaussian mixture model group corresponding to the (i-1)th frame video image according to the classification result of the pixel points, so as to obtain the Gaussian mixture model group corresponding to the i-th frame video image.
[0159] In one possible implementation, the processing submodule is specifically used for:
[0160] For any first sample pixel in the i-th frame video image, a Gaussian mixture model corresponding to the second sample pixel is determined in the Gaussian mixture model group corresponding to the (i-1)-th frame video image. The Gaussian mixture model includes multiple Gaussian models. The position of the first sample pixel in the i-th frame video image is the same as the position of the second sample pixel in the (i-1)-th frame video image.
[0161] The range of values is determined based on the mean and variance of the multiple Gaussian models.
[0162] When the pixel value of the first sample pixel is within the range of the given values, it is determined that the first sample pixel belongs to the Gaussian distribution.
[0163] If the pixel value of the first sample pixel is not within the range of values, it is determined that the first sample pixel does not belong to the Gaussian distribution.
[0164] In one possible implementation, the update submodule is specifically used for:
[0165] For pixels belonging to the Gaussian distribution, the parameters of the Gaussian mixture model corresponding to the pixel are updated according to the pixel value of the pixel to obtain the updated Gaussian mixture model.
[0166] For pixels that do not belong to the Gaussian distribution, a new Gaussian model is obtained based on the pixel value of the pixel, and an updated Gaussian mixture model is obtained based on the new Gaussian model.
[0167] Based on the updated Gaussian mixture model corresponding to the pixels in the i-th video image, the Gaussian mixture model group corresponding to the i-th video image is obtained.
[0168] The Gaussian mixture model training device provided in this embodiment is used to execute the above method embodiment. Its implementation principle and technical effect are similar, and will not be described again here.
[0169] Figure 11 This is a schematic diagram of the structure of the target detection model training device provided in the embodiments of this disclosure, as shown below. Figure 11 As shown, the target detection model training device 110 includes:
[0170] The acquisition unit 111 is used to acquire training samples, wherein the training samples include sample images and labeled images of the sample images;
[0171] Processing unit 112 is used to input the sample image into the target detection model to obtain the sample detection image output by the target detection model;
[0172] The update unit 113 is used to update the parameters of the target detection model based on the sample detection image and the labeled image.
[0173] In one possible implementation, the acquisition unit 111 includes:
[0174] The acquisition module is used to acquire multiple first sample images and multiple second sample images, wherein any second sample image includes at least one sample object;
[0175] The processing module is used to perform fusion processing on preset objects in the first sample image and the second sample image to obtain the sample image, wherein the sample image includes the at least one sample object;
[0176] The annotation module is used to annotate the sample image to obtain the annotated image.
[0177] The target detection model training device provided in this embodiment is used to execute the above method embodiment. Its implementation principle and technical effect are similar, and will not be described again here.
[0178] This disclosure provides an object recognition and model training method, apparatus, device, and storage medium, which are applied in the fields of big data, computer vision, and deep learning in the field of image processing technology, in order to reduce the false detection rate of target objects.
[0179] It should be noted that the target detection model in this embodiment is not designed for a specific target and cannot reflect information about a particular target object. It should also be noted that the sample images in this embodiment are from a publicly available dataset.
[0180] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0181] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0182] According to embodiments of this disclosure, this disclosure also provides a computer program product comprising: a computer program stored in a readable storage medium, at least one processor of an electronic device being able to read the computer program from the readable storage medium, and the at least one processor executing the computer program causing the electronic device to perform the scheme provided in any of the above embodiments.
[0183] Figure 12 A schematic block diagram of an example electronic device 1200 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0184] like Figure 12 As shown, device 1200 includes a computing unit 1201, which can perform various appropriate actions and processes according to a computer program stored in read-only memory (ROM) 1202 or a computer program loaded from storage unit 1208 into random access memory (RAM) 1203. The RAM 1203 may also store various programs and data required for the operation of device 1200. The computing unit 1201, ROM 1202, and RAM 1203 are interconnected via bus 1204. Input / output (I / O) interface 1205 is also connected to bus 1204.
[0185] Multiple components in device 1200 are connected to I / O interface 1205, including: input unit 1206, such as keyboard, mouse, etc.; output unit 1207, such as various types of monitors, speakers, etc.; storage unit 1208, such as disk, optical disk, etc.; and communication unit 1209, such as network card, modem, wireless transceiver, etc. Communication unit 1209 allows device 1200 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0186] The computing unit 1201 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1201 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1201 performs the various methods and processes described above, such as object detection methods, Gaussian mixture model training methods, or object detection model training methods. For example, in some embodiments, the object detection method, Gaussian mixture model training method, or object detection model training method can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 1208. In some embodiments, part or all of the computer program can be loaded and / or installed on device 1200 via ROM 1202 and / or communication unit 1209. When the computer program is loaded into RAM 1203 and executed by computing unit 1201, one or more steps of the object detection method, Gaussian mixture model training method, or object detection model training method described above can be performed. Alternatively, in other embodiments, computing unit 1201 can be configured to perform the object detection method, Gaussian mixture model training method, or object detection model training method by any other suitable means (e.g., by means of firmware).
[0187] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0188] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0189] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0190] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0191] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0192] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem, addressing the shortcomings of traditional physical hosts and VPS (Virtual Private Server, or simply "VPS") services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.
[0193] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0194] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. An object detection method, comprising: Determine the first image to be detected; Obtain a Gaussian mixture model group, wherein the Gaussian mixture model group includes multiple Gaussian mixture models corresponding to multiple pixels in the first image; The pixels in the first image are processed according to the Gaussian mixture model group to obtain a second image corresponding to the first image. The pixel values of the pixels in the second image indicate the pixel category of the pixels in the first image. The pixel category is either a static category or a motion category. A target region is determined in the first image based on the second image, the target region including a target object; The training steps for the Gaussian mixture model are as follows: Acquire a first video, which is a video captured from a preset area; Obtain multiple video frames based on the first video; Based on the first video image in the multi-frame video images and the Gaussian mixture model group, obtain the Gaussian mixture model group corresponding to the first video image; Perform a first operation, the first operation including: obtaining a classification result of the pixel in the i-th frame video image based on the pixel value of the pixel in the i-th frame video image and the Gaussian mixture model group corresponding to the i-1-th frame video image, wherein the classification result indicates that the corresponding pixel belongs to the Gaussian distribution corresponding to the i-1-th frame video image, or does not belong to the Gaussian distribution. For pixels belonging to the Gaussian distribution, the parameters of the Gaussian mixture model corresponding to the pixel are updated according to the pixel value of the pixel to obtain the updated Gaussian mixture model. For pixels that do not belong to the Gaussian distribution, a new Gaussian model is obtained based on the pixel value of the pixel, and an updated Gaussian mixture model is obtained based on the new Gaussian model. Based on the updated Gaussian mixture model corresponding to the pixels in the i-th video image, obtain the Gaussian mixture model group corresponding to the i-th video image; and update i to i+1; where i is initially 2 and i is a positive integer; When i is less than N, the first operation is repeated until i equals N, and the Gaussian mixture model group corresponding to the Nth frame video image is determined as the trained Gaussian mixture model group, where N is the number of the multiple frames of video images and N is a positive integer.
2. The method of claim 1, wherein, The pixels in the first image are processed according to the Gaussian mixture model group to obtain a second image corresponding to the first image, including: The pixel values of the pixels in the second image are determined based on the pixel values of the pixels in the first image and the Gaussian mixture model corresponding to the pixels. The second image is obtained based on the pixel values of the pixels in the second image.
3. The method of claim 2, wherein, Determining the pixel values of pixels in the second image based on the pixel values of pixels in the first image and the corresponding Gaussian mixture model of the pixels includes: For any first pixel in the first image, the Gaussian distribution result of the first pixel is obtained based on the pixel value of the first pixel and the first Gaussian mixture model corresponding to the first pixel. The Gaussian distribution result indicates whether the first pixel belongs to the Gaussian distribution of the first Gaussian mixture model or does not belong to the Gaussian distribution of the first Gaussian mixture model. When the first pixel belongs to the Gaussian distribution of the first Gaussian mixture model, the pixel value of the second pixel corresponding to the first pixel is determined to be the first pixel value, wherein the position of the second pixel in the second image is the same as the position of the first pixel in the first image; When the first pixel does not belong to the Gaussian distribution of the first Gaussian mixture model, the pixel value of the second pixel is determined to be the second pixel value.
4. The method of claim 3, wherein, If the pixel value of the second pixel is the first pixel value, then the pixel category of the first pixel is the static category; If the pixel value of the second pixel is the second pixel value, then the pixel category of the first pixel is the motion category.
5. The method according to any one of claims 1-4, wherein, Determining the target region in the first image based on the second image includes: Obtain the object detection model; The first image and the second image are input into the target detection model to obtain a detection image output by the target detection model, wherein the detection image includes a detection box; The target region is determined based on the detection frame.
6. The method according to claim 5, wherein the target detection model is trained by the following method: Obtain training samples, which include sample images and labeled images of the sample images; The sample image is input into the target detection model to obtain the sample detection image output by the target detection model; The parameters of the target detection model are updated based on the sample detection image and the labeled image.
7. The method according to claim 6, wherein obtaining training samples comprises: Acquire multiple first sample images and multiple second sample images, wherein any second sample image includes at least one sample object; The sample image is obtained by fusing the preset objects in the first sample image and the second sample image, and the sample image includes the at least one sample object; The sample image is labeled to obtain the labeled image.
8. The method according to claim 1, wherein obtaining the Gaussian mixture model group corresponding to the first frame video image based on the first frame video image in the multi-frame video images and the Gaussian mixture model group, comprises: Obtain the pixel values of the pixels in the first frame of the video image; The initialization parameters of the Gaussian mixture model group are obtained based on the pixel values of the pixels in the first frame of the video image. Based on the initialization parameters, obtain the Gaussian mixture model group corresponding to the first frame video image.
9. The method of claim 1, wherein, For any first sample pixel in the i-th frame of the video image, based on the pixel value of the first sample pixel and the Gaussian mixture model group corresponding to the (i-1)-th frame of the video image, the classification result of the first sample pixel is obtained, including: In the Gaussian mixture model group corresponding to the (i-1)th frame video image, the Gaussian mixture model corresponding to the second sample pixel is determined. The Gaussian mixture model includes multiple Gaussian models. The position of the first sample pixel in the i-th frame video image is the same as the position of the second sample pixel in the (i-1)th frame video image. The range of values is determined based on the mean and variance of the multiple Gaussian models. When the pixel value of the first sample pixel is within the range of the given values, it is determined that the first sample pixel belongs to the Gaussian distribution. If the pixel value of the first sample pixel is not within the range of values, it is determined that the first sample pixel does not belong to the Gaussian distribution.
10. An object detection device, comprising: A determining unit is used to determine the first image to be detected; An acquisition unit is used to acquire a Gaussian mixture model group, wherein the Gaussian mixture model group includes multiple Gaussian mixture models corresponding to multiple pixels in the first image; The processing unit is configured to process the pixels in the first image according to the Gaussian mixture model group to obtain a second image corresponding to the first image. The pixel values of the pixels in the second image indicate the pixel category of the pixels in the first image, and the pixel category is either a static category or a motion category. A detection unit is configured to determine a target region in the first image based on the second image, wherein the target region includes a target object; The Gaussian mixture model is trained using a Gaussian mixture model training device, which includes: The first acquisition unit is used to acquire a first video, wherein the first video is a video obtained by shooting a preset area; The second acquisition unit is used to acquire multiple frames of video images based on the first video; The training unit is used to train the Gaussian mixture model group based on the multi-frame video images to obtain the trained Gaussian mixture model group. The training unit includes: The acquisition module is used to acquire the Gaussian mixture model group corresponding to the first frame video image based on the first frame video image in the multi-frame video images and the Gaussian mixture model group; The processing module is used to perform a first operation, which includes: updating the Gaussian mixture model group corresponding to the (i-1)th frame video image according to the pixel value of the pixel point in the i-th frame video image, to obtain the Gaussian mixture model group corresponding to the i-th frame video image, and updating i to i+1; wherein i is initially 2 and i is a positive integer; The training module is used to repeatedly execute the first operation when i is less than N, until i is equal to N, and then determine the Gaussian mixture model group corresponding to the Nth frame video image as the trained Gaussian mixture model group, where N is the number of the multiple frames of video images and N is a positive integer; The processing module includes: The processing submodule is used to obtain the classification result of the pixel in the i-th frame video image based on the pixel value of the pixel in the i-th frame video image and the Gaussian mixture model group corresponding to the i-1th frame video image. The classification result indicates that the corresponding pixel belongs to the Gaussian distribution corresponding to the i-1th frame video image, or does not belong to the Gaussian distribution. The update submodule is used to update the Gaussian mixture model group corresponding to the (i-1)th frame video image according to the classification result of the pixel points, so as to obtain the Gaussian mixture model group corresponding to the i-th frame video image. The update submodule is specifically used for: For pixels belonging to the Gaussian distribution, the parameters of the Gaussian mixture model corresponding to the pixel are updated according to the pixel value of the pixel to obtain the updated Gaussian mixture model. For pixels that do not belong to the Gaussian distribution, a new Gaussian model is obtained based on the pixel value of the pixel, and an updated Gaussian mixture model is obtained based on the new Gaussian model. Based on the updated Gaussian mixture model corresponding to the pixels in the i-th video image, the Gaussian mixture model group corresponding to the i-th video image is obtained.
11. The apparatus of claim 10, wherein, The processing unit includes: The first processing module is used to determine the pixel value of the pixel in the second image based on the pixel value of the pixel in the first image and the Gaussian mixture model corresponding to the pixel. The second processing module is used to obtain the second image based on the pixel values of the pixels in the second image.
12. The apparatus of claim 11, wherein, The first processing module includes: The first processing submodule is configured to, for any first pixel in the first image, obtain the Gaussian distribution result of the first pixel based on the pixel value of the first pixel and the first Gaussian mixture model corresponding to the first pixel, wherein the Gaussian distribution result indicates whether the first pixel belongs to the Gaussian distribution of the first Gaussian mixture model or does not belong to the Gaussian distribution of the first Gaussian mixture model. The second processing submodule is used to determine the pixel value of the second pixel corresponding to the first pixel when the first pixel belongs to the Gaussian distribution of the first Gaussian mixture model, wherein the position of the second pixel in the second image is the same as the position of the first pixel in the first image; The third processing submodule is used to determine the pixel value of the second pixel when the first pixel does not belong to the Gaussian distribution of the first Gaussian mixture model.
13. The apparatus of claim 12, wherein, If the pixel value of the second pixel is the first pixel value, then the pixel category of the first pixel is the static category; If the pixel value of the second pixel is the second pixel value, then the pixel category of the first pixel is the motion category.
14. The apparatus of any one of claims 11-13, wherein, The detection unit includes: The acquisition module is used to acquire the target detection model; The first detection module is used to input the first image and the second image into the target detection model to obtain a detection image output by the target detection model, wherein the detection image includes a detection box; The second detection module is used to determine the target area based on the detection frame.
15. The apparatus of claim 14, wherein the target detection model is trained by a target detection model training device, the target detection model training device comprising: An acquisition unit is used to acquire training samples, wherein the training samples include sample images and labeled images of the sample images; The processing unit is used to input the sample image into the target detection model to obtain the sample detection image output by the target detection model; The update unit is used to update the parameters of the target detection model based on the sample detection image and the labeled image.
16. The apparatus according to claim 15, wherein the acquiring unit comprises: The acquisition module is used to acquire multiple first sample images and multiple second sample images, wherein any second sample image includes at least one sample object; The processing module is used to perform fusion processing on preset objects in the first sample image and the second sample image to obtain the sample image, wherein the sample image includes the at least one sample object; The annotation module is used to annotate the sample image to obtain the annotated image.
17. The apparatus according to claim 10, wherein the acquisition module of the Gaussian mixture model training device comprises: The first acquisition submodule is used to acquire the pixel values of the pixels in the first frame of the video image; The second acquisition submodule is used to acquire the initialization parameters of the Gaussian mixture model group based on the pixel values of the pixels in the first frame video image; The third acquisition submodule is used to acquire the Gaussian mixture model group corresponding to the first frame video image according to the initialization parameters.
18. The apparatus of claim 10, wherein, The processing submodule is specifically used for: For any first sample pixel in the i-th frame video image, a Gaussian mixture model corresponding to the second sample pixel is determined in the Gaussian mixture model group corresponding to the (i-1)-th frame video image. The Gaussian mixture model includes multiple Gaussian models. The position of the first sample pixel in the i-th frame video image is the same as the position of the second sample pixel in the (i-1)-th frame video image. The range of values is determined based on the mean and variance of the multiple Gaussian models. When the pixel value of the first sample pixel is within the range of the given values, it is determined that the first sample pixel belongs to the Gaussian distribution. If the pixel value of the first sample pixel is not within the range of values, it is determined that the first sample pixel does not belong to the Gaussian distribution.
19. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-9.
20. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-9.
21. A computer program product comprising a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 1-9.
Citation Information
Patent Citations
Static target detection method based on two-background differencing
CN107204006A