How to read images in the correct order with minibatchqueue?

1 次查看(过去 30 天)
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 个评论
Tomaso Cetto
Tomaso Cetto 2022-1-18
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

请先登录,再进行评论。

回答(1 个)

yanqi liu
yanqi liu 2022-1-19
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

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by