mxnet icon indicating copy to clipboard operation
mxnet copied to clipboard

[R] call im2rec in R

Open thirdwing opened this issue 9 years ago • 8 comments

thirdwing avatar Jul 31 '17 20:07 thirdwing

This is indeed needed. Currently we can create the rec files using python but to be able to stay completely in R is an advantage. All we need is a To-Do list to outline the work to be done to be able to create the rec files from R.

kimtang avatar Aug 06 '17 15:08 kimtang

I think this shouldn't be too hard. I always used the C++ version of im2rec from https://github.com/apache/incubator-mxnet/blob/master/tools/im2rec.cc

thirdwing avatar Aug 06 '17 20:08 thirdwing

Yes, it should not be that difficult but im2rec depends on opencv and this is not available in R. Can someone please confirm? As far as I can see we need to export the functions MXRecordIOWriterCreate,MXRecordIOReaderReadRecord,MXRecordIOWriterWriteRecord and MXRecordIOReaderFree to R. And this is done in mxnetR is by registering these functions using something like MXNET_REGISTER_IO_ITER. See ~\src\io\iter_image_recordio_2.cc (line 599).

If we are able to adapt this then it should be fairly simple to write the im2rec function in R.

kimtang avatar Aug 08 '17 13:08 kimtang

First, OpenCV is optional. It is not available in the pre-built pkg. However, you can add OpenCV support when compiling from source.

Second, I don't think we need to implement im2rec in R, since we have a C++ implementation. We just need to call it from R. This is almost done in https://github.com/thirdwing/mxnet/tree/iss7273

thirdwing avatar Aug 08 '17 15:08 thirdwing

This breaks compiling the R package even if USE_OPENCV=0 is used in config.mk. Since using OpenCV is optional, I think the R package and imports should respect the settings in config.mk.

areobe avatar Sep 26 '17 14:09 areobe

I agree with @areobe. This killed the R bindings on a system with no OpenCV.

hadjipantelis avatar Oct 20 '17 11:10 hadjipantelis

@sandeep-krishnamurthy please label - "Feature Request"

anirudhacharya avatar Sep 05 '18 18:09 anirudhacharya

Let's track the bugs introduced by #7389 separately. I opened https://github.com/apache/incubator-mxnet/issues/17282

Currently this feature request of this issue has been implemented, though breaking other use-cases that were previously supported.

leezu avatar Jan 13 '20 14:01 leezu