Browse Source
skip
Signed-off-by: xujinling <jinling.xu@zilliz.com>
main
xujinling
2 years ago
1 changed files with
3 additions and
0 deletions
-
video_swin_transformer.py
|
@ -65,11 +65,14 @@ class VideoSwinTransformer(NNOperator): |
|
|
mean=[0.485, 0.456, 0.406], |
|
|
mean=[0.485, 0.456, 0.406], |
|
|
std=[0.229, 0.224, 0.225], |
|
|
std=[0.229, 0.224, 0.225], |
|
|
) |
|
|
) |
|
|
|
|
|
self.model.eval() |
|
|
|
|
|
|
|
|
def decoder_video(self, data: List[VideoFrame]): |
|
|
def decoder_video(self, data: List[VideoFrame]): |
|
|
video = numpy.stack([img.astype(numpy.float32) / 255. for img in data], axis=0) |
|
|
video = numpy.stack([img.astype(numpy.float32) / 255. for img in data], axis=0) |
|
|
assert len(video.shape) == 4 |
|
|
assert len(video.shape) == 4 |
|
|
video = video.transpose(3, 0, 1, 2) # twhc -> ctwh |
|
|
video = video.transpose(3, 0, 1, 2) # twhc -> ctwh |
|
|
|
|
|
if self.skip_preprocess: |
|
|
|
|
|
self.transform_cfgs.update(num_frames=None) |
|
|
video = transform_video( |
|
|
video = transform_video( |
|
|
video=video, |
|
|
video=video, |
|
|
**self.transform_cfgs |
|
|
**self.transform_cfgs |
|
|