'Any way to make use of ImageClassificationInstance in C#?

I keep getting Grpc.Core.RpcException: Status(StatusCode="Unimplemented" ... exception when I try to use the ImageClassificationInstance objects to classify using a model I have created in the Vertex AI. Is there any way (either by using Google AiPlatform library or using HttpRequest ) to perform ImageClassification with some given image?

The following is the code that I am using

        var client = builder.Build();
        var instance = new ImageClassificationPredictionInstance() { Content = rawdata };
        var parameters = new ImageClassificationPredictionParams() { ConfidenceThreshold = 0.5f, MaxPredictions = 5 };
        var pv = ValueConverter.ToValue(parameters);
        var iv = new[] { ValueConverter.ToValue(instance) };
        var ep = new EndpointName("My project ID", "us-central1", "My endpoint id"); // Of course I have set the string to my project ID and my endpoint ID
        var returnobj = client.Predict(ep, iv, pv); // This is where the exception pops up

I can confirm that my vertex AI AutoML model is working on the web browser to classify any uploaded picture.



Solution 1:[1]

You must set Endpoint on PredictionServiceClientBuilder :

var client = new PredictionServiceClientBuilder
        {
            Endpoint = "us-central1-aiplatform.googleapis.com"
        }.Build();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Daniele Ferri