MCPcopy Create free account
hub / github.com/ICTMCG/FakeSV / pad_sequence_bbox

Function pad_sequence_bbox

code/run.py:44–57  ·  view source on GitHub ↗
(seq_len,lst)

Source from the content-addressed store, hash-verified

42 return torch.stack(result)
43
44def pad_sequence_bbox(seq_len,lst):
45 result=[]
46 for video in lst:
47 if isinstance(video, list):
48 video = torch.stack(video)
49 ori_len=video.shape[0]
50 if ori_len == 0:
51 video = torch.zeros([seq_len,45,4096],dtype=torch.float)
52 elif ori_len>=seq_len:
53 video=torch.FloatTensor(video[:seq_len])
54 else:
55 video=torch.cat([video,torch.zeros([seq_len-ori_len,45,4096],dtype=torch.float)],dim=0)
56 result.append(video)
57 return torch.stack(result)
58
59def pad_frame_sequence(seq_len,lst):
60 attention_masks = []

Callers 1

bbox_collate_fnFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected