I received a few P&ID diagram where the tags aren’t spelled out in-place (because the space perhaps was limiting), but just an indexed number is given. And in a separate table, the index is mapped with the tag name.
Please see that attached image which can provide further illustration.
I am not sure if the OCR + contextualization logic can map the index out and place the tag at the correct place. I am thinking it is unlikely. In such case, can you please provide clues on how one can map it - some amount of manual steps and tweaks, if expected, are fine.
Thanks for your inputs!
Best answer by Ola Liabøtrø
Hi! Is the table in a separate file, or in the same file?
At least if it is in the same file, one could consider to just detect the tags in the table. Just being able to navigate by clicking the numbers would be a plus, but especially since the tags seem to be very similar, I would think that a navigating user would be just as happy to see the table (with some extra information) as seeing the drawing in this case. E.g. how do they decide if they want to check out 54 rather than 55 here?
That said, an attempt to do it could proceed as follows:
Run regular diagram detect to detect known tags
For each detected tag named ABC123 with id X, produce the sample “00 [ABC123]”, also add a sample “00”.
Run diagram detect in beta with pattern_mode=True, min_tokens=1 and entities=[{“sample”:sample, “id”: X}]
The detections will now have names like “60 T-00XX”, but also “60”, “51” etc.
Finally, for each detection of a single two-digit number “XX” with a corresponding pattern detection “XX <TAG>” and regular detection of “<TAG>”, take the box of XX and insert the data corresponding to the tag and make annotations accordingly.
Hi! Is the table in a separate file, or in the same file?
At least if it is in the same file, one could consider to just detect the tags in the table. Just being able to navigate by clicking the numbers would be a plus, but especially since the tags seem to be very similar, I would think that a navigating user would be just as happy to see the table (with some extra information) as seeing the drawing in this case. E.g. how do they decide if they want to check out 54 rather than 55 here?
That said, an attempt to do it could proceed as follows:
Run regular diagram detect to detect known tags
For each detected tag named ABC123 with id X, produce the sample “00 [ABC123]”, also add a sample “00”.
Run diagram detect in beta with pattern_mode=True, min_tokens=1 and entities=[{“sample”:sample, “id”: X}]
The detections will now have names like “60 T-00XX”, but also “60”, “51” etc.
Finally, for each detection of a single two-digit number “XX” with a corresponding pattern detection “XX <TAG>” and regular detection of “<TAG>”, take the box of XX and insert the data corresponding to the tag and make annotations accordingly.
Thank you for your answers, I’ll be curious to try these steps myself. For the start how do I run the “diagram detect” program with the specified pattern modes. I am sure there is an API, a ready reference/guide will be very helpful indeed.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.