IP Cam Talk Custom Community DeepStack Model

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.
 
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.
 
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?
 
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.
 
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.
 
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
 
  • Like
Reactions: Buxton
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
 
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 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.
 
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
 
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?
 
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.
 
  • Like
Reactions: r34220 and avatar42
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.
 
  • Like
Reactions: r34220
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.
 
  • Like
Reactions: r34220 and avatar42
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.
 
  • Like
Reactions: r34220
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: