-
Hi! I get no signal from an onnx file exported from pytorch with the script below (a regular timm DeeplabV3-Resnet18 model). I get great and proper signals with similar models exported from Matlab onnx export. Any idea why? I can send the onnx file and an example image if needed. Onnx export script:
I get one warning when exporting the onnx, might that be a hint to what's wrong?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
Hello, @SahPet! Sigmoid/Softmax issueI see that you have used sigmoid as the final activation layer. For this I assume that you are doing binary segmentation (single-class detection), right? Using sigmoid, this results in a single-channel output. AFAIK, FAST neglects the first channel by default, as FAST assumes that the first channel is the background class. This is because normally our models use the softmax activation layer instead, which in your use case results in a two channel output, where the first channel is background and the second is the class of interest. However, it should still work if you have used sigmoid. For the HeatmapRenderer we have a mechanism to enable showing the zero-class (see here). Can't see that we have the same for the SegmentationRenderer (see here), but maybe that is not the main issue. Simple fixA very simple fix to this problem, as this is the export script, is to replace the
Preprocessing issueIf that does not resolve the issue, the preprocessing likely does not match between deployment in FastPathology and what you do in PyTorch. Quite often in PyTorch, when using pretrained backbones such as ResNet-18 which are pretrained on ImageNet, a specific type of preprocessing is performed on all image patches:
If you could send me the code used for training, it should be easier for me to debug this further. |
Beta Was this translation helpful? Give feedback.
scale-factor should be 0.00392156862 (which corresponds to 1/255) instead of 1, as you are 0-1 normalizing the images. The scale-factor is multiplied by the image. See the SegmentationNetwork PO in your FPL file.