dreamfly2016 2019-04-28 16:44
浏览 27

谷歌愿景预测返回空回应

I use Google vision API to predict image labels and i dont understand why my response is empty, but cannot be sure how the response should be.

    $predictionServiceClient = new PredictionServiceClient();

    try {
        $formattedName = $predictionServiceClient->modelName($this->config['project_id'], $this->config['region_name'], $this->config['dataset']);
        $payload       = new ExamplePayload([
            'image' => new Image([
                'image_bytes' => file_get_contents("https://www.example.com/image.jpg")
            ])
        ]);

        $response = $predictionServiceClient->predict($formattedName, $payload);
    } 
    finally {
        $predictionServiceClient->close();
    }

The region_name is us-central1.

It seems like all fine, there is no error in the predict proccess, but the response i get is:

RepeatedField {
  -container: []
  -type: 11
  -klass: "Google\Cloud\AutoMl\V1beta1\AnnotationPayload"
  -legacy_klass: "Google\Cloud\AutoMl\V1beta1\AnnotationPayload"
}

I not understand why the container is empty, what should be in the container, and how my results should be shown.

Anyone know how to get the real results of the predict proccess?

Thanks.

  • 写回答

0条回答 默认 最新

    报告相同问题?