mhamilton723 / STEGO

Unsupervised Semantic Segmentation by Distilling Feature Correspondences
MIT License
712 stars 143 forks source link

Provide explanation for the demo? #40

Open Benben0506 opened 2 years ago

Benben0506 commented 2 years ago

with torch.no_grad(): code1 = model(img) code2 = model(img.flip(dims=[3])) code = (code1 + code2.flip(dims=[3])) / 2 code = F.interpolate(code, img.shape[-2:], mode='bilinear', align_corners=False) linear_probs = torch.log_softmax(model.linear_probe(code), dim=1).cpu() cluster_probs = model.cluster_probe(code, 2, log_probs=True).cpu()

single_img = img[0].cpu() linear_pred = dense_crf(single_img, linear_probs[0]).argmax(0) cluster_pred = dense_crf(single_img, cluster_probs[0]).argmax(0)

Hi, I am not sure why you do the first three lines for the input picture? Could you please provide some comments? Thanks a lot!

Sahas-Ananth commented 1 year ago

with torch.no_grad(): code1 = model(img) code2 = model(img.flip(dims=[3])) code = (code1 + code2.flip(dims=[3])) / 2 code = F.interpolate(code, img.shape[-2:], mode='bilinear', align_corners=False) linear_probs = torch.log_softmax(model.linear_probe(code), dim=1).cpu() cluster_probs = model.cluster_probe(code, 2, log_probs=True).cpu()

single_img = img[0].cpu() linear_pred = dense_crf(single_img, linear_probs[0]).argmax(0) cluster_pred = dense_crf(single_img, cluster_probs[0]).argmax(0)

Hi, I am not sure why you do the first three lines for the input picture? Could you please provide some comments? Thanks a lot!

Hey did you find a solution?

EDIT: I think he kinda gave an explanation in #22.