diff --git a/README-zh-tw.md b/README-zh-tw.md index 36cb525..400cd21 100644 --- a/README-zh-tw.md +++ b/README-zh-tw.md @@ -3,32 +3,32 @@ AI-Driven Construction Safety Banner
- 模型伺服器 | - 串流網頁 | - 用戶管理 | - YOLOv8 數據增強 | - YOLOv8 評估 | - YOLOv8 訓練 + 模型伺服器 | + 串流網頁 | + 用戶管理 | + YOLOv8 數據增強 | + YOLOv8 評估 | + YOLOv8 訓練

- - Pre-commit 3.7.1 - - - Python 3.12.4 - - - YOLOv8 - - - Flask 3.0.3 - - - pytest 8.2.2 - + + Pre-commit 3.7.1 + + + Python 3.12.4 + + + YOLOv8 + + + Flask 3.0.3 + + + pytest 8.2.2 +

@@ -39,7 +39,7 @@
- diagram + diagram

@@ -51,27 +51,27 @@ ```yaml # 這是一個視頻配置列表 - video_url: "rtsp://example1.com/stream" # 視頻的 URL - image_name: "cam1" # 圖像的名稱 - label: "label1" # 視頻的標籤 - model_key: "yolov8n" # 視頻使用的模型鍵 - line_token: "token1" # 用於通知的 Line Token - run_local: True # 本地運行物件檢測 + image_name: "cam1" # 圖像的名稱 + label: "label1" # 視頻的標籤 + model_key: "yolov8n" # 視頻使用的模型鍵 + line_token: "token1" # 用於通知的 Line Token + run_local: True # 本地運行物件檢測 - video_url: "rtsp://example2.com/stream" - image_name: "cam2" - label: "label2" - model_key: "yolov8n" - line_token: "token2" - run_local: True + image_name: "cam2" + label: "label2" + model_key: "yolov8n" + line_token: "token2" + run_local: True ``` 數組中的每個對象代表一個視頻流配置,包含以下字段: - `video_url`: 現場視頻流的 URL。這可以包括: - - 監控流 - - RTSP - - 副流 - - YouTube 視頻或直播 - - Discord + - 監控流 + - RTSP + - 副流 + - YouTube 視頻或直播 + - Discord - `image_name`: 分配給圖像或攝影機的名稱。 - `label`: 分配給視頻流的標籤。 - `model_key`: 用於機器學習模型的鍵標識符。 @@ -81,83 +81,87 @@
- 使用 Docker - -要運行危險檢測系統,您需要在機器上安裝 Docker 和 Docker Compose。按照以下步驟來啟動系統: - -1. 將存儲庫克隆到本地機器。 - ```bash - git clone https://github.com/yihong1120/Construction-Hazard-Detection.git - ``` -2. 進入克隆的目錄。 - ```bash - cd Construction-Hazard-Detection - ``` -3. 使用 Docker Compose 構建並運行服務: - ```bash - docker-compose up --build - ``` - -4. 使用特定的配置文件運行主應用程序,使用以下命令: - ```bash - docker-compose run main-application python main.py --config /path/in/container/configuration.yaml - ``` - 將 `/path/in/container/configuration.yaml` 替換為容器內配置文件的實際路徑。 - -5. 停止服務,使用以下命令: - ```bash - docker-compose down - ``` + Docker + + ### 使用 Docker + + 要運行危險檢測系統,您需要在機器上安裝 Docker 和 Docker Compose。按照以下步驟來啟動系統: + + 1. 將存儲庫克隆到本地機器。 + ```bash + git clone https://github.com/yihong1120/Construction-Hazard-Detection.git + ``` + 2. 進入克隆的目錄。 + ```bash + cd Construction-Hazard-Detection + ``` + 3. 使用 Docker Compose 構建並運行服務: + ```bash + docker-compose up --build + ``` + + 4. 使用特定的配置文件運行主應用程序,使用以下命令: + ```bash + docker-compose run main-application python main.py --config /path/in/container/configuration.yaml + ``` + 將 `/path/in/container/configuration.yaml` 替換為容器內配置文件的實際路徑。 + + 5. 停止服務,使用以下命令: + ```bash + docker-compose down + ```
- 使用 Python - -要在終端運行危險檢測系統,您需要在機器上安裝 Python。按照以下步驟來啟動系統: - -1. 將存儲庫克隆到本地機器。 - ```bash - git clone https://github.com/yihong1120/Construction-Hazard-Detection.git - ``` - -2. 進入克隆的目錄。 - ```bash - cd Construction-Hazard-Detection - ``` - -3. 安裝所需的軟體包: - ```bash - pip install -r requirements.txt - ``` - -4. 安裝並啟動 MySQL 服務: - ```bash - sudo apt install mysql-server - sudo systemctl start mysql.service - ``` - -5. 設置用戶帳戶和密碼。使用以下命令啟動用戶管理 API: - ```bash - gunicorn -w 1 -b 0.0.0.0:8000 "examples.User-Management.app:user-managements-app" - ``` - 建議使用 Postman 應用程式與 API 進行互動。 - -6. 要運行物體檢測 API,使用以下命令: - ```bash - gunicorn -w 1 -b 0.0.0.0:8001 "examples.Model-Server.app:app" - ``` - -7. 使用特定的配置文件運行主應用程序,使用以下命令: - ```bash - python3 main.py --config /path/to/your/configuration.yaml - ``` - 將 `/path/to/your/configuration.yaml` 替換為您的配置文件的實際路徑。 - -8. 要啟動串流 Web 服務,執行以下命令: - ```bash - gunicorn -w 1 -k eventlet -b 127.0.0.1:8002 "examples.Stream-Web.app:streaming-web-app" - ``` + Python + + ### 使用 Python + + 要在終端運行危險檢測系統,您需要在機器上安裝 Python。按照以下步驟來啟動系統: + + 1. 將存儲庫克隆到本地機器。 + ```bash + git clone https://github.com/yihong1120/Construction-Hazard-Detection.git + ``` + + 2. 進入克隆的目錄。 + ```bash + cd Construction-Hazard-Detection + ``` + + 3. 安裝所需的軟體包: + ```bash + pip install -r requirements.txt + ``` + + 4. 安裝並啟動 MySQL 服務: + ```bash + sudo apt install mysql-server + sudo systemctl start mysql.service + ``` + + 5. 設置用戶帳戶和密碼。使用以下命令啟動用戶管理 API: + ```bash + gunicorn -w 1 -b 0.0.0.0:8000 "examples.user_management.app:user-managements-app" + ``` + 建議使用 Postman 應用程式與 API 進行互動。 + + 6. 要運行物體檢測 API,使用以下命令: + ```bash + gunicorn -w 1 -b 0.0.0.0:8001 "examples.YOLOv8_server_api.app:YOLOv8-server-api-app" + ``` + + 7. 使用特定的配置文件運行主應用程序,使用以下命令: + ```bash + python3 main.py --config /path/to/your/configuration.yaml + ``` + 將 `/path/to/your/configuration.yaml` 替換為您的配置文件的實際路徑。 + + 8. 要啟動串流 Web 服務,執行以下命令: + ```bash + gunicorn -w 1 -k eventlet -b 127.0.0.1:8002 "examples.streaming_web.app:streaming-web-app" + ```
@@ -188,15 +192,15 @@ - `9: '車輛'`
- 檢測模型 + 檢測模型 - | Model | size
(pixels) | mAPval
50 | mAPval
50-95 | params
(M) | FLOPs
(B) | - | ------- | --------------------- | ------------------ | ------------------ | ----------------- | ----------------- | - | YOLOv8n | 640 | // | // | 3.2 | 8.7 | - | YOLOv8s | 640 | // | // | 11.2 | 28.6 | - | YOLOv8m | 640 | // | // | 25.9 | 78.9 | - | YOLOv8l | 640 | // | // | 43.7 | 165.2 | - | YOLOv8x | 640 | 82.9 | 60.9 | 68.2 | 257.8 | + | Model | size
(pixels) | mAPval
50 | mAPval
50-95 | params
(M) | FLOPs
(B) | + | ------- | --------------------- | ------------------ | ------------------ | ----------------- | ----------------- | + | YOLOv8n | 640 | // | // | 3.2 | 8.7 | + | YOLOv8s | 640 | // | // | 11.2 | 28.6 | + | YOLOv8m | 640 | // | // | 25.9 | 78.9 | + | YOLOv8l | 640 | // | // | 43.7 | 165.2 | + | YOLOv8x | 640 | 82.9 | 60.9 | 68.2 | 257.8 |
diff --git a/README.md b/README.md index 71625a2..65ce224 100644 --- a/README.md +++ b/README.md @@ -3,32 +3,32 @@ AI-Driven Construction Safety Banner
- Server-API | - Streaming-Web | - User-Management | - Data-Augmentation | - Evaluation | - Train + Server-API | + Streaming-Web | + User-Management | + Data-Augmentation | + Evaluation | + Train

- - Pre-commit 3.7.1 - - - Python 3.12.4 - - - YOLOv8 - - - Flask 3.0.3 - - - pytest 8.2.2 - + + Pre-commit 3.7.1 + + + Python 3.12.4 + + + YOLOv8 + + + Flask 3.0.3 + + + pytest 8.2.2 +

@@ -39,7 +39,7 @@
- diagram + diagram

@@ -84,85 +84,88 @@ Each object in the array represents a video stream configuration with the follow Now, you could launch the hazard-detection system in Docker or Python env:
- Usage for Docker + Docker - To run the hazard detection system, you need to have Docker and Docker Compose installed on your machine. Follow these steps to get the system up and running: + ### Usage for Docker - 1. Clone the repository to your local machine. - ``` - git clone https://github.com/yihong1120/Construction-Hazard-Detection.git - ``` - - 2. Navigate to the cloned directory. - ``` - cd Construction-Hazard-Detection - ``` - - 3. Build and run the services using Docker Compose: + To run the hazard detection system, you need to have Docker and Docker Compose installed on your machine. Follow these steps to get the system up and running: - ```bash - docker-compose up --build - ``` + 1. Clone the repository to your local machine. + ``` + git clone https://github.com/yihong1120/Construction-Hazard-Detection.git + ``` - 4. To run the main application with a specific configuration file, use the following command: - ```bash - docker-compose run main-application python main.py --config /path/in/container/configuration.yaml - ``` - Replace `/path/in/container/configuration.yaml` with the actual path to your configuration file inside the container. + 2. Navigate to the cloned directory. + ``` + cd Construction-Hazard-Detection + ``` + + 3. Build and run the services using Docker Compose: + ```bash + docker-compose up --build + ``` - 5. To stop the services, use the following command: - ```bash - docker-compose down - ``` + 4. To run the main application with a specific configuration file, use the following command: + ```bash + docker-compose run main-application python main.py --config /path/in/container/configuration.yaml + ``` + Replace `/path/in/container/configuration.yaml` with the actual path to your configuration file inside the container. + + 5. To stop the services, use the following command: + ```bash + docker-compose down + ```
- Usage for Python + Python + + ### Usage for Python - To run the hazard detection system with Python, follow these steps: + To run the hazard detection system with Python, follow these steps: - 1. Clone the repository to your local machine: - ```bash - git clone https://github.com/yihong1120/Construction-Hazard-Detection.git - ``` + 1. Clone the repository to your local machine: + ```bash + git clone https://github.com/yihong1120/Construction-Hazard-Detection.git + ``` - 2. Navigate to the cloned directory: - ```bash - cd Construction-Hazard-Detection - ``` + 2. Navigate to the cloned directory: + ```bash + cd Construction-Hazard-Detection + ``` - 3. Install required packages: - ```bash - pip install -r requirements.txt - ``` + 3. Install required packages: + ```bash + pip install -r requirements.txt + ``` - 4. Install and launch MySQL service (if required): - ```bash - sudo apt install mysql-server - sudo systemctl start mysql.service - ``` + 4. Install and launch MySQL service (if required): + ```bash + sudo apt install mysql-server + sudo systemctl start mysql.service + ``` - 5. Start user management API: - ```bash - gunicorn -w 1 -b 0.0.0.0:8000 "examples.User-Management.app:user-managements-app" - ``` + 5. Start user management API: + ```bash + gunicorn -w 1 -b 0.0.0.0:8000 "examples.User-Management.app:user-managements-app" + ``` - 6. Run object detection API: - ```bash - gunicorn -w 1 -b 0.0.0.0:8001 "examples.Model-Server.app:app" - ``` + 6. Run object detection API: + ```bash + gunicorn -w 1 -b 0.0.0.0:8001 "examples.Model-Server.app:app" + ``` - 7. Run the main application with a specific configuration file: - ```bash - python3 main.py --config /path/to/your/configuration.yaml - ``` - Replace `/path/to/your/configuration.yaml` with the actual path to your configuration file. + 7. Run the main application with a specific configuration file: + ```bash + python3 main.py --config /path/to/your/configuration.yaml + ``` + Replace `/path/to/your/configuration.yaml` with the actual path to your configuration file. - 8. Start the streaming web service: - ```bash - gunicorn -w 1 -k eventlet -b 127.0.0.1:8002 "examples.Stream-Web.app:streaming-web-app" - ``` + 8. Start the streaming web service: + ```bash + gunicorn -w 1 -k eventlet -b 127.0.0.1:8002 "examples.Stream-Web.app:streaming-web-app" + ```
@@ -195,15 +198,15 @@ The primary dataset for training this model is the [Construction Site Safety Ima - `9: 'Vehicle'`
- Models for detection + Models for detection - | Model | size
(pixels) | mAPval
50 | mAPval
50-95 | params
(M) | FLOPs
(B) | - | ------- | --------------------- | ------------------ | ------------------ | ----------------- | ----------------- | - | YOLOv8n | 640 | // | // | 3.2 | 8.7 | - | YOLOv8s | 640 | // | // | 11.2 | 28.6 | - | YOLOv8m | 640 | // | // | 25.9 | 78.9 | - | YOLOv8l | 640 | // | // | 43.7 | 165.2 | - | YOLOv8x | 640 | 82.9 | 60.9 | 68.2 | 257.8 | + | Model | size
(pixels) | mAPval
50 | mAPval
50-95 | params
(M) | FLOPs
(B) | + | ------- | --------------------- | ------------------ | ------------------ | ----------------- | ----------------- | + | YOLOv8n | 640 | // | // | 3.2 | 8.7 | + | YOLOv8s | 640 | // | // | 11.2 | 28.6 | + | YOLOv8m | 640 | // | // | 25.9 | 78.9 | + | YOLOv8l | 640 | // | // | 43.7 | 165.2 | + | YOLOv8x | 640 | 82.9 | 60.9 | 68.2 | 257.8 |