what this function do?

1 visualizzazione (ultimi 30 giorni)
mohammed mahmoud
mohammed mahmoud il 25 Mar 2018
Commentato: Walter Roberson il 26 Mar 2018
function inputs = getBatchHdd(imdb, batch)
args_data = [{imdb.images.data(batch)} imdb.args];
noise = imdb.images.noise(:,:,:, batch);
label0 = imdb.images.label0(:,:,:, batch);
label1 = imdb.images.label1(:,:,:, batch);
data = vl_imreadjpeg(args_data{:});
data = data{1}/255*2-1; % set in the range of [-1:1]
if (imdb.gpus == true)
noise = gpuArray(noise);
data = gpuArray(data);
label0 = gpuArray(label0);
label1 = gpuArray(label1);
end
inputs = ({'noise', noise, 'data', data, 'label0',label0 'label1',label1} );
return;

Risposta accettata

Walter Roberson
Walter Roberson il 25 Mar 2018
Modificato: Walter Roberson il 25 Mar 2018
It pre-processes the data for the given batch number to scale it to [-1 +1], and creates a cell array with the corresponding noise array, data, and two label entries. If the gpus option is set it creates those arrays on the GPU. Oh, and it looks like it might read the image from disk along the way.
  2 Commenti
mohammed mahmoud
mohammed mahmoud il 26 Mar 2018
Thanks, but i don`t understand the step of add noise.
Walter Roberson
Walter Roberson il 26 Mar 2018
The function does not add noise: it retrieves a noise array that has already been calculated during the database creation. The noise will not be added to the data until later in the processing.
The noise array is created in src/cnn_train_dag_dcgan as
imdb.images.noise = single(randn(1, 1, 100, imdb.nSample, 'single'));
The surrounding comments indicate that the noise is pre-created for the purposes of reproducibility.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by