Sports helmet recognition and tracking method and device in complex traffic scenes

By determining and tracking the targets in the surveillance video in complex traffic scenarios, generating corresponding data sets, and determining the tracking results based on border position and status information, the problem of low accuracy in sports helmet recognition and tracking in complex traffic scenarios is solved. Achieve higher identification accuracy.

CN118942045BActive Publication Date: 2025-02-11CHENGDU UNIVERSITY OF TECHNOLOGY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411423038.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2025-02-11
Estimated Expiration
2044-10-12

AI Technical Summary

Technical Problem

In complex traffic scenarios, the existing sports helmet recognition and tracking methods are not very accurate, resulting in certain errors in helmet recognition and tracking.

Method used

By determining the tracking target in the monitoring video, the target is tracked using a preset tracking algorithm, and a first data set and a second data set are generated, and the tracking results are determined based on the border position information and status information, thereby improving the accuracy of helmet recognition.

Benefits of technology

The accuracy of sports helmet recognition in complex traffic scenarios has been improved, and the problem of low accuracy in the prior art has been solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118942045B_ABST
    Figure CN118942045B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for identifying and tracking sports helmets in complex traffic scenes. The method comprises the following steps: determining a tracking target according to a monitoring video; tracking the tracking target according to a preset tracking algorithm, and generating a corresponding first data set and a second data set; determining the first frame overlap of each tracking target between the first data set and the second data set according to the frame position information; when the first frame overlap meets the first threshold condition, determining the tracking result according to the state information and matching number information corresponding to the corresponding tracking target. The first data set and the second data set are generated by tracking and classifying the tracking target, and the tracking result is determined according to the state information and matching number information of the tracking target in the two data sets. The method solves the technical problem of low accuracy of the sports helmet identification and tracking method in complex traffic scenes in the prior art, and ensures the accuracy of sports helmet identification in complex traffic scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer vision technology, and in particular to a method and device for identifying and tracking sports helmets in complex traffic scenes. Background Art

[0002] With the development of society, motorcycles and electric bicycles are accepted and used by more and more people as a convenient means of transportation. However, while these vehicles bring convenience, they also bring certain safety issues. Among them, the problem of motorcycle and electric bicycle drivers not wearing safety helmets is particularly prominent. According to statistics, wearing safety helmets can reduce the injury rate of riders by 70% and the mortality rate by 40%. Therefore, how to regulate their riding behavior by identifying whether riders are wearing safety helmets is one of the important ways to reduce traffic safety accidents.

[0003] The existing safety helmet inspection method usually adopts a combination of manual inspection and image recognition, with traffic police law enforcement personnel enforcing the law on site, or detecting and identifying through identifying monitoring images. In the process of implementing the technical solution of the invention in the embodiment of the present application, the inventor of the present application found that the above technology has at least the following technical problems: in complex traffic scenes, due to the complex situation, there are often certain errors in the identification and tracking of helmets. Summary of the invention

[0004] In view of the above problems, the embodiments of the present invention solve the technical problem of low accuracy of sports helmet recognition and tracking methods in complex traffic scenes in the prior art by providing a sports helmet recognition and tracking method and device in complex traffic scenes, thereby ensuring the accuracy of sports helmet recognition in complex traffic scenes.

[0005] The embodiments of the present application provide a method and device for identifying and tracking sports helmets in complex traffic scenarios.

[0006] In a first aspect, the present invention provides a method and device for identifying and tracking sports helmets in complex traffic scenarios, comprising the following steps:

[0007] Determine a tracking target according to the surveillance video, wherein the tracking target is determined by a target recognition result, the target recognition result refers to an electric vehicle, a person or helmet wearing information, the helmet wearing information refers to whether a helmet is worn or not worn, and each tracking target includes image information related to the electric vehicle, the person and the helmet wearing information;

[0008] According to a preset tracking algorithm, the tracking target is tracked, and a corresponding first data set and a second data set are generated, wherein the first data set and the second data set are determined according to the helmet wearing information, and the first data set and the second data set respectively include at least one tracking information corresponding to the tracking target, and the tracking information includes a tracking ID, frame position information, helmet identification information, state information, and matching number information;

[0009] Determining, according to the frame position information, a first frame overlap degree of each tracked target between the first data set and the second data set;

[0010] When the first frame overlap degree meets the first threshold condition, the tracking result is determined according to the state information and the matching number information corresponding to the corresponding tracking target.

[0011] Preferably, determining the tracking target according to the surveillance video includes:

[0012] Perform target recognition on the surveillance video, obtain target recognition results, and generate recognition frame information corresponding to the target recognition results, wherein the recognition frame information includes recognition frame coordinate information related to the target recognition result, the recognition frame information of the person includes x1, y1, w1, and h1, the border information of the electric vehicle includes x2, y2, w2, and h2, and the recognition frame information of the helmet wearing information includes x3, y3, w3, and h3, where x1, y1, w1, and h1 refer to the x-axis coordinate, y-axis coordinate, border width, and border height of the recognition frame information of the person, respectively, x2, y2, w2, and h2 refer to the x-axis coordinate, y-axis coordinate, border width, and border height of the border information of the electric vehicle, respectively, and x3, y3, w3, and h3 refer to the x-axis coordinate, y-axis coordinate, border width, and border height of the recognition frame information of the helmet wearing information, respectively;

[0013] Determining the overlap degree of the second frame between each person and each electric vehicle according to the identification frame information;

[0014] When the second frame overlap satisfies the second threshold condition and y2>y1, determining the third frame overlap between each person and each helmet identification information according to the identification frame information;

[0015] When the third frame overlap degree satisfies the third threshold condition and y2>y1, determine whether y3≤y1 and x1<x3<x1+w1 are satisfied;

[0016] If yes, the tracking target and the frame position information corresponding to the tracking target are determined according to the corresponding target recognition result and the recognition frame information.

[0017] Preferably, the tracking target is tracked according to a preset tracking algorithm, and the corresponding first data set and second data set are generated, including:

[0018] Tracking the tracking target according to a preset tracking algorithm;

[0019] Generate tracking information related to the tracking target, wherein the tracking information includes a tracking ID, frame position information, helmet identification information, status information, and matching number information;

[0020] The tracking information is classified according to the helmet identification information to generate the first data set and the second data set.

[0021] Preferably, after the tracking information is classified according to the helmet identification information to generate the first data set and the second data set, the method further comprises:

[0022] Matching the current tracking information, and determining the number of matches of the current tracking information, wherein the number of matches refers to the number of tracking information with the same tracking ID as the current tracking information in the same data set;

[0023] Determine whether the number of matches is greater than 0;

[0024] If yes, update the matching number information of the current tracking information according to the matching number;

[0025] If not, updating the current tracking information into the corresponding data set according to the helmet identification information;

[0026] The state information of the current tracking information is set to an activated state.

[0027] Preferably, when the first frame overlap degree satisfies a first threshold condition, determining a tracking result according to state information and matching number information corresponding to a corresponding tracking target includes:

[0028] When the first frame overlap degree meets the first threshold condition, determining whether the state information between the two corresponding tracking targets are both in an activated state;

[0029] If so, determine the tracking target with the largest number of matching information;

[0030] Setting the state information corresponding to the tracking target to a re-identification state;

[0031] A tracking result is determined according to the status information.

[0032] Preferably, the tracking target is tracked according to a preset tracking algorithm to generate the corresponding first data set and second data set, and the preset tracking algorithm refers to one or more of Sort, DeepSort, and ByteTrack algorithms.

[0033] In a second aspect, the present invention also provides a method and device for identifying and tracking sports helmets in complex traffic scenarios, including:

[0034] A first determination module is used to determine a tracking target according to the monitoring video, wherein the tracking target is determined by a target recognition result, the target recognition result refers to an electric vehicle, a person or helmet wearing information, the helmet wearing information refers to whether a helmet is worn or not worn, and each tracking target includes image information related to the electric vehicle, the person and the helmet wearing information;

[0035] A tracking module, configured to track the tracking target according to a preset tracking algorithm, and generate a corresponding first data set and a second data set, wherein the first data set and the second data set are determined according to the helmet wearing information, and the first data set and the second data set respectively include at least one tracking information corresponding to the tracking target, and the tracking information includes a tracking ID, frame position information, helmet identification information, status information, and matching number information;

[0036] A second determination module, configured to determine, based on the frame position information, a first frame overlap degree of each tracked target between the first data set and the second data set;

[0037] The third determination module is used to determine the tracking result according to the state information and matching number information corresponding to the corresponding tracking target when the first frame overlap degree meets the first threshold condition.

[0038] In a third aspect, the present invention also provides an electronic device, comprising: a processor and a memory, wherein the processor is used to call a program in the memory so that the electronic device executes a method for identifying and tracking sports helmets in complex traffic scenarios.

[0039] In a fourth aspect, the present invention also provides a computer-readable storage medium, which stores instructions. When the instructions are executed, the computer executes a method for identifying and tracking sports helmets in complex traffic scenarios.

[0040] In a fifth aspect, the present invention also provides a computer program product, including a computer program, which, when executed, implements a method for identifying and tracking sports helmets in complex traffic scenarios.

[0041] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: by determining the target recognition result in the monitoring video, determining the tracking target, by tracking the tracking target, generating corresponding tracking information and classifying it, generating a first data set and a second data set, and determining the tracking result according to the state information and matching number information of the tracking target in the two data sets. The technical problem of low accuracy of the sports helmet recognition and tracking method in complex traffic scenes in the prior art is solved, and the accuracy of sports helmet recognition in complex traffic scenes is ensured. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 A flow chart of a sports helmet recognition and tracking method in a complex traffic scenario provided by an embodiment of the present application is shown;

[0043] Figure 2 A flow chart of a method for determining a tracking target provided by an embodiment of the present application is shown;

[0044] Figure 3 A schematic diagram of a tracking target provided by an embodiment of the present application is shown;

[0045] Figure 4 A flow chart of a method for generating a data set provided in an embodiment of the present application is shown;

[0046] Figure 5 A flow chart of a method for determining tracking results provided by an embodiment of the present application is shown;

[0047] Figure 6 A tracking schematic diagram before determining the tracking result is shown;

[0048] Figure 7 A schematic diagram of the tracking results is shown;

[0049] Figure 8 A schematic diagram of the structure of a sports helmet recognition and tracking device in a complex traffic scene provided by an embodiment of the present application is shown;

[0050] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown;

[0051] 400 - first determination module; 500 - tracking module; 600 - second determination module; 700 - third determination module. DETAILED DESCRIPTION

[0052] The embodiments of the present application solve the technical problem of low accuracy of sports helmet recognition and tracking methods in complex traffic scenes in the prior art by providing a sports helmet recognition and tracking method and device in complex traffic scenes, thereby ensuring the accuracy of sports helmet recognition in complex traffic scenes.

[0053] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0054] Embodiment 1

[0055] Figure 1 The flowchart of the sports helmet recognition and tracking method in complex traffic scenes provided by the embodiment of the present application is shown. Figure 1 As shown, the embodiment of the present application provides a method for identifying and tracking sports helmets in complex traffic scenarios, including the following steps:

[0056] S10. Determine a tracking target based on the surveillance video, wherein the tracking target is determined by a target recognition result, the target recognition result refers to the electric vehicle, the person or the helmet wearing information, the helmet wearing information refers to whether the helmet is worn or not, and each tracking target includes image information related to the electric vehicle, the person and the helmet wearing information.

[0057] In this embodiment, the monitoring video is shot by a monitoring device, and the monitoring video can be a real-time monitoring video or a video stored on a related device; electric vehicles include electric cars, electric motorcycles, and electric mopeds; people include riders and pedestrians; the target recognition result is obtained according to a preset target recognition algorithm, and specifically, the target recognition result refers to the electric vehicle, person, or helmet wearing information, and the helmet wearing information refers to whether a helmet is worn or not worn; the tracking target is determined by the target recognition result, and the rider riding the electric vehicle and the electric vehicle are determined as tracking targets through the target recognition result, and each tracking target also includes corresponding helmet wearing information. Specifically, the target detection method can use SSD Single Shotmultibox Detector), YOLO (You Only Look Once) series algorithms.

[0058] S20. Track the tracking target according to a preset tracking algorithm, and generate corresponding first data set and second data set, wherein the first data set and the second data set are determined according to the helmet wearing information, and the first data set and the second data set respectively include at least one tracking information corresponding to the tracking target, and the tracking information includes a tracking ID, a frame position information, a helmet identification information, a status information and a matching number information.

[0059] In this embodiment, the corresponding tracking targets are tracked by the tracking IDs corresponding to the tracking targets. The first data set and the second data set respectively include at least one tracking information corresponding to the tracking target. The frame position information refers to the frame information of the identification frame information including the electric vehicle, the person and the helmet wearing information. The state information includes the initial state, the activation state and the re-identification state. The number of matches refers to the number of tracking information with the same tracking ID in the same data set. Exemplarily, the preset tracking algorithm can adopt algorithms such as Sort, DeepSort, and ByteTrack.

[0060] S30: Determine, according to the frame position information, the first frame overlap degree of each tracked target between the first data set and the second data set.

[0061] In this embodiment, the first frame coincidence is determined by tracking the frame position information of the target. Specifically, the frame coincidence refers to the intersection-and-union ratio between two tracking information, and the intersection-and-union ratio is obtained according to the frame position information. Exemplarily, the calculation formula of the frame coincidence is A(a∩b) / A(a∪b), where A refers to the frame area, and a and b refer to two tracking information in the first data set and the second data set, respectively.

[0062] S40: When the first frame overlap degree meets the first threshold condition, determine the tracking result according to the state information and matching number information corresponding to the corresponding tracking target.

[0063] In this embodiment, when the frame overlap is greater than the first threshold, the helmet recognition result is determined by comparing the number of matches of the corresponding tracking target in the corresponding data set. The first frame overlap meeting the first threshold condition indicates that the two tracking targets are the same object. Exemplarily, when the number of matches corresponding to the tracking target in the first data set is greater than the number of matches corresponding to the tracking target in the second data set, the state information of the tracking target in the first data set is set to a re-identification state, and the tracking result of the tracking target is determined based on the state information of the tracking target and the helmet wearing information corresponding to the first data set. Specifically, the first threshold is 90%.

[0064] The technical solutions in the above embodiments of the present application have at least the following technical effects or advantages:

[0065] By determining the target recognition result in the monitoring video, the tracking target is determined, and by tracking the tracking target, the corresponding tracking information is generated and classified to generate a first data set and a second data set, and the tracking result is determined according to the state information and matching number information of the tracking target in the two data sets. The technical problem of low accuracy of the sports helmet recognition and tracking method in complex traffic scenes in the prior art is solved, and the accuracy of sports helmet recognition in complex traffic scenes is ensured.

[0066] Figure 2 A flow chart of a method for determining a tracking target provided by an embodiment of the present application is shown. Figure 3 FIG. 1 shows a schematic diagram of a tracking target provided by an embodiment of the present application. Figure 2 and Figure 3 As shown, S10, according to the monitoring video, determine the tracking target, wherein the tracking target is determined by the target recognition result, the target recognition result refers to the electric vehicle, the person or the helmet wearing information, the helmet wearing information refers to whether the helmet is worn or not worn, and each tracking target includes image information related to the electric vehicle, the person and the helmet wearing information. Specifically including:

[0067] S11. Perform target recognition on the surveillance video, obtain the target recognition result, and generate recognition frame information corresponding to the target recognition result, wherein the recognition frame information includes recognition frame coordinate information related to the target recognition result, the recognition frame information of the person includes x1, y1, w1, and h1, the border information of the electric vehicle includes x2, y2, w2, and h2, and the recognition frame information of the helmet wearing information includes x3, y3, w3, and h3. x1, y1, w1, and h1 refer to the x-axis coordinate, y-axis coordinate, border width, and border height of the recognition frame information of the person, respectively; x2, y2, w2, and h2 refer to the x-axis coordinate, y-axis coordinate, border width, and border height of the border information of the electric vehicle, respectively; and x3, y3, w3, and h3 refer to the x-axis coordinate, y-axis coordinate, border width, and border height of the recognition frame information of the helmet wearing information, respectively.

[0068] In this embodiment, a target recognition result is obtained by recognizing a frame image of the surveillance video, and the recognition frame information is used to determine the frame position information of the tracked target. x and y are the coordinate information of a point in the recognition frame information, and exemplarily, x and y are the horizontal and vertical coordinates of the upper left corner of the recognition frame.

[0069] S12. Determine the overlap of the second frame between each person and each electric vehicle according to the identification frame information.

[0070] S13, when the second frame overlap meets the second threshold condition and y2>y1, determine the third frame overlap between each person and each helmet identification information according to the identification frame information;

[0071] S14, when the third frame overlap degree satisfies the third threshold condition and y2>y1, determine whether y3≤y1 and x1<x3<x1+w1 are satisfied;

[0072] S15: If yes, determine the tracking target and the frame position information corresponding to it according to the corresponding target recognition result and the recognition frame information.

[0073] In this embodiment, the second bounding box overlap refers to the intersection over union (IoU) between the recognition box information of the electric vehicle and the person. The third bounding box overlap refers to the IoU between each person and the recognition information of each helmet. When the second bounding box overlap meets the second threshold condition and y2 > y1, it indicates that the person is riding an electric vehicle. When the third bounding box overlap meets the third threshold condition, y2 > y1, y3 ≤ y1, and x1 < x3 < x1 + w1, it indicates that the helmet recognition information corresponds to the corresponding person and electric vehicle. Thus, the tracking target is determined. Exemplarily, the second threshold condition refers to being greater than 0.02, and the third threshold condition refers to being greater than 0.0002.

[0074] Exemplarily, please refer to Figure 3 , where the lower block diagram points to the tracking target, and the upper small block diagram points to the helmet wearing information and the tracking ID.

[0075] Exemplarily, the source code corresponding to this embodiment can be as follows:

[0076] For moto in detectResult:

[0077] If moto is electric bicycle OR motorcycle:

[0078] motoBox=moto.box

[0079] For person in detectResult:

[0080] personBox=person.box

[0081] If person is person and iou(motoBox, personBox)>θ

[0082] and motoBox.y > personBox.y

[0083] For helmet in detectResult:

[0084] helmetBox=helmet.box

[0085] If helmet is not wearing a helmet and iou(personBox,helmetBox)>θ

[0086] and helmet.y <= personBox.y

[0087] and helmetBox.x>personBox.X

[0088] and helmetBox.x<(personBox.x+personBox.W):

[0089] noHelmetObj=moto

[0090] noHelmetObj.box.y=person.box.y

[0091] noHelmetBoxResult.append(noHelmetObj)

[0092] Endif

[0093] If helmet is wearing a helmet and iou(personBox,helmetBox)>θ

[0094] and helmet.y<= personBox.y

[0095] and helmetBox.x>personBox.X

[0096] and helmetBox.x<(personBox.x+personBox.W):

[0097] helmetObj=moto

[0098] helmetObj.box.y=person.box.y

[0099] helmetBoxResult.append(helmetObj)

[0100] Endif

[0101] Endfor

[0102] Endif

[0103] Endfor

[0104] Endif

[0105] Endfor

[0106] End

[0107] Figure 4 The flowchart of the method for generating a data set provided by the embodiment of the present application is shown. Figure 4 As shown, S20, tracking the tracking target according to a preset tracking algorithm, and generating a corresponding first data set and a second data set, including:

[0108] S21. Tracking the target according to a preset tracking algorithm.

[0109] S22: Generate tracking information related to the tracking target, wherein the tracking information includes a tracking ID, frame position information, helmet identification information, state information, and matching number information.

[0110] S23. Classify the tracking information according to the helmet identification information to generate a first data set and a second data set.

[0111] In this embodiment, the tracking target is tracked through the tracking ID, tracking information corresponding to the tracking target is generated, and the tracking information is synchronized to the first data set or the second data set according to the helmet identification information, so as to facilitate comparison of the tracking information of the same tracking target but different helmet identification information in the two data sets, so as to determine the tracking result.

[0112] like Figure 4 As shown, S23, after classifying the tracking information according to the helmet identification information to generate the first data set and the second data set, it also includes:

[0113] S24. Match the current tracking information and determine the number of matches of the current tracking information, wherein the number of matches refers to the number of tracking information with the same tracking ID as the current tracking information in the same data set.

[0114] S25. Determine whether the number of matches is greater than 0.

[0115] S26: If yes, update the matching number information of the current tracking information according to the matching number.

[0116] S27: If not, update the current tracking information to the corresponding data set according to the helmet identification information.

[0117] S28. Setting the status information of the current tracking information to an activated status.

[0118] In this embodiment, the current tracking information refers to the tracking information of the currently tracked tracking target. When the number of matches is greater than 0, it indicates that the tracking information with the same tracking ID is matched. According to the number of matches, the number of matches in the current tracking information is updated, and its status information is set to the activated state. When the number of matches is 0, it indicates that there is no tracking information with the same tracking ID as the current tracking target in the corresponding data set. At this time, the current tracking information is added to the corresponding data set, and its status information is set to the activated state for subsequent comparison.

[0119] Exemplarily, the source code corresponding to this embodiment may be as follows:

[0120] Begin

[0121] For elem in noHelmmetList:

[0122] elem.state=0

[0123] Endfor

[0124] For elem in helmetList:

[0125] elem.state = 0

[0126] Endfor

[0127] For elem in noHeletTargets:

[0128] notFoundFlag = True

[0129] For obj in noHelmetList:

[0130] If elem.trackID=obj.trackID:

[0131] notFoundFlag=False

[0132] Obj.state=1

[0133] obj.box=elem.box

[0134] elem.matchCount++

[0135] Endif

[0136] Endfor

[0137] If notFoundFlag:

[0138] elem.stale=1

[0139] noHelmetList.append(elem)

[0140] Endif

[0141] Endfor

[0142] For elem in helmetTargets:

[0143] notFoundFlag = True

[0144] For obj in helmetList:

[0145] If elem.tracklD = obj.trackID:

[0146] notFoundFlag = False

[0147] Obj.state=1

[0148] obj.box = elem.box

[0149] elem.matchCount++

[0150] Endif

[0151] Endfor

[0152] If notFoundFlag:

[0153] elem.state=1

[0154] helmetList.append(elem)

[0155] Endif

[0156] Endfor

[0157] Figure 5 A flow chart of a method for determining tracking results provided by an embodiment of the present application is shown. Figure 6 A tracking schematic diagram before determining the tracking result is shown. Figure 7 Figure 2 shows a schematic diagram of the tracking results. Figure 5-Figure 7 As shown, S40, when the first frame overlap degree meets the first threshold condition, determining the tracking result according to the state information and matching number information corresponding to the corresponding tracking target, including:

[0158] S41: When the first frame overlap degree meets the first threshold condition, determine whether the state information between the two corresponding tracking targets are both in the activated state.

[0159] S42: If yes, determine the tracking target with the largest number of matching times.

[0160] S43: Set the status information corresponding to the tracking target to a re-identification status.

[0161] S44. Determine the tracking result according to the status information.

[0162] In this embodiment, by comparing the first frame overlap of each tracking information between the two data sets, it is determined that the corresponding tracking targets in the two data sets are the same tracking target. When the first frame overlap meets the first threshold condition and the state information between the two tracking targets is both in the activated state, its state information is updated to the re-identified state according to the maximum number of matches. Finally, the helmet wearing information in the tracking information corresponding to the re-identified state is used to determine the tracking result. The technical problem of low accuracy of sports helmet recognition and tracking methods in complex traffic scenes is solved, and the accuracy of sports helmet recognition in complex traffic scenes is guaranteed.

[0163] For example, the red box indicates that the helmet is not worn, and the green box indicates that the helmet is worn. Figure 6 As shown, before determining the tracking result, the tracking information related to the tracking target exists in the first data set and the second data set respectively. At this time, the helmet wearing information of the tracking target includes both wearing a helmet and not wearing a helmet. After executing S44, it is determined that the tracking result is not wearing a helmet. The tracking result is as follows: Figure 7 shown.

[0164] Exemplarily, the source code corresponding to this embodiment may be as follows:

[0165] For elem in noHelmetTargets:

[0166] elemBox = elem.box

[0167] For obj in helmetTargets:

[0168] objBox = obj.box

[0169] If iou(elemBox,objBox)> a and elem.state=1 and obj.state=1:

[0170] If elem.matchCount > obj.matchCount:

[0171] obj.statue =2

[0172] elem.statue = 0

[0173] else:

[0174] elem.statue = 2

[0175] obj.statue = 0

[0176] Endif

[0177] Endif

[0178] Endfor

[0179] Endfor

[0180] In some embodiments, the preset tracking algorithm refers to one or more of the Sort, DeepSort, and ByteTrack algorithms.

[0181] Embodiment 2

[0182] Figure 8 The schematic diagram of the structure of a sports helmet recognition and tracking device in a complex traffic scene provided by an embodiment of the present application is shown. Figure 8 As shown, the embodiment of the present application provides a sports helmet recognition and tracking device in a complex traffic scene, including:

[0183] A first determination module 400 is used to determine a tracking target according to the monitoring video, wherein the tracking target is determined by a target recognition result, the target recognition result refers to an electric vehicle, a person or helmet wearing information, the helmet wearing information refers to whether a helmet is worn or not worn, and each tracking target includes image information related to the electric vehicle, the person and the helmet wearing information;

[0184] A tracking module 500, configured to track the tracking target according to a preset tracking algorithm, and generate a corresponding first data set and a second data set, wherein the first data set and the second data set are determined according to the helmet wearing information, and the first data set and the second data set respectively include at least one tracking information corresponding to the tracking target, and the tracking information includes a tracking ID, frame position information, helmet identification information, status information, and matching number information;

[0185] A second determination module 600 is used to determine the first frame overlap of each tracking target between the first data set and the second data set according to the frame position information;

[0186] The third determination module 700 is used to determine the tracking result according to the state information and matching number information corresponding to the corresponding tracking target when the first frame overlap degree meets the first threshold condition.

[0187] In some embodiments, the first determination module 400 includes:

[0188] an identification unit, for performing target identification on a surveillance video, obtaining a target identification result, and generating identification frame information corresponding to the target identification result, wherein the identification frame information includes identification frame coordinate information related to the target identification result, the identification frame information of a person includes x1, y1, w1, and h1, the frame information of an electric vehicle includes x2, y2, w2, and h2, and the helmet wearing information includes x3, y3, w3, and h3, wherein x1, y1, w1, and h1 refer to the x-axis coordinate, y-axis coordinate, frame width, and frame height of the identification frame information of the person, respectively; x2, y2, w2, and h2 refer to the x-axis coordinate, y-axis coordinate, frame width, and frame height of the frame information of the electric vehicle, respectively; and x3, y3, w3, and h3 refer to the x-axis coordinate, y-axis coordinate, frame width, and frame height of the helmet wearing information, respectively;

[0189] A first determining unit, configured to determine a second frame overlap between each person and each electric vehicle according to the identification frame information;

[0190] A second determination unit is used to determine a third frame overlap between each person and each helmet identification information according to the identification frame information when the second frame overlap satisfies a second threshold condition and y2>y1;

[0191] A judging unit, configured to judge whether y3≤y1 and x1<x3<x1+w1 are satisfied when the third frame overlap degree satisfies a third threshold condition and y2>y1;

[0192] The first determination unit is used to determine the tracking target and the frame position information corresponding thereto according to the corresponding target recognition result and the recognition frame information.

[0193] In some embodiments, the generating module includes:

[0194] A tracking unit, used to track a tracking target according to a preset tracking algorithm;

[0195] A generating unit, configured to generate tracking information related to a tracking target, wherein the tracking information includes a tracking ID, frame position information, helmet identification information, state information, and matching number information;

[0196] The classification unit is used to classify the tracking information according to the helmet identification information to generate a first data set and a second data set.

[0197] In some embodiments, the generating module further comprises:

[0198] A matching unit, used to match the current tracking information and determine the number of matches of the current tracking information, wherein the number of matches refers to the number of tracking information with the same tracking ID as the current tracking information in the same data set;

[0199] A judging unit, used to judge whether the number of matches is greater than 0;

[0200] A first updating unit, used for updating the matching number information of the current tracking information according to the matching number;

[0201] A second updating unit, used for updating the current tracking information into a corresponding data set according to the helmet identification information;

[0202] The setting unit is used to set the status information of the current tracking information to an activated state.

[0203] In some embodiments, the third determination module includes:

[0204] A judging unit, configured to judge whether the state information between the two corresponding tracking targets are both in an activated state when the first frame overlap degree meets a first threshold condition;

[0205] A determination unit, used for determining a tracking target having the largest number of matching times;

[0206] A setting unit, used to set the state information corresponding to the tracking target to a re-identification state;

[0207] The determination unit is used to determine the tracking result according to the state information.

[0208] Embodiment 3

[0209] Fig. 9 FIG. 1 is a schematic diagram showing the structure of an electronic device provided by an embodiment of the present application. Fig. 9 As shown, an embodiment of the present application provides an electronic device, including: a processor and a memory, the processor is used to call a program in the memory to enable the electronic device to execute a sports helmet recognition and tracking method in a complex traffic scene.

[0210] Embodiment 4

[0211] An embodiment of the present application provides a computer-readable storage medium, which stores instructions. When the instructions are executed, the computer executes a method for identifying and tracking sports helmets in complex traffic scenarios.

[0212] The computer readable storage medium mentioned above can be any type of volatile or non-volatile storage device or a programmable read-only memory, a programmable read-only memory, a read-only memory, a magnetic storage, a flash memory, a disk or an optical disk. The readable storage medium can be any available medium that can be accessed by a general or special purpose computer.

[0213] Optionally, a readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0214] Embodiment 5

[0215] An embodiment of the present application provides a computer program product, including a computer program, which, when executed, implements a method for identifying and tracking sports helmets in complex traffic scenarios.

[0216] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0217] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0218] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0219] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0220] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

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

Claims

1. A sports helmet recognition and tracking method in complex traffic scenes, characterized in that: The steps include: Determine a tracking target according to the surveillance video, wherein the tracking target is determined by a target recognition result, the target recognition result refers to an electric vehicle, a person or helmet wearing information, the helmet wearing information refers to whether a helmet is worn or not worn, and each tracking target includes image information related to the electric vehicle, the person and the helmet wearing information; According to a preset tracking algorithm, the tracking target is tracked, and a corresponding first data set and a second data set are generated, wherein the first data set and the second data set are determined according to the helmet wearing information, and the first data set and the second data set respectively include at least one tracking information corresponding to the tracking target, and the tracking information includes a tracking ID, frame position information, helmet identification information, state information, and matching number information; Determining, according to the frame position information, a first frame overlap degree of each tracked target between the first data set and the second data set; When the first frame overlap degree meets the first threshold condition, determining the tracking result according to the state information and matching number information corresponding to the corresponding tracking target; Wherein, determining the tracking target according to the surveillance video includes: Perform target recognition on the surveillance video, obtain target recognition results, and generate recognition frame information corresponding to the target recognition results, wherein the recognition frame information includes recognition frame coordinate information related to the target recognition result, the recognition frame information of the person includes x1, y1, w1, and h1, the border information of the electric vehicle includes x2, y2, w2, and h2, and the recognition frame information of the helmet wearing information includes x3, y3, w3, and h3, where x1, y1, w1, and h1 refer to the x-axis coordinate, y-axis coordinate, border width, and border height of the recognition frame information of the person, respectively, x2, y2, w2, and h2 refer to the x-axis coordinate, y-axis coordinate, border width, and border height of the border information of the electric vehicle, respectively, and x3, y3, w3, and h3 refer to the x-axis coordinate, y-axis coordinate, border width, and border height of the recognition frame information of the helmet wearing information, respectively; Determining the overlap degree of the second frame between each person and each electric vehicle according to the identification frame information; When the second frame overlap satisfies the second threshold condition and y2>y1, determining the third frame overlap between each person and each helmet identification information according to the identification frame information; When the third frame overlap degree satisfies the third threshold condition and y2>y1, determine whether y3≤y1 and x1<x3<x1+w1 are satisfied; If so, determining the tracking target and the frame position information corresponding thereto according to the corresponding target recognition result and the recognition frame information; The tracking target is tracked according to a preset tracking algorithm, and a corresponding first data set and a second data set are generated, including: Tracking the tracking target according to a preset tracking algorithm; Generate tracking information related to the tracking target, wherein the tracking information includes a tracking ID, frame position information, helmet identification information, status information, and matching number information; Classifying the tracking information according to the helmet identification information to generate the first data set and the second data set; Matching the current tracking information, and determining the number of matches of the current tracking information, wherein the number of matches refers to the number of tracking information with the same tracking ID as the current tracking information in the same data set; Determine whether the number of matches is greater than 0; If yes, update the matching number information of the current tracking information according to the matching number; If not, updating the current tracking information into the corresponding data set according to the helmet identification information; Setting the status information of the current tracking information to an activated state; When the first frame overlap degree satisfies a first threshold condition, determining a tracking result according to state information and matching number information corresponding to a corresponding tracking target includes: When the first frame overlap degree meets the first threshold condition, determining whether the state information between the two corresponding tracking targets are both in an activated state; If so, determine the tracking target with the largest number of matching information; Setting the state information corresponding to the tracking target to a re-identification state; A tracking result is determined according to the status information.

2. The method according to claim 1, characterized in that The tracking target is tracked according to a preset tracking algorithm, and the corresponding first data set and second data set are generated. The preset tracking algorithm refers to one or more of Sort, DeepSort, and ByteTrack algorithms.

3. A sports helmet recognition and tracking device in complex traffic scenes, characterized in that: include: A first determination module is used to determine a tracking target according to the monitoring video, wherein the tracking target is determined by a target recognition result, the target recognition result refers to an electric vehicle, a person or helmet wearing information, the helmet wearing information refers to whether a helmet is worn or not worn, and each tracking target includes image information related to the electric vehicle, the person and the helmet wearing information; A tracking module, configured to track the tracking target according to a preset tracking algorithm, and generate a corresponding first data set and a second data set, wherein the first data set and the second data set are determined according to the helmet wearing information, and the first data set and the second data set respectively include at least one tracking information corresponding to the tracking target, and the tracking information includes a tracking ID, frame position information, helmet identification information, status information, and matching number information; A second determination module, configured to determine, based on the frame position information, a first frame overlap degree of each tracked target between the first data set and the second data set; A third determination module, configured to determine a tracking result according to state information and matching number information corresponding to a corresponding tracking target when the first frame overlap degree satisfies a first threshold condition; Wherein, the first determination module is used for: Perform target recognition on the surveillance video, obtain target recognition results, and generate recognition frame information corresponding to the target recognition results, wherein the recognition frame information includes recognition frame coordinate information related to the target recognition result, the recognition frame information of the person includes x1, y1, w1, and h1, the border information of the electric vehicle includes x2, y2, w2, and h2, and the recognition frame information of the helmet wearing information includes x3, y3, w3, and h3, where x1, y1, w1, and h1 refer to the x-axis coordinate, y-axis coordinate, border width, and border height of the recognition frame information of the person, respectively, x2, y2, w2, and h2 refer to the x-axis coordinate, y-axis coordinate, border width, and border height of the border information of the electric vehicle, respectively, and x3, y3, w3, and h3 refer to the x-axis coordinate, y-axis coordinate, border width, and border height of the recognition frame information of the helmet wearing information, respectively; Determining the overlap degree of the second frame between each person and each electric vehicle according to the identification frame information; When the second frame overlap satisfies the second threshold condition and y2>y1, determining the third frame overlap between each person and each helmet identification information according to the identification frame information; When the third frame overlap degree satisfies the third threshold condition and y2>y1, determine whether y3≤y1 and x1<x3<x1+w1 are satisfied; If so, determining the tracking target and the frame position information corresponding thereto according to the corresponding target recognition result and the recognition frame information; The tracking module is used to: Tracking the tracking target according to a preset tracking algorithm; Generate tracking information related to the tracking target, wherein the tracking information includes a tracking ID, frame position information, helmet identification information, status information, and matching number information; Classifying the tracking information according to the helmet identification information to generate the first data set and the second data set; Matching the current tracking information, and determining the number of matches of the current tracking information, wherein the number of matches refers to the number of tracking information with the same tracking ID as the current tracking information in the same data set; Determine whether the number of matches is greater than 0; If yes, update the matching number information of the current tracking information according to the matching number; If not, updating the current tracking information into the corresponding data set according to the helmet identification information; Setting the status information of the current tracking information to an activated state; The third determination module is used for: When the first frame overlap degree meets the first threshold condition, determining whether the state information between the two corresponding tracking targets are both in an activated state; If so, determine the tracking target with the largest number of matching information; Setting the state information corresponding to the tracking target to a re-identification state; A tracking result is determined according to the status information.

4. An electronic device, characterized in that: include: A processor and a memory, wherein the processor is used to call a program in the memory to enable the electronic device to execute the method according to any one of claims 1 to 2.

5. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed, the computer executes the method according to any one of claims 1 to 2.

6. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 2 when being executed.

Citation Information

Patent Citations

  • Motorcycle helmet detection and tracking method based on improved YOLOv5DeepSORT algorithm

    CN116645322A

  • Vehicle target tracking method, device and equipment and storage medium

    CN117314960A