【发布时间】:2023-03-22 22:16:01
【问题描述】:
我正在使用 Tensorflow 的 1.3 Estimator API 来执行一些图像分类。由于我有大量数据,所以我试了一下 TFRecords。保存文件并可以使用估计器模型的 input_fn 内的解析器函数将示例读取到数据集。到现在为止还挺好。
问题是当我想做一些图像增强(在这种情况下是旋转和剪切)时。
1) 我尝试使用tf.contrib.keras.preprocessing.image.random_shear 等。事实证明 Keras 不喜欢 TF 形状('Dimension')的格式,我不能将它转换为列表,因为它的参数是轴索引而不是实际值。
2) 然后我尝试使用tf.contrib.image.rotate 和tf.contrib.image.transform 在我选择的范围内使用随机值。这次我收到NotFoundError: Op type not registered 'ImageProjectiveTransform' in binary running on MYPC. Make sure the Op and Kernel are registered in the binary running in this process. 的错误,这是一个未解决的问题 (https://github.com/tensorflow/tensorflow/issues/9672)。目前我无法从 Windows 迁移,所以我对可能的替代方案非常感兴趣。
3) 搜索了一种读取 TFRecords 并将其转换为 numpy 数组并使用其他工具进行扩充的方法,但在我无法访问会话的 input_fn 中找不到方法。
谢谢!
【问题讨论】:
标签: tensorflow keras