(self, image, need_preprocess=False)
| 46 | return name |
| 47 | |
| 48 | def get_image_features(self, image, need_preprocess=False): |
| 49 | if need_preprocess: |
| 50 | image = self.preprocess(image).unsqueeze(0).to(self.device) |
| 51 | with torch.no_grad(): |
| 52 | image_features = self.model.encode_image(image) |
| 53 | return image_features |
| 54 | |
| 55 | def get_text_feature(self, text): |
| 56 | text = clip.tokenize(text).to(self.device) |
no outgoing calls
no test coverage detected