MCPcopy Create free account
hub / github.com/LYX0501/DiscussNav / __init__

Method __init__

DiscussNav.py:122–138  ·  view source on GitHub ↗
(self, ram_path, current_rgb_path="current_view.jpg", view_record_path="cache_files/view_cache.json")

Source from the content-addressed store, hash-verified

120
121class Vision_Perception_Experts:
122 def __init__(self, ram_path, current_rgb_path="current_view.jpg", view_record_path="cache_files/view_cache.json"):
123 self.current_rgb_path = current_rgb_path
124 self.view_record_path = view_record_path
125 if os.path.exists(self.view_record_path):
126 with open(self.view_record_path, "r", encoding="utf-8") as file:
127 self.view_record = json.load(file)
128 else:
129 self.view_record = {}
130
131 while True:
132 try:
133 self.instructblip_model, self.instructblip_vis_processors, _ = load_model_and_preprocess(name="blip2_t5_instruct", model_type="flant5xl", is_eval=True, device=device)
134 self.ram_transform = get_transform(image_size=384)
135 self.ram_model = ram(pretrained=ram_path, image_size=384, vit='swin_l').eval().to(device)
136 break
137 except:
138 continue
139
140 def ram_img_tagging(self, image):
141 ram_img = self.ram_transform(image).unsqueeze(0).to(device)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected