diff --git a/internal/web/ui.go b/internal/web/ui.go index c5f3c0c..b584158 100644 --- a/internal/web/ui.go +++ b/internal/web/ui.go @@ -3964,6 +3964,7 @@ func (u *UI) actionFaceGalleryAdd(w http.ResponseWriter, r *http.Request) { return } defer f.Close() + u.rebuildFaceGallery() io.Copy(f, file) http.Redirect(w, r, "/ui/face-gallery?msg=ok", http.StatusFound) } @@ -4023,6 +4024,7 @@ func (u *UI) actionFaceGalleryDelete(w http.ResponseWriter, r *http.Request) { http.Error(w, "invalid", http.StatusBadRequest) return } + u.rebuildFaceGallery() repo := storage.NewFaceGalleryRepo(filepath.Join("resources", "standard_resources", "face_gallery", "face_gallery.db")) repo.DeletePerson(id) http.Redirect(w, r, "/ui/face-gallery", http.StatusFound) @@ -4082,8 +4084,22 @@ func (u *UI) actionFaceGalleryImport(w http.ResponseWriter, r *http.Request) { io.Copy(f, file) f.Close() file.Close() + u.rebuildFaceGallery() count++ } } http.Redirect(w, r, fmt.Sprintf("/ui/face-gallery?msg=已导入 %d 张照片", count), http.StatusFound) } + +func (u *UI) rebuildFaceGallery() { + builder := &service.FaceGalleryBuilder{ + PythonExe: "python", + BuildScript: filepath.Join("tools", "build_gallery.py"), + DetModel: filepath.Join("tools", "models", "RetinaFace_mobile320.onnx"), + RecogModel: filepath.Join("tools", "models", "mobilefacenet_arcface_prenorm.onnx"), + DetOutputsConfig: filepath.Join("tools", "models", "retinaface_mobile320_config.json"), + DatasetDir: filepath.Join("dataset"), + OutputDB: filepath.Join("resources", "standard_resources", "face_gallery", "face_gallery.db"), + } + builder.Build() +} diff --git a/internal/web/ui/templates/face_gallery.html b/internal/web/ui/templates/face_gallery.html index 9636bb0..6828a1b 100644 --- a/internal/web/ui/templates/face_gallery.html +++ b/internal/web/ui/templates/face_gallery.html @@ -47,9 +47,6 @@

{{icon "profile"}}人员列表

-
- -
diff --git a/tools/gallery_builder/__pycache__/__init__.cpython-311.pyc b/tools/gallery_builder/__pycache__/__init__.cpython-311.pyc index 3629090..25057fa 100644 Binary files a/tools/gallery_builder/__pycache__/__init__.cpython-311.pyc and b/tools/gallery_builder/__pycache__/__init__.cpython-311.pyc differ diff --git a/tools/gallery_builder/__pycache__/aggregate.cpython-311.pyc b/tools/gallery_builder/__pycache__/aggregate.cpython-311.pyc index 3cf08fd..015de85 100644 Binary files a/tools/gallery_builder/__pycache__/aggregate.cpython-311.pyc and b/tools/gallery_builder/__pycache__/aggregate.cpython-311.pyc differ diff --git a/tools/gallery_builder/__pycache__/align.cpython-311.pyc b/tools/gallery_builder/__pycache__/align.cpython-311.pyc index 86e09a0..4b6a802 100644 Binary files a/tools/gallery_builder/__pycache__/align.cpython-311.pyc and b/tools/gallery_builder/__pycache__/align.cpython-311.pyc differ diff --git a/tools/gallery_builder/__pycache__/dataset.cpython-311.pyc b/tools/gallery_builder/__pycache__/dataset.cpython-311.pyc index e772da5..94000c2 100644 Binary files a/tools/gallery_builder/__pycache__/dataset.cpython-311.pyc and b/tools/gallery_builder/__pycache__/dataset.cpython-311.pyc differ diff --git a/tools/gallery_builder/__pycache__/db.cpython-311.pyc b/tools/gallery_builder/__pycache__/db.cpython-311.pyc index dcd8dee..e82b442 100644 Binary files a/tools/gallery_builder/__pycache__/db.cpython-311.pyc and b/tools/gallery_builder/__pycache__/db.cpython-311.pyc differ diff --git a/tools/gallery_builder/__pycache__/detector.cpython-311.pyc b/tools/gallery_builder/__pycache__/detector.cpython-311.pyc index 3738bf1..054c776 100644 Binary files a/tools/gallery_builder/__pycache__/detector.cpython-311.pyc and b/tools/gallery_builder/__pycache__/detector.cpython-311.pyc differ diff --git a/tools/gallery_builder/__pycache__/recognizer.cpython-311.pyc b/tools/gallery_builder/__pycache__/recognizer.cpython-311.pyc index b8f7b7a..6bcd533 100644 Binary files a/tools/gallery_builder/__pycache__/recognizer.cpython-311.pyc and b/tools/gallery_builder/__pycache__/recognizer.cpython-311.pyc differ diff --git a/tools/gallery_builder/__pycache__/report.cpython-311.pyc b/tools/gallery_builder/__pycache__/report.cpython-311.pyc index 9dac0bb..041bd8b 100644 Binary files a/tools/gallery_builder/__pycache__/report.cpython-311.pyc and b/tools/gallery_builder/__pycache__/report.cpython-311.pyc differ diff --git a/tools/gallery_builder/__pycache__/types.cpython-311.pyc b/tools/gallery_builder/__pycache__/types.cpython-311.pyc index 585db2a..f21968c 100644 Binary files a/tools/gallery_builder/__pycache__/types.cpython-311.pyc and b/tools/gallery_builder/__pycache__/types.cpython-311.pyc differ