How do i upload all images at once?

3 ビュー (過去 30 日間)
Kamyar Mazarei
Kamyar Mazarei 2021 年 7 月 19 日
コメント済み: Image Analyst 2021 年 7 月 19 日
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 件のコメント
Walter Roberson
Walter Roberson 2021 年 7 月 19 日
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
Matt J 2021 年 7 月 19 日
Perhaps the intention is to upload the files to Matlab Drive for the purposes of a Mathworks-hosted workshop?

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2021 年 7 月 19 日
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 件のコメント
Kamyar Mazarei
Kamyar Mazarei 2021 年 7 月 19 日
zip method tells me i dont have enough space on workshop
i tried to zip each subfolder and do it 4 times but matlab froze and closed itself after 5 min
also the one at a time method which i want to do cant be done cause the images files are named:
Covid (1) , Covid (2) , ....
and the braces dosnt let me load them and it takes a long time to change names there are about 3500 images in total
i do have to resize them all so a 'for' loop is ideal
id like images to be in a cell and i cant find a way to do it
Image Analyst
Image Analyst 2021 年 7 月 19 日
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?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeThingSpeak についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by