How to read images in the correct order with minibatchqueue?
1 view (last 30 days)
Show older comments
I was trying to do CNN predictions using a customely trained dlnetwork. While I was trying to feed minibatch data to the network using minibatchqueue for prediction, I found that the image index of the first and the next minibatch was not sequential. Does anyone know how to read data with minibatchqueue object in a correct order?
Thanks!
1 Comment
Tomaso Cetto
on 18 Jan 2022
Hi there!
The order in which minibatchqueue returns images is most often dependent on the nature of the underlying datastore. By default minibatchqueue will return mini-batches in the same order as the datastore "read" outputs. What datastore are you using? It might be that the datastore is shuffling its data every time it reads it out. It might also be that there is a call to shuffle(minibatchqueue) somewhere in your code.
Another thing which could affect the order in which the images are read out is the use of the DispatchInBackground option of the minibatchqueue object. It's better not to use this option in this case.
Let me know if any of this applies to your case!
Tomaso
Answers (1)
yanqi liu
on 19 Jan 2022
yes,sir,may be set trainingOptions,such as
'Shuffle', 'never'
to make it do not shuffle data order,in common,we offen use
'Shuffle','every-epoch'
to make train more stable
0 Comments
See Also
Categories
Find more on Image Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!