Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issues running preprocessing: fixed_zero_mean_unit_variance #53

Closed
pr4deepr opened this issue Nov 26, 2024 · 3 comments
Closed

issues running preprocessing: fixed_zero_mean_unit_variance #53

pr4deepr opened this issue Nov 26, 2024 · 3 comments

Comments

@pr4deepr
Copy link

Hi
I am planning to release a better model than the one I referenced in #52 .
Considering I'm having trouble with the old model in recent deepimagej, I thought I'd fast track this, but I'm running into troubles..
This is a pytorch model and it was running on a previous version of deepimagej, however it was using the macros for pre and post-processing.

As the new version of deepimageJ does not use macros, when I used fixed_zero_mean_unit_variance for preprocessing it throws an error.

[SERVICE-1] {"responseType":"LAUNCH","task":"12250151-c846-49dc-a16c-d861d075e897"}
[WORKER-1] SLF4J: No SLF4J providers were found.
[WORKER-1] SLF4J: Defaulting to no-operation (NOP) logger implementation
[WORKER-1] SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
[SERVICE-1] 
[SERVICE-1] <INVALID> 
[SERVICE-1] <INVALID> Loading:     100% |========================================|
[SERVICE-1] {"responseType":"COMPLETION","task":"12250151-c846-49dc-a16c-d861d075e897"}
java.lang.IllegalArgumentException: Invalid method 'fixed_zero_mean_unit_variance' in the specs file. The method does not exist in the Bioimage.io framework.
	at io.bioimage.modelrunner.model.processing.TransformationInstance.findClassInClassPath(TransformationInstance.java:193)
	at io.bioimage.modelrunner.model.processing.TransformationInstance.getTransformationClass(TransformationInstance.java:177)
	at io.bioimage.modelrunner.model.processing.TransformationInstance.build(TransformationInstance.java:166)
	at io.bioimage.modelrunner.model.processing.TransformationInstance.<init>(TransformationInstance.java:63)
	at io.bioimage.modelrunner.model.processing.TransformationInstance.create(TransformationInstance.java:78)
	at io.bioimage.modelrunner.model.processing.Processing.buildPreprocessing(Processing.java:79)
	at io.bioimage.modelrunner.model.processing.Processing.<init>(Processing.java:66)
	at io.bioimage.modelrunner.model.processing.Processing.init(Processing.java:110)
	at io.bioimage.modelrunner.model.Model.runBMZ(Model.java:688)
	at io.bioimage.modelrunner.model.Model.runBMZ(Model.java:614)
	at io.bioimage.modelrunner.model.Model.runBMZ(Model.java:575)
	at deepimagej.Runner.runOnTestImages(Runner.java:146)
	at deepimagej.gui.Gui.lambda$runModelOnTestImage$23(Gui.java:314)
	at java.lang.Thread.run(Thread.java:75

You can download the model from this onedrive link

I think I may need help fixing up the rdf yaml file..

This is the output I expect from the sample image:

image


Something else I saw:

The test-input.npy appears to open as a rotated and flipped image when I click Run on Test Image

The npy file in Python:
image

When I click on Run on test in deepimagej, the image opens like this:

image

Cheers
Pradeep

@pr4deepr
Copy link
Author

Hi @carlosuc3m
I realized I omitted a normalization step in the preprocessing.

In Python, I preprocess the image by:

  • dividing image by 255
  • normalize by mean and std, i.e., zero_mean_unit_variance

How do I specify two preprocessing steps in the rdf.yaml?

The dividing image by 255, seems to be the scale_range preprocessing. with min_percentile of 0 and max_percentile of 100.

Cheers
Pradeep

@pr4deepr
Copy link
Author

Actually, I've updated and posted on imagesc: https://forum.image.sc/t/bioimageio-preprocessing-question/105581

@pr4deepr
Copy link
Author

Closing this here as this is more of a bioimageio spec question than
Posting it in bioimageio spec github page: bioimage-io/spec-bioimage-io#669

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant