Cartucho/vision_blender

read_data.py segmentation error

sallydly opened this issue · 3 comments

Hello,
I was testing the addon and noticed that read_data.py doesn't display any segmentation masks past pass_index=1. I've fixed this on my side to display all the masks for my project but just wanted to note in case this wasn't intentional.

For the demo, I just read the first pass_index. However, I understand that it is confusing if the other ones do not show, right?

The challenge is that we never really know how many pass indexes and which ones were set by the user. Imagine if the user set's the object index to 100, should I loop from 0 to 255 and check if any of them exist? That would be too slow.

I guess a way to avoid that would be to save in the .npz file all the existing indexes, and to which objects they correspond.

I changed the code so that the addon also stores the pass_indexes in the .npz file.
The colours will be automatically distributed for the different indexes in the sample code now.

Here is an example if the cube in the middle has pass_index = 1 and the other two pass_index = 2

image

I agree that the solution was not so simple considering the variability of what the user could input as a pass index. Thank you for your solution! I've pulled and tested with my own project and it works well.