tensorflow - 如何解析 tfds.features.Sequence 对象?它与 tf.io.FixedLenSequenceFeature 不兼容
问题描述
最近我试图在 Wider-Face 数据集上训练一个模型。我发现它已预建在 tfds 中(https://www.tensorflow.org/datasets/catalog/wider_face)。但是我很难解析它。它的特征图具有以下形式 -
FeaturesDict({
'faces': Sequence({
'bbox': BBoxFeature(shape=(4,), dtype=tf.float32),
'blur': tf.uint8,
'expression': tf.bool,
'illumination': tf.bool,
'invalid': tf.bool,
'occlusion': tf.uint8,
'pose': tf.bool,
}),
'image': Image(shape=(None, None, 3), dtype=tf.uint8),
'image/filename': Text(shape=(), dtype=tf.string),})
所以我将以下嵌套字典传递给 tf.io.parse_single_example
feature_description = {'faces': {
'bbox': tf.io.FixedLenFeature([], dtype=tf.float32),
'blur': tf.io.FixedLenFeature([], dtype=tf.uint8),
'expression': tf.io.FixedLenFeature([], dtype=tf.bool),
'illumination': tf.io.FixedLenFeature([], dtype=tf.bool),
'invalid': tf.io.FixedLenFeature([], dtype=tf.bool),
'occlusion': tf.io.FixedLenFeature([], dtype=tf.uint8),
'pose': tf.io.FixedLenFeature([], dtype=tf.bool),
},
'image': tf.io.FixedLenFeature([], dtype=tf.uint8),
'image/filename': tf.io.FixedLenFeature([], dtype=tf.string),}
但它给了我一个 ValueError: Unsupported dict 的值错误。后来我还了解到,Sequence 不支持 tf.io.FixedLenSequenceFeature 类型的功能。
请让我知道如何解析这种类型的 TFRecords。我没有找到太多关于如何使用构建到 Tensorflow 中的对象检测数据集的文档,因此提供一些示例链接也会有所帮助。
谢谢
解决方案
推荐阅读
- filter - 如何在 DAX 中获得过滤上下文的总百分比?
- firebase - Cloud Firestore 能够发送数据,但在提取数据时收到空异常
- r - 如何在 R 中以对数线性比例绘制 y 轴以 10 为底数,以 plot()t 为底数?
- python - 如何在 Pandas 中将 DMS 转换为 DD?
- sql - 在 SQL 中按小时计算出现次数
- javascript - 从脚本标签获取 JSON 值
- react-native - 如何在本机反应中划定地图中的区域
- python - 位置优化
- php - 如何让 PHP 和 PostgreSQL 就如何计算时间间隔达成一致?
- flutter - 推/弹出颤动内存泄漏