crop images in ImageDatastore for semantic segmentation
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
OJ27
am 21 Apr. 2020
Beantwortet: Sai Bhargav Avula
am 12 Mai 2020
I have ImageDataStore and PixelDataStore objects related to a dataset of 200 labeled images. Since the resolution is large, I want to crop these images randomly (N number of crops) AND also crop the image at the center. The example provided by matlab
deals with one image at a time and not a whole dataset. How do I go about doing this? I figured I could randomly crop N images out of Image_1 and then concatenate them with the image cropped at the center. Say I choose N=11 randomly cropped images and 1 image cropped at the center.
When I do this, I obtain two TransformedDatastore objects. My question is, how do I concatenate them?
combine
does not work well or perhaps I am doing it wrong. After putting together the randomly cropped images and the center image for I_1 (total 12 images), how do I concatenate them with images resulting from I_2, I_3.... and so on?
I also read about
randomPatchExtractionDatastore
This would take care of the random crops of my original images, but how do I add the center cropped images to this object before training my network?
Should I just develop my own code, crop the images, save them to a folder and then read the folder with ImageDataStore and PixelDataStore?
0 Kommentare
Akzeptierte Antwort
Sai Bhargav Avula
am 12 Mai 2020
Hi,
To the best of my knowledge this can be solved in multiple ways.
One possible work around is to used randomPatchExtractionDatastore to get the required number of random patches and augumentedImageDatastore or operate transform on imageDatastore. combine them and read them. This has a advantage of getting ordered images, meaning the centrecropped images and random cropped images are read simultaneously.
Since wanted to concatenate them you can try this
concatenatedDatastore = imageDatastore(cat(1,randomDatastore.Files,centerCroppedDatastore.Files));
This gives a single datastore of all the images you required to train.
Hope this helps!
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Data Workflows finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!