(self)
| 1057 | return image_pil, image |
| 1058 | |
| 1059 | def load_model(self): |
| 1060 | args = SLConfig.fromfile(self.model_config_path) |
| 1061 | args.device = self.device |
| 1062 | model = build_model(args) |
| 1063 | checkpoint = torch.load(self.model_checkpoint_path, map_location="cpu") |
| 1064 | load_res = model.load_state_dict(clean_state_dict(checkpoint["model"]), strict=False) |
| 1065 | print(load_res) |
| 1066 | _ = model.eval() |
| 1067 | return model |
| 1068 | |
| 1069 | def get_grounding_boxes(self, image, caption, with_logits=True): |
| 1070 | caption = caption.lower() |