From cceb70a6ced3c1225dc74329d952117558c4825c Mon Sep 17 00:00:00 2001 From: Nodar Gogoberidze Date: Wed, 12 Jun 2024 16:42:38 -0400 Subject: [PATCH] [mod] Update documentation and folder names --- .../group1-shard1of2.bin | Bin .../group1-shard2of2.bin | Bin .../{stardist => stardist-vhe}/model.json | 0 src/utils/models/StardistFluo/StardistFluo.ts | 13 ++++++------- src/utils/models/StardistVHE/loadStardist.ts | 6 +++--- 5 files changed, 9 insertions(+), 10 deletions(-) rename src/data/model-data/{stardist => stardist-vhe}/group1-shard1of2.bin (100%) rename src/data/model-data/{stardist => stardist-vhe}/group1-shard2of2.bin (100%) rename src/data/model-data/{stardist => stardist-vhe}/model.json (100%) diff --git a/src/data/model-data/stardist/group1-shard1of2.bin b/src/data/model-data/stardist-vhe/group1-shard1of2.bin similarity index 100% rename from src/data/model-data/stardist/group1-shard1of2.bin rename to src/data/model-data/stardist-vhe/group1-shard1of2.bin diff --git a/src/data/model-data/stardist/group1-shard2of2.bin b/src/data/model-data/stardist-vhe/group1-shard2of2.bin similarity index 100% rename from src/data/model-data/stardist/group1-shard2of2.bin rename to src/data/model-data/stardist-vhe/group1-shard2of2.bin diff --git a/src/data/model-data/stardist/model.json b/src/data/model-data/stardist-vhe/model.json similarity index 100% rename from src/data/model-data/stardist/model.json rename to src/data/model-data/stardist-vhe/model.json diff --git a/src/utils/models/StardistFluo/StardistFluo.ts b/src/utils/models/StardistFluo/StardistFluo.ts index cf16423f..44bb3c51 100644 --- a/src/utils/models/StardistFluo/StardistFluo.ts +++ b/src/utils/models/StardistFluo/StardistFluo.ts @@ -10,13 +10,12 @@ import { ModelTask } from "../enums"; import { Kind, ImageObject } from "store/data/types"; /* - * TODO: make sure this has Fluorescence model info: - * Stardist (Versatile) H&E Nuclei Segmentation - * https://zenodo.org/record/6338615 - * https://bioimage.io/#/?tags=stardist&id=10.5281%2Fzenodo.6338614&type=model + * Stardist (Versatile) Fluorescence Nuclei Segmentation + * https://zenodo.org/records/6348085 + * https://bioimage.io/#/?tags=stardist&id=10.5281%2Fzenodo.6348084 * https://github.com/stardist/stardist/blob/master/README.md#pretrained-models-for-2d * Stardist: model for object detection / instance segmentation with star-convex shapes - * This pretrained model: meant to segment individual cell nuclei from brightfield images with H&E staining + * This pretrained model: meant to segment individual cell nuclei from single channel fluorescence data (2018 DSB) */ export class StardistFluo extends Segmenter { protected _fgKind?: Kind; @@ -40,7 +39,7 @@ export class StardistFluo extends Segmenter { public async loadModel() { if (this._model) return; - // inputs: [ {name: 'input', shape: [-1,-1,-1,3], dtype: 'float32'} ] + // inputs: [ {name: 'input', shape: [-1,-1,-1,1], dtype: 'float32'} ] // outputs: [ {name: 'concatenate_4/concat', shape: [-1, -1, -1, 33], dtype: 'float32'} ] // where each -1 matches on input and output of corresponding dim/axis // 33 -> 1 probability score, followed by 32 radial equiangular distances of rays @@ -55,7 +54,7 @@ export class StardistFluo extends Segmenter { // (for VHE in particular), see: // https://github.com/stardist/stardist/blob/468c60552c8c93403969078e51bddc9c2c702035/stardist/models/model2d.py#L543 // https://github.com/stardist/stardist/blob/master/stardist/models/model2d.py#L201C30-L201C30 - // and config here (under source -> grid): https://bioimage.io/#/?tags=stardist&id=10.5281%2Fzenodo.6338614 + // and config here (under source -> grid): https://bioimage.io/#/?tags=stardist&id=10.5281%2Fzenodo.6348084&type=model // basically, in the case of VHE: 2^3 * 2 = 16 protected _getPaddings(height: number, width: number) { const padY = height % 16 === 0 ? 0 : 16 - (height % 16); diff --git a/src/utils/models/StardistVHE/loadStardist.ts b/src/utils/models/StardistVHE/loadStardist.ts index 8c4f81d0..4ec38373 100644 --- a/src/utils/models/StardistVHE/loadStardist.ts +++ b/src/utils/models/StardistVHE/loadStardist.ts @@ -1,10 +1,10 @@ import { io, loadGraphModel } from "@tensorflow/tfjs"; -import Stardist2DBrightfieldModel from "data/model-data/stardist/model.json"; +import Stardist2DBrightfieldModel from "data/model-data/stardist-vhe/model.json"; //@ts-ignore -import Stardist2DBrightfieldWeights1 from "data/model-data/stardist/group1-shard1of2.bin"; +import Stardist2DBrightfieldWeights1 from "data/model-data/stardist-vhe/group1-shard1of2.bin"; //@ts-ignore -import Stardist2DBrightfieldWeights2 from "data/model-data//stardist/group1-shard2of2.bin"; +import Stardist2DBrightfieldWeights2 from "data/model-data//stardist-vhe/group1-shard2of2.bin"; /* * model.json contains 'modelTopology' and 'weightsManifest