Skip to content

Commit ab11663

Browse files
committed
fix: input shape
1 parent 770791a commit ab11663

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

ml/src/main/java/com/fpf/smartscansdk/ml/models/providers/embeddings/clip/ClipImageEmbedder.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ClipImageEmbedder(private val context: Context, modelSource: ModelSource,
4545
override suspend fun embed(data: Bitmap): FloatArray = withContext(Dispatchers.Default) {
4646
if (!isInitialized()) throw IllegalStateException("Model not initialized")
4747

48-
val inputShape = longArrayOf(DIM_BATCH_SIZE.toLong(), DIM_PIXEL_SIZE.toLong(), IMAGE_SIZE_X.toLong(), IMAGE_SIZE_Y.toLong())
48+
val inputShape = longArrayOf(DIM_BATCH_SIZE.toLong(), DIM_PIXEL_SIZE.toLong(), IMAGE_SIZE_Y.toLong(), IMAGE_SIZE_X.toLong())
4949
val imgData: FloatBuffer = preProcess(data)
5050
val inputName = model.getInputNames()?.firstOrNull() ?: throw IllegalStateException("Model inputs not available")
5151
val output = model.run(mapOf(inputName to TensorData.FloatBufferTensor(imgData, inputShape)))

ml/src/main/java/com/fpf/smartscansdk/ml/models/providers/embeddings/dino/DinoV2SmallImageEmbedder.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class DinoV2SmallImageEmbedder(
5151
override suspend fun embed(data: Bitmap): FloatArray = withContext(Dispatchers.Default) {
5252
if (!isInitialized()) throw IllegalStateException("Model not initialized")
5353

54-
val inputShape = longArrayOf(DIM_BATCH_SIZE.toLong(), DIM_PIXEL_SIZE.toLong(), IMAGE_SIZE_X.toLong(), IMAGE_SIZE_Y.toLong())
54+
val inputShape = longArrayOf(DIM_BATCH_SIZE.toLong(), DIM_PIXEL_SIZE.toLong(), IMAGE_SIZE_Y.toLong(), IMAGE_SIZE_X.toLong())
5555
val imgData: FloatBuffer = preProcess(data)
5656
val inputName = model.getInputNames()?.firstOrNull() ?: throw IllegalStateException("Model inputs not available")
5757
val output = model.run(mapOf(inputName to TensorData.FloatBufferTensor(imgData, inputShape)))

ml/src/main/java/com/fpf/smartscansdk/ml/models/providers/embeddings/inception/InceptionResnetFaceEmbedder.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class InceptionResnetFaceEmbedder(
4646
if (!isInitialized()) throw IllegalStateException("Model not initialized")
4747

4848
val imgData = preProcess(data)
49-
val inputShape = longArrayOf(DIM_BATCH_SIZE.toLong(), DIM_PIXEL_SIZE.toLong(), IMAGE_SIZE_X.toLong(), IMAGE_SIZE_Y.toLong())
49+
val inputShape = longArrayOf(DIM_BATCH_SIZE.toLong(), DIM_PIXEL_SIZE.toLong(), IMAGE_SIZE_Y.toLong(), IMAGE_SIZE_X.toLong())
5050
val inputName = model.getInputNames()?.firstOrNull() ?: throw IllegalStateException("Model inputs not available")
5151
val output = model.run(mapOf(inputName to TensorData.FloatBufferTensor(imgData, inputShape)))
5252
(output.values.first() as Array<FloatArray>)[0]

0 commit comments

Comments
 (0)