Add real workspace acceptance
This commit is contained in:
76
README.md
76
README.md
@@ -69,15 +69,39 @@ SEG_SOURCE_ROOT=../Seg
|
||||
SEG_DATA_SERVER_ROOT=.
|
||||
SEG_BACKEND_DB=var/seg_data_server.sqlite3
|
||||
SEG_BACKEND_LOG_DIR=var/job_logs
|
||||
SEG_BACKEND_HOST=0.0.0.0
|
||||
SEG_BACKEND_PORT=8010
|
||||
SEG_BACKEND_RELOAD=1
|
||||
SEG_TASK_CONDA_ENV=seg_smp
|
||||
SEG_MMSEG_CONDA_ENV=seg_mmcv
|
||||
SEG_BACKEND_CONDA_ENV=seg_smp
|
||||
SEG_WEIGHT_MODE=copy
|
||||
SEG_ENABLE_SHELL_TASKS=1
|
||||
SEG_VALIDATE_DEEP=1
|
||||
SEG_FRONTEND_HOST=0.0.0.0
|
||||
SEG_FRONTEND_PORT=5173
|
||||
VITE_API_BASE=http://localhost:8010
|
||||
```
|
||||
|
||||
Environment variables used during deployment:
|
||||
|
||||
| Variable | Purpose |
|
||||
| --- | --- |
|
||||
| `SEG_SOURCE_ROOT` | Path to the original `Seg/` algorithm workspace. |
|
||||
| `SEG_DATA_SERVER_ROOT` | Runtime root for this web project. Keep `.` for normal deployments. |
|
||||
| `SEG_BACKEND_DB` | SQLite database used for datasets, jobs, and profiles. |
|
||||
| `SEG_BACKEND_LOG_DIR` | Directory for job logs streamed through SSE. |
|
||||
| `SEG_BACKEND_HOST` / `SEG_BACKEND_PORT` | FastAPI listen address. |
|
||||
| `SEG_BACKEND_RELOAD` | Set `1` for development reload, `0` for long-running production workers. |
|
||||
| `SEG_BACKEND_CONDA_ENV` | Conda env used to run FastAPI. |
|
||||
| `SEG_TASK_CONDA_ENV` | Default env for dataset, SegModel, YOLO, visual, and analysis jobs. |
|
||||
| `SEG_MMSEG_CONDA_ENV` | Dedicated env for full MMSeg/mmcv jobs. |
|
||||
| `SEG_WEIGHT_MODE` | `copy` or `reflink` when syncing weights. |
|
||||
| `SEG_ENABLE_SHELL_TASKS` | Enables execution of the wrapped legacy shell/Python tasks. |
|
||||
| `SEG_VALIDATE_DEEP` | Enables deep acceptance by default for local agent runs. |
|
||||
| `SEG_FRONTEND_HOST` / `SEG_FRONTEND_PORT` | Vite development server listen address. |
|
||||
| `VITE_API_BASE` | Backend URL embedded into the frontend build or used by the dev server. |
|
||||
|
||||
Install system prerequisites first: Git, Conda or Miniconda, Node.js/npm, a
|
||||
working NVIDIA driver and `nvidia-smi` for GPU discovery, and enough free disk
|
||||
space for the copied weights. Full weight sync currently needs about 35 GB
|
||||
@@ -129,11 +153,38 @@ scripts/run_backend.sh
|
||||
scripts/run_frontend.sh
|
||||
```
|
||||
|
||||
Defaults are `0.0.0.0:8010` for the backend and Vite's dev port for the
|
||||
frontend. Override backend binding with `SEG_BACKEND_HOST` and
|
||||
`SEG_BACKEND_PORT`. For a production process manager such as systemd,
|
||||
supervisor, or Docker Compose, call the same two scripts so `.env` and the
|
||||
configured conda environments are used consistently.
|
||||
Defaults are `0.0.0.0:8010` for the backend and `0.0.0.0:5173` for the
|
||||
frontend development server. Override backend binding with `SEG_BACKEND_HOST`
|
||||
and `SEG_BACKEND_PORT`; override the Vite dev server with `SEG_FRONTEND_HOST`
|
||||
and `SEG_FRONTEND_PORT`.
|
||||
|
||||
For long-running production service management, disable backend reload and
|
||||
start the same script from systemd, supervisor, or Docker Compose so `.env`
|
||||
and the configured conda environments are used consistently:
|
||||
|
||||
```bash
|
||||
SEG_BACKEND_RELOAD=0 scripts/run_backend.sh
|
||||
```
|
||||
|
||||
For a static frontend deployment, set `VITE_API_BASE` to the public backend
|
||||
URL before building, then serve `frontend/dist/` with Nginx or another static
|
||||
file server. A quick local preview is:
|
||||
|
||||
```bash
|
||||
cd frontend
|
||||
npm run build
|
||||
npm run preview -- --host 0.0.0.0 --port 4173
|
||||
```
|
||||
|
||||
If systemd is used, a minimal backend unit can call the script directly:
|
||||
|
||||
```ini
|
||||
[Service]
|
||||
WorkingDirectory=/home/wkmgc/Desktop/Data_Disk_1/Seg/Seg_Data_Server_Net
|
||||
Environment=SEG_BACKEND_RELOAD=0
|
||||
ExecStart=/home/wkmgc/Desktop/Data_Disk_1/Seg/Seg_Data_Server_Net/scripts/run_backend.sh
|
||||
Restart=always
|
||||
```
|
||||
|
||||
Validate a deployment before handing it to operators:
|
||||
|
||||
@@ -208,6 +259,16 @@ discovery. MMSeg full-model readiness is validated in
|
||||
`SEG_MMSEG_CONDA_ENV` by importing `mmcv._ext` and building a local MMSeg
|
||||
`EncoderDecoder` from the existing config tree.
|
||||
|
||||
`POST /api/acceptance/real` runs the same operator-facing path on existing
|
||||
non-synthetic workspace files. It discovers a real `DataSet_Own/*_Ori` image
|
||||
with a matching mask, discovers a real YOLO image/txt pair from
|
||||
`Seg_All_In_One_YoloModel/Yolo数据集构建/Data`, uploads those files through the
|
||||
dataset API, validates YOLO and mask readiness, generates `dataset.yaml`, runs
|
||||
YOLO prediction and heatmap jobs, and runs the legacy stack job on the uploaded
|
||||
real image/mask pair. The latest report is available from
|
||||
`GET /api/acceptance/real/latest` and is shown in the coverage panel as
|
||||
`真实数据`.
|
||||
|
||||
For stronger runtime proof, `POST /api/acceptance/deep` runs minimal training
|
||||
loops for the three model families: one SegModel optimizer step, one YOLO
|
||||
segmentation epoch on a synthetic 64x64 dataset, one YOLO GradCAM heatmap
|
||||
@@ -308,5 +369,6 @@ non-training validation pass is needed.
|
||||
|
||||
The web dashboard calls validation in light mode by default:
|
||||
`/api/agents/validate?run_build=false&run_acceptance=false&run_deep=false`.
|
||||
Pass `run_acceptance=true` or `run_deep=true` only when you explicitly want the
|
||||
agent to launch the heavier runtime acceptance checks from the browser/API.
|
||||
Pass `run_acceptance=true`, `run_real=true`, or `run_deep=true` only when you
|
||||
explicitly want the agent to launch the heavier runtime acceptance checks from
|
||||
the browser/API.
|
||||
|
||||
Reference in New Issue
Block a user