Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping the AnnotateImageRequest to AnnotationImageResponse in Vision API #10731

Closed
Y-AKBAS opened this issue Apr 23, 2024 · 2 comments
Closed
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue.

Comments

@Y-AKBAS
Copy link

Y-AKBAS commented Apr 23, 2024

Hi dear cloud team,

currently I am working with the google cloud vision api and with the BatchAnnonateImageRequest we can send multiple AnnotateImageRequests. TheBatchAnnotateImageResponse that we get returns multiple AnnotateImageResponses as expected. The problem here is we do not know which response belongs to which request that we sent and therefore we cannot map them to our entities.

I would be very happy if we can somehow relate the requests with the responses that we get.

A possible way to achieve could be that we introduce a requestId in proto files both for AnnotateImageRequest and AnnotationImageResponse classes and the server maps this from request to the response so that we can know which response belongs to which request.

Here is an example code snippet in Kotlin to show what I want to achieve:

                val bytesOfImages = links.map { async { getImage(it) } }.awaitAll().filterNotNull()
                val singleRequests = bytesOfImages.map {
                    AnnotateImageRequest.newBuilder()
                        .setRequestId(UUID.randomUUID().toString()) // doesn't exist now.
                        .setImage(Image.newBuilder().setContent(ByteString.copyFrom(it)).build())
                        .addFeatures(Feature.newBuilder().setType(Feature.Type.WEB_DETECTION).build())
                        .setImageContext(ImageContext.getDefaultInstance())
                        .build()
                }
                val batchRequest = BatchAnnotateImagesRequest.newBuilder().addAllRequests(singleRequests).build()
                val responses = imageAnnotatorClient!!.batchAnnotateImages(batchRequest).responsesList
// with the help of requestIds I want to know which response belongs to which request
                val reqResPair = batchRequest.requestsList.map { request -> request to responses.find { it.requestId == request.requestId } }

In the following links you can see that there were some questions in the StackOverFlow but we cannot rely on the order of returned responses:

If I can support you in a way I would be happy to do that. Thank you very much in advance!

@zhumin8
Copy link
Contributor

zhumin8 commented Apr 24, 2024

Thanks for filing your issue. Unfortunately, this repository contains only the java client library for Vision api, and we do not have the expertise in actual services.
What you are describing sounds more a feature request to the Vision API. You might want to try one of the channels listed in the product's support page here.

@zhumin8 zhumin8 added type: question Request for information or clarification. Not an issue. priority: p3 Desirable enhancement or fix. May not be included in next release. labels Apr 24, 2024
@Y-AKBAS
Copy link
Author

Y-AKBAS commented Apr 25, 2024

Hi @zhumin8 ! Thank you very much for your response. I will check the mentioned support page then.

@zhumin8 zhumin8 closed this as completed Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

2 participants