Blue Iris and DeepStack ALPR

I just posted V2.0 in the first post. I still need to write up the instructions on how to set it up. I am hoping to finish the instructions sometime today.
I took a break from my DeepStack Custom Model project and started work on a DeepStack LPR solution.

I made a lot of progress on the DeepStack LPR. The solution is made up of one Python scripts that crops and rotates (if needed) the license plate. Then the script reads all of the characters in the plate and logs the license plate details. Also the script will save the DeepStack results in JSON format and YOLO format. This data can be used to improve DeepStack Custom Model that does the OCR.

The model that does the OCR needs some work I would say it is about 75% accurate. The way the script is written it will save a small text file that can be used to retrain the OCR model. Once everyone starts using the DeepStack LPR models and scripts for a week or two you can send me the alert images and the text files with these files I will retrian the OCR model. If we do this about two to three times we should have a accurate OCR model. I will post more details later.

Also your antivirus might detect the scripts as a virus because the antivirus software has no signature reference for the Python scripts since they are not mass produced software. My Norton Antivirus did detecte them as a virus and I had to let Norton Antivirus know it is OK to run.

Version 2.0 notes
  • Only one script is needed for V2.0. The script does the cropping and rotation (if needed). Once cropped the script will have DeepStack run the OCR on the cropped plate.
  • After the OCR the script will save the DeepStack results in JSON format and YOLO format (for future retraining of the OCR custom model)
  • Since there is only one script only one camera is needed with the cropped license plate.
  • Also the new version is twice as fast as V1.1 since there is only one script.


View attachment 114941
 
While I was writing the instruction I broke V2.0. I updated the first post with V2.1. I am still working on the instructions, will post later this evening .
I took a break from my DeepStack Custom Model project and started work on a DeepStack ALPR solution.

I made a lot of progress on the DeepStack ALPR. The solution is made up of one Python scripts that crops and rotates (if needed) the license plate. Then the script reads all of the characters in the plate and logs the license plate details. Also the script will save the DeepStack results in JSON format and YOLO format. This data can be used to improve DeepStack Custom Model that does the OCR.

The model that does the OCR needs some work I would say it is about 75% accurate. The way the script is written it will save a small text file that can be used to retrain the OCR model. Once everyone starts using the DeepStack LPR models and scripts for a week or two you can send me the alert images and the text files with these files I will retrian the OCR model. If we do this about two to three times we should have a accurate OCR model. I will post more details later.

Also your antivirus might detect the scripts as a virus because the antivirus software has no signature reference for the Python script since they are not mass produced software. My Norton Antivirus did detecte it as a virus and I had to let Norton Antivirus know it is OK to run.

Version 2.0 notes:
  • Only one script is needed for V2.0. The script does the cropping and rotation (if needed). Once cropped the script will have DeepStack run the OCR on the cropped plate.
  • After the OCR the script will save the DeepStack results in JSON format and YOLO format (for future retraining of the OCR custom model)
  • Since there is only one script only one camera is needed with the cropped license plate.
  • Also the new version is twice as fast as V1.1 since there is only one script.
Version 2.1 notes:
  • Corrected rotation error
  • Corrected trigger delay error

View attachment 114941
 
The instructions for version 2.1 is posted in the first post
 
What version are you using, you should be on version 2.1?

Also cut and paste your ini file less userID and password and if there is a log file cut and paste the last few lines.

Yes, I am running v2.1.

here is lines from config:

[ds_lpr]
; Blue Iris short name for cropped licence plate camera and resolution settings
camera = Cam5
image_x = 640
image_y = 480

; Use to rotate cropped licence plate, positive number for CCW or negative number for CW
rotate_deg = 0

; If cropped licence plate is rotated increase number by "1" until black corners are removed
image_offset = 0

; Leave default setting of 0.200 ms
trigger_delay = 0.100

; Where Blue Iris saves LPR camera's alert images from motion trigger
input_directory = D:\BlueIris\Alerts\Cam5\*

; If Blue Iris is installed with default settings no changes needed, where script will save the cropped licence plate
cropped_directory = C:\Program Files\Blue Iris 5\www\ALPR

[ds_ocr]
; Where cropped camera's alert directory is
lpr_directory = D:\BlueIris\Alerts\ALPR\*

; Leave default setting of 4, how close the characters can be before the inferior one is ignored
overlapping_threshold = 4

; Leave default setting 0.40, if worst confidence is less than this, the result wont be written to output_logfile
min_conf_thres = 0.40

; Leave default setting of 2, if there is not more than this number of characters detected on the plate, the result wont be written to output_logfile
min_len_thres = 0

; Leave default setting of 8, if there is more character detected than this number, program will cut out the weakest confidence characters until value met.
plate_len_threshold = 8

; Leave default setting of 0.350 ms
path_delay = 0.350

and no log file. :-(
 
Yes, I am running v2.1.

here is lines from config:

[ds_lpr]
; Blue Iris short name for cropped licence plate camera and resolution settings
camera = Cam5
image_x = 640
image_y = 480

; Use to rotate cropped licence plate, positive number for CCW or negative number for CW
rotate_deg = 0

; If cropped licence plate is rotated increase number by "1" until black corners are removed
image_offset = 0

; Leave default setting of 0.200 ms
trigger_delay = 0.100

; Where Blue Iris saves LPR camera's alert images from motion trigger
input_directory = D:\BlueIris\Alerts\Cam5\*

; If Blue Iris is installed with default settings no changes needed, where script will save the cropped licence plate
cropped_directory = C:\Program Files\Blue Iris 5\www\ALPR

[ds_ocr]
; Where cropped camera's alert directory is
lpr_directory = D:\BlueIris\Alerts\ALPR\*

; Leave default setting of 4, how close the characters can be before the inferior one is ignored
overlapping_threshold = 4

; Leave default setting 0.40, if worst confidence is less than this, the result wont be written to output_logfile
min_conf_thres = 0.40

; Leave default setting of 2, if there is not more than this number of characters detected on the plate, the result wont be written to output_logfile
min_len_thres = 0

; Leave default setting of 8, if there is more character detected than this number, program will cut out the weakest confidence characters until value met.
plate_len_threshold = 8

; Leave default setting of 0.350 ms
path_delay = 0.350

and no log file. :-(
The camera should be set to ALPR also set the trigger_delay back to 0.200. Lets see if this works.

[ds_lpr]
; Blue Iris short name for cropped licence plate camera and resolution settings
camera = ALPR
image_x = 640
image_y = 480

; Leave default setting of 0.200 ms
trigger_delay = 0.200
 
Made it partially through the setup instructions but ran out of time before work. Setup was more involved than I anticipated. :) Looks impressive but I'm going to hold off for now. I'll follow this thread for updates.
 
Post screenshots like the ones in step 2 and ini file

I have exactly same settings as yours in step 2 and where do I find the ini file?

I cannot figure out why the script can't read my plates. :-(

The ALPR image is from ealier today, and not current image.
 

Attachments

  • logfile.txt
    logfile.txt
    1.2 KB · Views: 10
  • ALPR.20220110_170026.0.6146-1.0.0.jpg
    ALPR.20220110_170026.0.6146-1.0.0.jpg
    53 KB · Views: 23
  • ALPR.jpg
    ALPR.jpg
    31.1 KB · Views: 23
Last edited:
I have exactly same settings as yours in step 2 and where do I find the ini file?
it is what you provided here
 
it is what you provided here

[ds_lpr]
; Blue Iris short name for cropped licence plate camera and resolution settings
camera = ALPR
image_x = 640
image_y = 480

; Use to rotate cropped licence plate, positive number for CCW or negative number for CW
rotate_deg = 0

; If cropped licence plate is rotated increase number by "1" until black corners are removed
image_offset = 0

; Leave default setting of 0.200 ms
trigger_delay = 0.200

; Where Blue Iris saves LPR camera's alert images from motion trigger
input_directory = D:\BlueIris\Alerts\Cam5\*

; If Blue Iris is installed with default settings no changes needed, where script will save the cropped licence plate
cropped_directory = C:\Program Files\Blue Iris 5\www\ALPR

[ds_ocr]
; Where cropped camera's alert directory is
lpr_directory = D:\BlueIris\Alerts\ALPR\*

; Leave default setting of 4, how close the characters can be before the inferior one is ignored
overlapping_threshold = 4

; Leave default setting 0.40, if worst confidence is less than this, the result wont be written to output_logfile
min_conf_thres = 0.40

; Leave default setting of 2, if there is not more than this number of characters detected on the plate, the result wont be written to output_logfile
min_len_thres = 0

; Leave default setting of 8, if there is more character detected than this number, program will cut out the weakest confidence characters until value met.
plate_len_threshold = 8

; Leave default setting of 0.350 ms
path_delay = 0.350
 
[ds_lpr]
; Blue Iris short name for cropped licence plate camera and resolution settings
camera = ALPR
image_x = 640
image_y = 480

; Use to rotate cropped licence plate, positive number for CCW or negative number for CW
rotate_deg = 0

; If cropped licence plate is rotated increase number by "1" until black corners are removed
image_offset = 0

; Leave default setting of 0.200 ms
trigger_delay = 0.200

; Where Blue Iris saves LPR camera's alert images from motion trigger
input_directory = D:\BlueIris\Alerts\Cam5\*

; If Blue Iris is installed with default settings no changes needed, where script will save the cropped licence plate
cropped_directory = C:\Program Files\Blue Iris 5\www\ALPR

[ds_ocr]
; Where cropped camera's alert directory is
lpr_directory = D:\BlueIris\Alerts\ALPR\*

; Leave default setting of 4, how close the characters can be before the inferior one is ignored
overlapping_threshold = 4

; Leave default setting 0.40, if worst confidence is less than this, the result wont be written to output_logfile
min_conf_thres = 0.40

; Leave default setting of 2, if there is not more than this number of characters detected on the plate, the result wont be written to output_logfile
min_len_thres = 0

; Leave default setting of 8, if there is more character detected than this number, program will cut out the weakest confidence characters until value met.
plate_len_threshold = 8

; Leave default setting of 0.350 ms
path_delay = 0.350
Try the below settings so the the ALPR camera zooms in on the plate

; Blue Iris short name for cropped licence plate camera and resolution settings
camera = ALPR
image_x = 160
image_y = 120
 
[ds_lpr]
; Blue Iris short name for cropped licence plate camera and resolution settings
camera = ALPR
image_x = 640
image_y = 480

; Use to rotate cropped licence plate, positive number for CCW or negative number for CW
rotate_deg = 0

; If cropped licence plate is rotated increase number by "1" until black corners are removed
image_offset = 0

; Leave default setting of 0.200 ms
trigger_delay = 0.200

; Where Blue Iris saves LPR camera's alert images from motion trigger
input_directory = D:\BlueIris\Alerts\Cam5\*

; If Blue Iris is installed with default settings no changes needed, where script will save the cropped licence plate
cropped_directory = C:\Program Files\Blue Iris 5\www\ALPR

[ds_ocr]
; Where cropped camera's alert directory is
lpr_directory = D:\BlueIris\Alerts\ALPR\*

; Leave default setting of 4, how close the characters can be before the inferior one is ignored
overlapping_threshold = 4

; Leave default setting 0.40, if worst confidence is less than this, the result wont be written to output_logfile
min_conf_thres = 0.40

; Leave default setting of 2, if there is not more than this number of characters detected on the plate, the result wont be written to output_logfile
min_len_thres = 0

; Leave default setting of 8, if there is more character detected than this number, program will cut out the weakest confidence characters until value met.
plate_len_threshold = 8

; Leave default setting of 0.350 ms
path_delay = 0.350
Also post a screenshot of the folder where the script is it should be in C:\DeepStackALPR