htshinichi / caffe-onnx

caffe model convert to onnx model
MIT License
175 stars 43 forks source link

pooling op pads issue #38

Open Learneruestc opened 1 year ago

Learneruestc commented 1 year ago

In onnx: pooling node attrbute about ceil mode: ceil_mode: int64 Whether to use ceil or floor (default) to compute the output shape. default is 0. Thus in caffe-onnx-master/src/OPs/Pooling.py L36-L48 should be:

h = (input_shape[0][2] - kernel_shape[0] + pads[0] + pads[2])/strides[0] + 1
if h > int(h):
    output_shape_h = int(h) + 1
    **pads[0] += 1
    pads[2] += 1**
else:
    output_shape_h = int(h)

w = (input_shape[0][3] - kernel_shape[1] + pads[1] + pads[3])/strides[1] + 1
if w > int(w):
    output_shape_w = int(w) + 1
    **pads[1] += 1
    pads[3] += 1**