I want to convert a collection of 3 Landsat images (each 12 band) to a single image array and then export it in TFRecord format. I used below code. My input collection is named images
. imageT
is the accumulated image, starting with a zero band which is dropped at the end. Each pixel of final imageOfSeries
image contain a matrix of size 3x12:
var imageT = ee.Image(0)
images = images.map(function(image){
return image.toArray();
})
var accumulate = function(image, imageT) {
return(ee.Image(imageT).addBands(image))
};
var imageOfSeries = ee.Image(images.iterate(accumulate, imageT))
.slice(1).toArray(1).matrixTranspose()
Export.image.toDrive({
image: imageOfSeries,
description: 'imageOfSeriesExample',
scale: 30,
region: geometry,
fileFormat: 'TFRecord',
formatOptions: {
patchDimensions: [10,10],
tensorDepths: [3,12]
}
});
But GEE returns an error when running the export task and says that Arrays must have dimensions = 1
.
How can I do my task? I also need to have more information on how to decode the TFRecord file in such a case, for which I couldn't find any example in GEE tutorial.