MCPcopy Create free account
hub / github.com/Gabesarch/ICAL / update

Method update

TEACh/task_base/object_tracker.py:213–491  ·  view source on GitHub ↗

rgb: RGB image depth: depth image camX0_T_camX: rotation pose matrix to go from reference frame to current frame

(
        self, 
        rgb, 
        depth, 
        camX0_T_camX, 
        return_det_dict=False, 
        use_gt=False, 
        target_object=None, 
        only_keep_target=False,
        vis=None, 
        return_features=False,
        force_update_odin=False,
        )

Source from the content-addressed store, hash-verified

211 )).double()
212
213 def update(
214 self,
215 rgb,
216 depth,
217 camX0_T_camX,
218 return_det_dict=False,
219 use_gt=False,
220 target_object=None,
221 only_keep_target=False,
222 vis=None,
223 return_features=False,
224 force_update_odin=False,
225 ):
226 '''
227 rgb: RGB image
228 depth: depth image
229 camX0_T_camX: rotation pose matrix to go from reference frame to current frame
230 '''
231
232 if args.simulate_actions:
233 # do not update if simulating
234 return
235
236 out = {}
237
238 if not (depth.shape[-2]==self.W and depth.shape[-1]==self.H):
239 depth = cv2.resize(depth, (self.W, self.H), interpolation=cv2.INTER_NEAREST)
240
241
242 ####### DETECT OBJECTS ##########
243 if self.use_gt_objecttrack:
244 pred_scores, pred_labels, pred_boxes_or_masks, centroids_gt, attributes_gt = self.get_objects_gt(self.controller, depth)
245 if not args.use_gt_centroids:
246 if len(pred_boxes_or_masks)>0:
247 depth_ = torch.from_numpy(depth).cuda().unsqueeze(0).unsqueeze(0)
248 xyz = utils.geom.depth2pointcloud(depth_, torch.from_numpy(self.pix_T_camX).cuda().unsqueeze(0).float())
249 xyz_origin = utils.geom.apply_4x4(camX0_T_camX.cuda().float(), xyz).squeeze().cpu().numpy()
250 xyz_origin = xyz_origin.reshape(1,self.W,self.H,3)
251 else:
252 centroids = []
253 elif self.use_odin:
254 if not force_update_odin:
255 depth = self.navigation.task.get_observations()["depth"].copy()
256 depth[depth < 0.5] = 0.
257 self.odin_input_dict['images'].append(rgb.copy())
258 self.odin_input_dict['depths'].append(depth)
259 origin_T_camX = self.world_t_weird @ camX0_T_camX
260 self.odin_input_dict['poses'].append(origin_T_camX)
261 self.odin_input_dict['intrinsics'].append(self.pix_T_camX)
262 self.steps_since_odin_update += 1
263 if self.steps_since_odin_update>args.odin_update_frequency or force_update_odin:
264 pred_boxes_or_masks, pred_labels, pred_scores, centroids_odin, crops_odin = self.multiview_detector.get_masks(
265 self.odin_input_dict,
266 target_class=target_object,
267 id_to_mapped_id=self.id_to_mapped_id,
268 )
269 self.steps_since_odin_update = 0
270 else:

Callers 15

search_local_regionMethod · 0.45
step_backMethod · 0.45
explore_envMethod · 0.45
bring_head_to_angleMethod · 0.45
take_actionMethod · 0.45
get_state_changesFunction · 0.45
apply_state_diffFunction · 0.45

Calls 13

get_objects_gtMethod · 0.95
get_label_of_holdingMethod · 0.95
get_crop_from_maskMethod · 0.95
check_for_detectionsFunction · 0.90
resizeMethod · 0.80
apply_4x4Method · 0.80
get_masksMethod · 0.80
add_frameMethod · 0.80

Tested by

no test coverage detected