ncnn is a high-performance neural network inference framework optimized for the mobile platform.
I’ve been using NCNN for quite a while. And recently after compiling the latest version, I was surprised the network could not give the correct output. Besides, the program crashed randomly.
Cropping seemed to be the reason when I digging into the source code. The cropping operation crops not only the 2D feature map but also the channel dim when the input blob is a 3-dim tensor. So I modified _outc = ref_dims == 3 ? ref_channels : channels;
to _outc = channels
. I’m not sure whether there is another way to avoid this operation. The modification temporately cope the problem.
1 | void Crop::resolve_crop_roi(const Mat &bottom_blob, const Mat &reference_blob, int &_woffset, int &_hoffset, int &_coffset, int &_outw, int &_outh, int &_outc) const |
The following image shows the result of a foreground segmentation nework before and after the modification.