MCPcopy Create free account
hub / github.com/chenfei-wu/TaskMatrix / __init__

Method __init__

visual_chatgpt.py:803–815  ·  view source on GitHub ↗
(self, device)

Source from the content-addressed store, hash-verified

801
802class Segmenting:
803 def __init__(self, device):
804 print(f"Inintializing Segmentation to {device}")
805 self.device = device
806 self.torch_dtype = torch.float16 if 'cuda' in device else torch.float32
807 self.model_checkpoint_path = os.path.join("checkpoints","sam")
808
809 self.download_parameters()
810 self.sam = build_sam(checkpoint=self.model_checkpoint_path).to(device)
811 self.sam_predictor = SamPredictor(self.sam)
812 self.mask_generator = SamAutomaticMaskGenerator(self.sam)
813
814 self.saved_points = []
815 self.saved_labels = []
816
817 def download_parameters(self):
818 url = "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth"

Callers

nothing calls this directly

Calls 1

download_parametersMethod · 0.95

Tested by

no test coverage detected