IP Cam Talk Custom Community DeepStack Model

TBurt

Getting the hang of it
Joined
Aug 14, 2021
Messages
68
Reaction score
97
Location
Houston
I learned the hard way you will get best results with a custom model trained on images from your cameras. Granted most of us do not have many to start with so it is a good idea to add an action to your alerts to save a copy (preferably without markup) to a folder or better yet folders named for the first object found.


If you need a starter set for things you might see in the Texas hill country you can check out my dataset and model on avatar42 | Datasets Novice I'm planning on about doubling the number of images and moving them into folders by main object soon. Also separating day and night images into separate object classes.

I also have some utils to help making your own custom models easier at GitHub - avatar42/deepstack: DeepStack utils.
I tried your model out last night and found it really nice. I like how you broke "truck" down into types and made trucks, pick-ups, garbage, vans, etc. I just looked through the recordings today and your model works wonderfully. It was not slow, yet seems accurate so far. (as for cars, trucks, people,etc) I have not had any critters go by the cameras it is installed on yet. I am going to have to take a shot at making my own now.
 

sebastiantombs

Known around here
Joined
Dec 28, 2019
Messages
11,511
Reaction score
27,695
Location
New Jersey
The big advantage this model has is that it does not include things like chair, lamp, elephant, giraffe, zebra and so on. That allows a much faster detection time compared to the much larger models containing all those, generally superfluous, object.
 

CCTVCam

Known around here
Joined
Sep 25, 2017
Messages
2,674
Reaction score
3,505
What's the position now regarding Quadro vs CPU DS?

I still don't have my system up and running - long story, parts for bathroom renovation now in it's 3rd year (as I'm doing it!) in the way of where I want to place the server.

Problem is in the EU energy prices have gone through the roof due to Ukraine and my monthly bill has gone up by 50%. So it's now got me questioning whether or not I can afford to run an extra 50w 24/7 by running the quadro. So question is what's the difference in performance between the CPU and Quadro versions?
 

sebastiantombs

Known around here
Joined
Dec 28, 2019
Messages
11,511
Reaction score
27,695
Location
New Jersey
That's going to depend on the CPU, how many cameras and how many cameras will be running DS. You can always try the CPU version first and, if there's a problem with it like timeouts constantly, add the Quadro.
 

Buxton

Young grasshopper
Joined
Mar 1, 2019
Messages
33
Reaction score
17
Location
los angeles, CA
I learned the hard way you will get best results with a custom model trained on images from your cameras. Granted most of us do not have many to start with so it is a good idea to add an action to your alerts to save a copy (preferably without markup) to a folder or better yet folders named for the first object found.
Can you elaborate on how you're doing this ie, are you using the FTP function (in alert actions) to save an alert image, or are you using "Run a program or write to a file" or even "Do command -- set output 1." I'm looking for the easiest way to automate the saving of a jpeg to a specific local folder as I'd like to take a try at building my own custom models based on a given camera's history.
 

avatar42

n3wb
Joined
Jan 8, 2015
Messages
14
Reaction score
10
Location
Leander, TX
Can you elaborate on how you're doing this ie, are you using the FTP function (in alert actions) to save an alert image, or are you using "Run a program or write to a file" or even "Do command -- set output 1." I'm looking for the easiest way to automate the saving of a jpeg to a specific local folder as I'd like to take a try at building my own custom models based on a given camera's history.
Personally I use Cygwin so I can run a shell script like this
##
## Usage: copyNew.sh &ALERT_PATH &MEMO
## where &ALERT_PATH is like DAH412.20210731_143912.4034343.3.jpg
## and &MEMO is like person:93%,dog:81
##
#set -x
PATH="/usr/bin"

export FLAGGED=/cygdrive/i/_dea/odrive/GD.video/cams/DeepStackWS/data/new
export ALERTS=/cygdrive/i/BlueIris/Alerts
export LOG=/cygdrive/c/DeepStack/newLog.date +%Y.%m.out
echo "$*" >> $LOG

obj=echo $2 | cut -f1 -d':'
echo "(${obj})" >> $LOG 2>&1
mkdir -p ${FLAGGED}/${obj} >> $LOG 2>&1
clip=echo $1 | cut -f1-2 -d'.'
dat=ls -1tr ${ALERTS}/${clip}*.dat | tail -1
if [ -r "$dat" ]
then
pic=echo $dat | sed -e 's/.dat/.jpg/g'

#/usr/bin/cp ${ALERTS}/$1 ${FLAGGED}/${obj} >> $LOG 2>&1
/usr/bin/cp ${pic} ${FLAGGED}/${obj} >> $LOG 2>&1
else
# dat is missing for some reason
/usr/bin/cp ${ALERTS}/${clip}*.jpg ${FLAGGED}/${obj} >> $LOG 2>&1
fi

ls -latr ${FLAGGED}/${obj} | tail -5

Which is more complex than needed but I like to have a log and sort the images by what was found in them.
More details here ConvertAndMerge · avatar42/deepstack Wiki
 

Cooltiger

Getting the hang of it
Joined
Jun 28, 2020
Messages
51
Reaction score
46
Location
2701 NSW Australia
I am running MikeLud1 combined Deepstack Model and loving it.
Question re Picture and incorrect bird ID.
What do the blue and yellow squares mean that were overridden in the final ID and decided the birds were people??
Is there a list of all the codes that show up on Deepstack?1651633645206.png
 

Buxton

Young grasshopper
Joined
Mar 1, 2019
Messages
33
Reaction score
17
Location
los angeles, CA
Yeah a linux script on a win machine is a little too complex for my needs. Not that the script won't be reliable, but if I need to tweak it, I know I will have to review the code to understand what's what and that takes real time. I'm going to try to get Ken to write a simple Alert action option to do the job. There are plenty of C++ file management libraries out there that he should be able to plug into the existing alert object, without revising a lot of BlueIris code. Thx for your response. It's greatly appreciated.
 

avatar42

n3wb
Joined
Jan 8, 2015
Messages
14
Reaction score
10
Location
Leander, TX
Yeah a linux script on a win machine is a little too complex for my needs. Not that the script won't be reliable, but if I need to tweak it, I know I will have to review the code to understand what's what and that takes real time. I'm going to try to get Ken to write a simple Alert action option to do the job. There are plenty of C++ file management libraries out there that he should be able to plug into the existing alert object, without revising a lot of BlueIris code. Thx for your response. It's greatly appreciated.
Yeah most of that is to deal with the ALERT_PATH and the actual image name not always matching. Otherwise a simple bat file would work.
 

r34220

n3wb
Joined
Apr 23, 2015
Messages
7
Reaction score
2
I am running DS in a docker container separate from BI server. I have configured like I have read here in this thread but the new model is not being used. From the DS logs BI is only sending to /v1/vision/detection API. Any help is appreciated.


docker_DS_log.png

BI_AI_settings.PNG

cam_ai_settings.PNG
 

r34220

n3wb
Joined
Apr 23, 2015
Messages
7
Reaction score
2
Try unchecking "Default object detection" and check "Use custom folder" with the "combined" model placed in the custom folder of your choice. The way you have it now, you only have the original object model being accessed.
DS is not running on the BI server. It's running in docker on another machine. Would I still need to check the custom folder?
 

Buxton

Young grasshopper
Joined
Mar 1, 2019
Messages
33
Reaction score
17
Location
los angeles, CA
DS is not running on the BI server. It's running in docker on another machine. Would I still need to check the custom folder?
I would think so, though I don't have access to the internals of BI, so I can't say for sure. It looks like the config screen is set up to accommodate your use case. From the look of the config screen, you would need to place your custom model on a local drive\folder (and check that config box), while the Deepstack instance is pointed at a separate network endpoint.
 

Buxton

Young grasshopper
Joined
Mar 1, 2019
Messages
33
Reaction score
17
Location
los angeles, CA
I would think so, though I don't have access to the internals of BI, so I can't say for sure. It looks like the config screen is set up to accommodate your use case. From the look of the config screen, you would need to place your custom model on a local drive\folder (and check that config box), while the Deepstack instance is pointed at a separate network endpoint.
You could also try mapping the network endpoint and then use the mapped path as your custom folder path. That way the custom model sits on the same endpoint as the deepstack instance. However, there are probably tradeoffs in pushing large data sets across the network instead of using a local folder.
 

carteriii

Pulling my weight
Joined
Jan 8, 2016
Messages
146
Reaction score
157
Location
USA
I agree with Buxton. Think of it this way, BI has to know about any custom model files in order to do ANYTHING with them. Normally BI reads the custom model folder and then launches DeepStack with those models. You're not allowing that to happen, instead using the container which is fine, but BI still needs to know about those model files somehow. From your screenshot, BI isn't querying DeepStack to find out what custom models are in use. So you need to tell BI about them in the normal manner, and make sure your container is using the same models or you'll probably get an error.

As Buxton said, you could mount the same directory if you wanted to go to that effort, or you can just manually keep them in sync. Either way, BI needs to know about them, and the way BI does that is through the custom model folder.
 

avatar42

n3wb
Joined
Jan 8, 2015
Messages
14
Reaction score
10
Location
Leander, TX
I agree with Buxton. Think of it this way, BI has to know about any custom model files in order to do ANYTHING with them. Normally BI reads the custom model folder and then launches DeepStack with those models. You're not allowing that to happen, instead using the container which is fine, but BI still needs to know about those model files somehow. From your screenshot, BI isn't querying DeepStack to find out what custom models are in use. So you need to tell BI about them in the normal manner, and make sure your container is using the same models or you'll probably get an error.

As Buxton said, you could mount the same directory if you wanted to go to that effort, or you can just manually keep them in sync. Either way, BI needs to know about them, and the way BI does that is through the custom model folder.
Later BI versions allow you to say what custom models a cam should use but it is unclear if they are still required in the local models folder. Better safe than sorry unless someone wants to take the time to sort if any version(s) no longer require them.
 

MikeLud1

IPCT Contributor
Joined
Apr 5, 2017
Messages
2,211
Reaction score
4,252
Location
Brooklyn, NY
I am going to start making a dark model, below are some details. I am not sure exactly when it will be ready, definitely before the end of this month

Keeping for new dark model:
Bicycle, Bus, Car, Cat, Dog, Motorbike, & Person

Removing from the dark model:
Boat, Bottle, Chair, Cup, & Table
 
Last edited:
Top