Class Label miscount while creating image masks for semantic segmentation

Hey all,

When making a table of images with image masks, I realized wandb keeps the greatest amount of labels out of all the images as opposed to giving each image in a column its appropriate amount of labels. Ex: If I have 2 images, 1 with 5 labels and another with 11 labels, both image will have 11 labels as opposed to one with 5 and another with 11. I already debugged my code to make sure every time I created a dictionary with the appropriate amount of labels and passed it in as an argument, not sure why the final outcome in wandb still comes out with the wrong labels.


Hi @uahmed1 , I will take a look at this for you. Can you please provide me the following:

  • Link to your workspace where you are experiencing this behavior
  • Code example of how you are generating table, adding images, and assigning their labels. This will help me in attempting to recreate your specific issue.


Working on a locked workspace but here are some snippets of the issue:

for x in range(0, subset_val):
        example_id = dataset[x][0]
        data = dict(zip(field_names, dataset[x][1:]))
        AddToTable(tbl, x, example_id, data)

def AddToTable(table, indx, ex_id, data):
 """Creating Face Label then adding to table"
   face_labels = wandb.Image(img, masks={
        "predictions": {
            "mask_data": face_data,
            "class_labels": LabelMaker(face_data, "face")

    table.add_data(indx, ex_id, roof_img, face_labels.....)

def LabelMaker(data, labelName):
    total_unique_values = np.unique(data).size
    myDict = {}
    for x in range(0, total_unique_values):
        myDict[x] = labelName + '_' + str(x+1)
    return myDict


Hi @uahmed1 , wanted to followup with you on this. If you were to log individual images with masks then yes, their unique classes get logged with them. In tables however we populated all class labels in the UI regardless of user input. I can understand why this leads to confusion for some users. I will bring it up to our teams attention for review on addressing this confusion.


1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.