Image-based vehicle tail door anti-pinch method and device and storage medium
Through image acquisition and processing technology, it solves the problem that the existing tailgate anti-pinch technology cannot effectively identify small obstacles, and realizes real-time obstruction recognition and anti-pinch reversal during the closing process of the tailgate, ensuring user safety.
Patent Information
- Application Number
- CN202410959285.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-09-06
AI Technical Summary
Existing car tailgate anti-pinch technology cannot effectively trigger the anti-pinch function when encountering small obstacles such as children's fingers, or the user may be pinched after the tailgate is closed.
An image-based vehicle tailgate anti-pinch method is adopted. By collecting images of the anti-pinch area during the tailgate closing process, the tailgate opening and closing images are obtained, and the preset mask image is used for processing to determine whether there is an obstruction, and Control the tailgate motor to reverse to prevent pinching.
Real-time recognition of small obstacles and anti-pinch reversal during the tailgate closing process are achieved to avoid damage to users when the tailgate is closed and improve the accuracy and sensitivity of obstruction detection.
Smart Images

Figure CN118609060A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of automobile tailgates, and in particular to an image-based vehicle tailgate anti-pinch method, device and storage medium. Background Art
[0002] The anti-pinch function is an essential function for vehicle safety. The anti-pinch function of the tailgate of new energy vehicles mainly relies on Hall sensor technology. Specifically, during the opening or closing of the tailgate, the Hall sensor in the electric strut motor will monitor the speed of the motor. When the tailgate encounters an obstacle during the opening or closing process, the movement speed of the tailgate will decrease, and the speed of the electric strut motor will also decrease accordingly. The Hall sensor can sense this change and convert it into a pulse signal and send it to the tailgate controller. When the difference between the pulse width of the pulse signal and the reference pulse width is greater than the set threshold, the controller will enter the anti-pinch program to realize the anti-pinch reversal function, thereby preventing the tailgate from pinching people or objects.
[0003] However, when the obstacle is large or strong, this traditional anti-pinch function will respond normally. But in some special scenarios, the traditional anti-pinch solution also has some limitations. For example, when a child's fingers grab the lower edge of the tailgate, because the child's fingers are small and the contact position is relatively special, it may not be enough to cause a significant change in the sensor signal, resulting in the failure to trigger the anti-pinch function; or, when the speed and force of the vehicle's tailgate closing are large, the tailgate has been mostly closed before the child's fingers are clamped. In this case, it is very likely that the anti-pinch function will be triggered but will not prevent the tailgate from closing, or even if the anti-pinch reversal is triggered, it is likely to pinch or even injure the child's fingers. Summary of the invention
[0004] In view of the above-mentioned defects or deficiencies in the prior art, the present application aims to provide an image-based vehicle tailgate anti-pinch method, device and storage medium to solve the problem that the anti-pinch function cannot be triggered in some scenarios in the prior art and the user is still pinched after the function is triggered.
[0005] The present application provides an image-based vehicle tailgate anti-pinch method, the method comprising: In response to detecting a tailgate closing instruction, during the process of closing the tailgate of the vehicle, an image of an anti-pinch area corresponding to the tailgate of the vehicle is captured to obtain a tailgate closing image; Acquire a reference image, wherein the reference image is obtained by masking the tailgate opening image with a preset mask image corresponding to the anti-pinch area; The tailgate closing image is masked based on the preset mask image to obtain the image to be judged, and it is judged whether there is an obstruction in the anti-pinch area based on the reference image and the image to be judged. If so, the motor of the vehicle tailgate is controlled to reverse.
[0006] Optionally, the step of determining the preset mask image includes: In response to detecting a tailgate opening instruction, during the process of opening the tailgate of the vehicle, an image of an anti-pinch area corresponding to the tailgate of the vehicle is captured to obtain a tailgate opening image; Determining a position of a local block describing the anti-pinch area in the tailgate opening image based on the tailgate opening image and a pre-trained region localization model; A blank mask image having the same size as the tailgate opening image is generated, and a preset pixel value is filled at the position of the local block in the blank mask image to obtain the preset mask image.
[0007] Optionally, the anti-pinch area is provided with a striped bottom plate, and based on the tailgate opening image and a pre-trained regional positioning model, determining the position of a local block describing the anti-pinch area in the tailgate opening image comprises: Inputting the tailgate opening image into a pre-trained region positioning model, wherein the region positioning model includes a bottom plate rectangle feature extraction channel, a bottom plate stripe feature extraction channel, and a bottom plate corner feature extraction channel; The bottom plate rectangular feature, bottom plate stripe feature and bottom plate corner feature corresponding to the anti-pinch area are respectively extracted through the bottom plate rectangular feature extraction channel, the bottom plate stripe feature extraction channel and the bottom plate corner feature extraction channel; The bottom plate rectangular features, the bottom plate stripe features and the bottom plate corner features are processed by the area positioning model to locate the anti-pinch area in the tailgate opening image and obtain the position of the local block describing the anti-pinch area.
[0008] Optionally, the region positioning model further includes a feature map splicing module, a residual combination module, a pooling module, a feature map flattening module and a fully connected module; the bottom plate rectangular features, the bottom plate stripe features and the bottom plate corner features are processed by the region positioning model to locate the anti-pinch area in the tailgate opening image, and obtain the position of the local block describing the anti-pinch area, including: The bottom plate rectangular feature, the bottom plate stripe feature and the bottom plate corner feature are merged through the feature map splicing module to obtain an initial overall feature map; The residual combination module and the pooling module are used to sequentially perform feature extraction and feature dimension reduction on the initial total feature map to obtain a target total feature map; The target total feature map is flattened by the feature map flattening module, and the flattened target total feature map is dimensionally transformed by the fully connected module to obtain the position of the local block describing the anti-pinch area in the tailgate opening image.
[0009] Optionally, judging whether there is an obstruction in the anti-pinch area according to the reference image and the image to be judged includes: Inputting the reference image and the image to be judged into a pre-trained anti-pinch detection model to obtain a similarity metric output by the anti-pinch detection model, wherein the similarity metric is used to describe the degree of similarity between the reference image and the image to be judged; Based on the similarity metric and a preset metric threshold, it is determined whether there is an obstruction in the anti-pinch area.
[0010] Optionally, the reference image and the image to be judged are input into a pre-trained anti-pinch detection model to obtain a similarity measure output by the anti-pinch detection model, including: Inputting the reference image and the image to be judged into a pre-trained anti-pinch detection model, wherein the anti-pinch detection model includes a first edge enhancement unit, a second edge enhancement unit, a first sub-network unit, a second sub-network unit, and a feature vector comparison module; The first edge enhancement unit is used to filter the horizontal edge features in the reference image and enhance the vertical edge features, and the second edge enhancement unit is used to filter the horizontal edge features in the image to be determined and enhance the vertical edge features; Performing feature extraction on the output of the first edge enhancement unit through the first sub-network unit to obtain a first feature vector corresponding to the reference image, and performing feature extraction on the output of the second edge enhancement unit through the second sub-network unit to obtain a second feature vector corresponding to the image to be determined; A similarity measure between the first feature vector and the second feature vector is determined by the feature vector comparison module.
[0011] Optionally, determining a similarity measure between the first feature vector and the second feature vector includes: Determining a Euclidean distance between the first feature vector and the second feature vector, and a cosine similarity between the first feature vector and the second feature vector; A similarity measure between the first feature vector and the second feature vector is determined based on the Euclidean distance, the cosine similarity, a preset weight parameter corresponding to the Euclidean distance, and a preset weight parameter corresponding to the cosine similarity.
[0012] Optionally, the step of determining the preset metric threshold includes: After the anti-pinch detection model is trained, each sample pair in the validation set is input into the anti-pinch detection model to obtain the predicted similarity of each sample pair, wherein the sample pair is composed of a sample reference image and a sample image to be judged; Among the sample pairs whose actual labels are no occlusion in the validation set, the maximum predicted similarity is selected as the first threshold, and among the sample pairs whose actual labels are with occlusion in the validation set, the minimum predicted similarity is selected as the second threshold; The preset metric threshold is determined based on the first threshold and the second threshold.
[0013] The present application also provides an electronic device, the electronic device comprising: Processor and memory; The processor is used to execute the steps of the image-based vehicle tailgate anti-pinch method provided in any embodiment of the present application by calling the program or instruction stored in the memory.
[0014] An embodiment of the present application also provides a computer-readable storage medium, which stores a program or instruction, and the program or instruction enables a computer to execute the steps of the image-based vehicle tailgate anti-pinch method provided in any embodiment of the present application.
[0015] In summary, the present application proposes an image-based vehicle tailgate anti-pinch method. In response to detecting a tailgate closing instruction, during the process of closing the vehicle tailgate, an image of an anti-pinch area corresponding to the vehicle tailgate is captured to obtain a tailgate closing image, and a reference image is obtained by masking the tailgate opening image with a preset mask image corresponding to the anti-pinch area. Then, the tailgate closing image is masked with the preset mask image to obtain an image to be judged. Finally, according to the reference image and the image to be judged, it is judged whether there is an obstruction in the anti-pinch area. If so, the motor of the vehicle tailgate is controlled to reverse to achieve anti-pinch reversal of the obstruction. In the process of closing the tailgate, the method uses the image For example, the method can identify whether there is an obstruction in the anti-pinch area, and realize real-time identification of obstacles during the tailgate closing process. In scenarios where the obstruction is small, the tailgate closing speed is fast, or the tailgate closing force is large, the obstruction can be accurately identified and responded to quickly. The obstruction can be identified and the anti-pinch reversal can be triggered before the tailgate touches the obstruction, thereby preventing the closing of the tailgate from causing harm to the user. In addition, the method processes the tailgate opening image and the tailgate closing image through a preset mask image, which can block the part of the image except the anti-pinch area, thereby avoiding the influence of environmental changes on the obstruction detection, and improving the efficiency of obstruction detection, thereby ensuring the accuracy and sensitivity of obstruction recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0017] Figure 1 is a flow chart of an image-based vehicle tailgate anti-pinch method provided in an embodiment of the present application; Figure 2 is a schematic diagram of image acquisition of an anti-pinch area provided in an embodiment of the present application; Figure 3 is a schematic diagram of image acquisition of an anti-pinch area provided in an embodiment of the present application; Figure 4 It is a schematic diagram of a processing process of a regional positioning model provided in an embodiment of the present application; Figure 5 is a schematic diagram of a residual block provided in an embodiment of the present application; Figure 6 is a reference image schematic diagram provided in an embodiment of the present application; Figure 7 is a schematic diagram of an image to be judged provided in an embodiment of the present application; Figure 8 is a schematic diagram of an output of a reference image after being processed by a first edge enhancement unit provided in an embodiment of the present application; Fig. 9 is a schematic diagram of an output of an image to be judged after being processed by a second edge enhancement unit provided in an embodiment of the present application; Fig.10 It is a structural schematic diagram of an anti-pinch detection model provided in an embodiment of the present application; Fig.11 This is a schematic diagram of a process for implementing anti-pinch of a vehicle tailgate provided by this embodiment; Fig.12 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0018] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant inventions, rather than to limit the inventions. It should also be noted that, for ease of description, only the parts related to the invention are shown in the accompanying drawings.
[0019] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0020] As mentioned in the background technology, in order to solve the problems in the prior art, the present application proposes an image-based vehicle tailgate anti-pinch method. Figure 1 is a flow chart of an image-based vehicle tailgate anti-pinch method provided in an embodiment of the present application. Figure 1 The image-based vehicle tailgate anti-pinch method specifically includes: S110 , in response to detecting a tailgate closing instruction, during the process of closing the tailgate of the vehicle, capturing an image of an anti-pinch area corresponding to the tailgate of the vehicle to obtain a tailgate closing image.
[0021] The anti-pinch area corresponding to the tailgate of the vehicle may be an area pre-set in the vehicle for detecting whether an object will be pinched after the tailgate is closed. For example, the anti-pinch area may be located at the edge of the trunk of the vehicle, for example, a groove may be provided at the outer edge of the trunk at the position where the tailgate is closed, and the groove may be used as the anti-pinch area.
[0022] It should be noted that in order to ensure that a clear image of the anti-pinch area is captured and to ensure the accuracy of subsequent image-based recognition of obstructions, in this embodiment, a striped bottom plate may be provided in the anti-pinch area.
[0023] For example, a rectangular striped bottom plate can be designed according to the size of the outer edge groove at the tailgate closing position. The base color of the striped bottom plate is fluorescent white, black stripes are evenly distributed on the striped bottom plate, the width of the black stripes can be the same as the stripe spacing, and the surface of the striped bottom plate is frosted material, which is conducive to diffuse reflection of light, so that the collected image color is uniform and non-reflective.
[0024] Furthermore, in order to realize image acquisition of the anti-pinch area, a camera facing the anti-pinch area can be set in advance in the trunk of the vehicle, and the image of the anti-pinch area can be acquired through the camera. For example, a monocular camera with high resolution, small aperture, autofocus and high shutter speed can be selected and installed just above the top of the trunk of the vehicle, and the lens of the monocular camera is fixedly facing the direction of the anti-pinch area.
[0025] For example, Figure 2-Figure 3 This is a schematic diagram of image acquisition of an anti-pinch area provided in an embodiment of the present application, wherein the image acquisition of the anti-pinch area can be achieved by photographing a striped base plate provided on the anti-pinch area through a monocular camera.
[0026] Specifically, the tailgate closing command may be triggered based on the user's tailgate closing action. In this embodiment, if the tailgate closing command is detected, it means that the user is controlling the tailgate to close. At this time, in order to achieve anti-pinch detection and anti-pinch triggering during the tailgate closing process, an image of the anti-pinch area corresponding to the vehicle tailgate may be captured during the closing process of the vehicle tailgate.
[0027] For example, during the closing process of the vehicle tailgate, the anti-pinch area may be periodically imaged by a camera facing the anti-pinch area according to a preset acquisition cycle, such as 500 ms, and the acquired image may be used as the tailgate closing image.
[0028] Taking into account that during the process of closing the vehicle's tailgate, the tailgate opening angle is still large when the vehicle's tailgate is just beginning to close, and the possibility of the user being pinched is small at this time, in order to reduce the detection frequency and at the same time ensure the accurate triggering of the anti-pinch function, it is also possible to collect images of the anti-pinch area after detecting that the tailgate closing command is issued for a preset time (such as 1s).
[0029] It should be noted that in order to achieve comprehensive anti-pinch detection of the anti-pinch area, the camera's acquisition range needs to completely cover the anti-pinch area. Therefore, the tailgate closing image collected by the camera usually not only contains the content corresponding to the anti-pinch area, but may also contain other area information in the vehicle or the vehicle's environmental information, such as items inside the trunk, road surface, etc.
[0030] S120, obtaining a reference image, wherein the reference image is obtained by masking the tailgate opening image with a preset mask image corresponding to the anti-pinch area.
[0031] In this embodiment, in order to realize anti-pinch detection and anti-pinch triggering during the tailgate closing process, in addition to obtaining the tailgate closing image during the tailgate closing process, it is also necessary to obtain the tailgate opening image in advance, and determine the reference image based on the tailgate opening image and the preset mask image corresponding to the anti-pinch area.
[0032] The tailgate opening image may be an image captured during the tailgate opening process. The preset mask image may be a mask image used to mask pixels other than the anti-pinch area in the captured image. The reference image may be an image without obstructions used to identify whether there are obstructions in the anti-pinch area.
[0033] In a specific implementation, determining the preset mask image includes the following steps: Step 11, in response to detecting a tailgate opening instruction, during the process of opening the tailgate of the vehicle, an image of an anti-pinch area corresponding to the tailgate of the vehicle is captured to obtain a tailgate opening image; Step 12: based on the tailgate opening image and the pre-trained regional positioning model, determine the position of the local block describing the anti-pinch area in the tailgate opening image; Step 13: Generate a blank mask image with the same size as the tailgate opening image, and fill the local block position in the blank mask image with a preset pixel value to obtain a preset mask image.
[0034] In step 11, the tailgate opening command may be triggered based on the user's tailgate opening action. In this embodiment, if the tailgate opening command is detected, it means that the user is controlling the tailgate to open. At this time, during the process of opening the tailgate of the vehicle, the anti-pinch area corresponding to the tailgate of the vehicle may be captured by the camera, and the captured image may be used as the tailgate opening image.
[0035] It should be noted that, considering that during the process of opening the vehicle's tailgate, the opening angle of the tailgate is still small when the vehicle's tailgate is just opened, the captured image may be darker due to the small opening angle of the tailgate. Therefore, it is also possible to capture an image of the anti-pinch area after detecting that a preset time (such as 1s) has passed since the tailgate opening command was issued, so as to improve the accuracy of the tailgate opening image.
[0036] In order to improve the accuracy and efficiency of subsequent anti-pinch detection, after obtaining the tailgate opening image, the tailgate opening image can be converted into grayscale. For example, the weighted average method can be used to convert the color tailgate opening image into a grayscale tailgate opening image, and the weight of each color channel can be set according to actual needs, such as the red channel weight is 0.299, the green channel weight is 0.587, and the blue channel weight is 0.114.
[0037] Furthermore, in step 12, the tailgate opening image can be input into a pre-trained region positioning model, wherein the region positioning model can be a neural network model for identifying anti-pinch areas in an image, and the position of a local block describing the anti-pinch area is located in the tailgate opening image through the region positioning model, and the position of the local block can specifically be the coordinates of the four corner points of the local block in the image.
[0038] With respect to the above step 12, in one example, a striped bottom plate is provided in the anti-pinch area, and based on the tailgate opening image and a pre-trained area positioning model, the position of a local block describing the area in the tailgate opening image is determined, including the following steps: Step 121: input the tailgate opening image into a pre-trained region positioning model, wherein the region positioning model includes a bottom plate rectangle feature extraction channel, a bottom plate stripe feature extraction channel, and a bottom plate corner feature extraction channel; Step 122, respectively extracting the bottom plate rectangular features, bottom plate stripe features and bottom plate corner features corresponding to the anti-pinch area through the bottom plate rectangular feature extraction channel, the bottom plate stripe feature extraction channel and the bottom plate corner feature extraction channel; Step 123: Process the bottom plate rectangular features, bottom plate stripe features and bottom plate corner features through the area positioning model to locate the anti-pinch area in the tailgate opening image and obtain the position of the local block describing the anti-pinch area.
[0039] Among them, for the identification of anti-pinch areas in the image, three feature extraction channels can be set in the regional positioning model, namely, the bottom plate rectangle feature extraction channel, the bottom plate stripe feature extraction channel and the bottom plate corner feature extraction channel, so as to extract different types of features of the anti-pinch area through different feature extraction channels, so as to further improve the positioning accuracy of the anti-pinch area.
[0040] Specifically, in step 121, the tailgate opening image can be input into the bottom plate rectangle feature extraction channel, the bottom plate stripe feature extraction channel, and the bottom plate corner feature extraction channel respectively. Before being input into each feature extraction channel in the area positioning model, the grayscale tailgate opening image can also be resized to a preset size (e.g., 540×540) to ensure the accuracy of the anti-pinch area positioning in the image.
[0041] Further, in step 122, the bottom plate rectangle feature extraction channel can perform feature extraction on the tailgate opening image to obtain the bottom plate rectangle feature; the bottom plate stripe feature extraction channel can perform feature extraction on the tailgate opening image to obtain the bottom plate stripe feature; the bottom plate corner feature extraction channel can perform feature extraction on the tailgate opening image to obtain the bottom plate corner feature.
[0042] For example, the bottom plate rectangle feature extraction channel can identify horizontal boundary features and vertical boundary features through the convolution kernel in the channel; the bottom plate stripe feature extraction channel can identify horizontal boundary features through the convolution kernel in the channel; the bottom plate corner feature extraction channel can identify corner features through the convolution kernel in the channel. The convolution calculation is as follows: ; In the formula, For the tailgate opening image input into the model, is a convolution kernel of size k×k, The feature map generated by the convolution calculation is the output of the feature extraction channel. Represents the input image In, located at The pixel value of the pixel point, Represents the convolution kernel In, located at The weight value of the pixel point, and is the position index of the current convolution operation in the input tailgate opening image.
[0043] Furthermore, in step 123, the anti-pinch area in the tailgate opening image can be located by further using a regional positioning model and combining the features output by the three feature extraction channels, thereby obtaining the position of a local block describing the anti-pinch area in the tailgate opening image.
[0044] Through the above process, feature extraction based on multiple feature extraction channels can be achieved. This embodiment combines the rectangular features, stripe features and corner point features of the anti-pinch area, and designs three corresponding channels for extraction respectively, which can ensure the comprehensiveness of feature extraction and further ensure the positioning accuracy of the anti-pinch area in the tailgate opening image.
[0045] With respect to the above step 123, in one example, the region positioning model further includes a feature map splicing module, a residual combination module, a pooling module, a feature map flattening module, and a fully connected module; the bottom plate rectangular features, bottom plate stripe features, and bottom plate corner features are processed by the region positioning model to locate the anti-pinch area in the tailgate opening image, and the position of the local block describing the anti-pinch area is obtained, including: Through the feature map stitching module, the bottom plate rectangular features, bottom plate stripe features and bottom plate corner features are fused to obtain the initial total feature map; the initial total feature map is extracted and reduced in dimension through the residual combination module and the pooling module to obtain the target total feature map; the target total feature map is flattened through the feature map flattening module, and the flattened target total feature map is transformed in dimension through the fully connected module to obtain the position of the local block describing the anti-pinch area in the tailgate opening image.
[0046] Specifically, after obtaining the features output by each feature extraction channel, the feature map splicing module in the regional positioning model can be used to keep the height and width of the feature maps extracted by the three feature extraction channels unchanged, and splice the bottom plate rectangular features, bottom plate stripe features and bottom plate corner point features along the channel dimension to obtain the initial total feature map.
[0047] Figure 4 is a schematic diagram of a processing process of a regional positioning model provided in an embodiment of the present application, such as Figure 4 As shown, the outputs of channel 1, channel 2, and channel 3 are concatenated after feature maps.
[0048] Furthermore, after the initial total feature map is obtained by concatenation, multiple residual blocks (such as Figure 4 The residual combination module in the middle includes 2 residual blocks) convolves the initial total feature map to extract higher dimensional features from the initial total feature map, and reduces the feature map size through the pooling module (i.e., the maximum pooling layer) to obtain the target total feature map.
[0049] like Figure 4 As shown, the residual combination module may include residual block 7 and residual block 8 in the figure, the pooling module may be a maximum pooling layer connected to residual block 8, and the initial total feature map output by feature map splicing becomes the target total feature map after being processed by residual block 7, residual block 8 and the maximum pooling layer.
[0050] Furthermore, the target total feature map can be flattened through the feature map flattening module in the regional positioning model, and the flattened target total feature map can be dimensionally transformed through the fully connected module in the regional positioning model to transform the high-dimensional features into 8 coordinate values (i.e., the coordinates of 4 points) to obtain the position of the local block describing the anti-pinch area in the tailgate opening image.
[0051] like Figure 4 As shown, the fully connected module may include a fully connected layer 1 and a fully connected layer 2. The target total feature map output by the residual pooling module can output the coordinates of the four corner points of the local block describing the anti-pinch area after feature map flattening, full connection 1 and full connection 2.
[0052] Through the above example, the anti-pinch area in the tailgate opening image can be accurately positioned through the feature map stitching module, the residual pooling module, the feature map flattening module and the fully connected module.
[0053] In addition, in order to prevent the regional positioning model from degenerating and accelerate the model training, the bottom plate rectangle feature extraction channel, the bottom plate stripe feature extraction channel, and the bottom plate corner feature extraction channel can be composed of two residual blocks and a maximum pooling layer respectively. For example, Figure 4 The middle channel 1 (bottom plate rectangle feature extraction channel) includes residual block 1, residual block 4 and maximum pooling layer, channel 2 (bottom plate stripe feature extraction channel) includes residual block 2, residual block 5 and maximum pooling layer, channel 3 (bottom plate corner feature extraction channel) includes residual block 3, residual block 6 and maximum pooling layer. The sliding window size of the three channels is 2×2, and the sliding step size is 2.
[0054] Among them, the output of the residual block can be expressed by the following formula: ; in, represents the input of the residual block, It represents the output obtained after the input is linearly transformed. Represents the final output of the residual block. The construction of the residual block can refer to Figure 5 , Figure 5 It is a schematic diagram of a residual block provided in an embodiment of the present application.
[0055] like Figure 5 As shown in the figure, x is the input of the residual block, with a dimension of n, y is the output of the residual block, with a dimension of m, f is the filter in each convolution layer, and k is the convolution kernel in each filter. In order to solve the problem of inconsistent feature distribution, batch normalization (BN) is used after each convolution. The output dimension after the first convolution layer becomes m, that is, the input of batch normalization is B={x 1,x 2 ,…,x m}, first calculate the mean and variance of each feature dimension in the batch: ; ; Then, for each input x i Normalize it to have a mean of 0 and a variance of 1: ; In the formula, ε is a small constant used to avoid the denominator being 0. The normalized output Scaling and translation are performed through learnable parameters γ and β to restore the expressive power of the data: ; The activation function of the residual block uses ReLU (Rectified Linear Unit). When the input is greater than 0, it is directly output, and when the input is less than or equal to 0, it outputs 0.
[0056] In this embodiment, the training of the region positioning model may use the Smooth L1 Loss function: ; In the formula, is the predicted value, is the true value, and when their difference is less than 1, the square error is used, and when it is greater than or equal to 1, the linear error is used. Therefore, it can be more robust when dealing with large errors and more smooth when dealing with small errors. In addition, the Adam optimizer can also be used in this embodiment, which has fewer hyperparameter adjustments and faster convergence speed.
[0057] After determining the position of the local block describing the anti-pinch area in the tailgate opening image through the trained area localization model, further, in step 13, a blank mask image with the same size as the tailgate opening image can be generated, and the preset pixel value can be filled in the corresponding position of the blank mask image according to the position of the local block.
[0058] For example, a blank mask image with all pixel values being 0 may be generated. The blank mask image has the same size as the tailgate opening image. Then, according to the position of the local block located in the tailgate opening image, such as the four coordinate points TL (a 1 ,b 1 )、TR(a 2 ,b 2 )、LL(a 3 ,b 3 )、LR(a 4 ,b 4), draw a rectangular closed area in the blank mask image, and then fill 1 (preset pixel value) in the rectangular closed area to obtain a preset mask image.
[0059] Through the above steps 11 to 13, the preset mask image can be accurately determined. In the obtained preset mask image, the value of each pixel corresponding to the anti-pinch area is 1, and the value of the remaining pixel points is 0. This can facilitate the subsequent masking of the part of the image except the anti-pinch area based on the preset mask image, thereby improving the accuracy of anti-pinch detection, avoiding other area information or environmental information in the image from affecting the accuracy of anti-pinch detection, and thus avoiding the possibility of false detection and missed detection.
[0060] After obtaining the preset mask image, the tailgate opening image can continue to be masked to cover all pixel points in the tailgate opening image except the anti-pinch area. For example, the preset mask image can be used to perform a bitwise AND operation on the tailgate opening image according to the pixel value to set the pixel value of each pixel point outside the anti-pinch area to 0, and only retain the pixel value of each pixel point in the anti-pinch area in the tailgate opening image to obtain a reference image.
[0061] In this embodiment, during any opening process of the vehicle tailgate, a preset mask image can be acquired and a reference image can be obtained based on the preset mask image. The acquired preset mask image and reference image can be used for subsequent mask processing and anti-pinch detection.
[0062] Taking into account that the camera position or the striped bottom plate position may change due to vehicle bumps or collisions during driving, which may cause the anti-pinch area in the preset mask image to be inconsistent with the anti-pinch area position in the tailgate closing image to be detected. In order to ensure the accuracy of anti-pinch detection, the preset mask image can be acquired again when it is detected that the vehicle mileage reaches a preset mileage, or the vehicle driving time reaches a preset time, and the reference image is re-determined based on the new preset mask image to ensure the real-time nature of the preset mask image and the reference image, so as to avoid inconsistency between the preset mask image and the anti-pinch area position in the tailgate closing image to be detected.
[0063] S130, masking the tailgate closing image based on a preset mask image to obtain an image to be determined, and determining whether there is an obstruction in the anti-pinch area based on the reference image and the image to be determined, and if so, controlling the motor of the vehicle tailgate to be reversed.
[0064] Specifically, in addition to using the preset mask image to perform mask processing on the tailgate opening image, it is also necessary to use the preset mask image to perform mask processing on the tailgate closing image. For example, the color tailgate closing image can be first converted into a grayscale tailgate closing image, and then the preset mask image is used to perform a bitwise AND operation on the tailgate closing image according to the pixel value, so as to set the pixel value of each pixel point outside the anti-pinch area to 0, and only retain the pixel value of each pixel point in the anti-pinch area of the tailgate closing image, so as to obtain the image to be judged.
[0065] It should be noted that, in the present embodiment, the purpose of using a preset mask image to perform mask processing on the tailgate open image and the tailgate closed image is: in the process of image acquisition of the anti-pinch area, considering that information or environmental information at other positions of the vehicle may also be acquired, in order to avoid such information interfering with the anti-pinch detection, the tailgate open image and the tailgate closed image can be processed by a preset mask image to block all pixel points in the tailgate open image and the tailgate closed image except the anti-pinch area, and retain all pixel points within the anti-pinch area, so as to shield interference factors such as information at other positions of the vehicle and environmental information in the image, realize detection between the anti-pinch area and the anti-pinch area of the two images, avoid the influence of interference factors on the anti-pinch detection, and improve the accuracy of the anti-pinch detection.
[0066] In this embodiment, since the reference image is obtained based on the tailgate opening image processing, there is usually no obstruction in the anti-pinch area during the tailgate opening process. Therefore, it is possible to determine whether there is an obstruction in the anti-pinch area during the tailgate closing process by measuring the similarity between the reference image and the image to be judged.
[0067] In a specific implementation, judging whether there is an obstruction in the anti-pinch area according to the reference image and the image to be judged includes: The reference image and the image to be judged are input into a pre-trained anti-pinch detection model to obtain a similarity measure output by the anti-pinch detection model, wherein the similarity measure is used to describe the degree of similarity between the reference image and the image to be judged; based on the similarity measure and the preset measure threshold, it is determined whether there is an obstruction in the anti-pinch area.
[0068] The anti-pinch detection model may be a neural network model for determining a similarity measure between two input images. Specifically, the reference image and the image to be judged may be input into a trained anti-pinch detection model to obtain a similarity measure output by the anti-pinch detection model.
[0069] Optionally, inputting the reference image and the image to be judged into a pre-trained anti-pinch detection model to obtain a similarity measure output by the anti-pinch detection model includes the following steps: Step 21, inputting the reference image and the image to be judged into a pre-trained anti-pinch detection model, wherein the anti-pinch detection model includes a first edge enhancement unit, a second edge enhancement unit, a first sub-network unit, a second sub-network unit, and a feature vector comparison module; Step 22: filtering the horizontal edge features in the reference image and enhancing the vertical edge features through the first edge enhancement unit, and filtering the horizontal edge features in the image to be determined and enhancing the vertical edge features through the second edge enhancement unit; Step 23: extract features from the output of the first edge enhancement unit through the first sub-network unit to obtain a first feature vector corresponding to the reference image, and extract features from the output of the second edge enhancement unit through the second sub-network unit to obtain a second feature vector corresponding to the image to be judged; Step 24: Determine a similarity measure between the first feature vector and the second feature vector through a feature vector comparison module.
[0070] Among them, the anti-pinch detection model can be a twin neural network model with edge enhancement, such as, which can be referred to as EE-SNN (Edge Enhancement Siamese Neural Network). The anti-pinch detection model consists of two edge enhancement units, two sub-network units and a feature vector comparison module. The two edge enhancement units are used to perform vertical edge enhancement on the two input images respectively, and the two edge enhancement units can specifically be two two-dimensional convolution modules. The two sub-network units are used to further extract features from the outputs of the two edge enhancement units respectively, and the two sub-network units can be two lightweight CNNs (Convolutional Neural Networks, convolutional neural network units) with the same structure.
[0071] Specifically, in step 21-step 22, the reference image and the image to be judged are input into a pre-trained anti-pinch detection model. The first edge enhancement unit in the anti-pinch detection model can perform vertical edge enhancement on the reference image, that is, filter the horizontal edge features in the reference image and enhance the vertical edge features. The second edge enhancement unit in the anti-pinch detection model can perform vertical edge enhancement on the image to be judged, that is, filter the horizontal edge features in the image to be judged and enhance the vertical edge features.
[0072] It should be noted that the purpose of setting up two edge enhancement units in this embodiment is: since a horizontal striped base is set on the anti-pinch area, two edge enhancement units can be set up to perform two-dimensional convolution on the input image using a vertical edge detection convolution kernel to filter out horizontal edge features and enhance vertical edge features to extract the difference between the two images and highlight the difference between the two images.
[0073] Figure 6 is a reference image schematic diagram provided in an embodiment of the present application, Figure 7 is a schematic diagram of an image to be judged provided in an embodiment of the present application. Figure 8 is a schematic diagram of an output of a reference image after being processed by a first edge enhancement unit provided in an embodiment of the present application, Fig. 9 This is a schematic diagram of the output of an image to be judged after being processed by a second edge enhancement unit provided in an embodiment of the present application.
[0074] See also Figure 6 , the striped base in the reference image is not blocked, so, Figure 8 The horizontal stripe features of the reference image can be filtered out by vertical edge convolution; see Figure 7 , the striped base in the image to be judged is blocked by the finger, so, Fig. 9 The shape features of the occluder can be enhanced by vertical edge convolution.
[0075] Furthermore, in step 23, the first sub-network unit can be used to perform feature extraction on the output of the first edge enhancement unit to obtain a first feature vector corresponding to the reference image, and the second sub-network unit can be used to perform feature extraction on the output of the second edge enhancement unit to obtain a second feature vector corresponding to the image to be judged.
[0076] For example, Fig.10 is a structural schematic diagram of an anti-pinch detection model provided in an embodiment of the present application, such as Fig.10 As shown, Picture 1 and Picture 2 can be the reference image and the image to be judged respectively. After being input into the anti-pinch detection model, they are respectively subjected to vertical edge enhancement, i.e., two-dimensional convolution, and then input into sub-network 1 (CNN) and sub-network 2 (CNN) respectively, where both sub-network 1 and sub-network 2 can be composed of two convolutional layers and one fully connected layer, each convolutional layer is followed by a maximum pooling, and the two sub-networks share weights.
[0077] Furthermore, in step 24, the feature vector comparison module in the anti-pinch detection model can determine the similarity measure between the first feature vector and the second feature vector based on the first feature vector and the second feature vector output by the two sub-network units. Fig.10 As shown, the outputs of subnetwork 1 and subnetwork 2 can be further compared by feature vectors to obtain a similarity measure.
[0078] In this embodiment, considering that a single similarity index comparison may not be accurate enough, this embodiment may use a combined similarity index as a similarity metric to solve the problem of inaccurate comparison of a single similarity index and insufficient generalization ability.
[0079] With respect to the above step 24, in one example, determining a similarity measure between the first feature vector and the second feature vector includes: Determine the Euclidean distance between the first eigenvector and the second eigenvector, and the cosine similarity between the first eigenvector and the second eigenvector; determine the similarity measure between the first eigenvector and the second eigenvector based on the Euclidean distance, the cosine similarity, the preset weight parameter corresponding to the Euclidean distance, and the preset weight parameter corresponding to the cosine similarity.
[0080] Among them, the Euclidean distance between the first eigenvector and the second eigenvector can be calculated by the following formula: ;.
[0081] In the formula, P=(p 1 ,p 2 ,p 3 ,…,p n ) and Q = (q 1 ,q 2 ,q 3 ,…,q n ) are the feature vectors extracted by the two sub-network units, namely the first feature vector and the second feature vector, and D is the Euclidean distance between the two feature vectors.
[0082] The cosine similarity between the first eigenvector and the second eigenvector can be calculated by the following formula: ; Where C is the cosine similarity between two feature vectors.
[0083] Furthermore, the Euclidean distance and the cosine similarity can be weighted by using a preset weight parameter corresponding to the Euclidean distance and a preset weight parameter corresponding to the cosine similarity to obtain a similarity measure between the first feature vector and the second feature vector, such as: ; In the formula, is the similarity measure between the first eigenvector and the second eigenvector, , They are respectively a preset weight parameter corresponding to the Euclidean distance and a preset weight parameter corresponding to the cosine similarity, and the sum of the two preset weight parameters is equal to 1.
[0084] In this embodiment, the smaller the similarity measure, the higher the similarity between the first feature vector and the second feature vector, that is, the more similar the reference image and the image to be judged are. On the contrary, if the similarity measure is larger, the lower the similarity between the first feature vector and the second feature vector, that is, the more different the reference image and the image to be judged are. The similarity measure obtained by Euclidean distance and cosine similarity can solve the problem of inaccurate comparison and insufficient generalization ability of a single similarity index, and further ensure the accuracy of anti-pinch detection.
[0085] Through the above steps 21 to 24, the vertical edge features can be enhanced first based on the two edge enhancement units, and the horizontal edge features can be filtered to highlight the difference between the two images. Feature extraction is performed through two sub-network units, and the similarity measure is determined through the feature vector comparison module. The two images can be accurately compared, and it can be accurately determined whether there are any obstructions in the anti-pinch area of the image to be judged.
[0086] After obtaining the similarity measurement between the reference image and the image to be judged through the anti-pinch detection model, the similarity measurement can be further compared with the preset measurement threshold to determine whether there is an obstruction in the anti-pinch area. The preset measurement threshold can be a preset similarity critical value for determining whether there is an obstruction.
[0087] Optionally, determining the preset metric threshold includes the following steps: Step 31: After the anti-pinch detection model is trained, each sample pair in the validation set is input into the anti-pinch detection model to obtain the predicted similarity of each sample pair, wherein the sample pair is composed of a sample reference image and a sample to-be-judged image; Step 32: among the sample pairs whose actual labels are no occlusion in the validation set, select the largest predicted similarity as the first threshold, and among the sample pairs whose actual labels are with occlusion in the validation set, select the smallest predicted similarity as the second threshold; Step 33: Determine a preset metric threshold based on the first threshold and the second threshold.
[0088] Among them, the anti-pinch detection model can be trained using the sample set, such as Fig.10 As shown, the loss function of the anti-pinch detection model can adopt a contrast loss function, such as: ; Where L is the calculation result of the contrast loss function, N is the number of sample pairs (two images are one sample pair) in the sample set, is the label of sample pair j, indicating whether the sample pair is similar. The label of similar sample pairs is 1, and the label of dissimilar sample pairs is 0. m is a threshold, indicating the minimum distance of negative sample pairs, which can be tuned by the validation set. is the similarity measure of sample pair j.
[0089] In this embodiment, after the anti-pinch detection model training is completed, the preset metric threshold can be determined using the similarity metric of the predictions of each sample pair on the validation set, that is, the prediction similarity, and the actual label of each sample pair on the validation set.
[0090] Specifically, in step 31, each sample pair in the validation set may be input into the anti-pinch detection model to obtain the predicted similarity of each sample pair output by the model.
[0091] Furthermore, in step 32, among all sample pairs whose actual labels are no occlusions, the maximum predicted similarity, that is, the predicted similarity of the most dissimilar sample pairs, can be selected as the first threshold, and among all sample pairs whose actual labels are with occlusions, the minimum predicted similarity, that is, the predicted similarity of the most similar sample pairs, can be selected as the second threshold.
[0092] Furthermore, in step 33, the mean between the first threshold and the second threshold can be used as the preset metric threshold. Through the above steps 31 to 33, the preset metric threshold can be determined through the validation set, and the predicted similarity of all sample pairs with actual labels of no occlusion and with occlusion can be combined to obtain an accurate threshold, further improving the accuracy of anti-pinch detection and improving classification (i.e., whether there is an occlusion) performance.
[0093] In this embodiment, if the similarity measure between the reference image and the image to be judged is less than the preset measure threshold, it can be determined that the reference image and the image to be judged are very similar, and then it can be determined that there is no obstruction in the anti-pinch area; if the similarity measure between the reference image and the image to be judged is greater than or equal to the preset measure threshold, it can be determined that the reference image and the image to be judged are not similar, and then it can be determined that there is an obstruction in the anti-pinch area.
[0094] Furthermore, if there is an obstruction in the anti-pinch area, an anti-pinch instruction can be generated and sent to the controller of the tailgate motor so that the controller controls the tailgate motor to reverse, such as controlling the tailgate motor to reverse for 500ms and then stop, and then the tailgate closing image can continue to be obtained until there is no obstruction in the anti-pinch area. At this time, a stop intervention instruction can be output to the controller of the tailgate motor, and the tailgate motor can perform the original action normally.
[0095] Fig.11 FIG. 1 is a schematic diagram of a process for realizing anti-pinch of a vehicle tailgate provided by this embodiment. Fig.11 As shown, the image-based vehicle tailgate anti-pinch method provided in this embodiment can firstly detect the operation of the tailgate.
[0096] If it is detected that the tailgate is open, it can be determined whether the tailgate opening time t reaches 1s. If not, it will continue to return to determine the tailgate opening time. If so, the anti-pinch area can be photographed by a monocular camera to obtain the tailgate opening image P1, and P1 is grayed into P2. Further, P2 is input into the regional positioning module (i.e., the regional positioning model) to obtain the regional coordinates of the anti-pinch area, and a blank mask image is generated. According to the coordinates, the closed area in the blank mask image is determined, and the closed area is pixel-filled to obtain the preset mask image Mask1. The preset mask image Mask1 is applied to P2 to obtain the reference image P3.
[0097] If it is detected that the tailgate is closing, it can be determined whether the tailgate closing time t reaches 1s. If not, it will continue to return to determine the tailgate closing time. If so, the anti-pinch area can be photographed by a monocular camera to obtain the tailgate closing image P4, and then determine whether the preset period of 500ms is reached. If it is reached, it will return to photograph the tailgate closing image P4. If it is not reached, P4 will continue to be grayed into P5, and the preset mask image Mask1 will be applied to P5 to obtain the image to be judged P6.
[0098] Furthermore, the reference image P3 and the image to be judged P6 can be input into the anti-pinch detection module (i.e., the anti-pinch detection model). Based on the similarity threshold output by the anti-pinch detection module, it is determined whether there is an obstruction. If so, the motor is controlled to reverse for 500ms and then stop. If not, it is determined whether the tailgate is closed. If the tailgate is not closed, the process continues to return to capture the tailgate closing image P4. If the tailgate is closed, the entire process ends.
[0099] Through the above process, it is possible to accurately determine whether to trigger anti-pinch and respond quickly after triggering in special scenarios, such as when the anti-pinch obstacle is small (children's fingers) or when the anti-pinch target suddenly appears before the tailgate closes. It can identify the obstruction and trigger the anti-pinch reversal before it touches the obstacle, avoiding the force of the tailgate closing causing harm to the user, giving the user a better car experience. In addition, the image-based tailgate anti-pinch method involves various models that can be continuously optimized based on the collected image data, making anti-pinch detection more accurate and sensitive.
[0100] Moreover, in the method provided in the present embodiment, by designing a regional positioning model based on multi-channel convolution, by dividing three feature channels to extract features and then splicing them, the anti-pinch area in the image can be accurately detected and the corresponding position can be output. For different models of cars, the size and height of the trunk are different, so the size of the striped bottom plate is different, and the distance between the monocular camera and the striped bottom plate is also different. The regional positioning model in this embodiment can quickly locate and identify the anti-pinch area, without the need to calibrate the anti-pinch area for different types of vehicles, which greatly increases the adaptability of the solution.
[0101] In addition, in the method provided in this embodiment, by designing an anti-pinch detection model based on a twin neural network, it is possible to detect whether there are obstructions in the anti-pinch area. When there are slight differences between the two images, the traditional image feature comparison will judge that the images are highly similar, and output a high probability value for judging the image similarity, thereby affecting the detection result and failing to achieve accurate anti-pinch. If a more complex feature value distance metric is designed or an attention mechanism is introduced, the algorithm complexity and amount of calculation will be increased, and the calculation time of the model will be prolonged, which is not conducive to the rapid response of anti-pinch detection. Therefore, the anti-pinch detection model provided in this embodiment is based on a twin neural network with edge enhancement. It adopts a method of first performing edge enhancement processing on the image, highlighting the difference features, and then detecting. It can accurately detect obstructions on the basis of low complexity and rapid response.
[0102] The image-based vehicle tailgate anti-pinch method provided in the embodiment of the present application responds to the detection of the tailgate closing instruction. During the process of closing the vehicle tailgate, an image of the anti-pinch area corresponding to the vehicle tailgate is captured to obtain a tailgate closing image, and a reference image is obtained by masking the tailgate opening image with a preset mask image corresponding to the anti-pinch area. Then, the tailgate closing image is masked with the preset mask image to obtain an image to be judged. Finally, according to the reference image and the image to be judged, it is judged whether there is an obstruction in the anti-pinch area. If so, the motor of the vehicle tailgate is controlled to reverse to achieve anti-pinch reversal of the obstruction. The method is effective in the process of closing the tailgate. During the process, images are used to identify whether there are obstructions in the anti-pinch area, and real-time identification of obstacles can be achieved during the tailgate closing process. In scenarios where the obstruction is small, the tailgate closes at a high speed, or the tailgate closes with a large force, the obstruction can be accurately identified and responded to quickly. The obstruction is identified before the tailgate contacts the obstruction and the anti-pinch reversal is triggered to avoid harm to the user caused by the closing of the tailgate. In addition, the method processes the tailgate opening image and the tailgate closing image through a preset mask image, and can block the part of the image except the anti-pinch area, thereby avoiding the influence of environmental changes on the obstruction detection, improving the efficiency of obstruction detection, and ensuring the accuracy and sensitivity of obstruction recognition.
[0103] Fig.12 Schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig.12 As shown, the electronic device 400 includes one or more processors 401 and a memory 402 .
[0104] The processor 401 may be a central processing unit (CPU) or a graphics processing unit (GPU) or other forms of processing units with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 400 to perform desired functions.
[0105] The memory 402 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, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 301 may run the program instructions to implement the image-based vehicle tailgate anti-pinch method of any embodiment of the present application described above and / or other desired functions. Various contents such as initial external parameters, thresholds, etc. may also be stored in the computer-readable storage medium.
[0106] In one example, the electronic device 400 may further include: an input device 403 and an output device 404, which are interconnected via a bus system and / or other forms of connection mechanisms (not shown). The input device 403 may include, for example, a keyboard, a mouse, etc. The output device 404 may output various information to the outside, including early warning prompt information, braking force, etc. The output device 404 may include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, etc.
[0107] Of course, to simplify, Fig.12 Only some of the components related to the present application in the electronic device 400 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 400 may also include any other appropriate components.
[0108] 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 of the image-based vehicle tailgate anti-pinch method provided in any embodiment of the present application.
[0109] 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.
[0110] In addition, an embodiment of the present application may also be a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, enables the processor to execute the steps of the image-based vehicle tailgate anti-pinch method provided in any embodiment of the present application.
[0111] 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.
[0112] It should be noted that the terms used in this application are only for describing specific embodiments, rather than limiting the scope of this application. As shown in the specification and claims of this application, unless the context clearly indicates an exception, the words "one", "a", "a kind of" and / or "the" do not specifically refer to the singular, but may also include the plural. The terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method or device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the presence of other identical elements in the process, method or device including the elements.
[0113] It should also be noted that the terms "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside", etc., indicating the orientation or position relationship, are based on the orientation or position relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present application. Unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", etc. should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be a connection between the two elements. For those of ordinary skill in the art, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0114] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and its core ideas of this application. The above is only the preferred implementation method of this application. It should be pointed out that due to the limitations of textual expression and the objective existence of infinite specific structures, ordinary technicians in this technical field can make several improvements, modifications or changes without departing from the principles of this application, and can also combine the above technical features in an appropriate manner; these improvements, modifications, changes or combinations, or the direct application of the concept and technical solution of the invention to other occasions without improvement, should be regarded as the scope of protection of this application.
Claims
1. A vehicle tailgate anti-pinch method based on an image, characterized in that: include: In response to detecting a tailgate closing instruction, during the process of closing the tailgate of the vehicle, an image of an anti-pinch area corresponding to the tailgate of the vehicle is captured to obtain a tailgate closing image; Acquire a reference image, wherein the reference image is obtained by masking the tailgate opening image with a preset mask image corresponding to the anti-pinch area; The tailgate closing image is masked based on the preset mask image to obtain the image to be judged, and it is judged whether there is an obstruction in the anti-pinch area based on the reference image and the image to be judged. If so, the motor of the vehicle tailgate is controlled to reverse.
2. The method according to claim 1, characterized in that The step of determining the preset mask image comprises: In response to detecting a tailgate opening instruction, during the process of opening the tailgate of the vehicle, an image of an anti-pinch area corresponding to the tailgate of the vehicle is captured to obtain a tailgate opening image; Determining a position of a local block describing the anti-pinch area in the tailgate opening image based on the tailgate opening image and a pre-trained region localization model; A blank mask image having the same size as the tailgate opening image is generated, and a preset pixel value is filled at the position of the local block in the blank mask image to obtain the preset mask image.
3. The method according to claim 2, characterized in that The anti-pinch area is provided with a striped bottom plate, and based on the tailgate opening image and a pre-trained regional positioning model, a position of a local block describing the anti-pinch area in the tailgate opening image is determined, including: Inputting the tailgate opening image into a pre-trained region positioning model, wherein the region positioning model includes a bottom plate rectangle feature extraction channel, a bottom plate stripe feature extraction channel, and a bottom plate corner feature extraction channel; The bottom plate rectangular feature, bottom plate stripe feature and bottom plate corner feature corresponding to the anti-pinch area are respectively extracted through the bottom plate rectangular feature extraction channel, the bottom plate stripe feature extraction channel and the bottom plate corner feature extraction channel; The bottom plate rectangular features, the bottom plate stripe features and the bottom plate corner features are processed by the area positioning model to locate the anti-pinch area in the tailgate opening image and obtain the position of the local block describing the anti-pinch area.
4. The method according to claim 3, characterized in that The region positioning model further includes a feature map splicing module, a residual combination module, a pooling module, a feature map flattening module and a fully connected module; the bottom plate rectangular feature, the bottom plate stripe feature and the bottom plate corner feature are processed by the region positioning model to locate the anti-pinch area in the tailgate opening image, and obtain the position of the local block describing the anti-pinch area, including: The bottom plate rectangular feature, the bottom plate stripe feature and the bottom plate corner feature are merged through the feature map splicing module to obtain an initial overall feature map; The residual combination module and the pooling module are used to sequentially perform feature extraction and feature dimension reduction on the initial total feature map to obtain a target total feature map; The target total feature map is flattened by the feature map flattening module, and the flattened target total feature map is dimensionally transformed by the fully connected module to obtain the position of the local block describing the anti-pinch area in the tailgate opening image.
5. The method according to claim 1, characterized in that Judging whether there is an obstruction in the anti-pinch area according to the reference image and the image to be judged includes: Inputting the reference image and the image to be judged into a pre-trained anti-pinch detection model to obtain a similarity metric output by the anti-pinch detection model, wherein the similarity metric is used to describe the degree of similarity between the reference image and the image to be judged; Based on the similarity metric and a preset metric threshold, it is determined whether there is an obstruction in the anti-pinch area.
6. The method according to claim 5, characterized in that Inputting the reference image and the image to be judged into a pre-trained anti-pinch detection model to obtain a similarity measure output by the anti-pinch detection model, including: Inputting the reference image and the image to be judged into a pre-trained anti-pinch detection model, wherein the anti-pinch detection model includes a first edge enhancement unit, a second edge enhancement unit, a first sub-network unit, a second sub-network unit, and a feature vector comparison module; The first edge enhancement unit is used to filter the horizontal edge features in the reference image and enhance the vertical edge features, and the second edge enhancement unit is used to filter the horizontal edge features in the image to be determined and enhance the vertical edge features; Performing feature extraction on the output of the first edge enhancement unit through the first sub-network unit to obtain a first feature vector corresponding to the reference image, and performing feature extraction on the output of the second edge enhancement unit through the second sub-network unit to obtain a second feature vector corresponding to the image to be determined; A similarity measure between the first feature vector and the second feature vector is determined by the feature vector comparison module.
7. The method according to claim 6, characterized in that Determining a similarity measure between the first feature vector and the second feature vector includes: Determining a Euclidean distance between the first feature vector and the second feature vector, and a cosine similarity between the first feature vector and the second feature vector; A similarity measure between the first feature vector and the second feature vector is determined based on the Euclidean distance, the cosine similarity, a preset weight parameter corresponding to the Euclidean distance, and a preset weight parameter corresponding to the cosine similarity.
8. The method according to claim 5, characterized in that The step of determining the preset metric threshold comprises: After the anti-pinch detection model is trained, each sample pair in the validation set is input into the anti-pinch detection model to obtain the predicted similarity of each sample pair, wherein the sample pair is composed of a sample reference image and a sample image to be judged; Among the sample pairs whose actual labels are no occlusion in the validation set, the maximum predicted similarity is selected as the first threshold, and among the sample pairs whose actual labels are with occlusion in the validation set, the minimum predicted similarity is selected as the second threshold; The preset metric threshold is determined based on the first threshold and the second threshold.
9. An electronic device, characterized in that: The electronic device comprises: Processor and memory; The processor is used to execute the steps of the image-based vehicle tailgate anti-pinch method as described in any one of claims 1 to 8 by calling the program or instruction stored in the memory.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program or instruction, which enables a computer to execute the steps of the image-based vehicle tailgate anti-pinch method according to any one of claims 1 to 8.
