2021-09-21 09:51:48 +02:00
|
|
|
package face
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/photoprism/photoprism/internal/crop"
|
|
|
|
)
|
|
|
|
|
|
|
|
var CropSize = crop.Sizes[crop.Tile160]
|
|
|
|
var ClusterCore = 4
|
|
|
|
var ClusterMinScore = 15
|
2021-09-21 11:03:07 +02:00
|
|
|
var ClusterMinSize = 95
|
2021-09-22 13:05:59 +02:00
|
|
|
var ClusterRadius = 0.64
|
2021-09-21 11:03:07 +02:00
|
|
|
var MatchRadius = 0.46
|
2021-09-21 09:51:48 +02:00
|
|
|
var SampleThreshold = 2 * ClusterCore
|
|
|
|
var OverlapThreshold = 42
|
|
|
|
var OverlapThresholdFloor = OverlapThreshold - 1
|
|
|
|
var ScoreThreshold = float32(9.0)
|
|
|
|
|
|
|
|
// ScaleScoreThreshold returns the scale adjusted face score threshold.
|
|
|
|
func ScaleScoreThreshold(scale int) float32 {
|
|
|
|
// Smaller faces require higher quality.
|
|
|
|
switch {
|
2021-09-21 11:03:07 +02:00
|
|
|
case scale < 26:
|
|
|
|
return ScoreThreshold + 26.0
|
|
|
|
case scale < 32:
|
|
|
|
return ScoreThreshold + 16.0
|
|
|
|
case scale < 40:
|
|
|
|
return ScoreThreshold + 11.0
|
2021-09-21 09:51:48 +02:00
|
|
|
case scale < 50:
|
2021-09-21 11:03:07 +02:00
|
|
|
return ScoreThreshold + 9.0
|
2021-09-21 09:51:48 +02:00
|
|
|
case scale < 80:
|
|
|
|
return ScoreThreshold + 6.0
|
|
|
|
case scale < 110:
|
|
|
|
return ScoreThreshold + 2.0
|
|
|
|
}
|
|
|
|
|
|
|
|
return ScoreThreshold
|
|
|
|
}
|