Blue Iris and DeepStack ALPR

VideoDad

Pulling my weight
Joined
Apr 13, 2022
Messages
157
Reaction score
208
Location
USA
Yes, I did that. and then %cd /content/drive/MyDrive before cloning the deepstack-trainer. I think that should allow it to keep the results even if the Google Colab session is clobbered for time. Thanks again... I'm so close now!
 

MikeLud1

IPCT Contributor
Joined
Apr 5, 2017
Messages
2,141
Reaction score
4,118
Location
Brooklyn, NY
Yes, I did that. and then %cd /content/drive/MyDrive before cloning the deepstack-trainer. I think that should allow it to keep the results even if the Google Colab session is clobbered for time. Thanks again... I'm so close now!
If you mount the drive and it times out during training you can resume using the below
Code:
!python3 train.py --resume --dataset-path "\content\drive\MyDrive"
 

Futaba

Pulling my weight
Joined
Nov 13, 2015
Messages
220
Reaction score
153
Thanks for this @MikeLud1.

I have got it set up to the point where the cropped camera adds an alert to BI's alerts list and it is able to tag it with OCR result.

1654406170283.png

However, I am also not getting the log files and the json files saved. They are not saved where the jpg files are saved. The jpg files are saved to D:\BlueIris\Alerts instead of D:\BlueIris\Alerts\ALPR. in the ini file lpr_directory is set to D:\BlueIris\Alerts\ALPR\*

I also can't find logfile.txt anywhere on the drives. Any suggestions? Thanks.
 

MikeLud1

IPCT Contributor
Joined
Apr 5, 2017
Messages
2,141
Reaction score
4,118
Location
Brooklyn, NY
Thanks for this @MikeLud1.

I have got it set up to the point where the cropped camera adds an alert to BI's alerts list and it is able to tag it with OCR result.

View attachment 129837

However, I am also not getting the log files and the json files saved. They are not saved where the jpg files are saved. The jpg files are saved to D:\BlueIris\Alerts instead of D:\BlueIris\Alerts\ALPR. in the ini file lpr_directory is set to D:\BlueIris\Alerts\ALPR\*

I also can't find logfile.txt anywhere on the drives. Any suggestions? Thanks.
Post a copy of your DS_ALPR_config.ini less your password.
 

Futaba

Pulling my weight
Joined
Nov 13, 2015
Messages
220
Reaction score
153
Post a copy of your DS_ALPR_config.ini less your password.
Code:
[shared]
; If Blue Iris and DeepStack is installed with default settings no changes needed, otherwise adjusted as needed
    bi_server = http://127.0.0.1:8888
    ds_server = http://127.0.0.1:81
    alpr_server_ip = 127.0.0.1
    alpr_server_port = 5000

; Blue Iris userid and password is needed so script can communicate back to Blue Iris (must have admin rights)
    userid =
    password =

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

; 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

; 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 = 2

; 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.150 ms
    path_delay = 0.150

Here it is:
 

MikeLud1

IPCT Contributor
Joined
Apr 5, 2017
Messages
2,141
Reaction score
4,118
Location
Brooklyn, NY
The ini file looks good, one thing to check if the userid in the ini has admin rights. Also make sure the ALPR camera has the below settings. If this does not work try setting the path_delay to 0.200

1654481481288.png
1654481518324.png
 

Futaba

Pulling my weight
Joined
Nov 13, 2015
Messages
220
Reaction score
153
@MikeLud1 yes, account has admin privilege. I am getting car,jpg and file path.txt files saved to C:\Program Files (x86)\DeepStackALPR, and license plate captured and OCR'ed to the Alerts list. So most of it is working. However I am also not getting the log files and the json files saved. They are not saved where the jpg files are saved
1654482565834.png 1654482594087.png

The cropped camera looks to have the right settings.

1654482286844.png

The Action is created under the "Alerts" tab, not the "Immediate actions..." button under the "Trigger" tab, correct?

1654482458423.png
 

MikeLud1

IPCT Contributor
Joined
Apr 5, 2017
Messages
2,141
Reaction score
4,118
Location
Brooklyn, NY
@MikeLud1 yes, account has admin privilege. I am getting car,jpg and file path.txt files saved to C:\Program Files (x86)\DeepStackALPR, and license plate captured and OCR'ed to the Alerts list. So most of it is working. However I am also not getting the log files and the json files saved. They are not saved where the jpg files are saved
View attachment 129953 View attachment 129954

The cropped camera looks to have the right settings.

View attachment 129951

The Action is created under the "Alerts" tab, not the "Immediate actions..." button under the "Trigger" tab, correct?

View attachment 129952
Is the file path.txt file being updated, try deleting it and it will rewrite the file. This might be rights issue with the folder where the file path.txt is being save. Several people had similar issues. I need to figure out how to address this issue.

1654482999701.png
 

Futaba

Pulling my weight
Joined
Nov 13, 2015
Messages
220
Reaction score
153
Is the file path.txt file being updated, try deleting it and it will rewrite the file. This might be rights issue with the folder where the file path.txt is being save. Several people had similar issues. I need to figure out how to address this issue.

View attachment 129956
The "file path.txt" is getting updated.

1654483688972.png
 

Psylent126

n3wb
Joined
Aug 5, 2014
Messages
20
Reaction score
10
Location
California
I am having a really hard time getting this to work. I can get deepstack to see the plates, but I can't get deepstackalpr to do anything beyond that. I have followed the instructions exactly and read through the entire thread and I am stumped. In looking at the log I keep seeing errors similar to the following:

1654567184687.png
Does anyone know what might be causing this or what this error might signify? I am running the CPU version of deepstack on an I5-4790 with 24 GB RAM with the latest version of Blue Iris.

Also, running DeepStackALPR from the command line doesn't seem to show any sort of files being sent to it which makes me think there is a problem somewhere in the config file or script. Below is my config file:

1654567392044.png

Thanks.
 

MikeLud1

IPCT Contributor
Joined
Apr 5, 2017
Messages
2,141
Reaction score
4,118
Location
Brooklyn, NY
I am having a really hard time getting this to work. I can get deepstack to see the plates, but I can't get deepstackalpr to do anything beyond that. I have followed the instructions exactly and read through the entire thread and I am stumped. In looking at the log I keep seeing errors similar to the following:

View attachment 130032
Does anyone know what might be causing this or what this error might signify? I am running the CPU version of deepstack on an I5-4790 with 24 GB RAM with the latest version of Blue Iris.

Also, running DeepStackALPR from the command line doesn't seem to show any sort of files being sent to it which makes me think there is a problem somewhere in the config file or script. Below is my config file:

View attachment 130033

Thanks.
Do you have two LPR cameras? If so the api is not setup to do two cameras. I have been working on updating my custom models, after I am finished with the custom models I will do some more work on DeepStackALPR
 

Futaba

Pulling my weight
Joined
Nov 13, 2015
Messages
220
Reaction score
153
I am having a really hard time getting this to work. I can get deepstack to see the plates, but I can't get deepstackalpr to do anything beyond that. I have followed the instructions exactly and read through the entire thread and I am stumped. In looking at the log I keep seeing errors similar to the following:

View attachment 130032
Does anyone know what might be causing this or what this error might signify? I am running the CPU version of deepstack on an I5-4790 with 24 GB RAM with the latest version of Blue Iris.

Also, running DeepStackALPR from the command line doesn't seem to show any sort of files being sent to it which makes me think there is a problem somewhere in the config file or script. Below is my config file:

View attachment 130033

Thanks.
Looks like a plate was found by Deepstack, but maybe OCR is not getting the cropped jpg file saved to "C:\Program Files\Blue Iris 5\www\ALPR". Did you copy the sample file over to the file per instruction? Is your Blue Iris web server enabled and using port 81? I get these logs after a plate is found:

1654572783286.png
 

Psylent126

n3wb
Joined
Aug 5, 2014
Messages
20
Reaction score
10
Location
California
Do you have two LPR cameras? If so the api is not setup to do two cameras. I have been working on updating my custom models, after I am finished with the custom models I will do some more work on DeepStackALPR
I did have two cameras set up. I have since turned the deepstack AI off on one of the cameras and changed the save Hi-res JPG option back to Database for it. So right now I only have one camera set up according to the instructions. I am still not having any luck. It appears that deepstack can see the plate and tag it. The file gets saved to my alerts folder located at C:\Alerts\, but nothing happens after that. The 'file path.txt' file doesn't get updated, the ALPR.jpg file doesn't change, nothing else seems to happen. Is there something that stands out to you that I might be missing?

Also, I noticed that when deepstack processes the images and returns a 'nothing found' response, that if I look at the deepstack analysis I often find at least one instance when it identified a plate and marked it. However, the overall response from deepstack is still 'nothing found'. Do you have any idea what might be causing this to happen?

Thank you again for all the great work you have done on this.
 

Futaba

Pulling my weight
Joined
Nov 13, 2015
Messages
220
Reaction score
153
Caught the numbers and letters on the side of a UPS truck today.

1654630986787.png

Can post a screen cap from the recording without the label for training if it would help.
 

MikeLud1

IPCT Contributor
Joined
Apr 5, 2017
Messages
2,141
Reaction score
4,118
Location
Brooklyn, NY
For me, it was a permissions problem with the DeepstackALPR folder. I ended up giving full access to all user types and then it worked.
That is what I am seeing the issues people are having. I was going to look into during the install to run a bat file that will give full access to all user types
 

Futaba

Pulling my weight
Joined
Nov 13, 2015
Messages
220
Reaction score
153
I am likely doing something wrong and not getting logfile.txt. So I stopped DeepstackALPR service and run it in a command prompt. The most recent successful plate detection did not get OCR. Here is the output in the command prompt window:

Code:
C:\Program Files (x86)\DeepStackALPR>DeepStackALPR.exe /?
Serving on port 5000
[2022-06-07 14:45:41,459] ERROR in app: Exception on /DeepStackALPR [POST]
Traceback (most recent call last):
  File "flask\app.py", line 2073, in wsgi_app
  File "flask\app.py", line 1518, in full_dispatch_request
  File "flask\app.py", line 1516, in full_dispatch_request
  File "flask\app.py", line 1502, in dispatch_request
  File "DeepStackALPR.py", line 518, in ALPR
  File "DeepStackALPR.py", line 427, in alpr
ValueError: max() arg is an empty sequence
127.0.0.1 - - [2022-06-07 14:45:41] "POST /DeepStackALPR HTTP/1.1" 500 426 0.330898
127.0.0.1 - - [2022-06-07 14:46:03] yes, it is a positive match.  A plate was found in car.jpg  with 0.93652344 confidence.
[2022-06-07 14:46:03,728] ERROR in app: Exception on /DeepStackALPR [POST]
Traceback (most recent call last):
  File "flask\app.py", line 2073, in wsgi_app
  File "flask\app.py", line 1518, in full_dispatch_request
  File "flask\app.py", line 1516, in full_dispatch_request
  File "flask\app.py", line 1502, in dispatch_request
  File "DeepStackALPR.py", line 518, in ALPR
  File "DeepStackALPR.py", line 140, in alpr
  File "PIL\Image.py", line 2209, in save
PermissionError: [Errno 13] Permission denied: 'C:\\Program Files\\Blue Iris 5\\www\\ALPR\\ALPR.jpg'
127.0.0.1 - - [2022-06-07 14:46:03] "POST /DeepStackALPR HTTP/1.1" 500 426 0.131455
[2022-06-07 14:49:17,709] ERROR in app: Exception on /DeepStackALPR [POST]
Traceback (most recent call last):
  File "flask\app.py", line 2073, in wsgi_app
  File "flask\app.py", line 1518, in full_dispatch_request
  File "flask\app.py", line 1516, in full_dispatch_request
  File "flask\app.py", line 1502, in dispatch_request
  File "DeepStackALPR.py", line 518, in ALPR
  File "DeepStackALPR.py", line 427, in alpr
ValueError: max() arg is an empty sequence
127.0.0.1 - - [2022-06-07 14:49:17] "POST /DeepStackALPR HTTP/1.1" 500 426 0.357504

EDIT: After I added "&CAM\%Y%m%d\&CAM.%Y%m%d_%H%M%S" to the "Record" tab per @JNDATHP's reply, the errors seem to have disappeared. Thanks!
 
Last edited:

Futaba

Pulling my weight
Joined
Nov 13, 2015
Messages
220
Reaction score
153
@MikeLud1 the very first line in the installation PDF:

For all cameras [I think there is a comma here] have the camera alert folder broken out for each day using the override setting in the Record tab for the cameras (&CAM\%Y%m%d\&CAM.%Y%m%d_%H%M%S)
What do you mean by "all cameras"? All cameras whether they are using DeepstackALPR or not, or the LPR camera and the cropped camera (ALPR), or just the LPR camera? I actually missed this line because it was confusing when I first read it, and didn't get back to it as I continued through the installation.

Thanks.
 
Top