Skip to content

Commit

Permalink
add k8s-deployment file + release docker hub
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricve committed Sep 5, 2024
1 parent cfa4535 commit df9d0c7
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 1 deletion.
29 changes: 29 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build and Publish Docker Image
on:
release:
types: [created]
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image with latest tag
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: uugai/hub-yolov8:latest
- name: Build and push Docker image with release tag
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: uugai/hub-yolov8:${{ github.ref_name }}
100 changes: 100 additions & 0 deletions k8s-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: hub-yolov8
labels:
app: hub-yolov8
spec:
replicas: 1
selector:
matchLabels:
app: hub-yolov8
template:
metadata:
labels:
app: hub-yolov8
spec:
containers:
- name: hub-yolov8
image: uugai/hub-yolov8:latest
resources:
limits:
nvidia.com/gpu: 1 # requesting a single GPU
cpu: 2
memory: 2Gi
env:
# Queue parameters
- name: QUEUE_NAME
value: "kcloud-classify-queue.fifo" # This is the topic of RabbitMQ we will read messages from.
- name: TARGET_QUEUE_NAME
value: "kcloud-analysis-queue" # Once we processed the recording with ML, we will send results/metadata to a target topic of RabbitMQ.
- name: QUEUE_HOST
value: rabbitmq.rabbitmq:5672
- name: QUEUE_EXCHANGE
- name: QUEUE_USERNAME
value: yourusername
- name: QUEUE_PASSWORD
value: yourpassword

# Kerberos Vault parameters
- name: STORAGE_URI
value: "http://vault-lb.kerberos-vault/api"
- name: STORAGE_ACCESS_KEY
value: "52gyELgxutOXUWhF"
- name: STORAGE_SECRET_KEY
value: "k8DrcB@hQ5XfxDENzDKcnkxBHx"

# YOLOv8 parameters
- 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: "False"
- name: OUTPUT_MEDIA_SAVEPATH
value: "path/to/your/output_video.mp4"

- name: CREATE_BBOX_FRAME
value: "False"
- name: SAVE_BBOX_FRAME
value: "False"
- name: BBOX_FRAME_SAVEPATH
value: "path/to/your/output_bbox.jpg"

- name: CREATE_RETURN_JSON
value: "True"
- name: SAVE_RETURN_JSON
value: "False"
- name: RETURN_JSON_SAVEPATH
value: "path/to/your/output_json.json"

- name: TIME_VERBOSE
value: "True"

- name: CLASSIFICATION_FPS
value: "3"
- name: CLASSIFICATION_THRESHOLD
value: "0.3"
- name: MIN_DETECTIONS
value: "5"
- name: MIN_DISTANCE
value: "150"
- name: MIN_STATIC_DISTANCE
value: "0"
- name: MAX_NUMBER_OF_PREDICTIONS
value: "100"
- name: FIND_DOMINANT_COLORS
value: "False"
- name: ALLOWED_CLASSIFICATIONS
value: "0, 1, 2, 3, 5, 7, 14, 15, 16, 24, 26, 28"
- name: COLOR_PREDICTION_INTERVAL
value: "5"
- name: MIN_CLUSTERS
value: "4"
- name: MAX_CLUSTERS
value: "4"
2 changes: 1 addition & 1 deletion utils/ClassificationObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def edit_is_static(self):
"""

if self.static_distance <= int(os.getenv('MIN_STATIC_DISTANCE')) and self.distance >= int(os.getenv('MIN_DISTANCE')):
if self.static_distance <= int(os.getenv('MIN_STATIC_DISTANCE')):
self.is_static = True
else:
self.is_static = False
Expand Down

0 comments on commit df9d0c7

Please sign in to comment.