Vertex Object Classification导入含classificationAnnotation的JSONL文件失败排查
Vertex AI图像分类JSONL上传失败排查(classificationAnnotation字段问题)
以下是你可能踩中的语法问题及对应修正方案:
- 字段拼写错误:检查
classificationAnnotation的拼写是否完全正确,比如有没有漏写字母、大小写错误,Vertex的Schema对字段名的拼写和大小写是严格匹配的。 - JSON结构嵌套错误:
classificationAnnotation是对象类型,不能直接赋值字符串,必须嵌套包含displayName的子对象。
错误示例:
正确示例:{"imageGcsUri": "gs://your-bucket/image.jpg", "classificationAnnotation": "cat"}{"imageGcsUri": "gs://your-bucket/image.jpg", "classificationAnnotation": {"displayName": "cat"}} - 字符串格式问题:确认
displayName的值使用英文双引号,没有用中文引号或未闭合的引号;若值包含特殊字符(如引号、斜杠),需正确转义。 - 多余逗号问题:检查每条JSON记录的最后一个字段后是否多了逗号,比如:
错误示例:
正确示例:{"imageGcsUri": "gs://your-bucket/image.jpg", "classificationAnnotation": {"displayName": "cat"},}{"imageGcsUri": "gs://your-bucket/image.jpg", "classificationAnnotation": {"displayName": "cat"}} - 数据类型不匹配:确保
displayName的值是字符串类型,不能是数字、布尔值等其他类型,比如不能写成{"displayName": 123},必须是{"displayName": "123"}。
Vertex对JSONL格式校验极严格,微小语法错误都会导致上传失败且无明确提示,建议用本地jq命令行工具等JSON校验工具,先批量验证所有记录的格式合法性,再重新上传。
内容的提问来源于stack exchange,提问作者Phil Lucks
相关产品推荐
相关产品推荐

