A data processing method, storage medium, and electronic device
The target object's moving speed is calculated by using the center point coordinates of multiple frames and the frame number difference, which solves the problem of large speed determination error in existing technologies and achieves higher accuracy and stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ISA TECH CO LTD
- Filing Date
- 2022-12-01
- Publication Date
- 2026-05-26
AI Technical Summary
In existing technologies, the methods for determining the speed of a target vehicle assume that the vehicle's direction of travel is parallel to the length of the lane, resulting in low accuracy in speed determination, especially when the vehicle's direction of travel is adjusted.
By acquiring multiple frames of images from the target image set, the moving speed is calculated using the differences in the center point coordinates of the target object in the images and the differences in the number of frames. Combined with the image length and image refresh rate, weighting coefficients and parameter adjustments are used to improve the accuracy of speed calculation.
It improves the accuracy of target movement speed calculation, reduces speed determination errors caused by occlusion or orientation adjustment, and enhances the speed calculation capability between non-adjacent frame images.
Smart Images

Figure CN115830538B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing, and in particular to a data processing method, storage medium, and electronic device. Background Technology
[0002] With continuous economic development, intelligent transportation has become the future direction of transportation systems.
[0003] In intelligent transportation systems, the speed of a target vehicle traveling in a lane in any image of a surveillance video can be calculated. The specific processing method is as follows: two adjacent images in the time dimension are obtained from the surveillance video. Both images include the target vehicle. Based on the position of the target vehicle in the two images, the distance between the target vehicle along the length of the lane in the two images can be determined. Then, combined with the time difference between the two adjacent images in the time dimension, the speed of the target vehicle between the two images can be determined, and this speed can be used as the speed of the target vehicle in the second image of the two images.
[0004] However, the above processing method assumes that the target vehicle's driving direction is parallel to the length of the lane. In actual driving, the vehicle's driving direction is constantly being slightly adjusted, and there may even be significant adjustments such as lane changes. Therefore, it is unlikely that the target vehicle will strictly maintain a direction parallel to the length of the lane. Consequently, in the above processing method, the speed determined based on the distance between the target vehicle and the lane in two images has a large error. Therefore, the accuracy of the speed of the target vehicle in the second image is low. Summary of the Invention
[0005] To address the aforementioned technical problems, the technical solution adopted by this invention is as follows:
[0006] According to one aspect of this disclosure, a data processing method is provided, the method comprising the following steps:
[0007] S100, Obtain the target image set to be processed, A = (a1, a2, ..., a...). j ,...,a m ), j = 1, 2, ..., m; where a j Let f1 be the j-th image to be processed in A, where each image to be processed is any image in the target video, and each image to be processed includes an image of the first target object; m is the number of images to be processed in A, where m ≥ 2; f1 < f2 < ... < f j <...<f m ;f j For a j The number of frames in the target video.
[0008] S200, acquire the first target object in a m The speed of movement v in m ;v m The following conditions must be met:
[0009] v m =β*v 目标 +(1-β)*(C1 m / C2 m ) / tb.width m ; where v 目标 For the target velocity, when m = 2, v 目标 =v def v def ≥0, v def The preset speed; when m > 2, v 目标 =v m-1 v m-1 For the first target object in a m-1 The movement speed in the middle; β is the preset weighting coefficient; C1 m For a m The corresponding first parameter, C2 m For a m The corresponding second parameter; tb.width m For a m The length of the image of the first target object.
[0010] C1 m The following conditions must be met:
[0011] C1 m =(|x m -x m-1 |+|y m -y m-1 |).
[0012] Where, x m For a m The x-coordinate of the center point of the image of the first target object; m-1 For a m-1 The x-coordinate of the center point of the image of the first target object; y m For a m The ordinate of the center point of the image of the first target object; y m-1 For a m-1 The ordinate of the center point of the image of the first target object.
[0013] C2 m The following conditions must be met:
[0014] C2 m =Δf m *γ.
[0015] Among them, a m The corresponding frame rate difference Δf m =f m -f m-1 γ is a preset coefficient obtained based on the image refresh rate of the target video.
[0016] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is also provided, wherein at least one instruction or at least one program is stored in the storage medium, and the at least one instruction or at least one program is loaded and executed by a processor to implement the above-described data processing method.
[0017] According to another aspect of this disclosure, an electronic device is also provided, including a processor and the aforementioned non-transitory computer-readable storage medium.
[0018] The present invention has at least the following beneficial effects:
[0019] Therefore, in this invention, v can be used m =β*v 目标 +(1-β)*(C1 m / C2 m ) / tb.width m C1 m =(|x m -x m-1 |+|y m -y m-1 |) and C2 m =Δf m *γ determines a in the target image set A to be processed. m The moving speed of the first target object. Compared to the speed of the first target object at a. m-1 and a m The spacing along the length of the lane, and the generation of a in the target video. m-1 and a m The time difference determines the location of the first target object in a. m The moving speed in the invention, C1 m Equivalent to the first target object being at a m-1 With a m The distance between them, C2 m *tb.width m Equivalent to the first target object being at a m-1 With a m The travel time between them, therefore (C1) m / C2 m ) / tb.width m Equivalent to the first target object being at a m-1 With a mThe speed of movement between them, due to C1 m =(|x m -x m-1 |+|y m -y m-1 |), i.e., C1 m Taking into account the first target object in a m-1 With a m The displacements between them along multiple directions, and then based on (C1) m / C2 m ) / tb.width m The determined v m As the primary target in a m The error in the moving speed is small, therefore the a determined in this invention is... m The accuracy of the movement speed of the first target object is relatively high.
[0020] Furthermore, C2 of the present invention m =Δf m Δf in *γ m For a m With a m-1 The frame difference between the two images, compared to related technologies that can only calculate the velocity of the first target object from two adjacent images in the time dimension, allows for velocity calculation in this invention. m With a m-1 Even if the images are not two adjacent frames in the target video, it is still possible to determine a. m The speed at which the first target object moves in the video is such that even if the first target object in any frame of the target video is not detected due to occlusion or other reasons, the next frame image (a) can still be determined. m The moving speed of the first target in the middle, at this time a m-1 This can be a previous frame of the image or an image preceding the previous frame of the image, reducing the likelihood that the movement speed of the first target object in subsequent images cannot be determined when the first target object is not detected in any frame of the target video.
[0021] Furthermore, this invention also takes into account the relationship with v m negatively correlated tb.width m That is, the image of the first target object is taken into account in a m The length in the image, on the one hand, for different target objects, the image of the target object in a m The greater the length in the image, the larger the target object generally is, and the slower the target object generally moves. On the other hand, for the same target object, the image of the target object in a... mThe smaller the length in the image, the more likely the target object is moving at an angle to the lane length. Therefore, the image of the first target object is in a... m The smaller the length in a, the better the image of the first target object is in a m The actual movement speed in the game is generally greater, and thus through v m =β*v 目标 +(1-β)*(C1 m / C2 m ) / tb.width m The determined v m The accuracy is relatively high.
[0022] Additionally, v m It can be combined with v 目标 Once determined, we can then consider a in A. m The previous image a m-1 The moving speed of the first target in the middle is related to v m The influence can further improve the determined v m The accuracy. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 A flowchart of a data processing method provided in an embodiment of the present invention.
[0025] Figure 2 This is a schematic diagram of the image to be detected provided in an embodiment of the present invention. Detailed Implementation
[0026] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0027] This invention provides a data processing method, which can be performed by any one or any combination of the following: a terminal, a server, or other devices with processing capabilities. This invention does not limit the scope of the methods described.
[0028] The following will refer to Figure 1The flowchart shown introduces the data processing method.
[0029] The method includes the following steps:
[0030] S100, Obtain the target image set to be processed, A = (a1, a2, ..., a...). j ,...,a m ), j = 1, 2, ..., m.
[0031] Among them, a j Let f1 be the j-th image to be processed in A, where each image to be processed is any image in the target video, and each image to be processed includes an image of the first target object; m is the number of images to be processed in A, where m ≥ 2; f1 < f2 < ... < f j <...<f m ;f j For a j The number of frames in the target video.
[0032] Specifically, the target video can be a surveillance video of the lane taken from above by a monitor within a preset time period. During the video generation process, the monitor's viewing angle and monitoring range are fixed, and the target object can be a vehicle traveling in the lane. The preset time period identifier can be the start time of the preset time period, which includes information such as year, month, day, hour, minute, and / or second.
[0033] In one possible implementation, the target video can be deframed to obtain several images to be detected. Then, target detection can be performed on each image to obtain the bounding box information and type information of each target object in each image. For example, the YOLOv7 target detection algorithm can be used to process each image to obtain the bounding box information and type information of each target object in each image. At this point, each image to be detected can be treated as an image to be processed to obtain A.
[0034] For example, a schematic diagram of the image to be detected can be as follows: Figure 2 As shown, M1 is the uphill lane, M2 is the downhill lane, L1 is the vehicle traveling on M1, arrow 1 indicates the direction of travel of L1, L2 is the vehicle traveling on M2, and arrow 2 indicates the direction of travel of L2.
[0035] The detection box information can be a rectangle, and its information includes the center coordinates, length, and width of the detection box. Each target object in the image to be detected is located within its corresponding detection box. The larger the target object's image in the image to be detected, the larger its corresponding detection box. The type information can be a label indicating whether the target object is a bus, truck, or car, for example, a truck would have type information of 1, and a bus would have type information of 2. Furthermore, the horizontal axis of the image to be detected can be parallel to the length of the lane, and the vertical axis can be parallel to the width of the lane. Since each image to be detected is an image from the target video, the coordinate axes for each image are the same.
[0036] In another possible implementation, after performing frame deframe operation on the target video, a cropping box can be drawn for each image obtained from the frame deframe operation. The cropping boxes for each image obtained from the frame deframe operation are the same. Then, each image obtained from the frame deframe operation is cropped to remove the part outside the cropping box in the image obtained from the frame deframe operation, and a cropped image is obtained. At this time, each cropped image can be used as a detection image to reduce the interference of roadside parking areas and other objects on the target detection process.
[0037] S200, acquire the first target object in a m The speed of movement v in m ;v m The following conditions must be met:
[0038] v m =β*v 目标 +(1-β)*(C1 m / C2 m ) / tb.width m ; where v 目标 For the target velocity, when m = 2, v 目标 =v def v def ≥0, v def The preset speed; when m > 2, v 目标 =v m-1 v m-1 For the first target object in a m-1 The movement speed in the middle; β is the preset weighting coefficient; C1 m For a m The corresponding first parameter, C2 m For a m The corresponding second parameter; tb.width m For a mThe length of the image of the first target object in the image;
[0039] C1 m The following conditions must be met:
[0040] C1 m =(|x m -x m-1 |+|y m -y m-1 |);
[0041] Where, x m For a m The x-coordinate of the center point of the image of the first target object; m-1 For a m-1 The x-coordinate of the center point of the image of the first target object; y m For a m The ordinate of the center point of the image of the first target object; y m-1 For a m-1 The ordinate of the center point of the image of the first target object;
[0042] C2 m The following conditions must be met:
[0043] C2 m =Δf m *γ;
[0044] Among them, a m The corresponding frame rate difference Δf m =f m -f m-1 γ is a preset coefficient obtained based on the image refresh rate of the target video.
[0045] Specifically, v def It can be 0 or the speed limit value of the lane corresponding to the target video, etc., v m-1 Specific calculations and v m Similarly, the present invention will not be described in detail here. tb.width m It can be a m The detection box corresponding to the first target object in the image is along a. m The length along the horizontal axis, x m It can be a m The x-coordinate of the center point of the detection box corresponding to the first target object; m-1 It can be a m-1 The x-coordinate of the center point of the detection box corresponding to the first target object; y m It can be a m The ordinate of the center point of the detection box corresponding to the first target object; y m-1 It can be a m-1The ordinate of the center point of the detection box corresponding to the first target object. Based on this, C1 m With the first target object at a m-1 The corresponding image acquisition time up to a m The corresponding image acquisition times have similar shift distances, C2 m With the first target object at a m-1 The corresponding image acquisition time up to a m The corresponding image acquisition times are similar, and the image acquisition time can be the time it takes for the monitor to capture the corresponding image.
[0046] γ can be a preset coefficient obtained based on the image refresh rate of the target video. Specifically, if the image refresh rate is μ frames / second, then the initial γ can be set to (1 / μ), and then when γ = 1 / μ, v m The conditions that are met are used as the initial model for training. During the training process, the value of γ is adjusted until the loss value of the model is less than a preset threshold. At this point, the model is the v in this invention. m The conditions to be met. Optional, 1 / 700 < γ < 1 / 400; preferred, γ = 1 / 570.
[0047] After performing frame decoding on the target video, the 1st, 1+α, 1+2*α, 1+3*α, ... frames of the target video can be sequentially obtained as the images to be detected. Based on this, f m =(N m -1)*α+1,N m For obtaining a m The ordinal number of the corresponding image to be detected, f m-1 =(N m-1 -1)*δ+1,N m-1 For obtaining a m-1 The corresponding ordinal number of the image to be detected, and thus, Δf m =(N m -N m-1 )*δ. Optional, α > 0, preferred, α = 5.
[0048] For example, if a m The corresponding image to be detected is the first frame of the target video, then N m =1; if a m The corresponding image to be detected is the (1+α)th frame of the target video, then N m =2; if a m The corresponding image to be detected is the 1+2*αth frame of the target video, then N m =3.
[0049] Therefore, in this invention, v can be used m =β*v目标 +(1-β)*(C1 m / C2 m ) / tb.width m C1 m =(|x m -x m-1 |+|y m -y m-1 |) and C2 m =Δf m *γ determines a in the target image set A to be processed. m The moving speed of the first target object. Compared to the speed of the first target object at a. m-1 and a m The spacing along the length of the lane, and the generation of a in the target video. m-1 and a m The time difference determines the location of the first target object in a. m The moving speed in the invention, C1 m Equivalent to the first target object being at a m-1 With a m The distance between them, C2 m *tb.width m Equivalent to the first target object being at a m-1 With a m The travel time between them, therefore (C1) m / C2 m ) / tb.width m Equivalent to the first target object being at a m-1 With a m The speed of movement between them, due to C1 m =(|x m -x m-1 |+|y m -y m-1 |), i.e., C1 m Taking into account the first target object in a m-1 With a m The displacements between them along multiple directions, and then based on (C1) m / C2 m ) / tb.width m The determined v m As the primary target in a m The error in the moving speed is small, therefore the a determined in this invention is... m The accuracy of the movement speed of the first target object is relatively high.
[0050] Furthermore, C2 of the present invention m =Δf m Δf in *γ m For am With a m-1 The frame difference between the two images, compared to related technologies that can only calculate the velocity of the first target object from two adjacent images in the time dimension, allows for velocity calculation in this invention. m With a m-1 Even if the images are not two adjacent frames in the target video, it is still possible to determine a. m The speed at which the first target object moves in the video is such that even if the first target object in any frame of the target video is not detected due to occlusion or other reasons, the next frame image (a) can still be determined. m The moving speed of the first target in the middle, at this time a m-1 This can be a previous frame of the image or an image preceding the previous frame of the image, reducing the likelihood that the movement speed of the first target object in subsequent images cannot be determined when the first target object is not detected in any frame of the target video.
[0051] Furthermore, this invention also takes into account the relationship with v m negatively correlated tb.width m That is, the image of the first target object is taken into account in a m The length in the image, on the one hand, for different target objects, the image of the target object in a m The greater the length in the image, the larger the target object generally is, and the slower the target object generally moves. On the other hand, for the same target object, the image of the target object in a... m The smaller the length in the image, the more likely the target object is moving at an angle to the lane length. Therefore, the image of the first target object is in a... m The smaller the length in a, the better the image of the first target object is in a m The actual movement speed in the game is generally greater, and thus through v m =β*v 目标 +(1-β)*(C1 m / C2 m ) / tb.width m The determined v m The accuracy is relatively high.
[0052] Additionally, v m It can be combined with v 目标 Once determined, we can then consider a in A. m The previous image a m-1 The moving speed of the first target in the middle is related to v m The influence can further improve the determined v m The accuracy.
[0053] Optionally, prior to step S100, the method further includes the following steps:
[0054] S300: Obtain the target image corresponding to the target video.
[0055] S400, determine whether there is an image of the target object in the target image; if so, proceed to step S500.
[0056] S500, determine the region information set W = (w1, w2, ..., w) in the target image. i ,...,w n ), i = 1, 2, ..., n.
[0057] Among them, w i This represents the region information of the target area corresponding to the image of the i-th target object in the target image, where n is the number of images of the target objects in the target image.
[0058] S600, Get the list of images to be updated: PIC = (pic1, pic2, ..., pic v ,...,pic h ), v = 1, 2, ..., h.
[0059] Among them, pic v Let be the v-th image set to be updated in PIC, and h be the number of image sets to be updated in PIC; each image set to be updated includes at least one historical image, and each historical image is an image from the target video; each image set to be updated has a unique corresponding target object, and each historical image in the same image set to be updated includes an image of the target object corresponding to its image set to be updated.
[0060] S700, based on PIC, obtain the prediction region information set D = (d1, d2, ..., d v ,...,d h ).
[0061] Where, d v According to pic v Each historical image in the pic v The corresponding prediction area information.
[0062] S800, if d v with w i If the matching criteria are met, the target image will be added to the pic. v middle.
[0063] S900, if pic v If the total number of historical images in the image is greater than 2, then the image will be... v The image set is marked as the set to be processed and proceeds to step S100.
[0064] Wherein, the target image set A to be processed is any image set to be processed.
[0065] Specifically, the target image can be any image to be detected, the target region can be the region within the detection box of the corresponding target object, and the region information can be the detection box information of the corresponding detection box. Based on this, if any predicted region information and any region information simultaneously satisfy the following conditions: the distance between the center point of the detection box corresponding to the predicted region information and the center point of the detection box corresponding to the region information is less than a first threshold; the difference between the length of the detection box corresponding to the predicted region information and the length of the detection box corresponding to the region information is less than a second threshold; and the difference between the width of the detection box corresponding to the predicted region information and the width of the detection box corresponding to the region information is less than a third threshold, then it is said that the predicted region information and the region information meet the matching conditions. The first threshold, the second threshold, and the third threshold are all greater than 0.
[0066] Furthermore, the historical images in each image set to be updated are arranged in ascending order of their frame number in the target video. In step S600 above, the frame number corresponding to each historical image in the PIC is smaller than the frame number corresponding to the target image. In step S700 above, the PIC... v The corresponding prediction region information is based on pic v Each historical image in the image is predicted, pic v The corresponding prediction region information can be pic v The corresponding target object's region information within the target image. Wherein, pic v The corresponding prediction region information can be based on pic v And determined by Kalman filtering. The pic in step S900 above... v The set of images to be processed that already have the target image added to the PIC.
[0067] In one possible implementation, when the target video reaches 1+δ*α frames, this 1+δ*α frame image can be used as the target image, where δ is equal to 0 or a positive integer greater than 0. Then, the set of images to be processed can be determined through steps S400 to S900. When the target video reaches the first frame, the PIC in step S600 is an empty set. When the target video reaches 1+δ*α frames, the processing of the previous target image based on this data processing method has been completed. At this time, the PIC in step S600 is the PIC obtained after processing the previous target image based on this data processing method. Therefore, in this invention, each set of images to be processed corresponding to the same target object can be determined.
[0068] Optionally, step S800 includes the following steps:
[0069] S810, each image set to be updated in the PIC with a number of historical images greater than def1 is determined as the first image set, so as to obtain the first image set list PIC. 1 =(pic1) 1 ,pic2 1 ,...,pic s 1 ,...,pic u 1 ), s=1,2,...,u,u≤h.
[0070] Where u represents the number of historical images contained in PIC that is greater than the number of images to be updated in def1, and pic s 1 For PIC 1 The s-th first image set in the middle.
[0071] S820, obtain the prediction region information corresponding to each first image set in D, and obtain D. 1 =(d1) 1 ,d2 1 ,...,d s 1 ,...,d u 1 ).
[0072] Where, d s 1 For pic s 1 The corresponding prediction area information.
[0073] S830, if d s 1 with w i If the matching criteria are met, the target image will be added to the pic. s 1 middle.
[0074] Specifically, def1 > 0, for example, def1 = 3.
[0075] In one possible implementation, the pic in step S830 above s 1 This refers to a set of images to be updated in a PIC, which is then used to add the target image to the PIC. s 1 This means adding the target image to the PIC.
[0076] Therefore, the more images in the image set to be updated, the more accurate the predicted region information will be based on that image set. 1The number of historical images in each first image set exceeds def1, and thus D 1 The information for each predicted region in the D is relatively accurate. In this invention, the information is obtained through D. 1 d in s 1 with w i If the matching criteria are met, add the target image to the pic. s 1 In this context, for any target object in an image set to be updated that has already had a target image added, the likelihood that the target image does not include the target object can be reduced, thereby improving the accuracy of adding target images to at least a portion of the image sets to be updated in the PIC.
[0077] Based on the above scheme that when the target video reaches 1+δ*α frames, the image of the 1+δ*α frame can be used as the target image, after step S830, the method further includes:
[0078] D 1 The image set to be updated corresponding to the predicted region information in W where each region information does not meet the matching condition is taken as the first image set to be deleted. For each first image set to be deleted, it is determined whether the number of consecutive g images of the target images not added to the first image set to be deleted has reached g. If so, the first image set to be deleted is deleted from the PIC. g > 0, preferably g = 10.
[0079] Optionally, after step S830, step S800 further includes the following steps:
[0080] S840, determine whether the number of the first image set with added target images is equal to n; if yes, proceed to step S900, otherwise proceed to step S850.
[0081] S850, each image set to be updated that has a number of historical images of the PIC less than or equal to def1 is identified as the second image set, thus obtaining the second image set list PIC. 2 =(pic1) 2 ,pic2 2 ,...,pic r 2 ,...,pic t 2 ), r=1,2,...,t,t+u=h.
[0082] Where t is the number of historical images in PIC that are less than or equal to the number of images to be updated in the image set to def1, and pic r 2 For PIC 2 The r-th second image set;
[0083] S860, obtain the prediction region information corresponding to each second image set in D, and obtain D. 2 =(d1) 2 ,d2 2 ,...,d r 2 ,...,d t 2 ).
[0084] Where, d r 2 For pic r 2 The corresponding prediction area information.
[0085] S870, if d r 2 with w i If the matching criteria are met, the target image will be added to the pic. r 2 .
[0086] In one possible implementation, the pic in step S870 above r 2 This refers to a set of images to be updated in a PIC, which is then used to add the target image to the PIC. r 2 This means adding the target image to the PIC.
[0087] Therefore, since n is the number of images of target objects in the target image, if the number of images in the first image set after step S830 is equal to n, it indicates that there is a high probability that each target object in the target image has been correctly identified in its corresponding first image set. Compared to the related technology of matching each region information in W with each predicted region information in D, if d v with w i If the matching criteria are met, the target image will be added to the pic. v In this scheme, if the number of the first image set containing the target image is equal to n after step S830, it is not necessary to continue to identify whether the target object corresponding to the image set to be updated in the PIC other than the first image set is any target object in the target image. This can save computing resources and improve processing efficiency.
[0088] Optionally, after step S860, the method may further include:
[0089] D 2The image set to be updated corresponding to the predicted region information in W where each region information does not meet the matching condition is taken as the second image set to be deleted. For each second image set to be deleted, it is determined whether the target images not added to the second image set to be deleted have reached a consecutive number of g images. If so, the second image set to be deleted is deleted from the PIC.
[0090] Optionally, after step S830 and before step S870, the method further includes:
[0091] If the number of images in the first image set that has already been added to the target image is not equal to n, then obtain W from W. 1 =(w1) 1 w2 1 ,...,w var 1 ,...,w vor 1 ), var=1,2,...,vor, vor≤n.
[0092] Among them, w var 1 For W and D 1 Each predicted region in W does not meet the matching criteria for the var-th region, where vor is the region in W that matches D. 1 The number of regions in each predicted region that do not meet the matching criteria.
[0093] Based on this, step S870 includes the following steps:
[0094] S871, if d r 2 with w var 1 If the matching criteria are met, the target image will be added to the pic. r 2 .
[0095] Therefore, if the number of images in the first image set that have been added to the target image is not equal to n after step S830, then for W and D 1 If any predicted region information in the data matches any region information that meets the matching criteria, then there is no need to determine d again. r 2 Matching information with the region's criteria can save computing resources and improve processing efficiency.
[0096] Optionally, before step S810, step S800 further includes:
[0097] S880, determine whether there is a set of historical images in the PIC that has a number greater than the preset number def1 to be updated; if so, proceed to step S810; otherwise, proceed to step S850.
[0098] Optionally, after step S840, the method further includes the following steps:
[0099] S1100, determine whether there is any region information in W that does not meet the matching conditions of each predicted region information in D; if so, proceed to step S1200.
[0100] S1200, take the information of each predicted region in W that does not meet the matching condition with the information in D as the target information, so as to obtain the target information set W. 1 =(w1) 1 w2 1 ,...,w a 1 ,...,w b 1 ), a = 1, 2, ..., b, b ≤ n.
[0101] Where b represents the region information in W that does not meet the matching conditions with each predicted region information in D, and w a 1 For W 1 The a-th target information.
[0102] S1300, Generate a supplementary image set corresponding to each target information to obtain a supplementary image list REP = (rep1, rep2, ..., rep...). a ,...,rep b ).
[0103] Among them, rep a For w a 1 Corresponding supplementary image set; rep a Includes the target image;
[0104] S1400, rep a Add it to the PIC as an image set to be updated.
[0105] Among them, rep a The corresponding target object is w a 1 The corresponding target object.
[0106] Therefore, by using the region information in W and D that does not meet the matching conditions, the target image is added to the PIC as an image set to be updated corresponding to the target object corresponding to that region information. This can reduce the possibility that if a target object is not identified in the previous image of the target video, the region information of that target object in the subsequent image of the target video cannot match any of the predicted region information, thereby reducing the possibility of not obtaining an image set to be updated corresponding to any target object in the target video.
[0107] Optionally, the historical images in each image set to be updated are arranged in ascending order of their frame number in the target video;
[0108] Following step S800, the method further includes the following steps:
[0109] S1500 performs a counting process for each set of images to be updated for which target images have been added.
[0110] The target image is the last image in each set of images to be updated that has already had a target image added to it;
[0111] The counting process includes the following steps:
[0112] S1510, the set of images to be updated for counting processing is taken as the current set.
[0113] S1520, the target region of the target object corresponding to the last image in the current set is taken as the first target region.
[0114] S1530, the target region of the target object corresponding to the previous image of the last image in the current set is taken as the second target region.
[0115] S1540, Determine whether the x-coordinate X1 of the center point of the first target area and the x-coordinate X2 of the center point of the second target area satisfy X1≤X pre1 If ≤X2; if yes, store the target object identifier of the target object corresponding to the current set and the preset first position identifier as a data group in the preset first configuration file, and proceed to step S1560; otherwise, proceed to step S1550.
[0116] Each target identifier uniquely corresponds to its corresponding target; the data groups stored in the preset first configuration file are arranged according to storage time; X pre1 This is the first preset value.
[0117] S1550, Determine whether X1 and X2 satisfy X1≤X pre2If ≤X2; if yes, store the target object identifier of the target object corresponding to the current set and the preset second position identifier as a data group in the preset first configuration file, and proceed to step S1560; otherwise, end the counting process.
[0118] Among them, X pre2 X is the second preset value. pre1 ≠X pre2 The second position identifier is different from the first position identifier.
[0119] S1560, determine whether the number of data groups in the preset first configuration file that include the target object identifier of the target object corresponding to the current set reaches 2; if yes, proceed to step S1570; otherwise, end the counting process.
[0120] S1570, determine whether the first data group in the preset first configuration file, which includes the target object identifier of the target object corresponding to the current set, includes the first position identifier; if so, obtain num1 = num1 + 1; otherwise, obtain num2 = num2 + 1.
[0121] In one possible implementation, the expression is x = X. pre1 After visualizing the straight line, it can be used as Figure 2 The first line pre1 in the equation is expressed as x = X pre2 After visualizing the straight line, it can be used as Figure 2 The second straight line pre2. Based on this, in step S1570, if the data group arranged first includes the first position identifier, it means that the target object corresponding to the data group passes through the first straight line pre1 and then the second straight line pre2. At this time, num1 plus 1 can be used as the number of vehicles going uphill, num1. 1 In step S1570, if the data group at the beginning does not include the first position identifier, it means that the target object corresponding to the data group passed through the second straight line pre2 before passing through the first straight line pre1. In this case, num2 plus 1 can be used as the number of downhill vehicles num2. 1 Before applying this method to the first frame of the target video, the initial values of num1 and num2 are both 0.
[0122] Optionally, 0 < β < 0.5; preferably, β = 0.3.
[0123] In another possible implementation, after obtaining num1 plus 1, num1 1 = &*num11+(1-&)*num1, after obtaining num2 after adding 1, num2 1=&*num21+(1-&)*num2, 0.2≤&≤0.8, num11 is the number of uphill vehicles in the target video up to the target image obtained by other means, and num21 is the number of downhill vehicles in the target video up to the target image obtained by other means. Other means can be big data traffic flow calculation methods such as statistics from relevant departments.
[0124] Embodiments of the present invention also provide a non-transitory computer-readable storage medium that can be disposed in an electronic device to store at least one instruction or at least one program related to implementing a method in the method embodiments, wherein the at least one instruction or the at least one program is loaded and executed by the processor to implement the method provided in the above embodiments.
[0125] Embodiments of the present invention also provide an electronic device, including a processor and the aforementioned non-transitory computer-readable storage medium.
[0126] Embodiments of the present invention also provide a computer program product including program code, which, when the program product is run on an electronic device, causes the electronic device to perform the steps of the methods described above in various exemplary embodiments of the present invention.
[0127] While specific embodiments of the invention have been described in detail by way of example, those skilled in the art should understand that the above examples are for illustrative purposes only and are not intended to limit the scope of the invention. Those skilled in the art should also understand that various modifications can be made to the embodiments without departing from the scope and spirit of the invention. The scope of the invention is defined by the appended claims.
Claims
1. A data processing method, characterized in that, The method includes the following steps: S100, Obtain the target image set to be processed, A=(a1,a2,...,a...). j ,...,a m ), j=1,2,...,m; where a j Let f1 be the j-th image to be processed in A, where the image to be processed is any image in the target video, and each image to be processed includes an image of the first target object; m is the number of images to be processed in A, where m ≥ 2; f1 < f2 < ... < f j <...<f m ;f j For a j The number of frames in the target video; S200, obtain the first target object in a m Movement speed v m ;v m The following conditions must be met: ; where v 目 标 For the target velocity, when m=2, v 目 标 =v def v def ≥0, v def The preset speed; when m > 2, v 目 标 =v m-1 v m-1 For the first target object in a m-1 The movement speed in the middle; β is the preset weighting coefficient; C1 m For a m The corresponding first parameter, C2 m For a m The corresponding second parameter; tb.width m For a m The length of the image of the first target object; C1 m The following conditions must be met: C1 m =(|x m –x m-1 |+|y m -y m-1 |); Where, x m For a m The x-coordinate of the center point of the image of the first target object; m-1 For a m-1 The x-coordinate of the center point of the image of the first target object; y m For a m The ordinate of the center point of the image of the first target object; y m-1 For a m-1 The ordinate of the center point of the image of the first target object; C2 m The following conditions must be met: ; Among them, a m The corresponding frame rate difference Δf m =f m -f m-1 γ is a preset coefficient obtained based on the image refresh rate of the target video.
2. The method according to claim 1, characterized in that, Prior to step S100, the method further includes the following steps: S300, acquire the target image corresponding to the target video; S400, determine whether there is an image of the target object in the target image; if so, proceed to step S500; S500, determine the region information set W=(w1,w2,...,w) in the target image. i ,...,w n ), i=1,2,...,n; where w i The region information of the target region corresponding to the image of the i-th target object in the target image, where n is the number of images of the target objects in the target image; S600, Get the list of images to be updated: PIC=(pic1,pic2,...,pic v ,...,pic h ), v=1,2,...,h; where, pic v Let h be the vth image set to be updated in the PIC, and h be the number of image sets to be updated in the PIC. Each image set to be updated includes at least one historical image, and each historical image is an image in the target video. Each image set to be updated has a unique corresponding target object, and each historical image in the same image set to be updated includes an image of the target object corresponding to its image set to be updated. S700, based on the PIC, obtain the prediction region information set D=(d1,d2,...,d v ,...,d h ), where d v According to pic v Each historical image in the pic v Corresponding prediction area information; S800, if d v With w i If the matching criteria are met, the target image is added to the pic. v middle; S900, if pic v If the total number of historical images in the image is greater than 2, then the image will be... v The image set to be processed is marked as such, and the process proceeds to step S100; the target image set to be processed A is any of the image sets to be processed.
3. The method according to claim 2, characterized in that, Step S800 includes the following steps: S810, each image set to be updated in the PIC with a number of historical images greater than def1 is determined as the first image set, so as to obtain the first image set list PIC. 1 =(pic1 1 ,pic2 1 ,...,pic s 1 ,...,pic u 1 ), s=1,2,...,u,u≤h; where u is the number of historical images in PIC that is greater than the number of images to be updated in def1, pic s 1 For PIC 1 The s-th first image set; S820, obtain the prediction region information corresponding to each of the first image sets in D, and obtain D. 1 =(d1 1 ,d2 1 ,...,d s 1 ,...,d u 1 ); where d s 1 For pic s 1 Corresponding prediction area information; S830, if d s 1 With w i If the matching criteria are met, the target image is added to the pic. s 1 middle.
4. The method according to claim 3, characterized in that, After step S830, step S800 further includes the following steps: S840, determine whether the number of the first image set to which the target image has been added is equal to n; if yes, proceed to step S900, otherwise proceed to step S850; S850, each image set to be updated that has a number of historical images of the PIC less than or equal to def1 is identified as the second image set, thus obtaining the second image set list PIC. 2 =(pic1 2 ,pic2 2 ,...,pic r 2 ,...,pic t 2 ), r=1,2,...,t,t+u=h;t is the number of historical images in the PIC that are less than or equal to the number of images to be updated in def1, pic r 2 For PIC 2 The r-th second image set; S860, obtain the prediction region information corresponding to each of the second image sets in D, and obtain D. 2 =(d1 2 ,d2 2 ,...,d r 2 ,...,d t 2 ); where d r 2 For pic r 2 Corresponding prediction area information; S870, if d r 2 With w i If the matching criteria are met, the target image is added to the pic. r 2 .
5. The method according to claim 4, characterized in that, Before step S810, step S800 further includes: S880, determine whether there is a set of historical images in the PIC that has a number greater than the preset number def1 to be updated; if so, proceed to step S810; otherwise, proceed to step S850.
6. The method according to claim 4, characterized in that, Following step S840, the method further includes the following steps: S1100, determine whether there is any region information in W that does not meet the matching conditions for each predicted region information in D; if so, proceed to step S1200. S1200, each region in W that does not meet the matching condition with any predicted region in D is taken as target information to obtain the target information set W. 1 =(w1 1 w2 1 ,...,w a 1 ,...,w b 1 ), a=1,2,...,b, b≤n; where b is the region information in W that does not meet the matching condition for any predicted region information in D, w a 1 For W 1 The a-th target information; S1300, Generate a supplementary image set corresponding to each target information to obtain a supplementary image list REP=(rep1,rep2,...,rep a ,...,rep b ); where rep a For w a 1 Corresponding supplementary image set; rep a Including the target image; S1400, rep a Added to the PIC as an image set to be updated; rep a The corresponding target object is w a 1 The corresponding target object.
7. The method according to any one of claims 2-4, characterized in that, The historical images in each of the image sets to be updated are arranged in ascending order of their frame number in the target video; Following step S800, the method further includes the following steps: S1500, a counting process is performed for each set of images to be updated that has had the target image added; the target image is the last image in each set of images to be updated that has had the target image added. The counting process includes the following steps: S1510, the set of images to be updated for the counting process is taken as the current set; S1520, the target region of the target object corresponding to the last image in the current set is taken as the first target region; S1530, the target region of the target object corresponding to the previous image of the last image in the current set is taken as the second target region; S1540, Determine whether the x-coordinate X1 of the center point of the first target area and the x-coordinate X2 of the center point of the second target area satisfy X1≤X pre1 ≤X2; if yes, then store the target object identifier and the preset first location identifier of the target object corresponding to the current set as a data group in the preset first configuration file, and proceed to step S1560; otherwise, proceed to step S1550; each target object identifier uniquely corresponds to the corresponding target object; the data groups stored in the preset first configuration file are arranged according to storage time; X pre1 The first preset value; S1550, Determine whether X1 and X2 satisfy X1≤X pre2 ≤X2; if yes, then store the target object identifier and the preset second location identifier of the target object corresponding to the current set as a data group in the preset first configuration file, and proceed to step S1560; otherwise, end the counting process; X pre2 X is the second preset value. pre1 ≠X pre2 The second location identifier is different from the first location identifier. S1560, determine whether the number of data groups in the preset first configuration file that include the target object identifier of the target object corresponding to the current set reaches 2; if yes, proceed to step S1570; otherwise, end the counting process. S1570, determine whether the first data group in the preset first configuration file, which includes the target object identifier of the target object corresponding to the current set, includes the first position identifier; if yes, obtain num1=num1+1; otherwise, obtain num2=num2+1.
8. The method according to claim 1, characterized in that, 0<β<0.5。 9. A non-transitory computer-readable storage medium, wherein the storage medium stores at least one instruction or at least one program segment, characterized in that, The at least one instruction or the at least one program segment is loaded and executed by the processor to implement the method as described in any one of claims 1-8.
10. An electronic device, characterized in that, Includes a processor and the non-transitory computer-readable storage medium of claim 9.