I am trying to use the KNIME image processing tools and would like to extract the labels that I created after using node connected component analysis. Is there a way to export input images+annotations as something like collections etc. ? My second question if exporting is possible then, could we export the labels in coco json or json format?
There are in fact multiple ways of exporting your labels - it depends on what you want to do with them. Exporting the labels as json will hardly work, as a json is basically a string representation - you can think of using the base64 representation, but I doubt this is what you really want.
I would probably go with a Segmennt Features node after the Connected Component Analysis. Besides calculating all kinds of interesting features of each label, it gives the labels as a bitmask. The Bitmasks you can save to disk with an Image Writer and the rest of the table you can convert to a json with the Table to JSON and write with a JSON Writer.
But as said, it depends a little bit on what you intend to do with the data afterwards - could you elaborate on that? Maybe there is a more fitting solution.
Many thanks for the quick response. I want to use knime for labeling purposes for my training data and the reason why i choose knime is that its capability of image pre-processing.I use some other nodes before connected component analysis to reduce noise, applying threshold etc.
I followed your description and it works. I guess the same applies also for yolo format, but with .csv writer and then i need to convert it to .txt format.
My last question is that which node should i use to determine the coordinates of labeling ? I have DimensionX-Y-Z and Centroid X-Y-Z from segment features but i need to have polygonal point coordinates information to capture the contour of the object.
Thanks,
Canset
I’m glad it works! Getting the vertices of the polygon sounds difficult to me right now - do you maybe have an example of your labelings? How and where do you specify the vertices of the polygon - maybe there is a way of getting them right there in order to save them out? If not, I can think of the Convex Hull node, which you could apply to the bitmask of your labeling. Maybe this would help to find a non-pixel representation of the outline, e.g. via python or the like?
I mean with using interactive annotator, i already created polygon labels. Is there a way to access point information from interactive annotator and export as .json format.
unfortunately, it doesn’t seem possible with the Interactive Annotator to get the polygon vertices, at least I can’t think of a way.
A cumbersome approach that might work: You can try and find the polygon lines afterwards, e.g. with a Hough Transform (see e.g. this workflow). If your polygon resembles the shape of a circle, you might abstract them this way and detect circles instead?
Since this is unsatisfactory at best, however, I asked internally whether there is a more clever way of getting the polygon vertices right from the annotator. If there is a better solution I’ll come back to you in this topic and I also added a feature request (for internal reference: AP-11010)