How to restore old OCR model

111 views
Skip to first unread message

Rahul Pidkalwar

unread,
Apr 29, 2022, 2:25:48 AM4/29/22
to cloud-vision-discuss
Hello,
Recently Google update OCR Model for their functions like .TEXT_DETECTION and .DOCUMENT_TEXT_DETECTION which I found out highly inaccurate and whatever services I built using old version of model, now not giving me accurate answers which it used to give 2-3 days ago because of new version of OCR model  which set as default, now how can I switch back to the old version of model, so that I get proper results again
Please Help !!!!!!!

Brendan Lundy

unread,
Apr 29, 2022, 12:02:09 PM4/29/22
to cloud-vision-discuss
You can use the old model for the next 90 days by specifying "builtin/legacy" for the model: https://cloud.google.com/vision/docs/release-notes  After 90 days, the old model will be turned down.

If you have a specific issue, you can open a case here: https://cloud.google.com/support/docs/issue-trackers

Jaru Nartboon

unread,
Apr 30, 2022, 12:51:52 AM4/30/22
to cloud-vision-discuss
Hi Brendan 

One of my customer in Thailand gets impacted by this since yesterday. 

Regarding to "builtin/legacy"

Do you have some sample python snippet to implement that ? Sorry i am not good in programming but need to provide some advice for customer. 

nlawquaer...@gmail.com

unread,
May 5, 2022, 10:17:58 AM5/5/22
to cloud-vision-discuss
Google Support:

I have the same request to access previous version.  This is a critical Production issue.  Adding "builtin/legacy" returns the "new" JSON.  I've already posted on Google's Issue Tracker: ID 230865657.    Please provide detailed code.  Thx.

# Code

os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = key_file_location

scopes = ['https://www.googleapis.com/auth/analytics.readonly']

service = build('vision', 'v1')
   
with open(image_file, 'rb') as image:
    image_content = base64.b64encode(image.read())
    service_request = service.images().annotate(body={
                'requests': [{
                    'image': {
                        'content': image_content.decode('UTF-8')
                    },
                    'features': [
                    {
                        "model": "builtin/legacy"    ### Does not work.  Returns "new" JSON  ####
                    },
                    {
                        "type": "DOCUMENT_TEXT_DETECTION"
                    },
                    {
                        "type": "TEXT_DETECTION"
                    },                
                    {
                        "type": "FACE_DETECTION"
                    },
                    {
                        "type": "LANDMARK_DETECTION"
                    },
                    {
                        "type": "LOGO_DETECTION"
                    },                  
                    {
                        "type": "LABEL_DETECTION"
                    },
                    {
                        "type": "SAFE_SEARCH_DETECTION"
                    },
                    {
                        "type": "IMAGE_PROPERTIES"
                    },    
                    {
                        "type": "CROP_HINTS"
                    },                                  
                    {
                        "type": "WEB_DETECTION"
                    },
                    {
                        "type": "PRODUCT_SEARCH"
                    },                
                    {
                        "type": "OBJECT_LOCALIZATION"
                    },                                        
                    {
                        "type": "TYPE_UNSPECIFIED"
                    }]                                      
                }]
            })
                       
response = service_request.execute()

# End Code




Reply all
Reply to author
Forward
0 new messages