mxnet icon indicating copy to clipboard operation
mxnet copied to clipboard

The rgb order of the forward function

Open pinglforever opened this issue 10 years ago • 4 comments

Hi, I want to do the prediction using the pre-trained model, which trained by .rec file generated by the im2rec tool. When to predict, I load the image data using cv2.imread method, and I want to usemodel.predict to do the prediction. And OpenCV stores image data as order bgr, Need I change the image data order to rgb to pass to model.predict to do the prediction? thanks!

pinglforever avatar Aug 17 '16 02:08 pinglforever

by default mxnet uses rgb.

piiswrong avatar Aug 18 '16 00:08 piiswrong

@piiswrong , Does .rec file(using im2rec to generate) use rgb order? it looks like opencv store image as bgr order, when I pass the data which loaded by cv2.imread , is it necessary to swap its order first?

pinglforever avatar Aug 18 '16 04:08 pinglforever

@pinglforever ImgRecIter will swap the channels by itself. You don't need to worry about it if you use ImgRecIter. But if you feed in your own data by imread, you need to swap the channels by yourself.

winstywang avatar Aug 19 '16 14:08 winstywang

ok, @windywinter thanks a lot

pinglforever avatar Aug 22 '16 04:08 pinglforever