feat(web): add setting for minimum face count for face detection (#4128)

* feat: add setting for minimum face count for face detection

Adds the minimum face count setting to the web interface to
circumvent detection of strangers and random background people
if desired.

* fix: codestyle, remove max for face count
This commit is contained in:
GenericGuy
2023-09-18 06:05:35 +02:00
committed by GitHub
parent 40b802a5a9
commit 94cbbf3c4b
15 changed files with 68 additions and 5 deletions

View File

@@ -10,6 +10,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**enabled** | **bool** | |
**maxDistance** | **int** | |
**minFaces** | **int** | |
**minScore** | **int** | |
**modelName** | **String** | |
**modelType** | [**ModelType**](ModelType.md) | | [optional]

View File

@@ -15,6 +15,7 @@ class RecognitionConfig {
RecognitionConfig({
required this.enabled,
required this.maxDistance,
required this.minFaces,
required this.minScore,
required this.modelName,
this.modelType,
@@ -24,6 +25,8 @@ class RecognitionConfig {
int maxDistance;
int minFaces;
int minScore;
String modelName;
@@ -40,6 +43,7 @@ class RecognitionConfig {
bool operator ==(Object other) => identical(this, other) || other is RecognitionConfig &&
other.enabled == enabled &&
other.maxDistance == maxDistance &&
other.minFaces == minFaces &&
other.minScore == minScore &&
other.modelName == modelName &&
other.modelType == modelType;
@@ -49,17 +53,19 @@ class RecognitionConfig {
// ignore: unnecessary_parenthesis
(enabled.hashCode) +
(maxDistance.hashCode) +
(minFaces.hashCode) +
(minScore.hashCode) +
(modelName.hashCode) +
(modelType == null ? 0 : modelType!.hashCode);
@override
String toString() => 'RecognitionConfig[enabled=$enabled, maxDistance=$maxDistance, minScore=$minScore, modelName=$modelName, modelType=$modelType]';
String toString() => 'RecognitionConfig[enabled=$enabled, maxDistance=$maxDistance, minFaces=$minFaces, minScore=$minScore, modelName=$modelName, modelType=$modelType]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'enabled'] = this.enabled;
json[r'maxDistance'] = this.maxDistance;
json[r'minFaces'] = this.minFaces;
json[r'minScore'] = this.minScore;
json[r'modelName'] = this.modelName;
if (this.modelType != null) {
@@ -80,6 +86,7 @@ class RecognitionConfig {
return RecognitionConfig(
enabled: mapValueOfType<bool>(json, r'enabled')!,
maxDistance: mapValueOfType<int>(json, r'maxDistance')!,
minFaces: mapValueOfType<int>(json, r'minFaces')!,
minScore: mapValueOfType<int>(json, r'minScore')!,
modelName: mapValueOfType<String>(json, r'modelName')!,
modelType: ModelType.fromJson(json[r'modelType']),
@@ -132,6 +139,7 @@ class RecognitionConfig {
static const requiredKeys = <String>{
'enabled',
'maxDistance',
'minFaces',
'minScore',
'modelName',
};

View File

@@ -26,6 +26,11 @@ void main() {
// TODO
});
// int minFaces
test('to test the property `minFaces`', () async {
// TODO
});
// int minScore
test('to test the property `minScore`', () async {
// TODO