Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

Vsblty vision captor and data captor app #83

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions applications/data-captor/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

License and Copyright headers are missing.

name: ai-pipeline
description: A Helm chart for vsblty ai pipeline(data captor application)
type: application
version: 0.1.0
appVersion: 1.16.0
83 changes: 83 additions & 0 deletions applications/data-captor/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no proper details about pre-requisites and details about OpenNESS or Smart edge Open version used for this application?

# **Data Captor Application Overview**
DataCaptor leverages camera and sensor technology through AI tools (machine learning and computer vision), enabling real-time analytics and anonymous audience data based on who and what the camera sees

## **Pre Requisites – Resources Required**

| **Resource Information** | |
|------------------------------------|----------------------|
| Application Type | Data Captor |
| Compute (vCores) | 8 |
| Memory (RAM) | 8 GB |
| Storage | 128 GB |
| Host OS | Ubuntu 20 or higher |
| Physical Display | |
| Connected cameras(USB/IP/Network) | With RTSP URL |



## **Where to Purchase**
Contact [email protected]


## Pre Requisites - Installing OpenNESS
|**Configuration** | |
| ----------------------------------|-----------------------|
| OpenNESS Version | 20.12.02 |
| Flavor Used | Minimal |
| Distribution | OpenSource |


Follow below link to setup controller and edge-node for installing OpenNESS.

https://github.com/open-ness/specs/blob/openness-20.12.02/doc/getting-started/network-edge/controller-edge-node-setup.md

* Go to openness-experience-kits/ directory and comment out the grub role (role: machine_setup/grub) in the **network_edge.yml** file.
* Run the deployment script as ./deploy_ne.sh


## Pre Requisites - Installing Data Captor
|**Configuration** | |
| ----------------------------------|------------------------------------|
| Ubuntu | 20 or later |
| Folder to create on system | /home/vedge/models |
| Folder to create on system | /home/vedge/gallery |
| Folder to create on system | /home/vedge/videos |



## Loading Docker Images
docker image load -i data-captor.tar.gz

## Installing Data Captor Application using helm

Run the following commands to deploy through helm:

`helm install data-captor ./data-captor`

Sample Output would look like:

> `NAME: data-captor`
>
> `LAST DEPLOYED:`
>
> `NAMESPACE: default`
>
> `STATUS: deployed`
>
> `REVISION: 1`
>
> `TEST SUITE: None`



## Uninstall Data captor application
To uninstall application run below command:

`helm uninstall data-captor`

## Testing Steps
For further instructions about steps for testing, contact VSBLTY Team ([email protected])

## **Related material**
* https://vsblty.net/
62 changes: 62 additions & 0 deletions applications/data-captor/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

License and Copyright headers are missing.

Expand the name of the chart.
*/}}
{{- define "ai-pipeline.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "ai-pipeline.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "ai-pipeline.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "ai-pipeline.labels" -}}
helm.sh/chart: {{ include "ai-pipeline.chart" . }}
{{ include "ai-pipeline.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "ai-pipeline.selectorLabels" -}}
app.kubernetes.io/name: {{ include "ai-pipeline.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "ai-pipeline.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "ai-pipeline.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
69 changes: 69 additions & 0 deletions applications/data-captor/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
apiVersion: v1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

License and Copyright headers are missing.

kind: ConfigMap
metadata:
name: config-json-volume
data:
config.json: |-
{
"default": {
"logLevel": "INFO",
"pipeline": {
"template": [
"rtspsrc location={input} ! rtph264depay ! queue ! avdec_h264 ! videoconvert ! video/x-raw,format=BGRx !",
"gvadetect model={personDetection[model]} threshold=0.8 model_proc={personDetection[proc]} device={personDetection[device]} ! queue !",
"gvadetect model={faceDetection[model]} threshold=0.8 reshape=true reshape-width=600 reshape-height=600 model-proc={faceDetection[proc]} device={faceDetection[device]} ! gvatrack ! queue !",
"gvaclassify reclassify-interval=5 model={landmark[model]} model-proc={landmark[proc]} device={landmark[device]} batch-size=1 pre-process-backend=opencv object-class=face ! queue !",
"gvaclassify reclassify-interval=5 model={faceReidentification[model]} model-proc={faceReidentification[proc]} device={faceReidentification[device]} batch-size=1 pre-process-backend=opencv object-class=face ! queue !",
"gvaidentify cosine-distance-threshold={reidThreshold} gallery=/home/vedge/gallery/gallery.json ! queue name=frame-process !",
"videoconvert ! video/x-raw,format=NV12 ! fpsdisplaysink"
],
"params": {
"reidThreshold": 0.6,
"faceDetection": {
"model": "/home/vedge/models/face-detection-adas-0001/FP32/face-detection-adas-0001.xml",
"proc": "/home/vedge/models/face-detection-adas-0001/PROC/face-detection-adas-0001.json",
"device": "CPU"
},
"personDetection": {
"model": "/home/vedge/models/person-detection-0201/FP32/person-detection-0201.xml",
"proc": "/home/vedge/models/person-detection-0201/PROC/person-detection-0201.json",
"device": "CPU"
},
"landmark": {
"model": "/home/vedge/models/landmarks-regression-retail-0009/FP32/landmarks-regression-retail-0009.xml",
"proc": "/home/vedge/models/landmarks-regression-retail-0009/PROC/landmarks-regression-retail-0009.json",
"device": "CPU"
},
"faceReidentification": {
"model": "/home/vedge/models/face-reidentification-retail-0095/FP32/face-reidentification-retail-0095.xml",
"proc": "/home/vedge/models/face-reidentification-retail-0095/PROC/face-reidentification-retail-0095.json",
"device": "CPU"
}
}
}
},
"cameras": {
"camerap-1": {
"logLevel": "DEBUG",
"cloudCredential": "{{ .Values.device.accessToken }}",
"cloudEnv": "DEV",
"pipeline": {
"params": {
"input": "{{ .Values.camera.rtsp }}"
}
},
"services": [
{
"type": "face-recognition",
"pipelineElement": "frame-process",
"objectType": "face",
"outputImageSize": [
240,
180
],
"trackedFaceDuration": 10
}
]
}
}
}
107 changes: 107 additions & 0 deletions applications/data-captor/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
apiVersion: apps/v1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

License and Copyright headers are missing.

kind: Deployment
metadata:
name: {{ include "ai-pipeline.fullname" . }}
labels:
{{- include "ai-pipeline.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
strategy:
type: Recreate
selector:
matchLabels:
{{- include "ai-pipeline.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "ai-pipeline.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "ai-pipeline.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
volumes:
- name: config-map-volume
configMap:
name: config-json-volume
- name: gallery-map-volume
hostPath:
path: /home/vedge/gallery
type: Directory
- name: media-map-volume
hostPath:
path: /home/vedge/videos
type: Directory
- name: models-volume
hostPath:
path: /home/vedge/models
type: Directory
- name: x11-vol
hostPath:
path: /tmp
type: Directory
- name: var-temp
hostPath:
path: /var/tmp
type: Directory
- name: var-dev
hostPath:
path: /dev
type: Directory
hostNetwork: true
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
command:
- python3
- /home/vedge/ai-pipeline/main.py
- -c
- /home/vedge/config/config.json
- -id
- camerap-1
env:
- name: DISPLAY
value: "{{ .Values.display.displayName }}"
- name: PYTHONUNBUFFERED
value: "{{ .Values.display.pythonVar }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- mountPath: /home/vedge/config
name: config-map-volume
- mountPath: /home/vedge/gallery
name: gallery-map-volume
- mountPath: /home/vedge/videos
name: media-map-volume
- mountPath: /home/vedge/models
name: models-volume
- mountPath: /tmp
name: x11-vol
- mountPath: /var/tmp
name: var-temp
- mountPath: /dev
name: var-dev
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
28 changes: 28 additions & 0 deletions applications/data-captor/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- if .Values.autoscaling.enabled }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

License and Copyright headers are missing.

apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "ai-pipeline.fullname" . }}
labels:
{{- include "ai-pipeline.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "ai-pipeline.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
12 changes: 12 additions & 0 deletions applications/data-captor/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

License and Copyright headers are missing.

apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "ai-pipeline.serviceAccountName" . }}
labels:
{{- include "ai-pipeline.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
Loading