parkpow / deep-license-plate-recognition

Automatic License Plate Recognition (ALPR) or Automatic Number Plate Recognition (ANPR) software that works with any camera.
https://platerecognizer.com/
MIT License
523 stars 122 forks source link

Adding Optical Flow based approximation between inferences #142

Closed akonanykhin closed 1 year ago

akonanykhin commented 1 year ago

Finished: can be reviewed now.

Functionality:

Description: An attempt to reduce video processing time by only requesting inference for 1 out of SAMPLE (env variable in env.txt file) frames and approximating the frames in between using sparse optical flow. The only required change from normal run (https://guides.platerecognizer.com/docs/blur/video-utils/) is the absence of BLUR env variable from env.txt (blurring is done on video_editor's side with VIDEO_BLUR parameter and not by platerecognizer/skew-correction). Setting SAMPLE delivers approximately proportional speed-up in to processing time. With SAMPLE=1 no interpolation is done and processing time is maximal. High values of SAMPLE (>5) are not recommended, but could work for slower vehicles. SAMPLE=10 was tested on a wide range of videos with decent results.

Note: Env variable FPS was added to override normal detection. Recommend setting FPS=5 and SAMPLE=5 in env.txt to test speed-up and assess blur quality visually.

Any input is welcome.

akonanykhin commented 1 year ago

@marcbelmont Concerns we've discussed: Tested with VIDEO_BLUR=1 to 10, visual look of the blur is barely affected by overlapping polygons. Seen as slightly more blur than it should for the weakest blur.

Also tested with night time videos and videos with flashes/shadows. Tracking is slightly affected, but stable.