juglab / n2v

This is the implementation of Noise2Void training.
Other
387 stars 107 forks source link

Modelzoo Export #71

Closed tibuch closed 4 years ago

tibuch commented 4 years ago

Export models according to the modelzoo specifications.

frauzufall commented 4 years ago

Here's how it looks like in Fiji (and we want to be somewhat compatible with that, at least the location of mean and stddev for normalization needs to be the same):

name: YOUR MODEL NAME HERE
description: YOUR DESCRIPTION HERE
cite:
  text: |-
    Buchholz, T. et al. - Content-aware image restoration for electron microscopy. 
    Methods in Cell Biology, Volume 152 p.277-289, ISSN 0091-679X (2019)
  doi: https://doi.org/10.1016/bs.mch.2019.05.001
authors: [YOUR NAMES HERE]
documentation: README.md
test_input: ./test_input.tif
test_output: ./test_output.tif
covers: [./thumbnail.png]
tags: [denoising, unet2d, n2v]
license: BSD 3
format_version: 0.1.0
language: java
framework: tensorflow
source: de.csbdresden.n2v.train.N2VPrediction
inputs:
- name: raw
  axes: byxc
  data_type: float32
  data_range: [-inf, inf]
  shape:
    min: [1, 4, 4, 1]
    step: [1, 4, 4, 0]
outputs:
- name: denoised
  axes: byxc
  data_type: float32
  data_range: [-inf, inf]
  halo: [0, 32, 32, 0]
  shape:
    reference_input: raw
    scale: [1, 1, 1, 1]
    offset: [0, 0, 0, 0]
training:
  source: de.csbdresden.n2v.train.N2VTraining
  kwargs: {batchDimLength: 180, batchSize: 64, trainDimensions: 2, neighborhoodRadius: 5, numEpochs: 100,
    numStepsPerEpoch: 300, patchDimLength: 60, stepsFinished: 30000}
prediction:
  preprocess:
    spec: de.csbdresden.n2v.predict.N2VPrediction::preprocess
    kwargs: {mean: 41498.87, stdDev: 15007.021}
  weights: {source: https://github.com/bioimage-io/fiji-bioimage-io/releases/download/v0.1.0/n2v-sem-demo.zip}
  postprocess:
    spec: de.csbdresden.n2v.predict.N2VPrediction::postprocess
    kwargs: {mean: 41498.87, stdDev: 15007.021}
  dependencies: ./dependencies.yaml
uschmidt83 commented 4 years ago

Hi, are model exports according to the modelzoo specifications already supported in Fiji (or anywhere else)?

We talked about this a while ago, but haven't heard anything recently. It's a coincidence that I just saw this issue.

Best, Uwe

frauzufall commented 4 years ago

@uschmidt83 yes, it's currently being implemented here and I recently added a reader and writer for the spec to imagej-modelzoo (see howto). I just talked to @maweigert yesterday about having a meeting with you two after the NEUBIAS course next week to plan integrating this into CSBDeep as well.