People: Match faces after files have been uploaded #22

This commit is contained in:
Michael Mayer 2021-08-20 00:28:22 +02:00
parent 4d915af2b5
commit 080c0b5f23
4 changed files with 14 additions and 5 deletions

View file

@ -283,8 +283,8 @@ func (w *Faces) Start(opt FacesOptions) (err error) {
}
}
// Match existing markers and faces.
if recognized, unknown, err = w.MatchMarkers(); err != nil {
// Match markers with faces and subjects.
if recognized, unknown, err = w.Match(); err != nil {
return err
}

View file

@ -11,8 +11,8 @@ import (
"github.com/photoprism/photoprism/pkg/clusters"
)
// MatchMarkers matches existing markers and faces.
func (w *Faces) MatchMarkers() (recognized, unknown int64, err error) {
// Match matches markers with faces and subjects.
func (w *Faces) Match() (recognized, unknown int64, err error) {
if w.Disabled() {
return 0, 0, nil
}

View file

@ -238,6 +238,15 @@ func (imp *Import) Start(opt ImportOptions) fs.Done {
}
if filesImported > 0 {
// Match existing faces if facial recognition is enabled.
if w := NewFaces(imp.conf); w.Disabled() {
log.Debugf("import: skipping facial recognition")
} else if recognized, unknown, err := w.Match(); err != nil {
log.Errorf("import: %s", err)
} else if recognized > 0 || unknown > 0 {
log.Infof("faces: %d recognized, %d unknown", recognized, unknown)
}
if err := entity.UpdatePhotoCounts(); err != nil {
log.Errorf("import: %s", err)
}

View file

@ -233,7 +233,7 @@ func (ind *Index) Start(opt IndexOptions) fs.Done {
// Match existing faces if facial recognition is enabled.
if w := NewFaces(ind.conf); w.Disabled() {
log.Debugf("index: skipping facial recognition")
} else if recognized, unknown, err := w.MatchMarkers(); err != nil {
} else if recognized, unknown, err := w.Match(); err != nil {
log.Errorf("index: %s", err)
} else if recognized > 0 || unknown > 0 {
log.Infof("faces: %d recognized, %d unknown", recognized, unknown)