EasyOCR icon indicating copy to clipboard operation
EasyOCR copied to clipboard

UserWarning from torchvision

Open majunze2001 opened this issue 2 years ago • 3 comments

I am running the demo in the readme, but I got several warnings.

import easyocr
reader = easyocr.Reader(['en'])
result = reader.readtext(imgpath + 'sample.png', detail = 0)
print(result)

And I got the following warnings:

  warnings.warn(
C:\Users\22612\AppData\Local\Programs\Python\Python39\lib\site-packages\torchvision\models\_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and will be removed in 0.15, please use 'weights' instead.
  warnings.warn(
C:\Users\22612\AppData\Local\Programs\Python\Python39\lib\site-packages\torchvision\models\_utils.py:223: UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and will be removed in 0.15. The current behavior is equivalent to passing `weights=None`.
  warnings.warn(msg)```

majunze2001 avatar Jun 29 '22 16:06 majunze2001

Torchvision 0.13 added an upgrade that allows to use pre-trained models on different weigths (e.g. different data-sets or their versions). So this

from torchvision import models
model = models.resnet50(pretrained=True)

should now change to something like this

from torchvision import models
model = models.resnet50(weights='ResNet50_Weights.DEFAULT')

You can also disable specific warnings like so

import warnings
warnings.filterwarnings("ignore", category=UserWarning) 

TheMemoryDealer avatar Jul 01 '22 15:07 TheMemoryDealer

So do you believe easyocr will fix that?

Space-Dream-42 avatar Jul 01 '22 21:07 Space-Dream-42

@TheMemoryDealer thanks, do you want to create a pull request to fix this warning?

rkcosmos avatar Aug 07 '22 10:08 rkcosmos

@tdefoin thanks! @rkcosmos should this be closed now?

TheMemoryDealer avatar Jun 01 '23 11:06 TheMemoryDealer

But why does it appear as I used the DataLoader?I did not use the pretrain.

ZeroHzzzz avatar Jun 22 '23 14:06 ZeroHzzzz