alpr-unconstrained icon indicating copy to clipboard operation
alpr-unconstrained copied to clipboard

detection time issue

Open wyblmj opened this issue 6 years ago • 5 comments

Hi,

I was trying to implement the model in real time, sometimes, the detection for the number plate phase takes 0.1 second or less, but sometime it may need >1 second for each car, any idea or insight for this?

OCR part is quite stable and fast.

Thank you!

wyblmj avatar Sep 06 '19 12:09 wyblmj


detection_time:       0.8436911106109619 (361, 387, 3)

{'class': 'car', 'confidence': 0.7496426105499268, 'bbox': [509.45611572265625, 123.43011474609375, 896.5176391601562, 484.4489440917969], 'lpnumber': 'P2S2F0Z'}

detection_time:       1.1452476978302002 (380, 528, 3)

{'class': 'car', 'confidence': 0.3859272599220276, 'bbox': [167.177734375, 95.00535583496094, 695.397705078125, 475.1946716308594], 'lpnumber': 'PZ62FX'}

detection_time:       0.024300336837768555 (306, 345, 3)

{'class': 'car', 'confidence': 0.8674343228340149, 'bbox': [148.03366088867188, 139.3701934814453, 493.0506286621094, 445.1895751953125], 'lpnumber': 'PZ62FX'}

detection_time:       0.019081830978393555 (370, 374, 3)

{'class': 'car', 'confidence': 0.8243468403816223, 'bbox': [524.9869384765625, 111.51688385009766, 898.987548828125, 481.6993713378906], 'lpnumber': 'P262F0Z'}

detection_time:       0.04279327392578125 (398, 543, 3)

{'class': 'car', 'confidence': 0.35441669821739197, 'bbox': [165.87564086914062, 79.4346923828125, 708.5262451171875, 477.72381591796875], 'lpnumber': 'P262F0X'}

detection_time:       0.027606725692749023 (302, 345, 3)

{'class': 'car', 'confidence': 0.8941181898117065, 'bbox': [145.5121307373047, 137.0426788330078, 490.57305908203125, 439.7840881347656], 'lpnumber': 'PZ62F0X'}

detection_time:       0.01844048500061035 (375, 379, 3)

{'class': 'car', 'confidence': 0.8393195867538452, 'bbox': [522.6206665039062, 99.0545883178711, 901.1408081054688, 474.3648376464844], 'lpnumber': 'P262F0Z'}

detection_time:       0.02838587760925293 (301, 347, 3)

{'class': 'car', 'confidence': 0.8418242931365967, 'bbox': [143.4230499267578, 138.57362365722656, 490.14862060546875, 439.9139709472656], 'lpnumber': 'P2620X'}

detection_time:       0.020696640014648438 (332, 385, 3)

{'class': 'car', 'confidence': 0.7623285055160522, 'bbox': [539.0675659179688, 128.10333251953125, 924.0025024414062, 460.77825927734375], 'lpnumber': 'P262F0Z'}

detection_time:       1.0625498294830322 (413, 509, 3)

{'class': 'car', 'confidence': 0.30350157618522644, 'bbox': [376.99359130859375, 64.01167297363281, 885.2009887695312, 477.33282470703125], 'lpnumber': 'P262F0Z'}

detection_time:       0.023333072662353516 (302, 344, 3)

{'class': 'car', 'confidence': 0.8930449485778809, 'bbox': [146.70216369628906, 140.70623779296875, 490.9471435546875, 442.40240478515625], 'lpnumber': 'PZ62F0X'}

detection_time:       0.023662567138671875 (333, 385, 3)

{'class': 'car', 'confidence': 0.7581157088279724, 'bbox': [537.8450927734375, 128.2777557373047, 922.4044189453125, 461.4403076171875], 'lpnumber': 'P262F0Z'}

detection_time:       0.02642965316772461 (416, 492, 3)

{'class': 'car', 'confidence': 0.3797966241836548, 'bbox': [398.7354431152344, 62.118106842041016, 890.9222412109375, 478.7484130859375], 'lpnumber': 'P262F0Z'}

detection_time:       0.027992725372314453 (313, 345, 3)

{'class': 'car', 'confidence': 0.9228568077087402, 'bbox': [146.7262725830078, 137.85787963867188, 491.3896484375, 450.105224609375], 'lpnumber': 'PZ62F0X'}

detection_time:       0.7520897388458252 (371, 371, 3)

{'class': 'car', 'confidence': 0.7665897607803345, 'bbox': [527.9735107421875, 109.0196762084961, 898.0413818359375, 480.4696044921875], 'lpnumber': 'P262F0Z'}

detection_time:       1.3800139427185059 (457, 724, 3)

{'class': 'car', 'confidence': 0.37833863496780396, 'bbox': [150.31417846679688, 47.27754211425781, 874.67724609375, 504.4940490722656], 'lpnumber': 'P262F0X'}

wyblmj avatar Sep 06 '19 14:09 wyblmj

as can be seen from the detection_time, which is extracted from the function 'detect_lp' the elapsed time for model.predict(T)... sometimes is around 0.02, but sometimes, it jump to 1 or 2 seconds. the following is the image shapes.

Could someone please give some insight of this time cost issue?

wyblmj avatar Sep 06 '19 14:09 wyblmj

@wyblmj Hello, I had the same question before, but when I change the (w,h) of the test image, I found detection time is close to the size of image, which image is larger, more time you need to detect.

cherishtttz avatar Oct 21 '19 03:10 cherishtttz

@wyblmj Hello, I had the same question before, but when I change the (w,h) of the test image, I found detection time is close to the size of image, which image is larger, more time you need to detect.

However, when its running for a longer time, the processing time will be more stable and fast. any idea how to explain this situation?

wyblmj avatar Nov 26 '19 15:11 wyblmj

The time of detection depends on the dimensions of the image as it requires more processing to go through all the pixels.

Regarding the processing time becoming faster and more stable after running is a Normal phenomenon. The first couple of images take more time than the rest as the model initializes a lot of different variables.

AsharFatmi avatar Jan 28 '20 14:01 AsharFatmi