People: Add face detection logs #22

This commit is contained in:
Michael Mayer 2021-09-03 01:17:12 +02:00
parent e8bfec677f
commit 68f21146ba
2 changed files with 6 additions and 4 deletions

View file

@ -140,11 +140,11 @@ func (fd *Detector) Detect(fileName string) (faces []pigo.Detection, params pigo
var maxSize int
if cols < 20 || rows < 20 || cols < fd.minSize || rows < fd.minSize {
return faces, params, fmt.Errorf("image too small (%dx%d)", cols, rows)
return faces, params, fmt.Errorf("image size %dx%d is too small", cols, rows)
} else if cols < rows {
maxSize = cols - 10
maxSize = cols - 8
} else {
maxSize = rows - 10
maxSize = rows - 8
}
imageParams := &pigo.ImageParams{
@ -166,6 +166,8 @@ func (fd *Detector) Detect(fileName string) (faces []pigo.Detection, params pigo
ImageParams: *imageParams,
}
log.Debugf("faces: image size %dx%d, face size min %d, max %d", cols, rows, params.MinSize, params.MaxSize)
// Run the classifier over the obtained leaf nodes and return the Face results.
// The result contains quadruplets representing the row, column, scale and Face score.
faces = classifier.RunCascade(params, fd.angle)

View file

@ -150,7 +150,7 @@ func (t *Net) getFaceCrop(fileName, cacheHash string, f *Face) (img image.Image,
} else if img, err := imaging.Open(cacheFile); err != nil {
log.Errorf("faces: failed loading %s", filepath.Base(cacheFile))
} else {
log.Debugf("faces: using %s", filepath.Base(cacheFile))
log.Debugf("faces: extracting from %s", filepath.Base(cacheFile))
return img, nil
}