• Skip to main content

Perth Data Science

Using data for Prediction, Classification, Pattern detection, Image recognition and decision making.

  • Home
  • Contact me
  • All Projects
    • Monitoring CAD commands – What can be learnt?
    • Using data science to check electrical drawings.
    • A quick way to search for wire numbers in photos.
    • Building a model from production data to forecast a crusher shutdowns.
    • Using data science to test trading indicators
    • Machine learning to find endangered cockatoos
You are here: Home / A quick way to search for wire numbers in photos.

A quick way to search for wire numbers in photos.

Everyone who is experienced in brownfields electrical will have spent time looking through photographs to find wires while trying to as built old drawings.  Personally, in the past eighteen months, I’ve spent more time doing it than any sane person should.

There always seems to be that one elusive wire that takes forever to find.

I decided that there had to be an easier way.  I wanted to search for text in the photos the same way we search for text in a document.  Afterall, text recognition of car number plates is old technology, and wire ferrules do look a lot like tiny car number plates.  Could that round technology be driven into a square hole?

From previous experience using python for image classification, I knew it should be a straight forward exercise. I would need to import the image (using OpenCv), convert each piece of text (Using Googles tesseract library), and if the OCR’d text matched the wire number I was looking for, then draw a bounding box around the ferrule (using OpenCV again).

I dusted off out some old projects and cut and paste the code snippets I needed.  As a first pass, the results were excellent, the code was able to locate the wires about 80% of the time.  By converting the image to grey scale, and playing with the contrast I was able to increase the detection rate to about 90%.  However, the photos were not taken with OCR in mind and the camera angle often skewed the text, or the ferrules were facing downwards, and this prevented detection much beyond 90%. 

Searching images for wire 30422 using python code
Searching images for wire 41082 using python code

What I found exciting was the scalability of the code, for example if good resolution photos were taken from the appropriate angle and distance for OCR, then the detection rate would start to approach 100%.  If each panel was photographed, then thousands of wires could be searched simultaneously, and a wires entire path from the MCC to the field and back again could be shown highlighted.  Once a system is built, maintaining it would be as simple as taking a new photograph.

Further development could see the script compare a termination diagram (PDF) against a terminal strip photo, and highlight any discrepancies, or even automatically create the termination diagram (CAD file) from scratch based on the photo.

The script will never replace the checks of an experienced designer or engineer, but it can be used as an aid to speed up the design process. 

Using Python as a base means a form style front end could be added and the tool made available for all.  Please message if you think this tool is something you could use, or if you would like to see it developed further.

Tagged with: data science, Image Processing, mining, Python

Copyright Datascience.net.au© 2023 ·