| 1036 | self.grounding = (self.load_model()).to(self.device) |
| 1037 | |
| 1038 | def download_parameters(self): |
| 1039 | url = "https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth" |
| 1040 | if not os.path.exists(self.model_checkpoint_path): |
| 1041 | wget.download(url,out=self.model_checkpoint_path) |
| 1042 | config_url = "https://raw.githubusercontent.com/IDEA-Research/GroundingDINO/main/groundingdino/config/GroundingDINO_SwinT_OGC.py" |
| 1043 | if not os.path.exists(self.model_config_path): |
| 1044 | wget.download(config_url,out=self.model_config_path) |
| 1045 | def load_image(self,image_path): |
| 1046 | # load image |
| 1047 | image_pil = Image.open(image_path).convert("RGB") # load image |