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