Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo grosse conf #65

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
24 changes: 12 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,48 +12,48 @@ help:

.PHONY: edge_model_serving ## 💁 Start model_serving service (Docker container)
edge_model_serving:
docker-compose up -d --build edge_model_serving
docker compose up -d --build edge_model_serving

.PHONY: edge_orchestrator ## 🕵 Start edge_orchestrator service (Docker container)
edge_orchestrator:
docker-compose up -d --build edge_orchestrator
docker compose up -d --build edge_orchestrator

.PHONY: edge_interface ## 📸 Start edge_interface inside a docker container
edge_interface:
docker-compose up -d --build edge_interface
docker compose up -d --build edge_interface

.PHONY: edge_db ## 📁 Start edge_db inside a docker container
edge_db:
docker-compose up -d --build edge_db
docker compose up -d --build edge_db

.PHONY: hub_monitoring ## ⚙️ Start hub_monitoring inside a docker container
hub_monitoring:
docker-compose up -d --build hub_monitoring
docker compose up -d --build hub_monitoring

.PHONY: hub_labelizer ## ⚙️ Start hub_labelizer inside a docker container
hub_labelizer:
docker-compose up -d --build hub_labelizer
docker compose up -d --build hub_labelizer

.PHONY: hub_monitoring_db ## ⚙️ Start hub_monitoring database inside a docker container
hub_monitoring_db:
docker-compose up -d --build hub_monitoring_db
docker compose up -d --build hub_monitoring_db

.PHONY: vio-hub-up ## 🐳 Start all hub services (monitoring, monitoring_db, labelizer)
vio-hub-up:
docker-compose --profile hub up -d --build
docker compose --profile hub up -d --build

.PHONY: vio-edge-up ## 🐳 Start all edge services (db, model_serving, orchestrator, interface)
vio-edge-up:
docker-compose --profile edge up -d --build
docker compose --profile edge up -d --build

.PHONY: vio-up ## 🐳 Start all edge services (db, model_serving, orchestrator, interface) and hubs (monitoring, monitoring_db, labelizer)
vio-up:
docker-compose --profile hub --profile edge up -d --build
docker compose --profile hub --profile edge up -d --build

.PHONY: vio-edge-up-raspberrypi ## 🐳 Start all edge services on RaspberryPI (db, model_serving, orchestrator, interface)
vio-edge-up-raspberrypi:
docker-compose -f docker-compose.raspberrypi.yml up -d --build
docker compose -f docker-compose.raspberrypi.yml up -d --build

.PHONY: vio-down ## ❌ Stop all services (model_serving, edge_orchestrator, ui)
vio-down:
docker-compose down
docker compose down
2 changes: 1 addition & 1 deletion deployment/edge/ansible/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ ping-edge:
ansible all -i inventory.ini -m ping

deploy-vio-on-edge:
ansible-playbook -v -i inventory.ini deploy_vio_on_edge.yml
ansible-playbook -vv -i inventory.ini deploy_vio_on_edge.yml
25 changes: 23 additions & 2 deletions deployment/edge/ansible/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@ Before launching ansible export a env to specify your local vio directory
```
export LOCAL_VIO_DIR=
```
### Setup the edge

Install openssh-server on the edge:
```bash
sudo apt-get install openssh-server
```

Then, try to connect through:
```bash
ssh localhost
```

Install Docker on the edge help you with [this link](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository)
Don't forget [post-installation](https://docs.docker.com/engine/install/linux-postinstall/) steps to run docker as a non-root user.

Install *make* on the edge:
```bash
sudo apt-get install build-essential
```


### Install sshpass and the requirements
Expand All @@ -25,10 +44,12 @@ ip a | grep -A 2 'wlx' | grep 'inet ' | awk '{print $2}' | cut -d/ -f1

Then change the IP addresses on the inventory file

## docker-compose devices
## docker compose devices

We are adding those devices to be able to trigger capture from 2 cameras connected on the usb port of your edge.

devices:
- /dev/video0:/dev/video0
- /dev/video2:/dev/video2
- /dev/video2:/dev/video2


2 changes: 1 addition & 1 deletion deployment/edge/ansible/deploy_vio_on_edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
repo: https://github.com/octo-technology/VIO.git
dest: "{{ REMOTE_VIO_DIR }}"
single_branch: yes
version: main
version: demo-grosse-conf
force: true

- name: Remove config folder
Expand Down
2 changes: 1 addition & 1 deletion deployment/edge/ansible/files/docker-compose.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ services:
SERVING_MODEL_URL: http://edge_model_serving:8501
GOOGLE_APPLICATION_CREDENTIALS: /edge_orchestrator/config/secrets/credentials.json
GCP_BUCKET_NAME: tf-vio-bucket
ACTIVE_CONFIG_NAME: marker_classification_with_1_fake_camera
ACTIVE_CONFIG_NAME: duck_detector_with_2_usbcamera

edge_interface:
container_name: edge_interface
Expand Down
4 changes: 2 additions & 2 deletions deployment/edge/ansible/inventory.ini
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[edge_1]
10.103.252.192 ansible_user=devkit ansible_password=devkit
172.23.26.58 ansible_user=devkit ansible_password=devkit

[edge_1:vars]
EDGE_NAME="edge1"

[edge_2]
10.103.253.2 ansible_user=devkit ansible_password=devkit
172.23.26.10 ansible_user=devkit ansible_password=devkit

[edge_2:vars]
EDGE_NAME="edge2"
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ In case you want to run a specific module, each module has its own make command:
Indeed each of the above target correspond to a command [docker-compose.yml](https://github.com/octo-technology/VIO/blob/main/docker-compose.yml). For example, the target `edge_orchestrator` correspond to :

```shell
$ docker-compose up -d --build edge_orchestrator
$ docker compose up -d --build edge_orchestrator
```

To check all services are up and running you can run the command `docker ps`, you should see something like below:
Expand Down
6 changes: 3 additions & 3 deletions edge_orchestrator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ help:
grep -E '^\.PHONY: [a-zA-Z0-9_-]+ .*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = "(: |##)"}; {printf "\033[36m%-30s\033[0m %s\n", $$2, $$3}'

.PHONY: linting ## 🐍 Lint Python files to conform to the PEP 8 style guide
linting:
.PHONY: lint ## 🐍 Lint Python files to conform to the PEP 8 style guide
lint:
black .
isort . --gitignore
autoflake -i --remove-all-unused-imports -r --ignore-init-module-imports . --exclude .venv

.PHONY: lint ## 🐍 Check linting Python files to conform to the PEP 8 style guide
.PHONY: lint ## 🐍 Check lint Python files to conform to the PEP 8 style guide
lint:
black . --check
isort . --gitignore --check
Expand Down
5 changes: 5 additions & 0 deletions edge_orchestrator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ MacOS:
```bash
brew install postgresql
```
MAC : 172.23.26.18
ipconfig getifaddr en0

Intel : 192.168.1.25
ip a | grep -A 2 'wlx' | grep 'inet ' | awk '{print $2}' | cut -d/ -f1
13 changes: 13 additions & 0 deletions edge_orchestrator/config/inventory.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,19 @@
320
],
"objectness_threshold": 0.3
},
"duck_detector": {
"category": "classification",
"version": 1,
"class_names": [
"OK",
"NOK_CUT",
"NOK_COLORED"
],
"image_resolution": [
224,
224
]
}
},
"camera_rules": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "duck_detector_2_cams",
"cameras": {
"camera_id0": {
"type": "usb_camera",
"source": "/dev/video0",
"position": "front",
"exposition": 100,
"models_graph": {
"model_id4": {
"name": "duck_detector",
"depends_on": []
}
},
"camera_rule": {
"name": "expected_label_rule",
"parameters": {
"expected_label": ["OK"]
}
}
},
"camera_id2": {
"type": "usb_camera",
"source": "/dev/video2",
"position": "front",
"exposition": 100,
"models_graph": {
"model_id4": {
"name": "duck_detector",
"depends_on": []
}
},
"camera_rule": {
"name": "expected_label_rule",
"parameters": {
"expected_label": ["OK"]
}
}
}
},
"item_rule": {
"name": "min_threshold_ko_rule",
"parameters": {
"threshold": 1
}
}
}
4 changes: 2 additions & 2 deletions edge_streamlit/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ env:
run:
streamlit run app.py

.PHONY: linting ## 🐍 Lint Python files to conform to the PEP 8 style guide
linting:
.PHONY: lint ## 🐍 Lint Python files to conform to the PEP 8 style guide
lint:
black .
isort . --gitignore
autoflake -i --remove-all-unused-imports -r --ignore-init-module-imports . --exclude .venv
7 changes: 5 additions & 2 deletions edge_streamlit/app.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import json
import os
import time
from io import BytesIO

import requests
import streamlit as st
from prediction_boxes import filtering_items_that_have_predictions, plot_predictions
from PIL import Image
from io import BytesIO

from prediction_boxes import (filtering_items_that_have_predictions,
plot_predictions)

# Page configuration
st.set_page_config(page_title="VIO-edge", page_icon="🔦", layout="wide")
Expand Down
Loading