Skip to content

Commit

Permalink
apply PR feedback #3, use newest model with slightly different normal…
Browse files Browse the repository at this point in the history
…ization, make floodfill_threshold configurable
  • Loading branch information
daniel-wer committed Apr 10, 2019
1 parent d0cd45a commit 7d1ed27
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const outputExtent = 100;
const inputContextExtent = 20;
const inputExtent = outputExtent + 2 * inputContextExtent;
const NUM_PREDICT_SLICES = 3;
const FLOODFILL_THRESHOLD = 0.7;

// Will remove model validation, NaN checks, and other correctness checks in favor of performance
if (process.env.NODE_ENV === "production") tf.enableProdMode();
Expand Down Expand Up @@ -85,7 +84,10 @@ const getPredictionForTile = async (
});

const { mean, stdDev } = await meanAndStdDevFromDataset(dataset, colorLayerName);
const tensorArray = new Float32Array(new Uint8Array(cuboidData)).map(el => (el - mean) / stdDev);
const tensorArray = new Float32Array(new Uint8Array(cuboidData)).map(
// This is how the model was trained
el => ((el - mean) / stdDev) * (1 / 3) ** 0.5,
);
// When interpreting the 3d data slice as a 2d slice, the x and y axis are flipped only on the YZ plane
const isXYflipped = activeViewport === OrthoViews.PLANE_YZ;
const { useWebworker, useGPU } = getUseWebworkerAndGPU();
Expand Down Expand Up @@ -125,6 +127,8 @@ export default function* inferSegmentInViewport(
const activeViewport = yield* select(state => state.viewModeData.plane.activeViewport);
if (activeViewport === "TDView") return;

const FLOODFILL_THRESHOLD = window.floodfillThreshold || 0.6;

let aborted = false;
const toastConfig = {
onClose: () => {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@
"mini-css-extract-plugin": "^0.4.0",
"mjs": "^1.0.0",
"moment": "^2.21.0",
"n-dimensional-flood-fill": "^1.0.0",
"nanoevents": "^1.0.2",
"pako": "^0.2.8",
"pretty-bytes": "^5.1.0",
Expand Down
Binary file modified public/tf-models/group1-shard1of1
Binary file not shown.
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7746,11 +7746,6 @@ [email protected]:
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=

n-dimensional-flood-fill@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/n-dimensional-flood-fill/-/n-dimensional-flood-fill-1.0.0.tgz#c1b99ed55901f9edcd50e86997ee355109b3601b"
integrity sha1-wbme1VkB+e3NUOhpl+41UQmzYBs=

n-gram@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/n-gram/-/n-gram-1.1.0.tgz#c07fb7d6d59aa42d10fbf680fc4c46a30766c1ee"
Expand Down

0 comments on commit 7d1ed27

Please sign in to comment.