Skip to content

Commit e032ccd

Browse files
Merge pull request #10 from dev-diaries41/release/1.1.0-alpha
Release/1.1.0
2 parents b321435 + 1677f58 commit e032ccd

File tree

55 files changed

+405
-481
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+405
-481
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
### v1.1.0 - 30/10/2025
2+
3+
### Changed
4+
* Project structure refactored from **core + extensions** to **core + ml**.
5+
* Imports updated accordingly:
6+
- **core** → minimal runtime: shared interfaces, data classes, embeddings, media helpers, processor execution, and efficient batch/concurrent processing.
7+
- **ml** → ML infrastructure and models: model loaders, base models, embedding providers (e.g., CLIP), and few-shot classifiers. Optional or experimental ML-related features can be added under `ml/providers`.
8+
- Both modules organize contracts and data classes under their own `data/` packages.
9+
10+
* All `IEmbeddingProviders` must now implement `embedBatch`
11+
* `ClipImageEmbedder` and `ClipTextEmbedder` now accept context instead of resources
12+
* `BatchProcessor` now accepts a `Context` (uses `applicationContext` internally).
13+
14+
### Removed
15+
16+
* `Organiser` class removed.
17+
18+
### Notes
19+
This release replaces the old `core` and `extensions` structure.
20+
If you are upgrading from ≤1.0.4, update imports and Gradle dependencies.
21+
22+
123
## v1.0.4 – 19/10/2025
224

325
### Changed

README.md

Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,17 @@
88
* [Installation](#installation)
99

1010
+ [1. Install Core Module](#1-install-core-module)
11-
+ [2. Install Extensions Module (Optional)](#2-install-extensions-module-optional)
11+
+ [2. Install ML Module (Optional)](#2-install-ml-module-optional)
1212
* [Design Choices](#design-choices)
1313

14-
+ [Core and Extensions](#core-and-extensions)
14+
+ [Core and ML](#core-and-ml)``
1515
+ [Constraints](#constraints)
1616
+ [Model](#model)
1717
+ [Embedding Storage](#embedding-storage)
1818
- [Benchmark Summary](#benchmark-summary)
1919

2020
* [Gradle / Kotlin Setup Notes](#gradle--kotlin-setup-notes)
2121

22-
<a name="overview"></a>
2322

2423
## **Overview**
2524

@@ -29,12 +28,10 @@ SmartScanSdk is a modular Android SDK that powers the **SmartScan app**. It prov
2928
* On-device ML inference
3029
* Semantic media indexing and search
3130
* Few shot classification
31+
* Efficient batch processing
3232

33-
The SDK is **extensible**, allowing developers to add ML models or features without bloating the core runtime.
3433

35-
**Long-term vision:** SmartScanSdk was designed with the goal of becoming a **C++ cross-platform SDK** for **search and classification**, capable of running both **offline on edge devices** and in **bulk cloud environments**.
36-
37-
> **Note:** Because of its long-term cross-platform goals, some features may be experimental (extensions). However, the SDK is generally considered stable, as it is actively used in the SmartScan app, aswell as others``.
34+
> **Note:** The SDK is designed to be flexible, but its primary use is for the SmartScan app and other apps I am developing. It is also subject to rapid experimental changes.
3835
3936
---
4037

@@ -43,52 +40,60 @@ The SDK is **extensible**, allowing developers to add ML models or features with
4340
```
4441
SmartScanSdk/
4542
├─ core/ # Essential functionality
46-
│ ├─ ml/ # On-device ML infra + models
47-
│ │ ├─ embeddings/ # Generic + CLIP embeddings
48-
│ │ └─ models/ # Model base + loaders
49-
│ ├─ processors/ # Batch processing + pipelines
50-
│ └─ utils/ # General-purpose helpers
51-
52-
├─ extensions/ # Experimental / Optional features
53-
│ ├─ embeddings/ # File-based or custom embedding stores
54-
│ ├─ indexers/ # Media indexers
55-
│ └─ organisers/ # Higher-level orchestration
43+
│ ├─ data/ # Data classes and processor interfaces
44+
│ ├─ embeddings/ # Embedding utilities and file-based stores
45+
│ ├─ indexers/ # Image and video indexers
46+
│ ├─ media/ # Media helpers (image/video utils)
47+
│ └─ processors/ # Batch processing and memory helpers
5648
57-
├─ build.gradle
58-
└─ settings.gradle
49+
└─ ml/ # On-device ML infrastructure + models
50+
├─ data/ # Model loaders and data classes
51+
└─ models/ # Base ML models and providers
52+
└─ providers/
53+
└─ embeddings/ # Embedding providers
54+
├─ clip/ # CLIP image & text embedder
55+
└─ FewShotClassifier.kt # Few-shot classifier
56+
57+
├─ build.gradle
58+
└─ settings.gradle
5959
```
6060

6161
**Notes:**
6262

63-
* `core` and `extensions` are standalone Gradle modules.
63+
* `core` and `ml` are standalone Gradle modules.
6464
* Both are set up for **Maven publishing**.
65+
* The structure replaces the old `core` and `extensions` module in versions ≤1.0.4
6566

66-
---
67+
---
6768

6869
## **Installation**
6970

7071
### **1. Install Core Module**
7172

7273
```gradle
73-
implementation("com.github.dev-diaries41:smartscan-core:1.0.0")
74+
implementation("com.github.dev-diaries41.smartscan-sdk:smartscan-core:1.1.0")
7475
```
7576

76-
### **2. Install Extensions Module (Optional)**
77+
### **2. Install ML Module (Optional)**
7778

7879
```gradle
79-
implementation("com.github.dev-diaries41:smartscan-extensions:1.0.0")
80+
implementation("com.github.dev-diaries41.smartscan-sdk:smartscan-ml:1.1.0")
8081
```
8182

82-
> `extensions` depends on `core`, so including it is enough if you need both.
83+
> `ml` depends on `core`, so including it is enough if you need both.
8384
8485
---
8586

8687
## **Design Choices**
8788

88-
### Core and Extensions
89+
### Core and ML
90+
91+
* **core** → minimal runtime: shared interfaces, data classes, embeddings, media helpers, processor execution, and efficient batch/concurrent processing.
92+
* **ml** → ML infrastructure and models: model loaders, base models, embedding providers (e.g., CLIP), and few-shot classifiers. Optional or experimental ML-related features can be added under `ml/providers`.
8993

90-
* **core** → minimal runtime: shared interfaces, embeddings, model execution, efficient batch/concurrent processing.
91-
* **extensions** → implementations: indexers, retrievers, organisers, embedding stores, and other optional features.
94+
This structure replaces the old `core` and `extensions` modules from versions 1.0.4 and below. It provides more clarity and allows consumers to use core non-ML functionality independently. For the most part, the code itself remains unchanged; only the file organization has been updated. Documentation will be updated shortly.
95+
96+
---
9297

9398
### Constraints
9499

@@ -107,7 +112,7 @@ Supports models stored locally or bundled in the app.
107112

108113
### Embedding Storage
109114

110-
The SDK only provides a file based implementation of `IEmbeddingStore`, `FileEmbeddingStore` (in extensions) because the following benchmarks below show much better performance for the loading of embeddings
115+
The SDK only provides a file based implementation of `IEmbeddingStore`, `FileEmbeddingStore` (in core) because the following benchmarks below show much better performance for the loading of embeddings
111116

112117
#### **Benchmark Summary**
113118

@@ -138,13 +143,13 @@ ___
138143
## **Gradle / Kotlin Setup Notes**
139144

140145
* Java 17 / Kotlin JVM 17
141-
* compileSdk = 36, targetSdk = 34, minSdk = 30
142-
* `core` exposes `androidx.core:core-ktx` and ONNX runtime
143-
* `extensions` depends on `core`
144-
* Maven:
146+
* `compileSdk = 36`, `targetSdk = 34`, `minSdk = 30`
147+
* `core` exposes `androidx.core:core-ktx`
148+
* `ml` depends on `core` and ONNX Runtime
149+
* Maven publishing:
145150

146151
* `groupId`: `com.github.dev-diaries41`
147-
* `artifactId`: `core` or `extensions`
152+
* `artifactId`: `core` or `ml`
148153
* `version`: configurable (`publishVersion`, default `1.0.0`)
149-
150-
---
154+
155+
---

core/build.gradle.kts

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import java.io.ByteArrayOutputStream
2-
31
plugins {
42
id("com.android.library")
53
id("org.jetbrains.kotlin.android")
64
id("maven-publish")
5+
id("com.google.devtools.ksp")
6+
77
}
88

99
android {
@@ -13,15 +13,14 @@ android {
1313
defaultConfig {
1414
minSdk = 30
1515
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
16-
1716
}
1817

1918
packaging {
2019
resources.excludes.addAll(
2120
listOf(
2221
"META-INF/LICENSE.md",
2322
"META-INF/LICENSE-notice.md",
24-
)
23+
)
2524
)
2625
}
2726

@@ -40,13 +39,10 @@ android {
4039
jvmTarget = "17"
4140
}
4241

43-
buildFeatures {
44-
// Add any enabled features here if needed
45-
}
46-
4742
lint {
4843
targetSdk = 34
4944
}
45+
5046
testOptions {
5147
unitTests {
5248
isIncludeAndroidResources = true
@@ -55,6 +51,7 @@ android {
5551
}
5652
}
5753
}
54+
5855
}
5956

6057
java {
@@ -65,25 +62,28 @@ java {
6562
}
6663

6764
dependencies {
68-
implementation(libs.androidx.documentfile)
69-
implementation(libs.onnxruntime.android)
70-
71-
// Expose core-ktx and onnxruntime to consumers of core or extensions
65+
// Expose core-ktx to consumers of core or extensions
7266
api(libs.androidx.core.ktx)
7367

7468
// JVM unit tests
75-
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
76-
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0")
77-
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.0")
78-
testImplementation("io.mockk:mockk:1.14.5")
69+
testImplementation(libs.kotlinx.coroutines.test)
70+
testImplementation(libs.junit.jupiter.api)
71+
testRuntimeOnly(libs.junit.jupiter.engine)
72+
testImplementation(libs.mockk)
7973
testImplementation(kotlin("test"))
8074

8175
// Android instrumented tests
82-
androidTestImplementation("androidx.test:core:1.7.0")
83-
androidTestImplementation("androidx.test.ext:junit-ktx:1.3.0")
84-
androidTestImplementation("androidx.test:runner:1.6.1")
85-
androidTestImplementation("io.mockk:mockk-android:1.14.5")
86-
androidTestImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
76+
androidTestImplementation(libs.androidx.core)
77+
androidTestImplementation(libs.androidx.junit.ktx)
78+
androidTestImplementation(libs.androidx.runner)
79+
androidTestImplementation(libs.mockk.android)
80+
androidTestImplementation(libs.kotlinx.coroutines.test)
81+
82+
androidTestImplementation(libs.androidx.room.runtime)
83+
androidTestImplementation(libs.androidx.room.ktx)
84+
androidTestImplementation(libs.androidx.room.testing)
85+
ksp(libs.androidx.room.compiler)
86+
8787
}
8888

8989
val gitVersion: String by lazy {
@@ -96,6 +96,7 @@ val gitVersion: String by lazy {
9696
}.getOrDefault("1.0.0")
9797
}
9898

99+
99100
publishing {
100101
publications {
101102
register<MavenPublication>("release") {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.fpf.smartscansdk.extensions.data.images
1+
package com.fpf.smartscansdk.core.data.images
22

33
import androidx.room.*
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.fpf.smartscansdk.extensions.data.images
1+
package com.fpf.smartscansdk.core.data.images
22

33
import androidx.room.*
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.fpf.smartscansdk.extensions.data.images
1+
package com.fpf.smartscansdk.core.data.images
22

33
import android.app.Application
44
import androidx.room.*
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package com.fpf.smartscansdk.extensions.data.images
1+
package com.fpf.smartscansdk.core.data.images
22

33
import androidx.room.*
4-
import com.fpf.smartscansdk.core.ml.embeddings.Embedding
4+
import com.fpf.smartscansdk.core.data.Embedding
55

66
@Entity(tableName = "image_embeddings")
77
data class ImageEmbeddingEntity(
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
package com.fpf.smartscansdk.extensions.embeddings
1+
package com.fpf.smartscansdk.core.embeddings
22

33
import android.app.Application
44
import androidx.test.core.app.ApplicationProvider
55
import androidx.test.ext.junit.runners.AndroidJUnit4
6-
import com.fpf.smartscansdk.extensions.data.images.ImageEmbeddingDatabase
7-
import com.fpf.smartscansdk.extensions.data.images.ImageEmbeddingEntity
8-
import com.fpf.smartscansdk.extensions.data.images.toEmbedding
6+
import com.fpf.smartscansdk.core.data.images.ImageEmbeddingDatabase
7+
import com.fpf.smartscansdk.core.data.images.ImageEmbeddingEntity
8+
import com.fpf.smartscansdk.core.data.images.toEmbedding
99
import junit.framework.Assert.assertEquals
1010
import kotlinx.coroutines.runBlocking
1111
import org.junit.Test
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.fpf.smartscansdk.core.data
2+
3+
sealed class ClassificationResult {
4+
data class Success(val classId: String, val similarity: Float ): ClassificationResult()
5+
data class Failure(val error: ClassificationError ): ClassificationResult()
6+
}
7+
8+
enum class ClassificationError{MINIMUM_CLASS_SIZE, THRESHOLD, CONFIDENCE_MARGIN}
9+
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
package com.fpf.smartscansdk.core.ml.embeddings
1+
package com.fpf.smartscansdk.core.data
2+
23

34
import android.graphics.Bitmap
45

@@ -39,6 +40,7 @@ interface IEmbeddingProvider<T> {
3940
val embeddingDim: Int? get() = null
4041
fun closeSession() = Unit
4142
suspend fun embed(data: T): FloatArray
43+
suspend fun embedBatch(data: List<T>): List<FloatArray>
4244
}
4345

4446

0 commit comments

Comments
 (0)