【发布时间】:2020-07-01 08:47:51
【问题描述】:
我一直在使用 GEE 从 Sentinel-2 中导出一些训练补丁,以便在 Python 中使用。
我可以通过遵循 GEE 指南 https://developers.google.com/earth-engine/tfrecord 并使用 Export.image.toDrive 函数使其工作,然后我可以解析导出的 TFRecord 文件以重建我的图块。
var image_export_options = {
'patchDimensions': [366, 366],
'maxFileSize': 104857600,
// 'kernelSize': [366, 366],
'compressed': true
}
Export.image.toDrive({
image: clipped_img.select(bands.concat(['classes'])),
description: 'PatchesExport',
fileNamePrefix: 'Oros_1',
scale: 10,
folder: 'myExportFolder',
fileFormat: 'TFRecord',
region: export_area,
formatOptions: image_export_options,
})
但是,当我尝试在 formatOptions 中指定 kernelSize 时(应该 “将相邻的图块重叠 [kernelSize[0]/2, kernelSize[1]/2]” ,根据指南)文件已导出,但“*mixer.json”并未反映补丁数量的增加,之后我无法遍历补丁。以下命令使 google colab 会话崩溃:
image_dataset = tf.data.TFRecordDataset(str(path/(file_prefix+'-00000.tfrecord.gz')), compression_type='GZIP')
first = next(iter(image_dataset))
first
奇怪的是,只有当我将 kernelSize 添加到 formatOptions 时才会出现问题。
【问题讨论】:
标签: tensorflow training-data google-earth-engine tfrecord