2021-09-23 13:16:05 +02:00
|
|
|
package config
|
|
|
|
|
|
|
|
import "github.com/photoprism/photoprism/internal/face"
|
|
|
|
|
2021-09-23 13:47:18 +02:00
|
|
|
// FaceSize returns the face size threshold in pixels.
|
|
|
|
func (c *Config) FaceSize() int {
|
|
|
|
if c.options.FaceSize < 20 || c.options.FaceSize > 10000 {
|
2021-10-05 10:12:48 +02:00
|
|
|
return face.SizeThreshold
|
2021-09-23 13:47:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return c.options.FaceSize
|
|
|
|
}
|
|
|
|
|
2021-09-23 13:16:05 +02:00
|
|
|
// FaceScore returns the face quality score threshold.
|
|
|
|
func (c *Config) FaceScore() float64 {
|
|
|
|
if c.options.FaceScore < 1 || c.options.FaceScore > 100 {
|
|
|
|
return face.ScoreThreshold
|
|
|
|
}
|
|
|
|
|
|
|
|
return c.options.FaceScore
|
|
|
|
}
|
|
|
|
|
2021-09-23 13:21:21 +02:00
|
|
|
// FaceOverlap returns the face area overlap threshold in percent.
|
2021-09-23 13:16:05 +02:00
|
|
|
func (c *Config) FaceOverlap() int {
|
|
|
|
if c.options.FaceOverlap < 1 || c.options.FaceOverlap > 100 {
|
|
|
|
return face.OverlapThreshold
|
|
|
|
}
|
|
|
|
|
|
|
|
return c.options.FaceOverlap
|
|
|
|
}
|
|
|
|
|
2021-10-05 10:12:48 +02:00
|
|
|
// FaceClusterSize returns the size threshold for faces forming a cluster in pixels.
|
|
|
|
func (c *Config) FaceClusterSize() int {
|
2023-05-13 16:02:49 +02:00
|
|
|
if c.options.FaceClusterSize < 20 || c.options.FaceClusterSize > 10000 {
|
2021-10-05 10:12:48 +02:00
|
|
|
return face.ClusterSizeThreshold
|
|
|
|
}
|
|
|
|
|
|
|
|
return c.options.FaceClusterSize
|
|
|
|
}
|
|
|
|
|
|
|
|
// FaceClusterScore returns the quality threshold for faces forming a cluster.
|
|
|
|
func (c *Config) FaceClusterScore() int {
|
2023-05-13 16:02:49 +02:00
|
|
|
if c.options.FaceClusterScore < 1 || c.options.FaceClusterScore > 100 {
|
2021-10-05 10:12:48 +02:00
|
|
|
return face.ClusterScoreThreshold
|
|
|
|
}
|
|
|
|
|
|
|
|
return c.options.FaceClusterScore
|
|
|
|
}
|
|
|
|
|
2021-09-23 13:16:05 +02:00
|
|
|
// FaceClusterCore returns the number of faces forming a cluster core.
|
|
|
|
func (c *Config) FaceClusterCore() int {
|
2023-05-13 16:02:49 +02:00
|
|
|
if c.options.FaceClusterCore < 1 || c.options.FaceClusterCore > 100 {
|
2021-09-23 13:16:05 +02:00
|
|
|
return face.ClusterCore
|
|
|
|
}
|
|
|
|
|
|
|
|
return c.options.FaceClusterCore
|
|
|
|
}
|
|
|
|
|
|
|
|
// FaceClusterDist returns the radius of faces forming a cluster core.
|
|
|
|
func (c *Config) FaceClusterDist() float64 {
|
2023-05-13 16:02:49 +02:00
|
|
|
if c.options.FaceClusterDist < 0.1 || c.options.FaceClusterDist > 1.5 {
|
2021-09-23 13:16:05 +02:00
|
|
|
return face.ClusterDist
|
|
|
|
}
|
|
|
|
|
|
|
|
return c.options.FaceClusterDist
|
|
|
|
}
|
|
|
|
|
|
|
|
// FaceMatchDist returns the offset distance when matching faces with clusters.
|
|
|
|
func (c *Config) FaceMatchDist() float64 {
|
2023-05-13 16:02:49 +02:00
|
|
|
if c.options.FaceMatchDist < 0.1 || c.options.FaceMatchDist > 1.5 {
|
2021-09-23 13:16:05 +02:00
|
|
|
return face.MatchDist
|
|
|
|
}
|
|
|
|
|
|
|
|
return c.options.FaceMatchDist
|
|
|
|
}
|