Skip to content

Commit

Permalink
scripts for model creation reflect new vector store abstraction
Browse files Browse the repository at this point in the history
  • Loading branch information
metazool committed Feb 13, 2025
1 parent b934dbf commit 67bccc8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,25 @@ Please [see its documentation](https://github.com/NERC-CEH/object_store_api) for

`python src/os_api/api.py`

## Feature extraction API

FastAPI wrapper around different models - POST an image URL, get back embeddings

## Label Studio ML backend

Pre-annotation backend for Label Studio following their standard pattern.

Build an image embedding model which will assign a likely-detritus tag:

```
cd scripts
dvc repro
```

Application is in `src/label_studio_cyto_ml`

[Setup documentation](src/label_studio_cyto_ml/README.md)

## Pipelines

### DVC
Expand Down
6 changes: 3 additions & 3 deletions scripts/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import yaml

from sklearn.cluster import KMeans
from cyto_ml.data.vectorstore import embeddings, vector_store
from cyto_ml.data.vectorstore import vector_store


def main() -> None:
Expand All @@ -25,8 +25,8 @@ def main() -> None:
n_clusters = 5

kmeans = KMeans(n_clusters=n_clusters, random_state=42)
store = vector_store(collection_name)
X = embeddings(store)
store = vector_store("sqlite", collection_name)
X = store.embeddings()
kmeans.fit(X)

# We supply a -o for output directory - this doesn't ensure we write there.
Expand Down

0 comments on commit 67bccc8

Please sign in to comment.