Skip to content

multiple preprocessing using bioimageio spec #669

@pr4deepr

Description

@pr4deepr

Hi
I am duplicating an imagesc forum post as I think its better to ask the question here.
I am trying to use preprocessing in the new version of deepimageJ. Can I chain multiple preprocessing steps in the bioimageio model spec?

I have a pytorch model that worked on deepimagej v3.0.3. I used the preprocessing macro for fixed_zero_mean_unit_variance, but modified it to use

paramMean = newArray(0.485, 0.456, 0.406);
paramStd = newArray(0.229, 0.224, 0.225);

This was working well until the new update where I cannot use a custom macro anymore.
I can use the zero_mean_unit_variance preprocessing in the rdf.yaml file like:

inputs:
- axes: bcyx
  data_range: [0.0, 255.0]
  data_type: uint8
  name: input
  preprocessing:
  - name: zero_mean_unit_variance
    kwargs:
      axes: yx
      mean: [0.485, 0.456, 0.406]
      mode: fixed
      std: [0.229, 0.224, 0.225]

but the model prediction is wrong.

Using the deepimagej v3.1.0, if I use the above configuration, I get the prediction in the middle (wrong). However, if I remove preprocessing config, run the fixed_zero_mean_unit_variance.ijm macro first and then predict with deepimagej, I get the image on the right (correct).

image

So, my question is, without needing to use a macro, how can I leverage the model spec to:

  • convert image to RGB stack
  • convert to 32-bit
  • follow up with zero mean unit variance normalization as above.

Cheers
Pradeep

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions