Skip to content

aj-ats/maccer

Repository files navigation

Introduction

This project aims to implment the OCR 'zigmac' parser (pypi link) to tag Azure Blobs with backbone easyOcr

Dependancies

Python 3.10.12 machine to run script (preferably vm with gpu.. This implementation will be ported to Databricks for compute resources there) Docker

Packages

pip install azure-storage-blob azure-identity python-dotenv easyocr

Working OCR mac and serial

Working OCR (mac)

URLS that parsing algo is failing to parse. Use these to improve package

Blob Client Usage

🔧 Init

from util.blobClient import BlobClient

blob_client = BlobClient(
    storage_account_name="your_storage_account_name",
    storage_account_key="your_storage_account_key",
    container_name="your_container_name"
)

🏷️Set Blob tags

tags = {"env": "dev", "project": "example"}
blob_client.tag_blob(folder_path="path/to/blob.txt", tags=tags)

Parse runpod logs for sucsesfull tags

cat home/24c.ocr/log.txt | grep "{'mac': '00"

SSH RUNPOD

gen ssh ed25519 credentials add pub key to run pod

tmux
ssh r5hnl6wc2nzzdi-6441195a@ssh.runpod.io -i ~/.ssh/id_ed25519

Blob array length

As of 4/30/25 11:16 (UTC Central) 128440 including direcotres

grep log.txt to identify current index of array

cat log.txt | grep "Failed processing blob at index" log.txt | tail -1 | awk -F'index ' '{print $2}' | awk -F' ' '{print $1}'

grep to find how many blobs in the images container have been tagged

grep -c "{'mac': '00" log.txt

Script observations

Reading base plate data or macine data

# reading tape on a motor but parsing out what what it actially says. I could parse this reading out. it usualy happens on readings that are only seril.  
# if (!mac && serial) echo readings > logtxt 
#
Processed Results for 6058fb8b03e0890006150140/6489a711604db235c3f8d1a6/14d158d2-d7a5-458d-952a-a2cb12e852bc: {'mac': None, 'serial': 'S577'}
Processed Results for 6058fb8b03e0890006150140/648cdc8362be0caea63da393/12cb7fc8-e6db-4c43-834b-3881bf4ccaaa: {'mac': None, 'serial': 'S0106'}

ii

invalid mac address but valid serial

  • outputs both labled but only serial is valid. This usualy happenens on old sensor labels with big S# but small mac. logic to read a qr code from an image would be another good ai capabiliy. Not sure how to as its not a charchter
Readings:[('19735', 0.9928094162216953), ('00,1342 00', 0.7659641401321924), ('42 35 Da 98', 0.3699840879092524)]
Processed Results for 66b4fb566772daaac2b1a448/92dbc06f-6526-459a-be5f-dde2960d0dd5: {'mac': '00:13:42:00:42:35:da:98', 'serial': None}
# this image( 1st and second)  is a duplicate we could auto delete duplicates 
Processed Results for 6058fb8b03e0890006150140/648b4b15158ff8a022346b2a/e1409eab-cd55-4f52-a7a0-3212a3ff5fc0: {'mac': None, 'serial': 's510'}
Processed Results for 6058fb8b03e0890006150140/648b4b3d480c928f97999f06/01806ed1-59e2-444b-b5a9-a8d569d0b6c8: {'mac': None, 'serial': 's510'}
Processed Results for 6058fb8b03e0890006150140/648b6656158ff8a02234a8c5/1b7c2dd2-b51f-4b50-bce7-8f9f018a0cca: {'mac': None, 'serial': 's115'}

wins tagges with correct data ( mac or mac+ s#)

# This image I read wrong at first.  
Processed Results for 6058fb8b03e0890006150140/648cdc8362be0caea63da393/8563b4dd-52e9-4253-ae9a-ecf403ab72dd: {'mac': '00:13:a2:00:42:29:e1:b9', 'serial': None}
Processed Results for 6058fb8b03e0890006150140/648b3189158ff8a022342e5e/ef400b1e-830d-49ef-9718-861db17a02f2: {'mac': '00:13:a2:00:41:f5:8c:97', 'serial': 'S2763'}
Processed Results for 6058fb8b03e0890006150140/648cdbef2f4ef3ba6a88e7b0/a5358f06-acbf-4a7b-8cf9-459cad7cfdfb: {'mac': '00:13:a2:00:42:2d:fe:1c', 'serial': 'S_10268'}
Processed Results for 6058fb8b03e0890006150140/648b39ab2f4ef3ba6a8485c5/2d24bfc5-6fcc-4471-9471-cd52300c4859: {'mac': '00:13:a2:00:41:f6:fa:31', 'serial': None}
Processed Results for 6058fb8b03e0890006150140/648b39412f4ef3ba6a848484/8b240400-4dc7-46ea-b4ce-d9cd2c47ac64: {'mac': '00:13:a2:00:41:f6:fa:d4', 'serial': 'S_2770'}
Processed Results for 6058fb8b03e0890006150140/648b385308194cb84fbc3249/a1d9efba-5b12-43b5-a13a-17f5fc927d55: {'mac': '00:13:42:00:42:2d:fd:7b', 'serial': None}
Processed Results for 6058fb8b03e0890006150140/648b43adf96af772a4c45c12/f86e5121-5079-4966-b323-9993e6270e1c: {'mac': '00:13:a2:00:42:2d:68:56', 'serial': 'S_10290'}
Processed Results for 6058fb8b03e0890006150140/648dda572f4ef3ba6a8b9536/87ea616e-010b-47b3-87a7-129e854fa229: {'mac': '00:13:a2:00:42:11:40:84', 'serial': 'S_7007'}
Processed Results for 6058fb8b03e0890006150140/648dedf362be0caea640898d/93e996b8-adfe-4b64-b150-86cee60c84f3: {'mac': '00:13:42:00:42:29:e7:be', 'serial': 'S_8211'}

Valid Mac Invalid s#

# the acutal s# of this sensor is s_5721.  I need to log the readings in the future to infer more.  But I bet the S_ was a seperate reading from a number 5721.  5 for swapped as.
Processed Results for 6058fb8b03e0890006150140/648cce3af96af772a4c87a0a/87379f78-9b93-484c-9401-66e6d7e475c5: {'mac': '00:13:a2:00:41:f6:b1:66', 'serial': 'S712'}

What to do with logs after script runs

  1. pull duplicate readings and delete one of the duplicated blob
  2. for every result that has mac & serial - cross reffrence with sql to validate .. if valid tag 'varified: true'

About

use easyocr to parse mac addresses(zigbee formated ie. 00:13:a2:00:ff:ee:4e:a2) form images. This is used to tag az blobs with the mac address of a pictured sensor label

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors