Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ class SimFaceBioSdk @Inject constructor(
override val detector: SimFaceDetector,
private val simFace: SimFace,
) : FaceBioSDK {
override val version: String = "1"
override val templateFormat: String = simFace.getTemplateVersion()
override val matcherName: String = "SIM_FACE"
override fun version(): String = "1"

override fun templateFormat(): String = simFace.getTemplateVersion()

override fun matcherName(): String = "SIM_FACE"

override fun createMatcher(probeSamples: List<FaceSample>): FaceMatcher = SimFaceMatcher(simFace, probeSamples)
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ interface FaceBioSDK {
val initializer: FaceBioSdkInitializer
val detector: FaceDetector

val version: String
val templateFormat: String
val matcherName: String
fun version(): String

fun templateFormat(): String

fun matcherName(): String

fun createMatcher(probeSamples: List<FaceSample>): FaceMatcher
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ internal class ResolveRankOneVersionUseCase @Inject constructor(
?.version
?.takeIf { it.isNotBlank() } // Ensures version is not null or empty
requireNotNull(version) { "FaceBioSDK version is null or empty" }
return if (version == rocV3BioSdk.version) rocV3BioSdk else rocV1BioSdk
return if (version == rocV3BioSdk.version()) rocV3BioSdk else rocV1BioSdk
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ class RocV1BioSdk @Inject constructor(
override val initializer: RocV1Initializer,
override val detector: RocV1Detector,
) : FaceBioSDK {
override val version: String = "1.23"
override val templateFormat: String = RANK_ONE_TEMPLATE_FORMAT_1_23
override val matcherName: String = "RANK_ONE"
override fun version(): String = "1.23"

override fun templateFormat(): String = RANK_ONE_TEMPLATE_FORMAT_1_23

override fun matcherName(): String = "RANK_ONE"

override fun createMatcher(probeSamples: List<FaceSample>): FaceMatcher = RocV1Matcher(probeSamples)
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ class RocV3BioSdk @Inject constructor(
override val initializer: RocV3Initializer,
override val detector: RocV3Detector,
) : FaceBioSDK {
override val version: String = "3.1"
override val templateFormat: String = RANK_ONE_TEMPLATE_FORMAT_3_1
override val matcherName: String = "RANK_ONE"
override fun version(): String = "3.1"

override fun templateFormat(): String = RANK_ONE_TEMPLATE_FORMAT_3_1

override fun matcherName(): String = "RANK_ONE"

override fun createMatcher(probeSamples: List<FaceSample>): FaceMatcher = RocV3Matcher(probeSamples)
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ResolveRankOneVersionUseCaseTest {
.face
?.rankOne
?.version
} returns rocV3BioSdk.version
} returns rocV3BioSdk.version()

// When
val result = resolveTheVersionUseCase.invoke()
Expand All @@ -89,7 +89,7 @@ class ResolveRankOneVersionUseCaseTest {
.face
?.rankOne
?.version
} returns rocV1BioSdk.version
} returns rocV1BioSdk.version()

// When
val result = resolveTheVersionUseCase.invoke()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ internal class FaceMatcherUseCase @Inject constructor(
val bioSdk = resolveFaceBioSdk(matchParams.faceSDK)

if (matchParams.probeFaceSamples.isEmpty()) {
send(MatcherState.Success(emptyList(), 0, bioSdk.matcherName))
send(MatcherState.Success(emptyList(), 0, bioSdk.matcherName()))
return@channelFlow
}
val samples = mapSamples(matchParams.probeFaceSamples)
val queryWithSupportedFormat = matchParams.queryForCandidates.copy(
faceSampleFormat = bioSdk.templateFormat,
faceSampleFormat = bioSdk.templateFormat(),
)
val expectedCandidates = enrolmentRecordRepository.count(
queryWithSupportedFormat,
dataSource = matchParams.biometricDataSource,
)
if (expectedCandidates == 0) {
send(MatcherState.Success(emptyList(), 0, bioSdk.matcherName))
send(MatcherState.Success(emptyList(), 0, bioSdk.matcherName()))
return@channelFlow
}

Expand All @@ -81,7 +81,7 @@ internal class FaceMatcherUseCase @Inject constructor(
}

consumeAndMatch(candidatesChannel, samples, resultSet, bioSdk)
send(MatcherState.Success(resultSet.toList(), loadedCandidates.get(), bioSdk.matcherName))
send(MatcherState.Success(resultSet.toList(), loadedCandidates.get(), bioSdk.matcherName()))
}.flowOn(dispatcherBG)

suspend fun consumeAndMatch(
Expand Down
Loading