- Nov 3, 2017
- 30
- 31
Hey Everyone,
Updated July 18, 2019
TL;DR: I wrote several python scripts that can detect the make and model of a car in the driveway. I used both Machine Learning through Google's easy to use AutoML Image Classification and Sighthound's API for vehicle make and model detection. Both also allow the detection of people, although I prefer creating my own model for less false positives.
I decided to share this code, sorry it's a bit rough because I honestly have never coded anything in Python before, and I'm not a coder, just clever enough to get it working. And it does work.
I thought it would be great to have Blue Iris send me a text message of the make model and colour of a car in my driveway. I have also used it in another setup where there was a gate at the end of a long driveway, where it was particularly helpful.
This uses Sighthound's Cloud API which uses machine learning to determine the vehicle in the image. This API is free for the first 5000 calls, which my alerts fit well within. You can sign up on their website.
The script will check the previous vehicle detected and quit if it's the same. This is because Alert images from Blueiris may be set off by other factors and you may have a car parked in your driveway....you don't want to be alerted every minute that there's a White Ford F Series.
Updated Info:
I highly recommend you create your own model at Google's AutoML. It will probably take you about 30 minutes of work to set up, but it is not too complicated. It's all done via a GUI on their website. Pre-requisite: You need to have about 20 to 50 images of each category you want to train. Such as:
Bob Arriving
Bob Leaving
Alice Arriving
Alice Leaving
Mailman
Other Car
Just create folders on your desktop with each of these names, and drag and drop them, as you go through your alert images.
Steps:
1) You have to make sure BlueIris's service is not running as the local account. Open the start menu, type Services. Open Services and find BlueIris's service, and assign it to something other than the local account. Otherwise you can't run this python script.
2) Create a bat file in Word path with the following:
3) I have this set to check images based on the Camera Properties>Post tab, so I can lower the resolution of the jpeg manually, so that the upload is faster and thus the response is faster. Turn on Jpeg snapshots on trigger with a time that's much longer than the trigger time (So it only snaps one jpeg) and turn the quality down to around 60%. Set the camera name to just &CAM so it always has the same filename.
4) Alternatively, you can turn on Store Alerts as High-Res images and uncomment the lines that will look for the latest alert image.
5) In the Camera Alerts tab, turn on Execute Script on trigger, and select the bat file you created.
6) That's it. You should play with your trigger settings so that it works as intended, this is really only meant to detect vehicles, you will probably have some odd results if you have too many alerts from trigger settings. The API will also pick off cars in the background (say parked on the street), so you may want to have a Privacy Mask enabled on the camera.
Please if there is a more proficient coder and you make changes for the better, please do share them here to help me. Thanks.
mattkri/BlueIris-SmartDetection
Updated July 18, 2019
TL;DR: I wrote several python scripts that can detect the make and model of a car in the driveway. I used both Machine Learning through Google's easy to use AutoML Image Classification and Sighthound's API for vehicle make and model detection. Both also allow the detection of people, although I prefer creating my own model for less false positives.
I decided to share this code, sorry it's a bit rough because I honestly have never coded anything in Python before, and I'm not a coder, just clever enough to get it working. And it does work.
I thought it would be great to have Blue Iris send me a text message of the make model and colour of a car in my driveway. I have also used it in another setup where there was a gate at the end of a long driveway, where it was particularly helpful.
This uses Sighthound's Cloud API which uses machine learning to determine the vehicle in the image. This API is free for the first 5000 calls, which my alerts fit well within. You can sign up on their website.
The script will check the previous vehicle detected and quit if it's the same. This is because Alert images from Blueiris may be set off by other factors and you may have a car parked in your driveway....you don't want to be alerted every minute that there's a White Ford F Series.
Updated Info:
I highly recommend you create your own model at Google's AutoML. It will probably take you about 30 minutes of work to set up, but it is not too complicated. It's all done via a GUI on their website. Pre-requisite: You need to have about 20 to 50 images of each category you want to train. Such as:
Bob Arriving
Bob Leaving
Alice Arriving
Alice Leaving
Mailman
Other Car
Just create folders on your desktop with each of these names, and drag and drop them, as you go through your alert images.
Steps:
1) You have to make sure BlueIris's service is not running as the local account. Open the start menu, type Services. Open Services and find BlueIris's service, and assign it to something other than the local account. Otherwise you can't run this python script.
2) Create a bat file in Word path with the following:
Code:
python C:\directory\of\your\script.py
4) Alternatively, you can turn on Store Alerts as High-Res images and uncomment the lines that will look for the latest alert image.
5) In the Camera Alerts tab, turn on Execute Script on trigger, and select the bat file you created.
6) That's it. You should play with your trigger settings so that it works as intended, this is really only meant to detect vehicles, you will probably have some odd results if you have too many alerts from trigger settings. The API will also pick off cars in the background (say parked on the street), so you may want to have a Privacy Mask enabled on the camera.
Please if there is a more proficient coder and you make changes for the better, please do share them here to help me. Thanks.
mattkri/BlueIris-SmartDetection
Last edited: