Bug: Missing sigmoid in GroundingSAM2 postprocess & proposed solution #1176
Closed
tiucamaria
started this conversation in
Show and tell
Replies: 1 comment
-
|
Duplicated of #1179 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
I was using your project to detect and segment cars in the UAVID dataset using GroundingSAM2, but I wasn't satisfied with the result, so I decided to investigate further. I tried one of your old examples in the README file so I could compare the outputs, but they weren't the same.
Right now, if you run the GroundingSAM2 model on this image, the output will be:
Next, I checked which objects were being detected, and here I found the problem: the exact DINO model used in GorundingSAM2 is the same as the one that produces these results:
Then, I tested it again on one of my UAVID images, where I knew some objects should be detected. I printed the scores and noticed that the predictions returned values of 1.x instead of being in the range (0, 1). In the GroundingSAM2 file is omitted to apply the sigmoid (sig function). Here is how I modified the code:
def postprocess(
self, outputs, caption, with_logits=True, token_spans=None
):
logits, boxes = outputs
# logits_filt = np.squeeze(
# logits, 0
# ) # [0] # prediction_logits.shape = (nq, 256)
logits_filt = self.sig(np.squeeze(logits, 0)) # BUG SOLVED
......
See the results after adding the call of the sig function:
Beta Was this translation helpful? Give feedback.
All reactions