Repository navigation
Insufficient tokens for quota 'DefaultGroup' and limit 'USER-100s' of service 'vision.googleapis.com' #985
Description
In which file did you encounter the issue?
Did you change the file? If so, how?
- add lines in function to show cropped image using matplotlib
plt.imshow(im2)
plt.title("cropped")
plt.show() - use without command argument parsing
Describe the issue
I use the google cloud sdk. When I call crop_to_hint(imdir) in Jupyter notebook, sometimes it'll throw an error like bellow (usually happen the first time I call the function)
RetryError: GaxError(Exception occurred in retry method that was not classified as transient, caused by <_Rendezvous of RPC that terminated with (StatusCode.RESOURCE_EXHAUSTED, Insufficient tokens for quota 'DefaultGroup' and limit 'USER-100s' of service 'vision.googleapis.com' for consumer 'project_number:xxx'.)>)
The full traceback:
RetryError Traceback (most recent call last)
in ()
1 draw_hint(imdir)
----> 2 crop_to_hint(imdir)
in crop_to_hint(image_file)
35 def crop_to_hint(image_file):
36 """Crop the image using the hints in the vector list."""
---> 37 vects = get_crop_hint(image_file)
38
39 im = Image.open(image_file)
in get_crop_hint(path)
10 # Return bounds for the first crop hint using an aspect ratio of 1.77.
11 #return image.detect_crop_hints({1.77})[0].bounds.vertices
---> 12 return image.detect_crop_hints({1.77})[0].bounds.vertices
13
14
/Users/yiliu/anaconda/lib/python2.7/site-packages/google/cloud/vision/image.pyc in detect_crop_hints(self, aspect_ratios, limit)
167 image=image, features=[feature], image_context=image_context)
168
--> 169 annotations = self._detect_annotation_from_pb([request])
170 return annotations[0].crop_hints
171
/Users/yiliu/anaconda/lib/python2.7/site-packages/google/cloud/vision/image.pyc in _detect_annotation_from_pb(self, requests_pb)
127 :returns: Instance of Annotations.
128 """
--> 129 return self.client._vision_api.annotate(self, requests_pb=requests_pb)
130
131 def detect(self, features):
/Users/yiliu/anaconda/lib/python2.7/site-packages/google/cloud/vision/_gax.pyc in annotate(self, images, requests_pb)
67
68 annotator_client = self._annotator_client
---> 69 responses = annotator_client.batch_annotate_images(requests).responses
70 return [Annotations.from_pb(response) for response in responses]
71
/Users/yiliu/anaconda/lib/python2.7/site-packages/google/cloud/gapic/vision/v1/image_annotator_client.pyc in batch_annotate_images(self, requests, options)
179 request = image_annotator_pb2.BatchAnnotateImagesRequest(
180 requests=requests)
--> 181 return self._batch_annotate_images(request, options)
/Users/yiliu/anaconda/lib/python2.7/site-packages/google/gax/api_callable.pyc in inner(request, options)
426 func, this_settings.timeout, **this_settings.kwargs)
427 api_call = _catch_errors(api_call, gax.config.API_ERRORS)
--> 428 return api_caller(api_call, this_settings, request)
429
430 if settings.page_descriptor:
/Users/yiliu/anaconda/lib/python2.7/site-packages/google/gax/api_callable.pyc in base_caller(api_call, _, *args)
414 def base_caller(api_call, _, *args):
415 """Simply call api_call and ignore settings."""
--> 416 return api_call(*args)
417
418 def inner(request, options=None):
/Users/yiliu/anaconda/lib/python2.7/site-packages/google/gax/api_callable.pyc in inner(*args, **kwargs)
374 """Wraps specified exceptions"""
375 try:
--> 376 return a_func(*args, **kwargs)
377 # pylint: disable=catching-non-exception
378 except tuple(to_catch) as exception:
/Users/yiliu/anaconda/lib/python2.7/site-packages/google/gax/retry.pyc in inner(*args)
125 raise errors.RetryError(
126 'Exception occurred in retry method that was not'
--> 127 ' classified as transient', exception)
128
129 # pylint: disable=redefined-variable-type
But when I re-run that cell of calling the function (without any modification), usually it will execute smoothly without throwing this error.
I see google's websites say this is because there's restriction on request time per sec, see also #1756 issue. But I'm just using my local machine, and I do not exceed the 10 request/sec according to Usage Limits
Activity
engelke commentedon Dec 7, 2018
The API and libraries have been updated over the last year and half since this report, and the problem should be fixed by now. If not, please reopen this issue with new information. Thanks.