-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
App/Vision: Add a vision example that the exploits MLAgent Service
This patch adds a draft of the vision example (i.e., an object classification scenario using MobileNet_v1) that exploits the MLAgent Service. Signed-off-by: Wook Song <[email protected]>
- Loading branch information
Showing
10 changed files
with
341 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...nce_offloading/src/main/java/ai/nnstreamer/ml/inference/offloading/data/Classification.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package ai.nnstreamer.ml.inference.offloading.data | ||
|
||
data class Classification(val label: String, val confidence: Double) |
18 changes: 18 additions & 0 deletions
18
...ence_offloading/src/main/java/ai/nnstreamer/ml/inference/offloading/data/ImageAnalyzer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package ai.nnstreamer.ml.inference.offloading.data | ||
|
||
import ai.nnstreamer.ml.inference.offloading.domain.MobilenetClassifier | ||
import androidx.camera.core.ImageAnalysis | ||
import androidx.camera.core.ImageProxy | ||
|
||
class ImageAnalyzer( | ||
private val classifier: MobilenetClassifier, | ||
) : ImageAnalysis.Analyzer { | ||
override fun analyze(imageProxy: ImageProxy) { | ||
val rotationDegrees = imageProxy.imageInfo.rotationDegrees | ||
val bitmap = imageProxy.toBitmap() | ||
|
||
classifier.classify(bitmap, rotationDegrees) | ||
|
||
imageProxy.close() | ||
} | ||
} |
Oops, something went wrong.