mx.io.ImageRecordIter: seed does not change after resetting the iterator
Hi, I'm having some issues with the seed of mx.io.ImageRecordIter set for default at zero, because doing some tries I've noticed that after reading the whole rec.file and resetting the iterator I obtain in the second reading cycle exactly the same sequence of images with the exactly the same crop/rotation/etc for each one. Does this happen also when I run the model, with the CNN training every epoch on the same identical sequence of images? Is there a possibility to set the seed to "random"?
ImageRecordIter (shuffle=True)
Shuffle is already set to True, but it mix randomly the images always in the same order after resetting the iterator, because the seed remains fixed to zero. For the same reason random crop and random mirror produce always the same tranformation in differents epochs because the random generator starts always with seed equal to zero.
data_iter = mx.io.ImageRecordIter(
path_imgrec="./data/caltech_train.rec", # the target record file
data_shape=(3, 227, 227), # output data shape. An 227x227 region will be cropped from the original image.
batch_size=4, # number of samples per batch
resize=256, # resize the shorter edge to 256 before cropping
rand_crop=True
# ... you can add more augumentation options here. use help(mx.io.ImageRecordIter) to see all possible choices
)
Then
for _ in range(10):
data_iter.reset()
batch = data_iter.next()
data = batch.data[0]
for i in range(4):
plt.subplot(1,4,i+1)
plt.imshow(data[i].asnumpy().astype(np.uint8).transpose((1,2,0)))
plt.show()
gives different results each time
Thanks!