How do i upload all images at once?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Kamyar Mazarei
il 19 Lug 2021
Commentato: Image Analyst
il 19 Lug 2021
hi
lets say i have 2 folders called 'test' and 'train' and each one has 2 files 'A' and 'B' which each one has about 1000 images
how do i upload them?
i cant drag them all at once, only can do 1 at a time
thank you
4 Commenti
Walter Roberson
il 19 Lug 2021
What does it mean to move them to workshop ?
If you want to use them for NN then it would seem to make the most sense for you to use an imageDataStore, as a number of the Deep Learning functions are happy to read in imageDataStore
Matt J
il 19 Lug 2021
Perhaps the intention is to upload the files to Matlab Drive for the purposes of a Mathworks-hosted workshop?
Risposta accettata
Image Analyst
il 19 Lug 2021
You'd have to zip them up into a single file to do them "all at once".
Otherwise you can do them one-at-a-time using code from the FAQ:
where you use sprintf() to create source and destination files and use copyfile() to do the copying.
2 Commenti
Image Analyst
il 19 Lug 2021
How does zipping the source files on the source disk tell you that you don't have enough space on the destination folder (workshop)? Is that were you told it to create the output zip file? What exactly is a workshop? And, well, if you don't have enough room, then you don't have enough room, so clean up some by moving or deleting files that don't need to be in the destination folder.
"tried to zip each subfolder and do it 4 times but matlab froze and closed itself after 5 min" <== then don't use MATLAB for that. I don't know how you got MATLAB to even try to zip the files, but if it doesn't work, zip it from your operating system (i.e. select files and right click from File Explorer in Windows 10 and say Send to compressed folder).
The one-at-a-time method can work perfectly well with filenames like Covid(1), etc.: (Untested code)
filePattern = fullfile(sourceFolder, 'Covid(*.png');
fileList = dir(filePattern) % A list of all PNG files starting with "Covid(".
% Loop over all the files we found, resizing them and saving the resized
% files to the destination folder.
for k = 1 : length(fileList)
% Get source filename.
sourceFileName = fullfile(fileList(k).folder, fileList(k).name);
% Read the image into memory.
imageArray = imread(sourceFileName);
% Display it
imshow(imageArray);
drawnow;
% Resize it to the desired size.
imageArray = imresize(imageArray, [desiredRows, desiredColumns]);
% Save the resized image in the destination folder.
destinationFileName = fullfile(destinationFolder, fileList(k).name);
imageArray(imageArray, destinationFileName);
end
Note: no braces {} were used, only parentheses ().
You say that you want all images to be in a cell array. That would take up a huge amount of memory and could only be done for a few images. Moreover, there is no reason to put them all into a slow and wastefull cell array. None that I can see. Why do you think you need to do this?
Più risposte (0)
Vedere anche
Categorie
Scopri di più su ThingSpeak in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!