Identifying Image Overlap Between Tasks

2021273020001: We’re working with overlapped regions aka identical areas between images. These regions share a certain degree of similarity but are otherwise (!) unique for each group (!) of image. A group usually (98% of time) consists of two images, but sometimes it may include three or even four images. Basically, a part of image 1 contains a region A, then a part of image 2 contains the same region A; a part of image 3 contains a region B [and so on…]. As you can see, the region A is present only in image 1 and 2 and is not found in other images. So, we need to annotate these regions. We don’t think that merging images into one is a good idea due to a variety of reasons, so we’re trying to find a solution in labelstudio. The problem is we don’t know what tool we should select for annotation. We definitely can’t create specific annotations (labels) for each identical area since annotations are used for the entire project and we’re dealing with thousands of images. The way we see it is we should somehow “connect” images containing the overlapped region and simply annotate that region, which is, again, different between each group of “connected” images. Thus, if we’re able to “connect” images, then we only need one annotation called “overlapped region”. But how to “connect” images? We read about adding relations (https://labelstud.io/guide/labeling.html#Add-relations-between-annotations|https://labelstud.io/guide/labeling.html#Add-relations-between-annotations) and pairwise (https://labelstud.io/tags/pairwise|https://labelstud.io/tags/pairwise), but we’re not very sure which one to use or even whether any of them is suitable for this. Could anybody please tell us how to proceed?

2021273020001: To whoever encounters the same question. Here’s an answer from help center:

The relations and pairwise features you mentioned are used to create relationships between different regions within the same image, not across different images. Unfortunately, there isn’t a built-in feature in Label Studio that would allow you to “connect” images or annotate regions across multiple images.

Shivansh: From what I understand you have pairs or sets of images where each set contains a similar region that you want to annotate.

So, why not only annotate one image per image group in Label Studio.

Then, write a python script that maps each annotation to respective image group (assuming that there only needs to be one unique annotation per image group). In this step, make sure that your image files for each image group are similar to make it easier to match the ground truth in your script.

Then, duplicate the ground truth for however many are in each image group.

Using the above, you only need to worry about doing one annotation per group in Label Studio. Then, the script can parse the inputs and do everything you want to afterwards.

Let me know if I interpreted your request incorrectly. If you think I understand but you don’t get what I am saying, I can write some pseudocode to make this make more sense.

2021273020001: @Shivansh thank you for your reply. You understood everything correctly. But it was a mistake on my side to not attach an illustration. Could you please send me pseudocode?

Note: Image1.jpg shows that identical regions may be simultaneously present within an image and between/among images, but you may ignore this.

2021273020001: @Shivansh I don’t want to be a nuisance, but if you don’t have time to write pseudocode, could you please say it so I wouldn’t have my hopes up?

Shivansh: Oh so sorry about this I have had a lot of work lately outside of support and forgot to answer through my threads (silly me). Give me a bit and I’ll send what I’ve got.

2021273020001: Alright, thanks, I’m looking forward to seeing it lol Could you please DM me your full name? If your suggestion works, I’ll be more than happy to mention your name in acknowledgement of an article we’re planning to publish and my thesis.

Shivansh:

Shivansh: Took me a bit to find how to do template matching, but here you go. <https://stackoverflow.com/a/9253805|Here’s the link> to the stack overflow post.

2021273020001: Thank you very much, I’ll check it out

Note: This post was generated by the Label Studio Archive Bot from a conversation in the Label Studio Slack, a gathering place for the Label Studio community. Someone in the community thought this was worth sharing!

If this post answered a question for you, hit the Like button - we use that to assess which posts to put into docs.