Vertex Object Classification Import file issues

I am following the documentation on how to Prepare image training data for Object Classifiction which creates a JSONL schema like:

{
  "[imageGcsUri](https://cloud.google.com/vertex-ai/docs/image-data/classification/prepare-data#imagegcs)": "gs://bucket/filename.ext",
  "[classificationAnnotation](https://cloud.google.com/vertex-ai/docs/image-data/classification/prepare-data#class-annotation)": {
    "[displayName](https://cloud.google.com/vertex-ai/docs/image-data/classification/prepare-data#display-name)": "LABEL",
    "[annotationResourceLabels](https://cloud.google.com/vertex-ai/docs/image-data/classification/prepare-data#annotation-label)": {
        "aiplatform.googleapis.com/annotation_set_name": "displayName",
        "env": "prod"
      }
   },
  "[dataItemResourceLabels](https://cloud.google.com/vertex-ai/docs/image-data/classification/prepare-data#dataitem-label)": {
    "aiplatform.googleapis.com/ml_use": "training/test/validation"
  }
}

So I prepare a JSONL file like:

{"imageGcsUri":"gs://my-bucket-url/1/IMG_0822.jpg","classificationAnnotation":{"displayName":"1"}}
{"imageGcsUri":"gs://my-bucket-url/2/IMG_0823.jpg","classificationAnnotation":{"displayName":"2"}}
{"imageGcsUri":"gs://my-bucket-url/3/IMG_0824.jpg","classificationAnnotation":{"displayName":"3"}}
{"imageGcsUri":"gs://my-bucket-url/4/IMG_0825.jpg","classificationAnnotation":{"displayName":"4"}}

However, the upload fails in Vertex due to unknown issue as the error message is blank.

If I remove the classificationAnnotation field, the upload succeeds.

The documentation says the imageGcsUri field is the only required field.

What is wrong with my syntax of including classificationAnnotation?

1 Like

Hi @identafly ,

The issue is that your classificationAnnotation in the JSONL is using an inline JSON string, but it should be a proper nested JSON object — not quoted.

Example (correct format):
{“imageGcsUri”:“gs://my-bucket-url/IMG_0822.jpg”,“classificationAnnotation”:{“displayName”:“1”}}
So, just remove the extra quotes around classificationAnnotation.

I’m sorry but I don’t see the extra quotes you’re referring to. Can you please clarify?

Any chance there are updates required to the docs? I can only seem to generate a successful file upload by adding the following to a line item:

"annotationResourceLabels":"``aiplatform.googleapis.com/annotation_set_name":"3180898134272245760"}}],"dataItemResourceLabels``":{}

However, the docs indicate this is not required, so why does the file fail without? Can the JSONL be simplified?