Neural network training method, target detection method and device for target detection
By using the target pixel value distribution function in the neural network to transform the pixel value of the target image and generate differential output, the problem of the neural network sticking to target clusters during target detection is solved and the accuracy of target detection is improved.
Patent Information
- Application Number
- CN201910812656.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-08-30
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2039-08-30
AI Technical Summary
When the existing neural network detects targets, when the distance between two targets is too small, it is easy to cluster them into one target, resulting in reduced target detection accuracy.
By obtaining the pre-labeled target image, using the target pixel value distribution function to perform pixel value transformation, a second sample image is generated, and based on this training neural network, there are differences in target pixel values in the output target detection image, thereby facilitating target segmentation and clustering. category to improve detection accuracy.
Effectively segment adhering targets, reduce the possibility of clustering two target pixel points into the same target, and improve the accuracy of target detection.
Smart Images

Figure CN112446396B
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and more specifically, to a neural network training method, a target detection method and a device for target detection. Background Art
[0002] In order to provide the driver with driving strategies and track monitoring targets, it is usually necessary to use neural networks for target detection.
[0003] The current neural network for target detection can perform binary classification on each pixel in an image (for example, background pixels are set to black and target pixels are set to white), thereby outputting a target detection image in which the pixel values of the targets are the same.
[0004] However, when the distance between two targets in an image is too small, when the current neural network is used for target detection, the pixel values of the pixels in the area where the distance between the two targets is too small in the target detection image output by the neural network are the same as the pixel values of the targets. Subsequently, the two targets are easily clustered into one target, thereby reducing the accuracy of target detection. Summary of the invention
[0005] In order to solve the above technical problems, the present application is proposed. The embodiments of the present application provide a neural network training method, a target detection method, a device, a computer-readable storage medium and an electronic device for target detection. There are differences in the pixel values of the target in the target detection image output by the trained neural network, which facilitates the segmentation of the target, thereby improving the accuracy of clustering. Afterwards, when pixel clustering is performed on the target pixel point set in the target detection image output by the trained neural network, the possibility of clustering two target pixel point sets into the same target can be reduced, thereby improving the accuracy of target detection.
[0006] According to one aspect of the present application, a neural network training method for target detection is provided, comprising:
[0007] Acquire a first sample image, where the first sample image includes a pre-marked object;
[0008] According to the target pixel value distribution function, pixel value transformation is performed on the pre-marked target in the first sample image to determine the second sample image;
[0009] The first sample image is input into a neural network, and the neural network is trained based on the second sample image.
[0010] According to a second aspect of the present application, a target detection method is provided, comprising:
[0011] Inputting the image to be detected into the neural network trained by the method according to one aspect of the present application to obtain a first target detection image;
[0012] Perform pixel clustering on a set of target pixel points in the first target detection image according to a preset condition to determine a second target detection image.
[0013] According to a third aspect of the present application, a neural network training device for target detection is provided, comprising:
[0014] An acquisition module, configured to acquire a first sample image, wherein the first sample image includes a pre-marked object;
[0015] A transformation module, configured to transform the pixel values of the pre-annotated target in the first sample image according to the target pixel value distribution function to determine the second sample image;
[0016] A training module is used to input the first sample image into a neural network and train the neural network based on the second sample image.
[0017] According to a fourth aspect of the present application, a neural network training device for target detection is provided, comprising:
[0018] A detection module, used to input the image to be detected into the neural network trained by the device according to the third aspect of the present application to obtain a first target detection image;
[0019] The clustering module is used to perform pixel clustering on a set of target pixel points in the first target detection image according to a preset condition to determine a second target detection image of the frame image to be detected.
[0020] According to a fifth aspect of the present application, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and the computer program is used to execute the above method.
[0021] According to a sixth aspect of the present application, an electronic device is provided, the electronic device comprising:
[0022] processor;
[0023] a memory for storing instructions executable by the processor;
[0024] The processor is used to read the executable instructions from the memory and execute the instructions to implement the above method.
[0025] Compared with the prior art, the embodiments of the present application provide a neural network training method, a target detection method, a device, a computer-readable storage medium, and an electronic device for target detection, which have at least the following beneficial effects:
[0026] On the one hand, this embodiment takes a first sample image as input, and a second sample image obtained after pixel value conversion of the target in the sample image by a target pixel value distribution function as supervision, that is, the target is represented by the color corresponding to the pixel value of the target pixel value distribution function, and the neural network is trained to change the representation of the target in the image output by the neural network, thereby obtaining a neural network for target detection. The neural network can detect the target in the image and output a target detection image. There are differences in the pixel values of the targets in the target detection image, which facilitates the segmentation of the target and improves the accuracy of clustering.
[0027] On the other hand, by using the trained neural network to output the target detection image of the image to be detected and performing pixel clustering on the target pixel point set in the target detection image, the possibility of clustering two target pixel point sets into the same target can be reduced, thereby improving the accuracy of target detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] By describing the embodiments of the present application in more detail in conjunction with the accompanying drawings, the above and other purposes, features and advantages of the present application will become more apparent. The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation of the present application. In the accompanying drawings, the same reference numerals generally represent the same components or steps.
[0029] Figure 1 It is a flowchart of a neural network training method for target detection provided by an exemplary embodiment of the present application.
[0030] Figure 2 It is a schematic diagram of a second sample image in a neural network training method for target detection provided by an exemplary embodiment of the present application.
[0031] Figure 3 It is a flowchart of a target detection method provided by an exemplary embodiment of the present application.
[0032] Figure 4 It is a flowchart of step 302 in the target detection method provided by an exemplary embodiment of the present application.
[0033] Figure 5 It is a schematic diagram of a first target detection image and a second target detection image in a target detection method provided by an exemplary embodiment of the present application.
[0034] Figure 6 It is a flowchart of step 3022 in the target detection method provided by an exemplary embodiment of the present application.
[0035] Figure 7It is a structural schematic diagram of a neural network training device for target detection provided by an exemplary embodiment of the present application.
[0036] Figure 8 It is a schematic diagram of the structure of a target detection device provided by an exemplary embodiment of the present application.
[0037] Fig. 9 It is a structural schematic diagram of a target detection device provided by another exemplary embodiment of the present application.
[0038] Fig.10 It is a structural diagram of the second clustering unit 8022 in the target detection device provided by another exemplary embodiment of the present application.
[0039] Fig.11 It is a structural diagram of an electronic device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0040] Below, the exemplary embodiments according to the present application will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application, and it should be understood that the present application is not limited to the exemplary embodiments described here.
[0041] Application Overview
[0042] In order to find the target in the image, it is usually necessary to detect the target in the image. Since various objects have different appearances, shapes, and postures, and are interfered by factors such as illumination and occlusion during imaging, target detection has always been the most challenging problem in the field of machine vision. In the current target detection method, the target detection problem is usually converted into an image pixel classification problem using a neural network, that is, each pixel in an image is classified into two categories, background and target, through a neural network. A background pixel value is set for the pixel classified as background, and a target pixel value is set for the pixel classified as target. Then, the same target pixel values in the image after binary classification are clustered as targets, thereby achieving the purpose of target detection.
[0043] However, when multiple targets in the captured image are stuck together, a neural network is used to detect the image to determine the target detection image corresponding to the image. The pixel values of the pixels of several stuck targets in the obtained target detection image are the same, so that the several stuck targets are clustered into one target, which reduces the accuracy of target detection. That is, the current neural network uniformly processes the pixel values of the targets, making the pixel values of the targets the same, thereby increasing the difficulty of target segmentation and clustering.
[0044] The present embodiment fully takes into account the shortcomings of the above-mentioned neural network, and trains the neural network by taking the first sample image as input and the second sample image obtained after the target pixel value distribution function is used to convert the pixel value of the target in the sample image as supervision, thereby changing the representation of the target in the target detection image output by the neural network, and then obtaining a neural network for target detection. The neural network can detect the target in the image and output a target detection image. There are differences in the pixel values of the targets in the target detection image, which facilitates the segmentation of the target and improves the accuracy of clustering. When pixel clustering is subsequently performed on the target pixel point set in the target detection image output by the neural network for target detection, the possibility of clustering two target pixel point sets into the same target can be reduced, thereby improving the accuracy of target detection.
[0045] Exemplary Methods
[0046] Figure 1 It is a flowchart of a neural network training method for target detection provided by an exemplary embodiment of the present application.
[0047] This embodiment can be applied to electronic devices, and can be specifically applied to servers or general computers. Figure 1 As shown, a neural network training method for target detection provided by an exemplary embodiment of the present application includes at least the following steps:
[0048] Step 101: Acquire a first sample image, where the first sample image includes a pre-labeled object.
[0049] The first sample image is an RGB image that truly reflects the information of the target. The RGB image contains three channels, and the pixel value of the pixel point includes the values corresponding to the three channels. In order to detect the object of interest in the image, it is usually necessary to mark the object of interest in the first sample image. Here, the object of interest is the target. The target can be a vehicle, a pedestrian, or other physical object. Usually, the target is a movable object, such as a vehicle. The first sample image contains several annotated images. These images can be any images including targets, such as aerial images, images taken by a camera, etc. In order to ensure the quality of the image, the annotated targets in these images are complete and the image sizes are the same. Considering that too many first sample images will reduce the efficiency of training the neural network, and too few first sample images will affect the accuracy of the trained neural network, the data volume of the first sample image should be appropriate to quickly train the neural network and obtain a neural network with high accuracy for target detection. Considering that there is a large amount of information with no reference value or small reference value in the image, in order to further improve the operation efficiency, the pixel values of the information with no reference value or small reference value of the first image sample are unified to reduce the influence of the information with no reference value or small reference value on target detection. For example, taking the target as a vehicle and several images containing vehicles as an example, for each image, the vehicle and the road where the vehicle is located have greater reference value, while the reference value of vehicles and other objects in the area outside the road where the vehicle is located is smaller. Here, the pixel values of the area outside the road where the vehicle is located are uniformly processed, and the complete vehicle on the road where the vehicle is located is labeled, thereby obtaining the first image sample.
[0050] Step 102: Perform pixel value transformation on the pre-annotated target in the first sample image according to the target pixel value distribution function to determine a second sample image.
[0051] In order to obtain a target that is not prone to sticking, here, the pixel value of the target in the image is transformed to change the original pixel value of the target pixel point, so as to express the detected target in a simpler and clearer way. Pixel value transformation refers to the method of changing the pixel value of each pixel point in the source image point by point according to certain conditions and a certain transformation relationship.
[0052] In this embodiment, based on the target pixel value distribution function, the pixel value of the pre-marked target in the first sample image is transformed to determine the second sample image. Here, the pixel value in the target pixel value distribution function is the dependent variable, and the position of the pixel point in the target is the independent variable, thereby indicating the position of the pixel point in the target and the pixel value corresponding to the position. The pixel value of the pixel point of the target in the second sample image is within the pixel value range of the target pixel value distribution function, and the pixel value range refers to the value range of the pixel value in the target pixel value distribution function. Here, considering that the pixel value in the target pixel value distribution function is within a certain value range, the process of transforming the pixel value of the target in the first sample image using the target pixel value distribution function is actually a process of normalizing the pixel value.
[0053] In the prior art, the pixel values of the detected targets are usually processed uniformly, that is, the pixel values of the targets are the same. However, when the targets are stuck together, the processing of the uniform pixel values cannot reflect the pixel value differences of the targets, resulting in the clustering of several stuck targets into one target. The target edge is an important feature to distinguish different targets. The target edge refers to the edge of the target. In order to ensure that the target after the pixel value transformation can more accurately reflect the pixel value difference of the target, considering that the construction of the target pixel value distribution function needs to be based on the reference point, and the area between the target center and the target edge corresponds to the complete target, and the target center is the key point to determine the target position. The target center refers to the center of the target. Therefore, the target pixel value distribution function is determined based on the preset pixel value of the target center and the preset pixel value of the target edge, so that the original pixel value from the target center to the target edge is mapped to the target pixel value transformation function, so as to comprehensively transform the pixel values of several pixel points in the target. The preset pixel value of the target center refers to the pixel value of the pixel point of the target center that is preset. Considering that there are several pixels corresponding to the target edge, and there are several distance values from the pixel point at the target center to the pixel point at the target edge, in order to fully reflect the pixel value distribution of the target pixel points, the preset pixel value of the target edge refers to the preset pixel value of the pixel point at the target edge farthest from the target center. Here, the color corresponding to the pixel value is artificially set. For example, the color corresponding to the pixel value of 1 can be set to white, and the color corresponding to the pixel value of 0 can be set to black. The preset pixel value of the target edge and the preset pixel value of the target center are preset.
[0054] Considering that the target edge is an important feature to distinguish different targets, the essence of the target pixel value distribution function is to ensure that the area around the target edge in the target detection image output by the neural network is easy to segment from the target. The area around the target edge accounts for a relatively small proportion of the target area, so as to ensure that the area around the target edge does not affect the size and position of the target too much after segmentation. After that, it is easy to segment the target edge in the target detection image, which is conducive to segmenting the adhesion targets, thereby improving the accuracy of target detection. Here, the target pixel value distribution function determined based on the preset pixel value of the target center to the preset pixel value of the target edge includes but is not limited to a monotonic function or a piecewise function. The monotonic function indicates that the preset pixel value of the target center continuously decreases or continuously increases to the preset pixel value of the target edge. On the premise that the area around the target edge can be divided, the piecewise function can divide the target center to the target edge into different areas, and set the pixel value range for different areas. Here, the monotonic function and the piecewise function both use the Euclidean distance from the target center as the independent variable and the pixel value as the dependent variable, thereby ensuring that the preset pixel value of the target center is different from the preset pixel value of the target edge, so as to distinguish the target edge and the target center, increase the difference of the pixel value of the target, thereby facilitating the segmentation of the target, and thus improving the accuracy of clustering. Specifically, the preset pixel value of the target center is greater than the preset pixel value of the target edge. Obviously, the preset pixel value of the target edge can also be greater than the preset pixel value of the target edge.
[0055] It should be noted that, considering that RGB images will occupy a large amount of storage resources, the second sample image is usually selected as a grayscale image. Based on the target pixel value distribution function, the second sample image can be determined by performing a grayscale value transformation on the target pre-marked in the first sample image. For example, setting the pixel value to 1 represents white, the pixel value to 0 represents black, and the brightness of the pixel values between 0 and 1 gradually increases. In one possible implementation, the preset pixel value of the target edge is set to 0.2, the preset pixel value of the target center is set to 1, and the pixel value of the area outside the target is 0. Then the following can be obtained: Figure 2 In the second sample image shown, the target center is bright and the edge is dark, that is, the brightness gradually decreases from the target center to the target edge. Figure 2There is only one target shown, but there may be multiple targets in the second sample image in the actual scene. Obviously, the preset pixel value of the target edge may be set to 1, and the preset pixel value of the target center may be set to 0.2, so that the target center in the obtained second sample image is dark and the edge is bright. In another possible implementation, the target is divided into several areas, and different pixel values or pixel value ranges are set for different areas based on the monotonicity of the preset pixel value of the target center and the preset pixel value of the target edge or the divisibility of the area around the target edge. For example, the target may be divided into a central area, a middle area and an edge area, and different pixel values are set for the central area, the middle area and the edge area. At the same time, the preset pixel value of the target center is 1, and the preset pixel value of the target edge is 0.2. For example, the pixel value of the central area is set to 1, the pixel value of the middle area is set to 0.6, and the pixel value of the edge area is set to 0.2.
[0056] Step 103: input the first sample image into a neural network, and train the neural network based on the second sample image.
[0057] The first sample image is used as input and the second sample image is used as supervision to train a neural network so that the trained neural network can detect targets in the image and perform pixel value transformation on the detected targets, thereby achieving target detection.
[0058] The target detection in the image by the neural network in the prior art is a pixel classification problem, and the target detection in the image by the trained neural network in the embodiment of the present invention is a pixel regression problem, that is, the neural network can determine the probability distribution from the target center to the target edge corresponding to the pixel point in the image, and the value range of the independent variable in the probability distribution corresponds to the distance value between the target center and the target edge. Then, according to the target pixel value distribution function, based on the probability distribution from the target center to the target edge corresponding to the pixel point, the pixel value of the pixel point can be determined to achieve the pixel value transformation of the target.
[0059] The beneficial effect of the neural network training method for target detection provided by the present embodiment is at least that: pixel values of pre-annotated targets in a first sample image are transformed to determine a second sample image, the first sample image is used as input and the second sample image is used as a supervised training neural network, so that the trained neural network can transform the pixel values of the detected targets, thereby outputting a target detection image, and there are differences in the pixel values of the targets in the target detection image, which facilitates the segmentation of the targets, thereby improving the accuracy of clustering.
[0060] Figure 3 It is a flowchart of a target detection method provided by an exemplary embodiment of the present application.
[0061] This embodiment can be applied to electronic devices, and can be specifically applied to servers or general computers. Figure 3 As shown, an exemplary embodiment of the present application provides a target detection method including at least the following steps:
[0062] Step 301: Input the image to be detected into Figure 1 The neural network trained by the method described above obtains a first target detection image.
[0063] The image to be detected specifically refers to the image that needs to detect the target. The image to be detected is an unlabeled image. In order to detect the target in the image to be detected, the image to be detected can be input into Figure 1 In the neural network trained by the method, the neural network can determine the probability distribution of each pixel point in the image to be detected being located from the center of the target to the edge of the target, and determine the pixel value of the pixel point based on the target pixel value distribution function and the probability distribution, thereby obtaining a first target detection image. The first target detection image is as follows Figure 1 In the output graph of the neural network trained by the method, there are differences in the pixel values of the targets in the first target detection image, which facilitates the segmentation of the targets and further improves the accuracy of clustering.
[0064] It should be noted that the image to be detected should meet the following requirements: Figure 1 The input conditions of the neural network trained by the method described above are to ensure that the target in the image to be detected can be accurately detected. For example, if the target is a vehicle, and the vehicle and the area outside the road where the vehicle is located in the first sample image are set to black, the vehicle and the area outside the road where the vehicle is located in the image to be detected should also be black.
[0065] Step 302: Perform pixel clustering on a set of target pixel points in the first target detection image according to preset conditions to determine a second target detection image.
[0066] Due to traffic congestion on the road, the viewing angle of the camera image and the mutual occlusion between targets, it is easy to cause several targets in the captured image to be detected to be stuck together. Here, sticking refers to the connection between targets. When several targets in the first target detection image are stuck together, in order to prevent the stuck targets from being detected as one target, it is usually necessary to perform pixel clustering on the target pixel point set to segment the stuck targets, thereby determining the second target detection image. Here, pixel clustering refers to the process of dividing the target pixel point set into multiple categories. Therefore, the preset condition refers to the condition that the target pixel point should meet when the pixels are clustered into different categories. The first target detection image includes several target pixel point sets, each target pixel point set corresponds to one target, therefore, the target pixel point set includes several pixel points that constitute the target, and the pixel values of these pixel points are within the pixel value range of the target pixel value distribution function.
[0067] It should be noted that the second target detection image is an image obtained after pixel clustering of the first target detection image. For the same target, the area of the target in the second target detection image is smaller than the area of the target in the first target detection image, that is, the area from the center of the target to the edge of the target in the second target detection image is located within the area from the center of the target to the edge of the target in the first target detection image, thereby achieving the purpose of segmenting adhering targets. The embodiment of the present invention is applicable to scenes where the target is a vehicle, and can achieve the segmentation of adhering vehicles. Here, there is no limitation on the type and size of the vehicle. Of course, the embodiment of the present invention is also applicable to scenes where the target is other objects, for example, the target is an animal, and can achieve the segmentation of animals that occlude each other.
[0068] This embodiment is implemented by Figure 1 The neural network trained by the method described above obtains a target detection image of the image to be detected, and pixel clustering is performed on a set of target pixel points in the target detection image to segment the adhered targets, thereby reducing the possibility of clustering the adhered targets as the same target, so as to ensure the accuracy of the number of types of targets detected in the image to be detected, thereby improving the accuracy of target detection.
[0069] Figure 4 It shows that Figure 3 The embodiment shown is a schematic flow chart of the step of performing pixel clustering on the target pixel point set in the first target detection image according to preset conditions.
[0070] like Figure 4 As shown in the above Figure 3 Based on the illustrated embodiment, in an exemplary embodiment of the present application, the step of performing pixel clustering on the target pixel point set in the first target detection image according to preset conditions shown in step 302 may specifically include the following steps:
[0071] Step 3021: cluster the pixel points that meet preset conditions in the target pixel point set in the first target detection image into targets.
[0072] Here, the preset conditions indicate the conditions that must be met for clustered pixel points to be targeted. The preset conditions include that the pixel values of the target pixel points in the first target detection image are within a preset range. The preset range indicates the range in which the pixel values of the pixel points whose categories are clustered as targets are located.
[0073] In one possible implementation, the target segmentation position is determined in advance, and the pixel value corresponding to the target segmentation position on the target pixel value distribution function is determined as the target segmentation threshold. The pixels in the target pixel point set are divided according to the target segmentation threshold, and the divided pixels are classified to achieve pixel clustering. The target segmentation position indicates the segmentation point between the target center and the target edge. The segmentation point is usually close to the target edge, thereby ensuring that the size of the segmented target does not change too much. The target segmentation threshold refers to the minimum or maximum value of the pixel value clustered as the target. The pixel value range between the target segmentation threshold and the preset pixel value of the target center indicates the range of pixel values of the pixel points clustered as the target, that is, the pixel value range between the target segmentation threshold and the preset pixel value of the target center is the preset range. For example, the preset pixel value of the target center gradually decreases to the pixel value of the target edge. The preset pixel value of the target center is 1, the preset pixel value of the target edge is 0.2, and the pixel value of the area outside the target is 0. For two adherent targets, such as Figure 1 The output of the neural network trained by the method described is as follows Figure 5 In the first target detection image shown in FIG. 1 , the target segmentation threshold is sufficient to make the adhered targets segmentable. Therefore, the target segmentation threshold can be set to 0.4, which is slightly larger than the preset pixel value of the target edge. The preset range is 0.4 to 1, that is, the pixel points with pixel values between 0.4 and 1 in the target pixel point set are clustered as targets. Figure 5 After pixel clustering, the first target detection image shown in FIG. Figure 5 The second target detection image shown is used to achieve the segmentation of the adhesion target.
[0074] In this step, the pixel points that meet the preset conditions in the target pixel point set in the first target detection image are clustered as targets, specifically, the pixel points whose pixel values in the target pixel point set in the first target detection image are within a preset range are clustered as targets. It should be noted that the pixel values of the pixel points clustered as targets are usually not changed, but new pixel values can be reassigned.
[0075] Step 3022: cluster the pixel points in the target pixel point set in the first target detection image that do not meet the preset conditions as background.
[0076] Background refers to the area outside the target in the image. Here, the pixels in the target pixel set in the first target detection image that do not meet the preset conditions are clustered as background, so that the target pixel set is clustered into two categories, target and background, to segment the adhered targets, and then obtain the second target detection image. It is usually necessary to change the pixel values of the pixels clustered as background to distinguish different targets in image visualization.
[0077] This embodiment achieves segmentation of the adhered target by clustering the target pixel point set into the target and the background.
[0078] Figure 6 It shows that Figure 4 The illustrated embodiment is a flow chart of the step of clustering the pixel points in the target pixel point set in the first target detection image that do not meet the preset conditions as background.
[0079] like Figure 6 As shown in the above Figure 4 On the basis of the illustrated embodiment, in an exemplary embodiment of the present application, the step 3022 of clustering the pixel points in the target pixel point set in the first target detection image that do not meet the preset conditions as the background step may specifically include the following steps:
[0080] Step 30221, obtain background pixel value.
[0081] Background pixel values refer to the pixel values corresponding to the background pixels outside the target. Background pixel points refer to the pixel points in the area outside the target. Usually, the background pixel values in the target detection image will be processed uniformly, so that the target detection image only has the target and the background, so as to more clearly show the target in the image. Therefore, it is necessary to use the background pixel values to process the pixels clustered as the background. Specifically, it can be done as follows Figure 1 The neural network trained by the method described above detects background pixels in the image to be detected and unifies the pixel values of the background pixels, thereby making the pixel values corresponding to the background pixels in the first target detection image the same.
[0082] Step 30222: Replace the pixel value of the pixel point that does not meet the preset condition with the background pixel value.
[0083] By replacing the pixel values of the pixels that do not meet the preset conditions with the background pixel values, the pixels clustered as the background in the target pixel set are merged with the background to segment the target pixel set in the first target detection image, and the pixel points clustered as the target and the background are segmented in the image visualization method, that is, the segmentation of the adhered target is achieved. For example, Figure 5The background pixel value is 0, the target center pixel value is 1, and the target edge pixel value is 0.2. Figure 5 Based on the first target detection image shown in FIG. 1 , the pixel points with pixel values between 0.4 and 0.2 in the target pixel point set are replaced with the background pixel values to obtain Figure 5 The second target detection image is shown.
[0084] In this embodiment, the pixel values of the pixels that do not meet the preset conditions are replaced by the background pixel values, so that the pixel points clustered as the background in the target pixel point set are merged with the background, thereby achieving the segmentation of the adhered target.
[0085] Exemplary Devices
[0086] Based on the same concept as the method embodiment of the present application, the embodiment of the present application also provides a neural network training device for target detection.
[0087] Figure 7 A schematic structural diagram of a neural network training device for target detection provided by an exemplary embodiment of the present application is shown.
[0088] like Figure 7 As shown, a neural network training device for target detection provided by an exemplary embodiment of the present application includes:
[0089] An acquisition module 701 is used to acquire a first sample image, where the first sample image includes a pre-marked object;
[0090] A transformation module 702, configured to perform pixel value transformation on a pre-annotated target in the first sample image according to a target pixel value distribution function to determine a second sample image;
[0091] The training module 703 is used to input the first sample image into the neural network and train the neural network based on the second sample image.
[0092] Based on the same concept as the method embodiment of the present application, the embodiment of the present application also provides a target detection device.
[0093] Figure 8 A schematic diagram of the structure of a target detection device provided by an exemplary embodiment of the present application is shown.
[0094] like Figure 8 As shown, an exemplary embodiment of the present application provides a target detection device, comprising:
[0095] Detection module 801, used to input the image to be detected into Figure 5 The neural network trained by the device to obtain a first target detection image;
[0096] The clustering module 802 is used to perform pixel clustering on a set of target pixel points in the first target detection image according to a preset condition to determine a second target detection image of the frame image to be detected.
[0097] Fig. 9 It is a structural schematic diagram of a target detection device provided by another exemplary embodiment of the present application.
[0098] like Fig. 9 As shown, in another exemplary embodiment, the clustering module 802 includes:
[0099] A first clustering unit 8021 is used to cluster pixel points that meet a preset condition in a target pixel point set in the first target detection image into targets;
[0100] The second clustering unit 8022 is used to cluster the pixel points that do not meet the preset conditions in the target pixel point set in the first target detection image as background.
[0101] Fig.10 It is a structural diagram of the second clustering unit 8022 in the target detection device provided by another exemplary embodiment of the present application.
[0102] like Fig.10 As shown, in another exemplary embodiment, the second clustering unit 8022 includes:
[0103] The acquisition subunit 80221 is used to acquire background pixel values;
[0104] The replacement subunit 80222 is used to replace the pixel value of the pixel point that does not meet the preset condition with the background pixel value.
[0105] Exemplary Electronic Devices
[0106] Fig.11 A block diagram of an electronic device according to an embodiment of the present application is illustrated.
[0107] like Fig.11 As shown, the electronic device 110 includes one or more processors 111 and a memory 112 .
[0108] The processor 111 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 110 to perform desired functions.
[0109] The memory 112 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 111 may execute the program instructions to implement the neural network training method for target detection and the target detection method and / or other desired functions of the various embodiments of the present application described above.
[0110] In one example, the electronic device 110 may further include: an input device 113 and an output device 114 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).
[0111] Of course, to simplify, Fig.11 Only some of the components related to the present application in the electronic device 110 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device 110 may also include any other appropriate components.
[0112] Exemplary computer program products and computer-readable storage media
[0113] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps in the neural network training method for target detection and the target detection method according to various embodiments of the present application described in the above "Exemplary Method" section of this specification.
[0114] The computer program product may be written in any combination of one or more programming languages to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0115] In addition, an embodiment of the present application may also be a computer-readable storage medium having computer program instructions stored thereon, and when the computer program instructions are executed by a processor, the processor executes the steps in the neural network training method for target detection and the target detection method according to various embodiments of the present application described in the above “Exemplary Method” section of this specification.
[0116] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0117] The basic principles of the present application are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present application are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present application. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, not for limitation, and the above details do not limit the present application to being implemented by adopting the above specific details.
[0118] The block diagrams of the devices, apparatuses, equipment, and systems involved in this application are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagram. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including", "comprising", "having", etc. are open words, referring to "including but not limited to", and can be used interchangeably with them. The words "or" and "and" used here refer to the words "and / or" and can be used interchangeably with them, unless the context clearly indicates otherwise. The words "such as" used here refer to the phrase "such as but not limited to", and can be used interchangeably with them.
[0119] It should also be noted that in the apparatus, device and method of the present application, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present application.
[0120] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present application. Therefore, the present application is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
[0121] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present application to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.
Claims
1. A neural network training method for target detection, comprising: Acquire a first sample image, where the first sample image includes a pre-marked object; According to the target pixel value distribution function, pixel value transformation is performed on the pre-marked target in the first sample image to determine the second sample image; The target pixel value distribution function takes the position of the pixel point in the target as an independent variable and the pixel value corresponding to the position as a dependent variable; The target pixel value distribution function includes a monotonic function or a piecewise function; The first sample image is input into a neural network, and the second sample image is used as a supervisory training neural network, so that the trained neural network can detect targets in the image and perform pixel value transformation on the detected targets.
2. The method according to claim 1, wherein: The target pixel value distribution function is determined based on a preset pixel value at the center of the target and a preset pixel value at the edge of the target.
3. The method according to claim 2, wherein: The preset pixel value of the target edge is smaller than the preset pixel value of the target center.
4. A target detection method, comprising: Inputting the image to be detected into the neural network trained by the method according to any one of claims 1 to 3 to obtain a first target detection image; Perform pixel clustering on a set of target pixel points in the first target detection image according to a preset condition to determine a second target detection image.
5. The method according to claim 4, wherein: The performing pixel clustering on the target pixel point set in the first target detection image according to the preset condition comprises: Clustering pixel points that meet preset conditions in a target pixel point set in the first target detection image as targets; Pixel points in the target pixel point set in the first target detection image that do not meet a preset condition are clustered as background.
6. The method according to claim 5, wherein: The step of clustering the pixel points in the target pixel point set in the first target detection image that do not meet the preset condition as background comprises: Get the background pixel value; The background pixel value is used to replace the pixel value of the pixel point that does not meet the preset condition.
7. The method according to claim 6, wherein: The preset condition includes that the pixel value of the target pixel point in the first target detection image is within a preset range.
8. A neural network training device for target detection, comprising: An acquisition module, configured to acquire a first sample image, wherein the first sample image includes a pre-marked object; A transformation module, configured to transform the pixel values of the pre-annotated target in the first sample image according to the target pixel value distribution function to determine the second sample image; The target pixel value distribution function takes the position of the pixel point in the target as an independent variable and the pixel value corresponding to the position as a dependent variable; The target pixel value distribution function includes a monotonic function or a piecewise function; The training module is used to input the first sample image into the neural network, and use the second sample image as a supervisory training neural network, so that the trained neural network can detect targets in the image and perform pixel value transformation on the detected targets.
9. A target detection device, comprising: A detection module, configured to input the image to be detected into the neural network trained by the apparatus as claimed in claim 8 to obtain a first target detection image; The clustering module is used to perform pixel clustering on a set of target pixel points in the first target detection image according to a preset condition to determine a second target detection image of the image to be detected.
10. A computer-readable storage medium storing a computer program, wherein the computer program is configured to be executed by a processor to implement the method according to any one of claims 1 to 7.
11. An electronic device, comprising: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the method described in any one of claims 1 to 7.
