-
Notifications
You must be signed in to change notification settings - Fork 6.8k
How to read rec files in R #6943
Comments
I figured that I can read the .lst file to find out the labels. |
Please try the code below. I used the cifar10 data from http://data.mxnet.io/mxnet/data/cifar10.zip dataiter <- mx.io.ImageRecordIter(
path.imgrec = "./data/cifar/train.rec",
path.imglist = "./data/cifar/train.lst",
mean.img = "./data/cifar/cifar10_mean.bin",
batch.size = 100,
data.shape = c(28, 28, 3),
rand.crop = TRUE,
rand.mirror = TRUE
)
dataiter$reset()
dataiter$iter.next()
dataiter$value()$label
dataiter$value()$data |
You can get more info on how to use iterators from https://github.com/dmlc/mxnet/blob/master/R-package/tests/testthat/test_io.R |
Thank you! |
Please make sure the following two lines have been executed. dataiter$reset()
dataiter$iter.next() |
Thank you! Now I can see the label and the data. However, I also notice that I only see 8 labels instead of all 2137 labels. In my input shape, I set the batch size to be 8. |
This is just what |
Hi, I have a follow-up question: I assign variables labels=dataiter$value()$label dim(mydata) = 28 28 3 100 but if I do mydata[,,,1] or labels[1:10] How do I access the values from mydata and labels? Thanks! |
I use im2rec.py in mxnet to generate rec files for training and validation. I am wondering how to access the content of the rec files, such as the indices, labels, or images in R.
Say val is the variable name for the rec file I generated and loaded in R.
I used the command
val@.xData,
trying to see if I can get the indices or labels, my R crashes.
The text was updated successfully, but these errors were encountered: