Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

convert to onnx and then convert to CoreML , but the prediction is wrong #556

Open
douli9862 opened this issue Mar 17, 2020 · 1 comment
Labels
bug Unexpected behaviour that should be corrected (type)

Comments

@douli9862
Copy link

🐞Describe the bug

onnx to CoreML, but onnx's upsample BILINEAR cannot find the corresponding op in CoreML;
CoreML :

message UpsampleLayerParams {

/**
 * Scaling Factor.
 * Must be length 2 in order ``[H, W]``.
 * If not set, default value ``[1, 1]`` is used.
 */
repeated uint64 scalingFactor = 1;

enum InterpolationMode {

    NN = 0; /// Nearest Neighbour
    BILINEAR = 1; /// Bilinear

}

InterpolationMode mode = 5;

}

message SamplingMode {

enum Method {

    /**
     * start = 0, end = X-1
     * grid points = numpy.linspace(start, end)
     */
    STRICT_ALIGN_ENDPOINTS_MODE = 0;

    /**
     * if N == 1: start = end = (X-1)/2
     * otherwise, start = 0, end = X-1
     * grid points = numpy.linspace(start, end)
     */
    ALIGN_ENDPOINTS_MODE = 1;

    /**
     * start = 0, end = X - X/N
     * grid points = min(X-1, numpy.linspace(start, end))
     * This is same as the mode used in the upsample layer in this specification, when used with bilinear interpolation. In that case N/X = upsample ratio.
     */
    UPSAMPLE_MODE = 2;

    /**
     * spacing = max(1, X-1)/N
     * start = 0.5 * spacing
     * end = start + (N-1) * spacing
     * grid points = min(X-1, numpy.linspace(start, end))
     */
    ROI_ALIGN_MODE = 3;

}

Method samplingMethod = 1;

}

The effects of the above two methods are not correct;

0.28950363397598267
-0.35252106189727783

@douli9862 douli9862 added the bug Unexpected behaviour that should be corrected (type) label Mar 17, 2020
@douli9862
Copy link
Author

image
The first picture is the target picture, and the second picture is my converted CoreML effect picture, the third picture is the difference picture;
The effect of the previous op is aligned

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Unexpected behaviour that should be corrected (type)
Projects
None yet
Development

No branches or pull requests

1 participant