Bus passenger OD matching method and device and electronic equipment
1. A bus passenger OD matching method, the method comprising:
acquiring continuous n frames of first screenshots of each getting-on passenger before getting on the bus and continuous m frames of second screenshots of each getting-off passenger before getting off the bus;
inputting the n frames of first screenshots and the m frames of second screenshots into a pre-trained ReID model respectively to obtain n first vectors corresponding to each getting-on passenger and m second vectors corresponding to each getting-off passenger;
matching the boarding passengers and the alighting passengers according to the n first vectors of each boarding passenger and the m second vectors of each alighting passenger.
2. The method of claim 1, prior to obtaining n consecutive first screenshots of each boarding passenger prior to boarding and m consecutive second screenshots of each disembarking passenger prior to disembarking, the method further comprising:
acquiring video data of passengers getting on and off the bus in each time period;
for any passenger, judging whether the passenger is an getting-on passenger or a getting-off passenger in a corresponding time period according to the video data;
and obtaining the video data of the passengers getting on the bus and the video data of the passengers getting off the bus in each time period according to the judgment result.
3. The method of claim 2, determining from the video data whether the passenger is an entering passenger or a leaving passenger for a corresponding time period, comprising:
aiming at any passenger, detecting and tracking the passenger by utilizing a passenger detection and tracking model trained in advance, and extracting the track of the passenger by utilizing a tracking frame;
and judging whether the passenger is an getting-on passenger or a getting-off passenger according to the track of the passenger.
4. The method of claim 3, determining whether the passenger is an entering passenger or an exiting passenger based on the passenger's trajectory, comprising:
recording an initial position and a final position of the passenger tracking frame based on the passenger track;
if the initial position of the passenger is located outside the door area of the bus and the terminal position is located in the door area of the bus, judging that the passenger is a passenger getting off the bus;
and if the initial position of the passenger is located in the door area of the bus and the terminal position is located outside the door area of the bus, judging that the passenger is the passenger getting on the bus.
5. The method of claim 4, obtaining n consecutive first screenshots of each boarding passenger prior to boarding and m consecutive second screenshots of each disembarking passenger prior to disembarking, comprising:
continuously intercepting a tracking frame of a passenger detection and tracking model for any passenger at preset time intervals;
and based on the initial position and the end position of the passenger tracking frame, when the passenger is judged to be an entering passenger or a leaving passenger, acquiring n continuous frames of first screenshots of the passenger before entering the vehicle or m continuous frames of second screenshots of the passenger before leaving the vehicle.
6. The method of claim 1, matching the boarding passenger and the disembarking passenger according to the n first vectors of each boarding passenger and the m second vectors of each disembarking passenger, comprising:
respectively calculating cosine similarity of each first vector of the boarding passenger and each second vector of the alighting passenger aiming at any boarding passenger and any alighting passenger so as to obtain n x m cosine similarities of each boarding passenger and each alighting passenger;
calculating the average value of the n x m cosine similarity degrees to obtain the cosine similarity average value of each getting-on passenger and each getting-off passenger;
and matching the passengers getting on the bus and the passengers getting off the bus based on the cosine similarity average value.
7. The method of claim 6, prior to calculating the cosine similarity of each first vector of the boarding passenger and each second vector of the disembarking passenger, the method further comprising:
acquiring the boarding time of the boarding passenger and the disembarking time of the disembarking passenger;
if the getting-off time of the getting-off passenger is earlier than the getting-on time of the getting-on passenger, judging that the getting-off passenger is not matched with the getting-on passenger;
otherwise, the cosine similarity of each first vector of the getting-on passenger and each second vector of the getting-off passenger is calculated.
8. The method of claim 6, matching the boarding passenger and the alighting passenger based on the cosine similarity average, comprising:
and matching the passengers getting on the train with the passengers getting off the train by using a Hungarian algorithm based on the cosine similarity average value.
9. The method according to claim 2, wherein the step of obtaining the video data of the passengers getting on and off the vehicle in each time period specifically comprises the following steps:
and respectively acquiring the video data of the passengers getting on and off the bus in each time period by utilizing the cameras arranged in the front door area and the back door area of the bus.
10. The method according to any one of claims 1 to 9, the method of training the ReID model comprising:
acquiring a training data set of a ReID model; the training data set at least comprises continuous multi-frame screenshots aiming at each passenger, which are intercepted from the video data of the passengers getting on the bus and the passengers getting off the bus by utilizing a passenger detection and tracking model trained in advance, and the same passengers are marked with the same ID in the video data of the passengers getting on the bus and the passengers getting off the bus;
and training the ReID model by using the acquired training data set of the ReID model, so that the cosine similarity between a first vector which is output by the ReID model and is taken as an getting-on passenger by the passenger and a second vector which is taken as a getting-off passenger by the passenger is close to the cosine similarity.
11. A bus passenger OD matching device, the device comprising:
the system comprises an acquisition module and a display module, wherein the acquisition module is used for acquiring continuous n frames of first screenshots of each getting-on passenger before getting on the bus and continuous m frames of second screenshots of each getting-off passenger before getting off the bus;
the mapping module is configured with a pre-trained ReiD model, and the n frames of first screenshots and the n frames of second screenshots can be respectively input into the pre-trained ReiD model to obtain n first vectors corresponding to each getting-on passenger and m second vectors corresponding to each getting-off passenger;
the matching module is used for matching the passengers getting on the train with the passengers getting off the train according to the n first vectors of the passengers getting on the train and the m second vectors of the passengers getting off the train.
12. The apparatus of claim 11, further comprising a first determining module configured to: for any passenger, judging whether the passenger is an entering passenger or an exiting passenger in the corresponding time period according to the video data of the passenger entering or exiting the vehicle in each time period, and obtaining the video data of the entering passenger and the video data of the exiting passenger in each time period according to the judgment result;
the acquisition module is used for acquiring continuous n frames of first screenshots of each getting-on passenger before getting-on and continuous m frames of second screenshots of each getting-off passenger before getting-off according to the getting-on passenger video data and the getting-off passenger video data obtained by the first judgment module.
13. The apparatus of claim 12, wherein the first determining module is configured with a pre-trained passenger detection and tracking model, and is specifically configured to: aiming at any passenger, the passenger is detected and tracked by utilizing a pre-trained passenger detection and tracking model, the track of the passenger is extracted by utilizing a tracking frame, and whether the passenger is an getting-on passenger or a getting-off passenger is judged according to the track of the passenger.
14. An electronic device, comprising: at least one processor and a memory, the memory storing a program and configured to execute the bus passenger OD matching method of any of claims 1-10 by the at least one processor.
15. A computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the bus passenger OD matching method of any one of claims 1-10.
Background
With the rapid development of the urbanization process in China, the urban population is increasing continuously, and the pressure of public transport as the main travel mode of the citizens is increasing day by day. How to improve the operation efficiency of public transportation and make public resources more fully utilized becomes urgent. By counting passenger flow data of the bus and analyzing the mode of the citizen's travel OD (initial and Destination information), the bus company can be helped to efficiently make an operation scheduling plan and meet the demand of the citizen taking the bus at different time periods. The passenger flow data of the public transport refers to the number of passengers from a boarding station (starting point) to a disembarking station (Destination point) in a public transport line network, and the passenger OD data has wide application in the aspects of urban public transport planning, public transport line optimization, public transport operation scheduling and the like.
Based on this, there is a need in the art for a method that can more comprehensively and accurately count the OD of a bus passenger.
Disclosure of Invention
In view of this, embodiments of the present disclosure provide a method and an apparatus for matching a bus passenger OD, and an electronic device, so as to achieve the purpose of counting the bus passenger OD more comprehensively and accurately.
The embodiment of the specification adopts the following technical scheme:
the specification provides a bus passenger OD matching method, which comprises the following steps:
acquiring continuous n frames of first screenshots of each getting-on passenger before getting on the bus and continuous m frames of second screenshots of each getting-off passenger before getting off the bus;
inputting the n frames of first screenshots and the m frames of second screenshots into a pre-trained ReID model respectively to obtain n first vectors corresponding to each getting-on passenger and m second vectors corresponding to each getting-off passenger;
matching the boarding passengers and the alighting passengers according to the n first vectors of each boarding passenger and the m second vectors of each alighting passenger.
This specification still provides a bus passenger OD matching device, and the device includes:
the system comprises an acquisition module and a display module, wherein the acquisition module is used for acquiring continuous n frames of first screenshots of each getting-on passenger before getting on the bus and continuous m frames of second screenshots of each getting-off passenger before getting off the bus;
the mapping module is configured with a pre-trained ReiD model, and the n frames of first screenshots and the m frames of second screenshots can be respectively input into the pre-trained ReiD model to obtain n first vectors corresponding to each getting-on passenger and m second vectors corresponding to each getting-off passenger;
the matching module is used for matching the passengers getting on the train with the passengers getting off the train according to the n first vectors of the passengers getting on the train and the m second vectors of the passengers getting off the train.
This specification also provides an electronic device, including: at least one processor and a memory, the memory storing a program and configured to execute the above-described bus passenger OD matching method by the at least one processor.
The present specification also provides a computer-readable storage medium having stored thereon computer-executable instructions that, when executed by a processor, implement the above-described bus passenger OD matching method.
The embodiment of the specification adopts at least one technical scheme which can achieve the following beneficial effects: in the scheme of the specification, the passenger detection and tracking model and the ReiD model are trained in advance by collecting the training data set of the passenger detection and tracking model and the ReiD model training data set. And then, detecting and tracking passengers getting on and off the train by using the trained passenger detecting and tracking model so as to judge whether the tracks of the passengers are getting on and off the train or not, then intercepting n continuous screenshots of the passengers getting on the train before getting on the train and m continuous screenshots of the passengers getting off the train by using a passenger detecting and tracking model tracking frame, respectively converting multiple continuous screenshots of the passengers getting on and off the train into vectors by using the trained ReiD model, taking the vectors of the passengers getting on and off the train as input, and obtaining the optimal passenger OD by using an intelligent matching algorithm. Specifically, a plurality of cosine similarities between a plurality of vectors of the passengers getting on the bus and a plurality of vectors of the passengers getting off the bus are calculated in a crossed manner, an average value of the plurality of cosine similarities is obtained, and the passengers getting on the bus and the passengers getting off the bus are matched according to the average value. The passenger detection and tracking model is adopted in the specification, the vectors of continuous multiframe passengers getting on and off the train are calculated by the ReiD model, the optimal result is obtained by using a passenger OD intelligent matching algorithm, and the OD matching accuracy of the passengers getting on and off the train is greatly improved.
Drawings
In order to more clearly illustrate the embodiments of the present specification or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the specification, and for those skilled in the art, other drawings can be obtained according to the drawings without inventive exercise:
fig. 1 is a schematic main flow chart of a bus passenger OD matching method according to an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of a ReID model generating vector of an embodiment of the present description;
FIG. 3 is a schematic illustration of a process for matching bus passengers OD in accordance with an embodiment of the present disclosure;
fig. 4 is an overall flow chart of a bus passenger OD matching method according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a bus passenger OD matching device according to an embodiment of the present disclosure.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any inventive step based on the embodiments of the present disclosure, shall fall within the scope of protection of the present application.
At present, typical bus passenger flow statistical methods mainly comprise: a mode based on IC card recording; infrared sensor based approaches; based on the manner in which the video image is processed. The method based on IC recording cannot count the total passenger flow data, because many citizens take buses by cash and payment APP at present; the mode based on the infrared sensor has lower cost, but is greatly influenced by climate, and has large statistical error when people are crowded; the method based on video image processing has high statistical accuracy and is considered to be one of the methods most suitable for bus passenger flow statistics, but the convolutional neural network model used by the previous method is large and cannot well meet the requirement of detection real-time performance. Meanwhile, the above methods cannot achieve accurate matching of each passenger OD.
The scheme provided by the specification can be deployed on a computing platform of a bus and is used for bus passenger flow statistics and passenger OD statistics. In the present specification, OD, an acronym of Origin and Destination, represents start point and end point information; ReID, an abbreviation for reidentification, is a pedestrian re-identification technique.
Referring to fig. 1, fig. 1 is a schematic main flow chart of a bus passenger OD matching method according to an embodiment of the present disclosure. As shown in fig. 1, the method for matching the bus passenger OD provided by the present specification mainly includes:
s110: and acquiring continuous n frames of first screenshots of each getting-on passenger before getting on the bus and continuous m frames of second screenshots of each getting-off passenger before getting off the bus.
In this step, for any passenger, the passenger is regarded as an entering passenger when the passenger enters the vehicle and as a leaving passenger when the passenger leaves the vehicle. That is, the same passenger is either an entering passenger or an exiting passenger during the same time period; the same passenger can be either the boarding passenger or the alighting passenger at different time periods. For any passenger, when the passenger is a boarding passenger, acquiring continuous n frames of first screenshots before the passenger gets on the bus; and when the passenger is a passenger getting off the bus, acquiring continuous m frames of second screenshots before the passenger gets off the bus. Wherein n and m are integers more than 1. Here, n and m may be equal or unequal. For example, 5 frames are acquired for the first screenshot of any passenger, 7 frames are acquired for the second screenshot of any passenger, and the like, and 5 frames, 7 frames … n frames and the like can be acquired for both the first screenshot of any passenger and the second screenshot of any passenger, which can also facilitate subsequent calculations. For convenience of explanation, n and m are taken as examples in this specification, that is, n consecutive frames of first screenshots before each getting-on passenger gets on the bus and n consecutive frames of second screenshots before each getting-off passenger gets off the bus are obtained.
As a specific example, before performing step S110, it may be determined whether the passenger is an entering passenger or a alighting passenger by:
s1101: and acquiring video data of passengers getting on and off the vehicle in each time period.
In the step, cameras are generally arranged in front door areas and rear door areas of the bus, and video data of passengers getting on and off the bus in each time period can be acquired through the cameras arranged in the front door areas and the rear door areas.
S1103: and judging whether the passenger is an getting-on passenger or a getting-off passenger in the corresponding time period according to the video data for any passenger.
In this step, as an example, for any passenger, the passenger may be detected and tracked by using a passenger detection and tracking model trained in advance, and the track of the passenger is extracted by using a tracking frame, so as to determine whether the passenger is an entering passenger or an exiting passenger according to the track of the passenger. The passenger detection and tracking model can be trained through a pre-collected data set, for example, pedestrian labeling pictures and labeling information in data sets such as COCO, PASCAL VOC and the like can be collected, passenger types and position information in video frames of a large number of front and rear bus door cameras are manually labeled to serve as a training data set of the passenger detection and tracking model, and then the passenger detection and tracking model is trained through the training data set to adjust parameters of the passenger detection and tracking model until the passenger detection and tracking model meets requirements. The specific training mode for the passenger detection and tracking model will not be described in detail herein, and those skilled in the art can train the passenger detection and tracking model in any reasonable way, or directly use the existing and trained passenger detection and tracking model, without departing from the scope of the present disclosure.
It should be noted that, the passenger detection and tracking model in this specification can be understood as including two independent models, namely a passenger detection module and a passenger tracking module, and the detection and tracking purposes of the passenger are respectively realized through the two modules; the passenger detection and tracking model can also be understood as an integral module, namely the model has the functions of passenger detection and tracking, so that the aim of passenger detection and tracking can be fulfilled through the model; the passenger detection and tracking model can also be understood as the integration of two models, namely the passenger detection model and the passenger tracking model are integrated into one passenger detection and tracking model, so that the purpose of detecting and tracking passengers is realized. In addition, other suitable models may be used by those skilled in the art to implement passenger detection and tracking, and the description is not limited thereto.
Further, when the passenger is judged to be an entering passenger or an exiting passenger according to the track of the passenger, the initial position and the final position of the passenger tracking frame can be recorded. As an example, if the initial position of the passenger is located outside the door area of the bus and the terminal position is located in the door area of the bus, the passenger may be considered to move from the inside of the bus to the door at this time, that is, to get off the bus, and then the passenger is determined to be a passenger getting off the bus; if the initial position of the passenger is located in the door area of the bus and the terminal position is located outside the door area of the bus, the passenger can be judged to move from the door area to the inside of the bus, and then the passenger is judged to be the passenger getting on the bus. According to the judgment result, the video data of the passengers getting on the bus and the video data of the passengers getting off the bus in each time period can be obtained.
Returning to step S110, for any passenger, continuously intercepting a tracking frame of the passenger detection and tracking model for the passenger at preset time intervals (for example, the preset time may be 0.5 second, and a time interval may also be flexibly set by a person skilled in the art according to actual needs), and then determining whether the passenger is an entering passenger or an exiting passenger based on an initial position and an end position of the passenger tracking frame. Specifically, when the passenger is judged to be a boarding passenger, acquiring continuous n frames of first screenshots of the passenger before boarding; and when the passenger is judged to be the passenger getting off the bus, acquiring n continuous frames of second screenshots of the passenger before getting off the bus.
After step S110 is executed, that is, after n consecutive first screenshots of each boarding passenger before boarding and n consecutive second screenshots of each disembarking passenger before disembarking are obtained, the method for matching the bus passenger OD provided in this specification further includes:
s120: and respectively inputting the n frames of first screenshots and the n frames of second screenshots into a pre-trained ReID model to obtain n first vectors corresponding to each getting-on passenger and n second vectors corresponding to each getting-off passenger.
In this step, referring to fig. 2, fig. 2 is a schematic diagram of a ReID model generation vector according to an embodiment of the present specification. As shown in fig. 2, for example, for the boarding passenger a, n consecutive first screenshots (first screenshot 1, first screenshot 2, first screenshot 3 … first screenshot n) before the boarding passenger a gets on the bus are respectively input into the ReID model, and n first vectors (i.e., first vector 1, first vector 2, first vector 3 … first vector n) of the boarding passenger a are correspondingly generated. Similarly, for the alighting passenger B (this alighting passenger B may be the same passenger as the boarding passenger a, or may not be the same passenger), n consecutive second screenshots (second screenshot 1, second screenshot 2, second screenshot 3 …, second screenshot n) of the alighting passenger B before the alighting passenger B is input to the ReID model, and n second vectors (that is, second vector 1, second vector 2, second vector 3 …, second vector n) of the alighting passenger B are generated correspondingly. In this way, the n-frame first screenshot and the n-frame second screenshot can be mapped to corresponding vectors respectively by using the pre-trained ReID model.
By way of example, the method for training the ReID model may include: acquiring a training data set of a ReID model; the training data set at least comprises continuous multi-frame screenshots aiming at each passenger, which are intercepted from the video data of the passengers getting on the bus and the passengers getting off the bus by utilizing a passenger detection and tracking model trained in advance, and the same passengers are marked with the same ID in the video data of the passengers getting on the bus and the passengers getting off the bus. That is, continuous multi-frame screenshots of a large number of passengers are intercepted from videos of front and rear door cameras of the bus by utilizing a pre-trained passenger detection and tracking frame of a model, and the same passengers in the front and rear door videos can be manually marked with the same ID. In this way, the ReID model is trained by using the acquired training data set to adjust the parameters of the ReID model so that the cosine similarity between the first vector of the passenger as the boarding passenger and the second vector of the passenger as the disembarking passenger, which are output by the ReID model for the same passenger, is close. That is, after the ReID model is trained by using the acquired training data set, a first vector obtained by mapping the getting-on screenshot of the same passenger (for example, the passenger D) and a second vector obtained by mapping the getting-off screenshot of the same passenger D are similar to each other by the ReID model, so that whether the getting-on passenger and the getting-off passenger are the same passenger can be determined according to the similarity between the first vector and the second vector. Specifically, after step S120 is performed, step S130 is performed.
S130: matching the boarding passengers and the alighting passengers according to the n first vectors of each boarding passenger and the n second vectors of each alighting passenger.
In this step, after n first vectors of each getting-on passenger and n second vectors of each getting-off passenger are obtained, for any getting-on passenger and any getting-off passenger (where the getting-on passenger and the getting-off passenger may be the same passenger or different passengers), the cosine similarity of each first vector of the getting-on passenger and each second vector of the getting-off passenger is calculated respectively. According to the above example, for the boarding passenger a and the disembarking passenger B, n first vectors of the boarding passenger a and n second vectors of the disembarking passenger B are cross-calculated to obtain n first vectors of the boarding passenger a and n second vectors of the disembarking passenger B2Cosine similarity, and then n is calculated2And the average value of the cosine similarity is used for obtaining the average value of the cosine similarity of the boarding passenger A and the alighting passenger B, and then the boarding passenger A and the alighting passenger B are matched according to the average value of the cosine similarity so as to judge whether the boarding passenger A and the alighting passenger B are the same passenger.
As an example, the algorithm for matching the getting-on passenger a and the getting-off passenger B may adopt a hungarian algorithm for optimal matching. Besides the hungarian algorithm, other feasible matching algorithms can be adopted by those skilled in the art, and the description does not limit the matching algorithms.
As a more specific embodiment, in step S130, the vehicle is loaded according to each of the upper vehiclesWhen the n first vectors of the passengers and the n second vectors of each passenger getting off are matched, the boarding time of the passengers and the getting off time of the passengers can be judged firstly. For example, referring to fig. 3, fig. 3 is a schematic diagram of a matching process of a bus passenger OD according to an embodiment of the present disclosure. As shown in fig. 3, before calculating the cosine similarity of the n first vectors of the boarding passenger a and the n second vectors of the alighting passenger B, the boarding time t of the boarding passenger a is obtained first1And a alighting time t of the alighting passenger B2If the time t for getting off the bus of the passenger B2Before the boarding time t of the boarding passenger A1If the number of the first vectors of the getting-off passenger a is greater than or equal to the number of the second vectors of the getting-off passenger a, the cosine similarity between the getting-on passenger a and the getting-off passenger B is set to-1, that is, the getting-off passenger B and the getting-on passenger a are judged to be mismatched, that is, the cosine similarity between the n first vectors of the getting-on passenger a and the n second vectors of the getting-off passenger B does not need to be calculated. If the time t of getting-off of the passenger B2Later than boarding time t of boarding passenger A1And then, the passenger B getting off the vehicle and the passenger a getting on the vehicle are probably the same person, at this time, the passenger B getting off the vehicle and the passenger a getting on the vehicle need to be further matched, namely, cosine similarities of n first vectors of the passenger a getting on the vehicle and n second vectors of the passenger B getting off the vehicle are calculated, and then an average value of the cosine similarities is calculated.
To more intuitively illustrate the method provided herein, a specific application of the method of the present specification is generally described below in conjunction with fig. 4. Referring to fig. 4, fig. 4 is an overall flowchart of a bus passenger OD matching method according to an embodiment of the present disclosure. As shown in fig. 4, a user of a front door camera and a rear door camera of a bus collects video data of passengers getting on and off the bus; judging the getting-on and getting-off behaviors of passengers by utilizing a passenger detection and tracking model based on the collected video data, namely judging whether the passengers get on or get off the bus, and further entering an on-off passenger OD matching stage; at the stage, according to the judgment result of the passenger detection and tracking model, n continuous frames of first screenshots of the boarding passengers before boarding and n continuous frames of second screenshots of the alighting passengers before alighting are intercepted, then the n continuous frames of first screenshots and the n continuous frames of second screenshots are respectively input into the trained ReID model to obtain n first vectors of the boarding passengers and n second vectors of the alighting passengers, and then a preset passenger OD matching algorithm (such as Hungary algorithm) is utilized to carry out OD matching on the boarding passengers and the alighting passengers.
As described above, in the present specification, the passenger detection and tracking model and the ReID model are trained in advance by collecting the training data set and the ReID model training data set of the passenger detection and tracking model. And then detecting and tracking the passengers getting on and off the bus by using the trained passenger detecting and tracking model so as to judge whether the tracks of the passengers are getting on and off the bus, then intercepting n continuous screenshots of the passengers getting on the bus before getting on the bus and n continuous screenshots of the passengers getting off the bus before getting off the bus by using a passenger detecting and tracking model tracking frame, respectively converting multiple continuous screenshots of the passengers getting on and off the bus into vectors by using the trained ReiD model, taking the vectors of the passengers getting on and off the bus as input, and obtaining the optimal passenger OD by using an intelligent matching algorithm. Specifically, a plurality of cosine similarities between a plurality of vectors of the passengers getting on the bus and a plurality of vectors of the passengers getting off the bus are calculated in a crossed manner, an average value of the plurality of cosine similarities is obtained, and the passengers getting on the bus and the passengers getting off the bus are matched according to the average value. The passenger detection and tracking model is adopted in the specification, the vectors of continuous multiframe passengers getting on and off the train are calculated by the ReiD model, the optimal result is obtained by using a passenger OD intelligent matching algorithm, and the OD matching accuracy of the passengers getting on and off the train is greatly improved.
Compared with the prior art, the scheme of the specification also counts the total passenger flow data, is slightly influenced by the climate environment, has high counting accuracy, and can accurately count the OD information of each passenger. Therefore, after the full passenger flow data with high accuracy is obtained, based on the OD information of each passenger, reliable data basis can be provided in the aspects of urban bus planning, bus route optimization, bus operation scheduling and the like, for example, a data basis can be provided for realizing the functions of trip prediction, arrival reminding and the like of each passenger, so that personalized services and the like can be formulated for different passengers.
Based on the same inventive concept, the description also provides a bus passenger OD matching device. Referring to fig. 4, fig. 4 is a schematic structural diagram of a bus passenger OD matching device according to an embodiment of the present disclosure.
As shown in fig. 4, the apparatus includes:
an obtaining module 501, where the obtaining module 501 is configured to obtain n consecutive first screenshots of each boarding passenger before boarding and n consecutive second screenshots of each alighting passenger before alighting;
a mapping module 502, where the mapping module 502 is configured with a pre-trained ReID model, and the n frames of first screenshots and the n frames of second screenshots can be respectively input into the pre-trained ReID model to obtain n first vectors corresponding to each getting-on passenger and n second vectors corresponding to each getting-off passenger;
a matching module 503, wherein the matching module 503 is configured to match the boarding passenger and the alighting passenger according to the n first vectors of each boarding passenger and the n second vectors of each alighting passenger.
Further, the apparatus further includes a first determining module 504, where the first determining module 504 is configured to: for any passenger, judging whether the passenger is an entering passenger or an exiting passenger in the corresponding time period according to the video data of the passenger entering or exiting the vehicle in each time period, and obtaining the video data of the entering passenger and the video data of the exiting passenger in each time period according to the judgment result; the obtaining module 501 is configured to obtain n consecutive first screenshots of each boarding passenger before boarding and n consecutive second screenshots of each disembarking passenger before disembarking according to the boarding passenger video data and the disembarking passenger video data obtained by the first determining module 504.
Further, the first determining module 504 is configured with a pre-trained passenger detecting and tracking model, and is specifically configured to: aiming at any passenger, the passenger is detected and tracked by utilizing a pre-trained passenger detection and tracking model, the track of the passenger is extracted by utilizing a tracking frame, and whether the passenger is an getting-on passenger or a getting-off passenger is judged according to the track of the passenger.
Further, the first determining module 504 is further configured to: recording an initial position and a final position of the passenger tracking frame based on the passenger track; if the initial position of the passenger is located outside the door area of the bus and the terminal position is located in the door area of the bus, judging that the passenger is a passenger getting off the bus; and if the initial position of the passenger is located in the door area of the bus and the terminal position is located outside the door area of the bus, judging that the passenger is the passenger getting on the bus.
Further, the obtaining module 501 is specifically configured to: continuously intercepting a tracking frame of a passenger detection and tracking model for any passenger at preset time intervals; based on the initial position and the end position of the passenger tracking frame, when the first determining module 504 determines that the passenger is an entering passenger or a leaving passenger, n consecutive frames of first screenshots before the passenger enters the vehicle or n consecutive frames of second screenshots before the passenger leaves the vehicle are obtained.
Further, the matching module 503 is specifically configured to: respectively calculating cosine similarity of each first vector of the boarding passenger and each second vector of the alighting passenger aiming at any boarding passenger and any alighting passenger to obtain n of each boarding passenger and each alighting passenger2Cosine similarity; calculating n2The average value of the cosine similarity is obtained to obtain the cosine similarity average value of each getting-on passenger and each getting-off passenger; and matching the passengers getting on the bus and the passengers getting off the bus based on the cosine similarity average value.
Further, the apparatus further includes a second determining module 505, before the matching module 503 calculates the cosine similarity between each first vector of the getting-on passenger and each second vector of the getting-off passenger, where the second determining module 505 is configured to determine whether the getting-off time of the getting-off passenger is earlier than the getting-on time of the getting-on passenger according to the getting-on time of the getting-on passenger and the getting-off time of the getting-off passenger; if so, judging that the passengers getting off the vehicle are not matched with the passengers getting on the vehicle; otherwise, the cosine similarity of each first vector of the boarding passenger and each second vector of the alighting passenger is calculated by using a matching module.
For a more detailed description of the apparatus, reference is made to the description of the method above, which is not repeated here.
Based on the same inventive concept, the present specification also provides an electronic device, including: at least one processor and a memory, the memory storing a program and configured to execute the above-described bus passenger OD matching method by the at least one processor.
Based on the same inventive concept, the present specification also provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the above-described bus passenger OD matching method.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually making an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Hardware Description Language), traffic, pl (core universal Programming Language), HDCal (jhdware Description Language), lang, Lola, HDL, laspam, hardward Description Language (vhr Description Language), vhal (Hardware Description Language), and vhigh-Language, which are currently used in most common. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functions of the various elements may be implemented in the same one or more software and/or hardware implementations of the present description.
As will be appreciated by one skilled in the art, the present specification embodiments may be provided as a method, system, or computer program product. Accordingly, embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
The description has been presented with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the description. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium which can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
This description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present specification, and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.