MCPcopy
hub / github.com/yangchris11/samurai / process

Method process

lib/test/tracker/data_utils.py:11–17  ·  view source on GitHub ↗
(self, img_arr: np.ndarray, amask_arr: np.ndarray)

Source from the content-addressed store, hash-verified

9 self.std = torch.tensor([0.229, 0.224, 0.225]).view((1, 3, 1, 1)).cuda()
10
11 def process(self, img_arr: np.ndarray, amask_arr: np.ndarray):
12 # Deal with the image patch
13 img_tensor = torch.tensor(img_arr).cuda().float().permute((2,0,1)).unsqueeze(dim=0)
14 img_tensor_norm = ((img_tensor / 255.0) - self.mean) / self.std # (1,3,H,W)
15 # Deal with the attention mask
16 amask_tensor = torch.from_numpy(amask_arr).to(torch.bool).cuda().unsqueeze(dim=0) # (1,H,W)
17 return NestedTensor(img_tensor_norm, amask_tensor)
18
19
20class PreprocessorX(object):

Callers 5

getThumbnailImageDataOldFunction · 0.45
initializeMethod · 0.45
trackMethod · 0.45
initializeMethod · 0.45
trackMethod · 0.45

Calls 2

NestedTensorClass · 0.90
toMethod · 0.45

Tested by

no test coverage detected