When using CPU to run app.py, the following error will occur
File "/home/ao/Project/Segmentation/cliper.code/app.py", line 54, in process_image
embedding[(fg_text_features @ embedding.T).sort().indices[:, ::1500]].flatten(0, 1)],
RuntimeError: expected scalar type Float but found Half
A way to fix it is to edit the line 52 of app.py when using CPU:
bg_text_features = CLIPer.cliper.classifier(bg_classes, cfg.semantic_templates)
bg_text_features = torch.cat([bg_text_features,
embedding[(fg_text_features.float() @ embedding.T.float()).sort().indices[:, ::1500]].flatten(0, 1)],
dim=0)
# bg_text_features = torch.cat([bg_text_features,
# embedding[(fg_text_features @ embedding.T).sort().indices[:, ::1500]].flatten(0, 1)],
# dim=0)
When using CPU to run
app.py, the following error will occurA way to fix it is to edit the line 52 of
app.pywhen using CPU: