I am having trouble understanding how .rec files are generated and what they return.
Here what I mean.
I have followed this wiki page, i.e. downloaded the caltech data, generated a .lst and .rec file and start iterating over it.
So, here what happens
train_iter = mx.io.ImageRecordIter(path_imgrec="./caltech.rec",
data_shape=(3, 227, 227),
batch_size=4,
resize=256)
for batch in train_iter:
print(batch.data[0].shape)
print(batch.label[0])
break
which correctly returns
(4L, 3L, 227L, 227L)
[ 42. 91. 62. 4.]
<NDArray 4 @cpu_pinned(0)>
but then when I visualize one image (the fourth in the batch)
plt.imshow(batch.data[0][3].asnumpy().reshape(227, 227, 3))
I get this thing
which is very different than the original 274 x 184 pixels JPG
Now, except for the obviously different shape, I have no clue why ImageRecordIter
returns the first image.
I tried digging into im2rec.py
(which is the script translating JPGs into .lst and then .rec) but I cannot figure out what is going on there.
Can anybody help, please?