Skip to content

Commit

Permalink
add MTCNN for face detection
Browse files Browse the repository at this point in the history
  • Loading branch information
thebino committed Aug 23, 2023
1 parent 77e11ae commit 3c1e201
Show file tree
Hide file tree
Showing 21 changed files with 858 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package photos.network.domain.photos

import org.koin.dsl.module
import photos.network.domain.photos.usecase.GetFacesUseCase
import photos.network.domain.photos.usecase.GetPhotoUseCase
import photos.network.domain.photos.usecase.GetPhotosUseCase
import photos.network.domain.photos.usecase.StartPhotosSyncUseCase
Expand All @@ -28,6 +29,12 @@ val domainPhotosModule = module {
)
}

factory {
GetFacesUseCase(
photoRepository = get()
)
}

factory {
GetPhotoUseCase(
photoRepository = get(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package photos.network.domain.photos.usecase

import android.net.Uri
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.distinctUntilChanged
import photos.network.repository.photos.PhotoRepository
import photos.network.repository.photos.model.Box

class GetFacesUseCase(
private val photoRepository: PhotoRepository,
) {
operator fun invoke(photoUri: Uri): Flow<List<Box>> {
return photoRepository.getFaces(photoUri = photoUri)
}
}
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ ktor = "2.1.1"
junit-junit = "4.13.2"
androidx-arch-core = "2.1.0"
truth = "1.1.3"
tensorflow-android = "1.13.1"


[libraries]
Expand Down Expand Up @@ -165,6 +166,8 @@ com-google-android-material = { group = "com.google.android.material", name = "m

security-crypto = { group = "androidx.security", name = "security-crypto", version.ref = "androidx-security-crypto" }

tensorflow-android = { group = "org.tensorflow", name = "tensorflow-android", version.ref = "tensorflow-android" }

coil = { group = "io.coil-kt", name = "coil", version.ref = "coil-kt" }
coil-compose = { group = "io.coil-kt", name = "coil-compose", version.ref = "coil-kt" }

Expand Down
2 changes: 2 additions & 0 deletions repository/photos/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ dependencies {
implementation(projects.api)
api(projects.database.photos)

implementation(libs.tensorflow.android)

testImplementation(libs.mockk)
testImplementation(libs.junit.junit)
testImplementation(libs.truth)
Expand Down
Binary file not shown.
Loading

0 comments on commit 3c1e201

Please sign in to comment.