pengsongyou/openscene

How to binary classification?

Opened this issue · 0 comments

If I want to locate ‘obj_name’ in a Scannet scene, can the following code work?

text = [clip.tokenize(f'a {obj_name} in a scene').cuda(), clip.tokenize(f'a other in a scene').cuda()]
text_features = clip_pretrained.encode_text(text)
predictions = model(sinput)
predictions = predictions[inds_reverse, :]
pred = predictions.half() @ text_features.t()
logits_pred = torch.max(pred, 1)[1].cpu()  # if it's 0 then is the point to be located