Skip to content

Commit

Permalink
add k8s template + updated .env file
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricve committed Aug 8, 2024
1 parent 071b085 commit 50b4f1b
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 29 deletions.
26 changes: 4 additions & 22 deletions .env
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Environment variables
MEDIA_SAVEPATH = "data/video/car.mp4"

# Model parameters
MODEL_NAME = "license_plate_detector.pt"
MODEL_NAME = "yolov8n.pt"

# Queue parameters
QUEUE_NAME="data-filtering"
Expand All @@ -19,31 +17,15 @@ STORAGE_SECRET_KEY="xxx"

# Feature parameters
PLOT = "True"

SAVE_VIDEO = "True"
MEDIA_SAVEPATH = "data/video/car.mp4"
OUTPUT_MEDIA_SAVEPATH = "data/video/output_video.mp4"

CREATE_BBOX_FRAME = "True"
SAVE_BBOX_FRAME = "True"
BBOX_FRAME_SAVEPATH = "data/video/output_bbox.jpg"

CREATE_RETURN_JSON = "True"
SAVE_RETURN_JSON = "True"
RETURN_JSON_SAVEPATH = "data/video/output_json.json"

TIME_VERBOSE = "True"
LOGGING = "True"

FIND_DOMINANT_COLORS = "True"
COLOR_PREDICTION_INTERVAL = "5"
MIN_CLUSTERS = "3"
MAX_CLUSTERS = "3"

# Classification parameters
CLASSIFICATION_FPS = "5"
CLASSIFICATION_THRESHOLD = "0.2"
MAX_NUMBER_OF_PREDICTIONS = "1000"
MIN_DISTANCE = "50"
MIN_STATIC_DISTANCE = "50"
MIN_DETECTIONS = "5"

MAX_NUMBER_OF_PREDICTIONS = "100"
ALLOWED_CLASSIFICATIONS = "0, 1, 2, 3, 4, 5, 6, 7, 8, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 28"
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
venv
data/input/*
data/output/*
yolov8n-seg.pt
yolov8n.pt
utils/__pycache__
run.sh
data/video
data/video
.env.production
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"request": "launch",
"program": "${workspaceFolder}/queue_filter.py",
"console": "integratedTerminal",
"envFile": "${workspaceFolder}/.env",
"envFile": "${workspaceFolder}/.env.production",
"python": "${workspaceFolder}/venv/bin/python"
},
{
Expand All @@ -19,7 +19,7 @@
"request": "launch",
"program": "${workspaceFolder}/single-shot.py",
"console": "integratedTerminal",
"envFile": "${workspaceFolder}/.env",
"envFile": "${workspaceFolder}/.env.production",
"python": "${workspaceFolder}/venv/bin/python"
}
]
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ This project includes a Python program, `queue_filter.py`, which leverages the Y
MODEL, frame, video_out, condition)

if conditionMet:
print(
"Condition met, stopping the video loop, and forwarding video to remote vault")
print("Condition met, stopping the video loop, and forwarding video to remote vault")
# @TODO: Forward the video to the remote vault.
break

Expand Down
Binary file added __pycache__/condition.cpython-310.pyc
Binary file not shown.
67 changes: 67 additions & 0 deletions k8s-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: datafilter
labels:
app: datafilter
spec:
replicas: 1
selector:
matchLabels:
app: datafilter
template:
metadata:
labels:
app: datafilter
spec:
containers:
- name: datafilter
image: uugai/data-filter:latest
resources:
limits:
nvidia.com/gpu: 1 # requesting a single GPU
env:
- name: QUEUE_NAME
value: "data-filtering" # This is the topic of the queue (Kerberos Vault sends a message to this topic, and the data filter listens to this topic)
- name: QUEUE_HOST
value: rabbitmq-broker.xxx.xxx:5672
- name: QUEUE_EXCHANGE
- name: QUEUE_USERNAME
value: xxxx
- name: QUEUE_PASSWORD
value: xxx

- name: STORAGE_URI
value: "https://vault.xxx.xx/api"
- name: STORAGE_ACCESS_KEY
value: "xxx"
- name: STORAGE_SECRET_KEY
value: "xxx"

- name: MODEL_NAME
value: "yolov8n.pt"

- name: MEDIA_SAVEPATH
value: "/ml/data/input/video.mp4"

- name: LOGGING
value: "True"
- name: PLOT
value: "False"
- name: SAVE_VIDEO
value: "True"
- name: OUTPUT_MEDIA_SAVEPATH
value: "/ml/data/input/output_video.mp4"


- name: TIME_VERBOSE
value: "True"

- name: CLASSIFICATION_FPS
value: "3"
- name: CLASSIFICATION_THRESHOLD
value: "0.3"
- name: MAX_NUMBER_OF_PREDICTIONS
value: "100"
- name: ALLOWED_CLASSIFICATIONS
value: "0, 1, 2, 3, 5, 7, 14, 15, 16, 24, 26, 28"
Binary file added yolov8n.pt
Binary file not shown.

0 comments on commit 50b4f1b

Please sign in to comment.