1

For image batch classification I've used code from this question Modifying the Caffe C++ prediction code for multiple inputs . But I noticed function that splits channels of image for some reason.

I guess it works for usual CNN architecture, but does it work for Siamese architecture? I guess not, since in C++ classification it doesn't work correctly.

Can someone explain, how should I change code for siamese architecture(that splits image by channels and gives those channels to different layers, that's the point), or at least how memory storage for input works, to figure it out myself?

Blob<float>* input_layer = net_->input_blobs()[0];
Community
  • 1
  • 1
Il'ya Zhenin
  • 1,272
  • 2
  • 20
  • 31

1 Answers1

0

Figured it out, problem was in opencv function in Classifier::Preprocess

cv::split(img[i], channels);

because it is working only if cv::Mat contained in img was formed as 2D image with channels. If, as in my case, it was formed otherwise, with dimensions like (channels, width, height) or (width, height, channels) cv::split will not split cv::Mat as you expect to, so I've replaced this step with other realisation.

Il'ya Zhenin
  • 1,272
  • 2
  • 20
  • 31