Skip to content
avatar42 edited this page Jan 26, 2022 · 12 revisions

DeepStack config

Adjust options and tests to run as needed.

Installing needed packages

See my DeepStack training post for details about sorting out how to get set up with the right matching package versions.

Run DeepStack with Docker pulling new image if needed.

Linux

docker run -e VISION-FACE=True -e VISION-DETECTION=True -e VISION-SCENE=True -v localstorage:/datastore -e MODE=Medium -v /deepstack/mymodels:/modelstore/detection -v /deepstack/myfaces:/DeepStack/Faces --name DSfaces -p 82:5000 deepquestai/deepstack

Windows

docker run -e VISION-FACE=True -e VISION-DETECTION=True -e VISION-SCENE=True -v localstorage:/datastore -e MODE=Medium -v C:\DeepStack\MyModels:/modelstore/detection -v C:\DeepStack/myfaces:/DeepStack/Faces -p 82:5000 deepquestai/deepstack

Options are:

Option Means
-e VISION-FACE=True Do face detection
-e VISION-DETECTION=True Do object detection
-e VISION-SCENE=True Do scene detection
-e MODE=Medium Mode to run in. Same as Blue Iris options (High/Medium/Low)
-v /deepstack/mymodels:/modelstore/detection Where custom models are. Note maps local path outside of Docker /deepstack/mymodels to container path /modelstore/detection
-v /deepstack/myfaces:/DeepStack/Faces Where known faces images are. Note maps local path outside of Docker
-v localstorage:/datastore This specifies the local volume where DeepStack will store all temp data. Note maps local path in user space outside of Docker
--name DSfaces Name to use to interact with image. Random name is assigned if not given. Note will fail it image with that name already exists on your system.
-p 82:5000 External port:internal one. Internal is always 5000 and 82 is assumed external port by BI.
deepquestai/deepstack Name of cloud image to use.
--gpus all deepquestai/deepstack:gpu If using the gpu version you will want to use.

Windows local

deepstack --VISION-FACE True --VISION-DETECTION True --VISION-SCENE True --MODE Medium --MODELSTORE-DETECTION "c:/DeepStack/MyModels" -PORT 82

Get install from here and put all the custom models in c:\DeepStack\MyModels

Last tested on setup

DeepStack: Version 2021.09.01 with these APIs enabled

/v1/vision/custom/actionnetv2

/v1/vision/custom/dark

/v1/vision/custom/licence-plate

/v1/vision/custom/openlogo

/v1/vision/face

/v1/vision/face/recognize

/v1/vision/face/register

/v1/vision/face/match

/v1/vision/face/list

/v1/vision/face/delete (not tested yet)

/v1/vision/detection

/v1/vision/scene

/v1/backup

/v1/restore (not tested yet)

For further help/info see this debug guide

My file structure

Is a top level folder (DeepStackWS in my case) with the repos underneath. So it would look something like this

My file structure

Repos

deepstack-trainer

My DeepStack Utils

RMRR.model

labelImg For details see labeling data for object detection yolo

Configuration options for DeepStack utils in config.py

Set these values as needed / to match your setup.

Base URL of your DeepStack server

dsUrl = "http://localhost:82/"

Mode DeepStack started with -e MODE=Medium or -e MODE=High

mode = "Medium"

Where images to test with are located

imgPath = "test.imgs/"

Where to save debug images of from tests

debugPath = "debug.pics/"

Path to labeled training pics.

trainPath = "../RMRR.model/train/"

Unlabeled / new files to label and add folder

newPicPath = "new/"

Name of trained set model.

Usually the same as the name of the pt file. RMRR is mine from the data in the checked in the RMRR.model train folder. trainedName = "RMRR"

Folder where images with found objects and their mapping files are put by quickLabel and read by chkClasses

labeled = "labeled/"

Folder where images with no found objects are put by quickLabel and read by chkClasses

unlabeled = "unlabeled/"

Output debug info Y,N

debugPrintOn = "N"

If Y saves debug images to compare between expected and found objects for mismatches.

saveDebugPics = "Y"

Y=Fail on error, N=Just warn on error

failOnError = "Y"

Supported images suffixes to look for in folders

includedExts = ['jpg', 'webp', 'bmp', 'png', 'gif']

Installed models to use to find objects

detection is the built in model

openlogo custom model.

licence-plate custom model.

dark custom model.

actionnetv2 custom model.

tests2Run = ["detection", "custom/openlogo", "custom/licence-plate", "custom/dark", "custom/actionnetv2"]

#Yolo Format:

In the above,

object-class is class_id, not name. The ID is the line number of the class in the classes.txt file, starting with 0.

x is the x-axis center of the object in pixels / image width in pixels. Like % from left

y is the y-axis center of the object in pixels / image height in pixels. Like % from top

width is the width of an object / image width in pixels. Like % of frame

height is the height of an object / image height in pixels. Like % of frame

xy image

For a deep dive look at Collect and Label Images to Train a YOLOv5 Object Detection Model in PyTorch and How to Train YOLO v5 on a Custom Dataset

Clone this wiki locally