Dusty-nv sgmentation threshold setting option?

Hi,

I can set threshold in object detection, but I found out there is no threshold option in segmentation.

The problem right now is that I have trained my own segmentation model. And when I run the test set, there are two pictures that segmentation area cannot cover the whole ground truth area, I want to reduce the threshold to see if the segmentation area increase. Thx

optional --network flag changes the segmentation model being used (see above)
optional --visualize flag accepts mask and/or overlay modes (default is overlay)
optional --alpha flag sets the alpha blending value for overlay (default is 120)
optional --filter-mode flag accepts point or linear sampling (default is linear)

Hi,

It looks like the output is set to the argmax of all the classes directly.

Thanks.

Hi,
May I know if there is any other way I can adjust the segmentation area coverage?
I have already trained my custom segmentation training using 100 epoch…, Is there any option I can do with the training?
I follow this link for training. Thx

@AK51 how many images are in your training dataset? Typically if the model is underperforming and needs higher accuracy, you would add more training data. Or you could try using FCN-ResNet34/50 instead of FCN-ResNet18 and see if that helps.

And you could try manually adding a threshold in the code that @AastaLLL linked to, and fall back to a default class if the threshold was not exceeded. However, as Aasta also pointed out, the output is already the argmax of all the classes, so I feel this issue would best be resolved when training the model (and/or by augmenting your dataset). Otherwise you may be constantly adjusting the thresholds.

Dear Dusty and AastaLLL,
They are MRI images. It is about 140 images in total. 80% training, 10% validation, and 10% testing.
I got a good result in k-flop cross validation where k=10
There are only 2 pictures that the segmentation is smaller than the ground truth. I want to see if there is any option I can improve the result. Particular on these two pictures is fine.

I am using resnet-101 already.

For that 2 particular pictures, I want to see the result if I tune down the threshold value.
I am looking at segnet,cpp, not really sure where is the threshold, may I have more hint? p-max, c-max?
Thx

@AK51 this is a small dataset and if you want to further improve the accuracy, I would recommend adding more annotated images. It sounds like it’s already working fairly well for you though, and tailoring the model to achieve a specific result (i.e. on a couple test images) can be hit or miss, whether it be during training or inference.

There isn’t a threshold currently, because they aren’t typically used with segNet. What the p-max and c-max are doing in that code, is finding the argmax (the class with the maximum probability). It loops through each output class logit and keeps track of the maximum probability so far (p-max) and corresponding class index (c-max). Then it sets the output class map to that class index.

What you could try instead, is if the argmax probability is less than your threshold, set it to a default class index instead:

if( p_max < 0.5f )   // your threshold
   c_max = 0;        // default class index

classMap[y * s_w + x] = c_max;

I am unsure about what other side-effects this might have on your other images, but you can experiment with it.

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