silverbulletmdc / PVEN

Parsing based vehicle ReID
109 stars 24 forks source link

Constant local features! #49

Open hamid-mp opened 2 years ago

hamid-mp commented 2 years ago

Hi, Thanks for sharing your great work, I'm using your code but when I want to calculate the local features distance, I see that for every image I have same values!! what is wrong? here is the code:

img1 = (Image.open(...))
img2 = (Image.open(...))
import torchvision.transforms as transforms
tran = transforms.ToTensor()
img1 = tran(img1)
img2 = tran(img2)
img1 = img1.unsqueeze(0)
img2 = img2.unsqueeze(0)
model.eval()
with torch.no_grad():
    output = model(img1)
    global_feat = output["global_feat"]
    local_feat = output["local_feat"]
    vis_score = output["vis_score"] 
    global_feats = F.normalize(global_feat, dim=1, p=2)
    local_feats = F.normalize(local_feat, dim=1, p=2)
    # Follow same for image 2

but local feat for image1 and image 2 is equal, I think it is due to lack of mask for input image. In general How should I infere an image to extract it's features? How should I generate a mask for my custom image?

silverbulletmdc commented 2 years ago

You can refer to the code in examples/parsing.