Skip to content

Commit 9d9581c

Browse files
committed
Merge branch 'dev_v2'
2 parents 8f0d155 + 06bd5e9 commit 9d9581c

47 files changed

Lines changed: 9842 additions & 1305 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# VisionFlow 環境變數配置範例
2+
# 複製此檔案為 .env 並填入實際數值
3+
4+
# ===========================================
5+
# 資料庫配置
6+
# ===========================================
7+
POSTGRES_USER=user
8+
POSTGRES_PASSWORD=password
9+
POSTGRES_DB=vision_notify
10+
DATABASE_URL=postgresql://user:password@db:5432/vision_notify
11+
12+
# ===========================================
13+
# Flask Web 應用配置
14+
# ===========================================
15+
FLASK_ENV=development
16+
FLASK_DEBUG=false
17+
FLASK_HOST=0.0.0.0
18+
FLASK_PORT=5000
19+
SECRET_KEY=your-secret-key-change-this-in-production
20+
21+
# ===========================================
22+
# 服務端口配置 (避免衝突)
23+
# ===========================================
24+
BACKEND_PORT=5001
25+
CAMERA_CTRL_PORT=5002
26+
DB_PORT=5433
27+
REDIS_PORT=6380
28+
29+
# ===========================================
30+
# Redis 配置
31+
# ===========================================
32+
REDIS_HOST=redis
33+
REDIS_PORT=6380
34+
REDIS_DB=0
35+
REDIS_PASSWORD=
36+
37+
# ===========================================
38+
# API 服務配置
39+
# ===========================================
40+
API_SERVICE_URL=http://backend:5000
41+
CAMERA_SERVICE_URL=http://camera_ctrl:5000
42+
API_TIMEOUT=30
43+
44+
# ===========================================
45+
# 物件辨識服務配置
46+
# ===========================================
47+
# 模型配置
48+
MODEL_PATH_BASE=/app/models
49+
DEFAULT_MODEL_CONFIDENCE=0.5
50+
GPU_ENABLED=false
51+
BATCH_SIZE=1
52+
53+
# 模型啟用設定
54+
MODEL1_ENABLED=true
55+
MODEL2_ENABLED=false
56+
MODEL3_ENABLED=false
57+
58+
# 模型信心度閾值
59+
MODEL1_CONF=0.5
60+
MODEL1_CONF_PERSON=0.7
61+
MODEL1_CONF_BICYCLE=0.6
62+
MODEL1_CONF_CAR=0.6
63+
MODEL1_CONF_DOG=0.7
64+
MODEL1_CONF_CAT=0.7
65+
66+
MODEL2_CONF=0.5
67+
MODEL2_CONF_CAT=0.7
68+
MODEL2_CONF_LAPTOP=0.6
69+
MODEL2_CONF_CELL_PHONE=0.6
70+
MODEL2_CONF_CHAIR=0.7
71+
MODEL2_CONF_BOOK=0.6
72+
73+
MODEL3_CONF=0.5
74+
MODEL3_CONF_BOTTLE=0.7
75+
MODEL3_CONF_CUP=0.6
76+
MODEL3_CONF_FORK=0.6
77+
MODEL3_CONF_KNIFE=0.7
78+
MODEL3_CONF_SPOON=0.6
79+
80+
# 標註設定
81+
MODEL1_BOX_THICKNESS=2
82+
MODEL1_TEXT_THICKNESS=1
83+
MODEL1_TEXT_SCALE=0.5
84+
85+
MODEL2_BOX_THICKNESS=2
86+
MODEL2_TEXT_THICKNESS=1
87+
MODEL2_TEXT_SCALE=0.5
88+
89+
MODEL3_BOX_THICKNESS=2
90+
MODEL3_TEXT_THICKNESS=1
91+
MODEL3_TEXT_SCALE=0.5
92+
93+
# 處理配置
94+
PROCESSING_SLEEP_INTERVAL=0.1
95+
MAX_WORKERS=4
96+
97+
# 儲存配置
98+
BASE_SAVE_DIR=saved_images
99+
ENABLE_IMAGE_SAVING=true
100+
IMAGE_RETENTION_DAYS=7
101+
102+
# ===========================================
103+
# 相機控制器服務配置
104+
# ===========================================
105+
# 相機配置
106+
CAMERA_FETCH_INTERVAL=0.1
107+
CAMERA_TIMEOUT=30
108+
CAMERA_MAX_RETRIES=3
109+
110+
# 圖像處理
111+
IMAGE_QUALITY=85
112+
IMAGE_FORMAT=JPEG
113+
MAX_IMAGE_WIDTH=1920
114+
MAX_IMAGE_HEIGHT=1080
115+
116+
# 圖像儲存
117+
SAVE_PATH=/app/images
118+
IMAGE_RETENTION_HOURS=24
119+
120+
# 安全配置
121+
CORS_ORIGINS=*
122+
123+
# 性能配置
124+
WORKER_THREADS=4
125+
FRAME_BUFFER_SIZE=5
126+
127+
# 監控配置
128+
HEALTH_CHECK_INTERVAL=30
129+
STATUS_UPDATE_INTERVAL=5
130+
131+
# ===========================================
132+
# 通知服務配置
133+
# ===========================================
134+
NOTIFICATION_COOLDOWN=60
135+
ENABLE_EMAIL_NOTIFICATIONS=false
136+
ENABLE_LINE_NOTIFICATIONS=false
137+
138+
# 郵件配置
139+
SMTP_SERVER=smtp.gmail.com
140+
SMTP_PORT=587
141+
SMTP_USERNAME=
142+
SMTP_PASSWORD=
143+
EMAIL_FROM=
144+
145+
# LINE Notify 配置
146+
LINE_NOTIFY_TOKEN=
147+
148+
# ===========================================
149+
# 外部服務配置
150+
# ===========================================
151+
TOKEN=hf_xxxxxx
152+
DATASETNAME=danlee01633060/imgtest
153+
154+
# ===========================================
155+
# 工作器配置
156+
# ===========================================
157+
WORKER_ID=1
158+
NUM_WORKERS=3
159+
160+
# ===========================================
161+
# 郵件服務配置
162+
# ===========================================
163+
MAIL_API_URL=https://api.example.com/v1
164+
165+
# ===========================================
166+
# 日誌配置
167+
# ===========================================
168+
LOG_LEVEL=INFO
169+
LOG_FORMAT=%(asctime)s - %(name)s - %(levelname)s - %(message)s
170+
ENABLE_FILE_LOGGING=true
171+
LOG_FILE_PATH=logs/app.log
172+
LOG_FILE_MAX_BYTES=10485760
173+
LOG_FILE_BACKUP_COUNT=5

.github/workflows/docker-image.yml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,43 @@ name: Docker Image CI
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: [ "dev" ]
66
pull_request:
7-
branches: [ "main" ]
7+
branches: [ "dev" ]
88

99
jobs:
10+
build-backend:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Build Backend Image
15+
run: |
16+
cd web
17+
docker build . --file Dockerfile --tag backend-image:$(date +%s)
1018
11-
build:
19+
build-camera-ctrl:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Build Camera Control Image
24+
run: |
25+
cd camera_ctrler
26+
docker build . --file cameractrlDockerfile --tag camera-ctrl-image:$(date +%s)
1227
28+
build-objectrecognition:
1329
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
- name: Build Object Recognition Image
33+
run: |
34+
cd object_recognition
35+
docker build . --file objectrecognitionDockerfile --tag objectrecognition-image:$(date +%s)
1436
37+
build-worker_1:
38+
runs-on: ubuntu-latest
1539
steps:
1640
- uses: actions/checkout@v4
17-
- name: Build the Docker image
18-
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
41+
- name: Build worker Image
42+
run: |
43+
cd redisv1
44+
docker build . --file rtsptestDockerfile --tag worker_1-image:$(date +%s)

.gitignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,38 @@
1+
# 環境變數和敏感檔案
2+
.env
3+
*.env
4+
.env.local
5+
.env.production
6+
.env.staging
7+
8+
# AI 模型檔案
9+
*.pt
10+
*.pth
11+
*.onnx
12+
*.tflite
13+
*.pb
14+
*.bin
15+
*.param
16+
*.mlmodel
17+
*.engine
18+
19+
# 圖片和媒體檔案
20+
saved_images/
21+
frames/
22+
stream/
23+
image/
24+
25+
# Redis 資料
26+
redis-data/
27+
28+
# 日誌檔案
29+
*.log
30+
logs/
31+
*.log.*
32+
33+
# 資料庫檔案
34+
db/
35+
136
# Byte-compiled / optimized / DLL files
237
__pycache__/
338
*.py[cod]
@@ -164,3 +199,4 @@ db/
164199
rtsp_test/frames/
165200
object_recognition/saved_images/
166201
redis-data/
202+
camera_ctrler/__pycache__/

0 commit comments

Comments
 (0)