diff --git a/Makefile b/Makefile index f71ee9f7..69abcf8e 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/deployment/edge/ansible/Makefile b/deployment/edge/ansible/Makefile index fc071dcf..b33017e5 100644 --- a/deployment/edge/ansible/Makefile +++ b/deployment/edge/ansible/Makefile @@ -19,8 +19,8 @@ deploy-vio-on-inventory: .PHONY: register-inventory-on-gcp-hub ## 🚀 Register the edge devices on the GCP hub register-inventory-on-gcp-hub: - ansible-playbook -v -i inventory.ini register_edge_on_gcp_hub.yml -e ansible_python_interpreter=.venv/bin/python + ansible-playbook -v -i inventory.ini register_inventory_on_gcp_hub.yml -e ansible_python_interpreter=.venv/bin/python -.PHONY: test-registering-localhost-on-gcp-hub ## 🚀 Test registering localhost on the GCP hub -test-registering-localhost-on-gcp-hub: - ansible-playbook -v -c local -l localhost -i inventory.ini register_edge_on_gcp_hub.yml -e ansible_python_interpreter=.venv/bin/python +.PHONY: test-register-localhost-on-gcp-hub ## 🚀 Test register localhost on the GCP hub +test-register-localhost-on-gcp-hub: + ansible-playbook -v -c local -l localhost -i inventory.ini register_inventory_on_gcp_hub.yml -e ansible_python_interpreter=.venv/bin/python diff --git a/deployment/edge/ansible/README.md b/deployment/edge/ansible/README.md index 42706b21..f8fa19cf 100644 --- a/deployment/edge/ansible/README.md +++ b/deployment/edge/ansible/README.md @@ -2,6 +2,30 @@ 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 +``` + +Do not forget to install the google-cloud-storage package: +```bash +pip install google-cloud-storage==3.0.0 +``` + +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 @@ -25,7 +49,7 @@ 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. diff --git a/deployment/edge/ansible/deploy_vio_on_edge.yml b/deployment/edge/ansible/deploy_vio_on_edge.yml index 4f528cb6..ddb89590 100644 --- a/deployment/edge/ansible/deploy_vio_on_edge.yml +++ b/deployment/edge/ansible/deploy_vio_on_edge.yml @@ -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 diff --git a/deployment/edge/ansible/files/docker-compose.template.yml b/deployment/edge/ansible/files/docker-compose.template.yml index 54ac0fd2..76871415 100644 --- a/deployment/edge/ansible/files/docker-compose.template.yml +++ b/deployment/edge/ansible/files/docker-compose.template.yml @@ -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 diff --git a/deployment/edge/ansible/inventory.ini b/deployment/edge/ansible/inventory.ini index 61662bcc..cea171ee 100644 --- a/deployment/edge/ansible/inventory.ini +++ b/deployment/edge/ansible/inventory.ini @@ -1,16 +1,16 @@ [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" -IP_ADDRESS="10.103.252.192" +IP_ADDRESS="172.23.26.58" [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" -IP_ADDRESS="10.103.253.2" +IP_ADDRESS="172.23.26.10" ; [localhost] ; 127.0.0.1 diff --git a/deployment/edge/ansible/register_edge_on_gcp_hub.yml b/deployment/edge/ansible/register_inventory_on_gcp_hub.yml similarity index 94% rename from deployment/edge/ansible/register_edge_on_gcp_hub.yml rename to deployment/edge/ansible/register_inventory_on_gcp_hub.yml index 0c1c90ae..0d03d9c5 100644 --- a/deployment/edge/ansible/register_edge_on_gcp_hub.yml +++ b/deployment/edge/ansible/register_inventory_on_gcp_hub.yml @@ -1,4 +1,4 @@ -- name: "Register edge on GCP hub" +- name: "Register inventory on GCP hub" hosts: all tasks: - name: Create edge_ip file diff --git a/docs/index.md b/docs/index.md index 359c13d4..d4c4ab90 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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: diff --git a/edge_orchestrator/README.md b/edge_orchestrator/README.md index 90148bc9..c4e7ba0b 100644 --- a/edge_orchestrator/README.md +++ b/edge_orchestrator/README.md @@ -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 diff --git a/edge_orchestrator/config/inventory.json b/edge_orchestrator/config/inventory.json index f2b3a0cf..bf454dd1 100644 --- a/edge_orchestrator/config/inventory.json +++ b/edge_orchestrator/config/inventory.json @@ -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": [ diff --git a/edge_orchestrator/config/station_configs/duck_detector_with_2_usbcamera.json b/edge_orchestrator/config/station_configs/duck_detector_with_2_usbcamera.json new file mode 100644 index 00000000..d591ef05 --- /dev/null +++ b/edge_orchestrator/config/station_configs/duck_detector_with_2_usbcamera.json @@ -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 + } + } +} diff --git a/edge_streamlit/app.py b/edge_streamlit/app.py index 11f147b7..c7918e2d 100644 --- a/edge_streamlit/app.py +++ b/edge_streamlit/app.py @@ -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")