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

TypeError: annotate() missing 1 required positional argument: 's' #199

Open
GMXela opened this issue Mar 21, 2022 · 5 comments
Open

TypeError: annotate() missing 1 required positional argument: 's' #199

GMXela opened this issue Mar 21, 2022 · 5 comments

Comments

@GMXela
Copy link

GMXela commented Mar 21, 2022

Hello, I have this error and I don't understand...

Looking for /root/.keras-ocr/craft_mlt_25k.h5
Looking for /root/.keras-ocr/crnn_kurapan.h5

TypeError Traceback (most recent call last)
in ()
19 fig, axs = plt.subplots(nrows=len(images), figsize=(20, 20))
20 for ax, image, predictions in zip(axs, images, prediction_groups):
---> 21 keras_ocr.tools.drawAnnotations(image=image, predictions=predictions, ax=ax)
22
23 print(prediction_groups)

/usr/local/lib/python3.7/dist-packages/keras_ocr/tools.py in drawAnnotations(image, predictions, ax)
182 color="r",
183 fontsize=14,
--> 184 horizontalalignment="right" if side == "left" else "left",
185
186 )

TypeError: annotate() missing 1 required positional argument: 's'

@vittoema96
Copy link

Try updating matplotlib, the last version should not lead to this error

@GMXela
Copy link
Author

GMXela commented Mar 23, 2022

I'm working on Colab so i'm not supposed to make any down/update... I think...

But, I tried a LOT of modifications and nothing works... I'm trying to understand the error and analyzing the source code but i never found where and what is the 's' argument...

TypeError: annotate() missing 1 required positional argument: 's'

@docstring.dedent_interpd
def annotate(self, text, xy, *args, **kwargs):
    a = mtext.Annotation(text, xy, *args, **kwargs)
    a.set_transform(mtransforms.IdentityTransform())
    if 'clip_on' in kwargs:
        a.set_clip_path(self.patch)
    self._add_text(a)
    return a
annotate.__doc__ = mtext.Annotation.__init__.__doc__
#### Lines and spans

@vittoema96
Copy link

I guess there's a better solution to this, but i had the same problem on colab too and a
!pip install --upgrade matplotlib
solved it for me

@GMXela
Copy link
Author

GMXela commented Mar 24, 2022

@vittoema96 @faustomorales
Thank you so much!! It solved it to me too.... But I have this other issue :

#201

I'm working on it this morning and I hope to be able to fix it.

THX guys!!! So much!!!

@nagvekarshankar
Copy link

nagvekarshankar commented May 27, 2022

I am getting same issue on colabs.
How to use this function in colabs

def annotate(self, text, xy, *args, **kwargs):
a = mtext.Annotation(text, xy, *args, **kwargs)
a.set_transform(mtransforms.IdentityTransform())
if 'clip_on' in kwargs:
a.set_clip_path(self.patch)
self._add_text(a)
return a
annotate.doc = mtext.Annotation.init.doc

Lines and spans

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants