deeptibhegde / CLIP-goes-3D

Official code release of "CLIP goes 3D: Leveraging Prompt Tuning for Language Grounded 3D Recognition"
https://jeya-maria-jose.github.io/cg3d-web/
215 stars 11 forks source link

Error with eval.py #13

Closed Usrui closed 1 year ago

Usrui commented 1 year ago

python eval.py --config cfgs/ShapeNet55_models/PointTransformerVPTbak.yaml --exp_name expt --ckpts point_transformer_1k.pth --slip_model models/SLIP/slip_base_100ep.pt ############### error ############## Traceback (most recent call last): File "/home/xxx/CLIP-goes-3D/eval.py", line 399, in main() File "/home/xxx/CLIP-goes-3D/eval.py", line 224, in main cls_acc = validate(base_model,test_dataloader, val_writer, args, config) File "/home/xxx/CLIP-goes-3D/eval.py", line 382, in validate pred = logits.argmax(-1).view(-1) AttributeError: 'tuple' object has no attribute 'argmax'

############### code ################

with torch.no_grad():
    for idx, (taxonomy_ids, model_ids, data) in enumerate(test_dataloader):
        points = data[0].cuda()
        label = data[1].cuda()

        points = misc.fps(points, npoints)

        if config.model.NAME == 'PointMLP' or config.model.NAME == 'PointConv':
            logits = base_model(points.permute(0,2,1).contiguous())
        else:
            logits = base_model(points)
        target = label.view(-1)

        pred = logits.argmax(-1).view(-1)

        # pred = torch.argmax(logits,dim=-1).view(-1)
        test_pred.append(pred.detach())
        test_label.append(target.detach())

######################## can I know why this 'pred' are tuple type not the tensor ?

deeptibhegde commented 1 year ago

In case you are performing zero-shot evaluation, please make sure to add the --zshot tag. In case you are performing fine-tune inference, remove the tag and make sure to use the appropriate configuration file (ex: CLIP-goes-3D/cfgs/ModelNet_models/PointTransformer.yaml)

deeptibhegde commented 1 year ago

closing, please feel free to open if further issues are faced