onnx-coreml
onnx-coreml copied to clipboard
convert to onnx and then convert to CoreML , but the prediction is wrong
🐞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
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