Disclosure of Invention
An object of the embodiments of the present application is to provide a method and an apparatus for charging unlicensed vehicles, an electronic device, and a storage medium, which help a parking lot system to normally charge by accurately identifying unlicensed vehicles, and promote a unlicensed vehicle to leave as soon as possible by using a supervising mechanism, so as to assist in maintaining the order of a parking lot, and solve the problems of confusion, charging error, increased maintenance cost of the parking lot, waste of public resources, and the like caused by the fact that the existing parking lot cannot normally charge unlicensed vehicles.
The embodiment of the application provides a charging method for a unlicensed vehicle, which comprises the following steps:
acquiring a first characteristic and an entrance moment of a current unlicensed vehicle entering a field;
calculating the cosine similarity of the first characteristic and the characteristic of the entering unlicensed vehicle;
comparing the cosine similarity with a preset threshold value, according to the comparison result, singly grouping the current unlicensed vehicles or grouping the current unlicensed vehicles corresponding to the maximum cosine similarity into a group, and storing the current unlicensed vehicle entering time and the first characteristic into the corresponding group;
acquiring a second characteristic and departure time of the unlicensed vehicle, searching a first characteristic which is best matched with the second characteristic according to cosine similarity, and acquiring the latest departure time of the current remaining vehicles in the group of the first characteristic;
and taking the latest entering time as the entering charging time of the departure unlicensed vehicle, and acquiring the charging time of the departure unlicensed vehicle based on the leaving time and the entering charging time.
In the implementation process, a plurality of unlicensed vehicles of the same brand and the same model have higher cosine similarity, so that the unlicensed vehicles can be divided into a group, a supervising mechanism is adopted, the latest entrance moment of the same group is taken as the entrance moment of the departure vehicle for charging when the vehicle leaves the parking lot, the unlicensed vehicles are driven away as soon as possible, the order of the parking lot is maintained in a assisting manner, and the problems that the existing parking lot cannot normally charge the unlicensed vehicles, confusion is caused, charging errors are caused, the maintenance cost of the parking lot is increased, public resources are wasted and the like are solved.
Further, the comparing the cosine similarity with a preset threshold, according to the comparison result, grouping the current unlicensed vehicles individually or grouping the parked unlicensed vehicles corresponding to the maximum cosine similarity into a group, and storing the parking time of the current unlicensed vehicle and the first characteristic into a corresponding group includes:
if the cosine similarity does not exceed the preset threshold, taking a temporary identity generated when the current unlicensed vehicle enters as an identity thereof, establishing a key value pair by taking the identity as a key, and storing the first characteristic and the entering time;
and if the cosine similarity exceeds a preset threshold value, storing the current entrance moment of the unlicensed vehicle and the first characteristic into the value of the key value pair corresponding to the identity mark corresponding to the maximum cosine similarity.
In the implementation process, the cosine similarity is used to obtain the similarity degree of two feature vectors corresponding to the first feature and the unlicensed vehicle feature, and the larger the cosine similarity is, the more similar the two features are, therefore, if the cosine similarity exceeds a preset threshold, the entering time of the current unlicensed vehicle and the first feature are stored in the value of the key value pair corresponding to the identity mark corresponding to the maximum cosine similarity, that is, the first feature and the entering time of a plurality of unlicensed vehicles of the same brand and the same model are stored in the value.
Further, the obtaining a second feature and a departure time of the unlicensed vehicle, searching for a first feature best matched with the second feature according to cosine similarity, and obtaining a latest departure time in a group where the first feature is located includes:
acquiring a first feature which is best matched with the second feature and a best matching identity corresponding to the first feature;
and traversing the value of the key where the optimal matching identity mark is located to obtain the latest approach time and a matching key value corresponding to the latest approach time, and deleting the matching key value from the key where the optimal matching identity mark is located.
In the implementation process, when the vehicle leaves the parking lot, the latest entering time is selected from the key value pair of the multiple unlicensed vehicles of the same brand and the same model which enter the parking lot, namely the value of the key value pair corresponding to the best matching identity mark, and the latest entering time is used as the entering time of the unlicensed vehicle which leaves the parking lot for charging, so that the purpose of promoting the unlicensed vehicles to drive away as soon as possible is achieved, and the orderly operation of the parking lot is maintained.
Further, the obtaining the latest approach time of the current remaining vehicles in the group where the first feature is located includes:
calculating the difference value between the departure time and all the entry time in the group of the first characteristic;
and if the difference value is larger than the preset time difference, taking the approach time corresponding to the difference value as the latest approach time.
In the implementation process, the latest entering moment is limited by the preset time difference, the charging time can be adjusted according to needs, and the flexibility is improved.
Further, acquiring a first characteristic and an approach time of a current unlicensed vehicle entering the field, comprising:
acquiring a vehicle image of the current unlicensed vehicle;
extracting a vehicle face image from the vehicle image by using a target detection model, wherein the vehicle face image comprises vehicle colors, vehicle marks, vehicle front textures, vehicle lamps, bumpers, a license plate area and vehicle appearance;
and performing feature extraction on the car face image by using a MobileFaceNet model to obtain the first feature.
In the implementation process, the characteristics of the car face image are extracted, so that the unlicensed cars of the same brand and the same model are distinguished.
Further, prior to the step of obtaining a first characteristic of a current unlicensed vehicle entering the field and a time of the approach, the method further comprises:
training a deep learning model by using a self-adaptive learning metric function Curricular face to mine a difficult sample, wherein the self-adaptive learning metric function Curricular face is expressed as:
wherein, T (cos θ)0)=cos(θ0+m);
the definition of t is:
t(k)=αr(k)+(1-α)t(k-1);
wherein k represents the kth batch of sample data, alpha is a constant, and t is at the beginning(0)R may be represented as 0:
r=Σcosθ0。
in the implementation process, the measurement function during model training adopts curriculface, the mining strength of a difficult sample can be automatically and adaptively enhanced according to the network convergence degree and the sample difficulty degree during training, and compared with other measurement functions (such as cosface, arcface and the like), the network can obtain stronger resolution capability.
Further, the method further comprises:
acquiring vehicle information including an annual inspection label, dust, in-vehicle furnishings and decorations within a windshield using a high resolution camera;
and respectively acquiring the scene and the face image in the vehicle by utilizing the polarization camera and the infrared camera so as to acquire the characteristics of the unlicensed vehicle.
In the implementation process, under the condition that the number of the unlicensed vehicles of the same brand and the same model is large, more and richer vehicle information and in-vehicle face images are acquired through cameras with more enhanced functions, such as a high-resolution camera, a polarization camera, an infrared camera and the like, so that the identification precision is improved.
The embodiment of the present application further provides a charging device for a unlicensed vehicle, the device includes:
the first feature acquisition module is used for acquiring a face image and an entrance moment of a current unlicensed vehicle entering a field, and simultaneously extracting features based on a preset deep learning model to acquire a first feature;
the calculation module is used for calculating the cosine similarity of the first characteristic and the characteristic of the entered unlicensed vehicle;
the classification module is used for comparing the cosine similarity with a preset threshold value, grouping the current unlicensed vehicles individually or grouping the parked unlicensed vehicles corresponding to the maximum cosine similarity into a group according to the comparison result, and storing the parking time of the current unlicensed vehicles and the first characteristic into the corresponding group;
the second characteristic acquisition module is used for acquiring a second characteristic and departure time of the unlicensed vehicle, searching the first characteristic which is best matched with the second characteristic according to cosine similarity, and acquiring the latest departure time of the current remaining vehicles in the group where the first characteristic is located;
and the charging time obtaining module is used for taking the latest entering time as the entering charging time of the departure unlicensed vehicle and obtaining the charging time of the departure unlicensed vehicle based on the leaving time and the entering charging time.
In the implementation process, a plurality of unlicensed vehicles with the same brand and the same model are divided into a group, and the latest entrance moment is used as the entrance charging time of the departure unlicensed vehicles, so that the unlicensed vehicles are promoted to leave as soon as possible.
Further, the classification module includes:
the comparison module is used for traversing and comparing the cosine similarity of the first characteristic and the entered unlicensed vehicle characteristic;
the first judgment module is used for taking a temporary identity generated when the current unlicensed vehicle enters the field as an identity if the cosine similarity does not exceed the preset threshold, taking the identity as a key to establish a key value pair, and storing the first characteristic and the entering time;
and the second judgment module is used for storing the current entrance moment of the unlicensed vehicle and the first characteristic into the value of the key value pair corresponding to the identity mark corresponding to the maximum cosine similarity if the cosine similarity exceeds a preset threshold.
In the implementation process, the identity is matched with the incoming unlicensed vehicle by comparing the cosine similarity of the first feature with the stored features of all the unlicensed vehicles, if the cosine similarity does not exceed a preset threshold, the similarity between the incoming unlicensed vehicle and the unlicensed vehicles in the parking lot is not high, and the incoming unlicensed vehicles and the unlicensed vehicles can be independently grouped, namely, the temporary identity is used as the identity of the temporary identity; if the similarity is larger than the preset threshold value, the similarity between the incoming unlicensed vehicles and some unlicensed vehicles in the parking lot is higher, and the unlicensed vehicles with the same brand and model are possibly classified into one group.
Further, the second feature acquisition module includes:
the identity matching module is used for acquiring a first feature which is best matched with the second feature and a best matching identity corresponding to the first feature;
and the latest moment acquisition module is used for traversing the value of the key where the optimal matching identity mark is located to acquire the latest approach moment and a matching key value corresponding to the latest approach moment, and deleting the matching key value from the key where the optimal matching identity mark is located.
In the implementation process, the latest entering time of the entering unlicensed vehicles with the same brand and model is used as the entering charging time of the leaving vehicle, so that the unlicensed vehicles can be driven out of the parking lot as soon as possible.
An embodiment of the present application further provides an electronic device, where the electronic device includes a memory and a processor, where the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute any one of the above methods for charging a unlicensed vehicle.
An embodiment of the present application further provides a readable storage medium, where computer program instructions are stored, and when the computer program instructions are read and executed by a processor, the method for charging a unlicensed vehicle is performed.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
Example 1
Referring to fig. 1, fig. 1 is a flowchart of a unlicensed vehicle charging method according to an embodiment of the present application. The method can assist a parking lot charging system to accurately identify the unlicensed vehicles and acquire the entering time of each unlicensed vehicle, so that the unlicensed vehicles are charged, in addition, a supervising mechanism is adopted, the unlicensed vehicles of the same brand and the same model enter the parking lot to be parked, and the latest entering time of the unlicensed vehicles of the same brand and the same model can be used as the entering charging time of the left unlicensed vehicles when the vehicles leave the parking lot, so that the unlicensed vehicles are promoted to leave the parking lot as soon as possible, and the orderly operation of the parking lot is maintained. The method specifically comprises the following steps:
step S100: acquiring a first characteristic and an entrance moment of a current unlicensed vehicle entering a field;
acquiring a face image and an entrance moment of a current unlicensed vehicle entering a field, and simultaneously extracting features based on a preset deep learning model to acquire a first feature;
as shown in fig. 2, a flow chart of feature extraction is provided, and the feature extraction for the deep learning model specifically includes:
step S101: extracting the car face image from the car image by using a target detection model, wherein the car face image comprises car colors, car logos, car front textures, car lamps, bumpers, a license plate area and a car appearance;
step S102: and performing feature extraction on the car face image by using a MobileFaceNet model to obtain the first feature.
Illustratively, the car face image includes, but is not limited to, car color, car logo, car front texture, car lights, bumper, license plate region, and car appearance, etc., for increasing specificity between each unlicensed car, thereby improving recognition rate.
For example, the object detection model may employ a yolo-v5 model that detects satisfactory face images from vehicle images, ready for feature extraction. On the premise of ensuring the detection effect, the yolo-v5 model is higher in speed and more flexible than a previous yolo model, and is favorable for rapid deployment.
The network for feature extraction adopts MobileFaceNet, wherein layers are mainly depth separable convolution layers, the total amount of training parameters is 1986880, the occupied machine resources are less, reasoning can be completed in a short time, the network can be ensured to have good capacity, and the output dimensionality of each image is 512.
Illustratively, at an entrance of a parking lot, a structured vehicle passing record and a vehicle face image of a current unlicensed vehicle are obtained from a license plate recognition system, a vehicle face is detected, characteristics are extracted, a temporary Identity (ID) is generated for the current unlicensed vehicle by using structured data, and the characteristics of all the unlicensed vehicles are stored in a hash table H in the system.
The temporary identity ID may be an identification code consisting of time and unlicensed vehicle serial number information extracted from the structured vehicle passing record.
Step S200: calculating the cosine similarity of the first characteristic and all stored unlicensed vehicle characteristics;
step S300: comparing the cosine similarity with a preset threshold value, according to the comparison result, singly grouping the current unlicensed vehicles or grouping the current unlicensed vehicles corresponding to the maximum cosine similarity into a group, and storing the current unlicensed vehicle entering time and the first characteristic into the corresponding group;
as shown in fig. 3, a flowchart of a process for determining a current unlicensed vehicle based on cosine similarity includes:
step S301: the cosine similarity of the first feature and the features of the entered unlicensed vehicles is compared in a traversing mode;
step S302: if the cosine similarity does not exceed the preset threshold, taking a temporary identity generated when the current unlicensed vehicle enters as an identity thereof, and establishing a key value pair by taking the identity as a key, wherein the key value pair comprises the first characteristic and the entering time;
step S303: and if the cosine similarity exceeds a preset threshold value, combining and storing the current entrance time of the unlicensed vehicle and the first characteristic into a value of a key value pair corresponding to the identity mark corresponding to the maximum cosine similarity.
Exemplarily, the first feature of the current unlicensed vehicle passing through the entrance is compared with the features of all unlicensed vehicles in the parking lot, the similarity of the rest strings is calculated, the cosine similarity is larger, the two features are more similar, if the cosine similarity is not greater than the preset threshold value after the comparison, the similarity between the current unlicensed vehicle and all the unlicensed vehicles in the parking lot is lower, and the current unlicensed vehicle is not a unlicensed vehicle of the same brand and model, a key value pair is established in H by taking the temporary identity ID of the current unlicensed vehicle as a key and taking an empty stack as a value, and the first feature and the arrival time of the current unlicensed vehicle are pushed into the stack, as shown in fig. 4, the storage schematic diagram of the current unlicensed vehicle is shown when the preset threshold value is not exceeded.
If the cosine similarity exceeds the preset threshold value after comparison, selecting the ID corresponding to the maximum cosine similarity (the vehicle corresponding to the maximum cosine similarity and the current unlicensed vehicle belong to the same brand and model vehicle), namely a certain key in the H table, called as the IDbest matchAnd pushing the first characteristic and the approach moment of the current unlicensed vehicle into the value (stack) corresponding to the key, as shown in fig. 5, which is a schematic storage diagram of the current unlicensed vehicle when a preset threshold value is exceeded, and then discarding the temporary identity ID of the current unlicensed vehicle obtained just by calculation, wherein the ID already exists in the system at this timebest matchIt is already the ID of the current unlicensed car.
For the cosine similarity between the first feature and the unlicensed vehicle feature, the extracted feature of the vehicle image is a 512-dimensional vector, and the cosine similarity between any two feature vectors is defined as:
wherein the numerator of the formula is the inner product of two vectors; norm () in the denominator represents the modulo length of the vector, i.e., the L2 norm, and the denominator represents the product of the two vector modulo lengths.
The cosine similarity has a value range of [ -1,1], and the closer to-1, the more dissimilar the two vectors are; closer to 1 indicates that the two vectors are more similar.
The similarity degree of the two characteristic vectors can be known through cosine similarity, so that whether the corresponding car face images which are compared belong to the same ID (the same brand and the same model of the unlicensed car) or not can be known.
Step S400: acquiring a second characteristic and departure time of the unlicensed vehicle, searching a first characteristic which is best matched with the second characteristic according to cosine similarity, and acquiring the latest departure time of the current remaining vehicles in the group of the first characteristic;
as shown in fig. 6, the flowchart for obtaining the latest approach time may specifically include:
step S401: acquiring a first feature which is best matched with the second feature and a best matching identity corresponding to the first feature;
step S402: and traversing the key value of the key where the optimal matching identity is located to obtain the latest approach time and the matching key value corresponding to the latest approach time, and deleting the matching key value from the key where the optimal matching identity is located.
In a storage mode using a stack for storage, the first feature and the approach time at the top of the value corresponding to the best matching identifier (i.e. the first feature and the approach time added into the value at the latest) are used as the first feature and the approach time of the vehicle corresponding to the second feature, and this approach time is used for billing of the vehicle corresponding to the second feature, and then this first feature and the approach time are deleted, that is, this first feature and the approach time are popped up from the top of the value.
Other storage means, such as a set, etc., may also be used, and are not limited herein.
When the vehicle passing record of the present unlicensed vehicle is obtained at the exit of the parking lot, the currently obtained second feature is compared with the existing unlicensed vehicle feature of the system, the cosine similarity between the second feature and the existing unlicensed vehicle feature is calculated in the process, so that the best matching unlicensed vehicle feature is found, the specific process is shown in step S300, no further description is provided, and the corresponding ID which is the best matching identity ID can be found according to the best matching unlicensed vehicle featurebest matchThen at IDbest matchTo get the latest approach time, possibly from the IDbest matchPopping up a corresponding key value at the stack top of the corresponding key: features and time of approach (latest time of approach t)Moment of approach). The corresponding characteristics and the approach time of the pair of key values popped from the top of the stack are not saved in the stack any moreAnd (5) enabling the next unlicensed vehicle to continue to search the latest entering time.
For example, a plurality of unlicensed vehicles of the same brand and the same model enter the field at different times, and the latest entering time of the first unlicensed vehicle of the same brand and the same model can be used as the entering charging time of the departure unlicensed vehicle (the entering time of the first unlicensed vehicle is possibly earlier than the latest entering time), so that the parking cost can be saved. Based on the method, a supervision mechanism is realized, and the unlicensed vehicles are prompted to drive away as soon as possible so as to assist in maintaining the order of the parking lot, and the problems that the existing parking lot cannot normally charge the unlicensed vehicles, so that confusion, charging errors, increase in the maintenance cost of the parking lot, waste of public resources and the like are caused are solved.
In addition, as one of the embodiments, the selection of the latest approach time may be limited, and the difference between the approach time and all the approach times in the group where the first feature is located may be calculated; and if the difference value is larger than the preset time difference, taking the approach time corresponding to the difference value as the latest approach time.
For example, a plurality of groups of key value pairs are stored in the same ID, namely, a plurality of unlicensed vehicles of the same brand and the same model enter the field, when one of the unlicensed vehicles leaves the field, because the departure time is close to the latest departure time, the departure time larger than the preset time difference can be used as the latest departure time corresponding to the unlicensed vehicle, and the preset time difference can be adjusted according to a plurality of factors such as the number of vehicles in the parking lot, the entering frequency of the unlicensed vehicles of the same brand and the same model, so that the flexibility is increased.
Step S500: and taking the latest entering time as the entering charging time of the departure unlicensed vehicle, and acquiring the charging time of the departure unlicensed vehicle based on the leaving time and the entering charging time.
The charging time of the present unlicensed vehicle is as follows: t is tMoment of departure-tMoment of approachThat is, the counting of the charging time of a unlicensed vehicle is completed, the first feature popped up from the top of the stack and the time of arrival will not be saved in the stack, as shown in fig. 7, which is a schematic diagram of a system at the exit of the parking lot.
For example, 3 BYD vehicles enter the field successively, if the cosine similarity exceeds the threshold, the BYD vehicles have the same ID and belong to the same key-value pair, and the characteristics and the entrance time of the 3 BYD vehicles are stored in the value of the key-value pair with the ID as the key; the structure of the value is similar to a stack, and the characteristics and the approach time of the BYD of the latest approach are naturally stored at the top of the stack; if 1 BYD leaves, popping up the stack top as the entering time of the BYD; therefore, the earlier the unlicensed vehicles are out of the field, the less the charging is, so that the unlicensed vehicles are encouraged to be out of the field, the phase change punishment is made on the residence of the unlicensed vehicles, and the supervising effect is realized.
Before the step of feature extraction based on the preset deep learning model, the method further comprises:
the self-adaptive learning measurement function Curricular face is used for training a deep learning model to mine a difficult sample, the mining strength of the difficult sample can be automatically and self-adaptively enhanced according to the network convergence degree and the sample difficulty degree during training of the self-adaptive learning measurement function Curricular face, and compared with other measurement functions (such as cosface, arcface and the like), the network can obtain stronger resolving power.
In general, the cross-entropy based loss function used to identify problems is of the general formula:
where c is a constant, cos θ0The labels correspond to cosine similarity, cos theta corresponds to non-labels correspond to cosine similarity, and T is related to cos theta0N is a function on cos θ.
While in other metric functions of margin-based, such as arcface, the corresponding functions T and N are:
T(cosθ0)=cos(θ0+m);
N(cosθ)=cosθ;
as can be seen from the above formula, the function N outputs the non-label corresponding cosine similarity without any operation, and the weighting factor of the similarity is not increased or other operations are not performed, i.e., difficult sample mining is not performed.
For another example, mv-arc-softmax, the corresponding function N is:
where t is a hyperparameter and is set to a fixed value. The formula judges whether a non-label corresponding sample is a difficult sample by comparing the non-label corresponding cosine similarity with the label corresponding cosine similarity acted by the function T.
If the cosine similarity corresponding to the non-label is greater than the cosine similarity corresponding to the label after the function T, the sample corresponding to the non-label is a difficult sample, otherwise, the sample is a simple sample. The formula gives the expression of the function N when determining that a certain non-label corresponding sample is a simple sample and a difficult sample respectively. It can be seen that, when the non-tag corresponding sample is a difficult sample, the function N acts to change the similarity, where the fixed value of t is usually a value greater than 1, for example, 1.4, so that the function N increases the weight of the non-tag corresponding cosine similarity, so that the training focuses more on the similarity, and therefore the difficult sample mining is performed. However, since t is a fixed value, the mining strength for difficult samples is constant throughout the training process, which weakens the learning of simple samples by the network in the early training stage to some extent, thereby causing the network to not converge.
Based on the above factors, curriculrface follows a function T of a certain mature margin-based metric function, such as a function T of arcfacace, on the one hand, and improves T and a function N on the other hand, so that the adaptive learning metric function curriculrface can be expressed as:
when the non-tag corresponding samples are difficult samples, the function N contains a nonlinear term related to the cosine similarity corresponding to the non-tag, and the threshold value of the easy-to-obtain t is:
tcritical=1-cosθ;
therefore, the harder a certain sample is, which means that the cosine similarity corresponding to the non-tag in the formula is larger, the smaller the critical value is, and the function N is more prone to give a weight value larger than 1 to the cosine similarity corresponding to the non-tag; conversely, the easier a certain sample is, meaning that the smaller the non-tag corresponding cosine similarity in the above formula is, the larger the threshold value is, at this time, the function N is more likely to give a weight value smaller than 1 to the non-tag corresponding cosine similarity, so that the function N realizes that the weight is given to the function N according to the difficulty degree of the sample.
And t is no longer a fixed value, defined as:
t(k)=αr(k)+(1-α)t(k-1);
wherein k represents the kth batch of sample data, alpha is a constant, and t is at the beginning(0)R may be represented as 0:
r=Σcosθ0。
it can be seen that r is the sum of cosine similarities corresponding to all tags in the batch of data, and represents the convergence degree of the network at this time, so that t has a linear relationship with t of the previous batch of data and the network convergence degree corresponding to the batch of data, and the function N realizes that a weight is given to a difficult sample according to the network convergence degree.
In summary, curricillarface inherits the advantages of a margin-based measurement function, realizes more reasonable mining of difficult samples, and can effectively improve the resolution capability of the network.
In addition, for the condition that the number of the unlicensed vehicles is large, especially for the condition that the number of the unlicensed vehicles of the same brand and the same model is large, the resolution capability of the system can be increased by adopting cameras with more abundant functions, such as a high-resolution camera, a camera with a polarized lens, a camera capable of shooting infrared images and the like, so that the identification precision and the accuracy are improved.
Specifically, more image information, such as annual inspection labels, dust, in-vehicle ornaments, decorations, etc., within the range of the windshield, is acquired by the high-resolution camera; the influence of the reflected light of the strong light on the windshield is eliminated through the camera with the polarizing lens, so that a clear image in the vehicle is obtained; the method comprises the steps of obtaining a face image in a car under a dark light condition through a camera capable of shooting an infrared image, and distinguishing the unlicensed car by combining a face recognition method.
The method adopts a supervising and urging mechanism, and when a plurality of vehicles with the same brand and the same model are present, the vehicles with the same type entering the parking lot are charged according to the latest time, so that the vehicles without the license boards are promoted to drive away as soon as possible, and the orderly operation of the parking lot is maintained.
Example 2
The embodiment of the present application provides a unlicensed vehicle charging device, which is applied to the unlicensed vehicle charging method in embodiment 1, and is a structural block diagram of the unlicensed vehicle charging device as shown in fig. 8, where the device includes:
the first feature acquisition module 100 is configured to acquire a face image and an approach time of a current unlicensed vehicle entering a field, and perform feature extraction based on a preset deep learning model to acquire a first feature;
a calculating module 200, configured to calculate a cosine similarity between the first feature and the feature of the approaching unlicensed vehicle;
the classification module 300 is configured to compare the cosine similarity with a preset threshold, group the current unlicensed vehicles individually or group the parked unlicensed vehicles corresponding to the maximum cosine similarity according to the comparison result, and store the parking time of the current unlicensed vehicles and the first characteristic into corresponding groups;
a second feature obtaining module 400, configured to obtain a second feature and a departure time of the unlicensed vehicle, search for the first feature that best matches the second feature according to cosine similarity, and obtain a latest departure time of the current remaining vehicle in the group where the first feature is located;
and a charging time obtaining module 500, configured to use the latest entry time as an entry charging time of the departure unlicensed vehicle, and obtain the charging time of the departure unlicensed vehicle based on the exit time and the entry charging time.
As shown in fig. 9, the charging device is a block diagram of an overall structure of the unlicensed vehicle charging device, where the first feature obtaining module 100 includes:
the system comprises a vehicle face image acquisition module 101, a vehicle identification module and a vehicle identification module, wherein the vehicle face image acquisition module 101 is used for extracting a vehicle face image from a vehicle image by using a target detection model, and the vehicle face image comprises vehicle colors, vehicle marks, vehicle front textures, vehicle lamps, bumpers, a license plate area and vehicle shapes;
and the feature extraction module 102 is configured to perform feature extraction on the car face image by using a MobileFaceNets model to obtain the first feature.
The classification module 300 includes:
a first judging module 301, configured to, if none of the cosine similarities exceeds the preset threshold, use a temporary identity generated when the current unlicensed vehicle enters as an identity thereof, establish a key-value pair with the identity as a key, and store the first feature and the entering time;
the second determining module 302 is configured to, if the cosine similarity exceeds a preset threshold, store the current entrance time of the unlicensed vehicle and the first feature into a value of a key value pair corresponding to an identity mark corresponding to the maximum cosine similarity.
The second feature acquisition module 400 includes:
an identity matching module 401, configured to obtain a first feature that is best matched with the second feature and a best matching identity corresponding to the first feature;
a latest time obtaining module 402, configured to traverse values of the key where the best matching identifier is located, to obtain a matching key value corresponding to the latest entry time and the latest entry time, and delete the matching key value from the key where the best matching identifier is located.
An embodiment of the present application further provides an electronic device, where the electronic device includes a memory and a processor, the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the unlicensed vehicle charging method described in embodiment 1.
The embodiment of the present application further provides a readable storage medium, where computer program instructions are stored, and when the computer program instructions are read and executed by a processor, the method for charging a unlicensed vehicle according to embodiment 1 is executed.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, 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 identical elements in a process, method, article, or apparatus that comprises the element.