|
|
@ -25,8 +25,9 @@ to classify and generate a vector for the given video path './archery.mp4' ([dow |
|
|
|
import towhee |
|
|
|
|
|
|
|
( |
|
|
|
towhee.glob('./archery.mp4') |
|
|
|
.video_decode.ffmpeg() |
|
|
|
towhee.dc(['./demo_video.mp4']) |
|
|
|
.video_decode.ffmpeg(sample_type='uniform_temporal_subsample', args={'num_samples': 4}) |
|
|
|
.runas_op(func=lambda x: [y for y in x]) |
|
|
|
.action_classification.video_swin_transformer(model_name='swin_tiny_patch244_window877_kinetics400_1k') |
|
|
|
.show() |
|
|
|
) |
|
|
@ -41,10 +42,10 @@ import towhee |
|
|
|
import towhee |
|
|
|
|
|
|
|
( |
|
|
|
towhee.glob['path']('./archery.mp4') |
|
|
|
.video_decode.ffmpeg['path', 'frames']() |
|
|
|
.action_classification.video_swin_transformer['frames', ('labels', 'scores', 'features')]( |
|
|
|
model_name='swin_tiny_patch244_window877_kinetics400_1k') |
|
|
|
towhee.dc['path']('./demo_video.mp4') |
|
|
|
.video_decode.ffmpeg['path', 'frames'](sample_type='uniform_temporal_subsample', args={'num_samples': 4}) |
|
|
|
.runas_op['frames', 'frames'](func=lambda x: [y for y in x]) |
|
|
|
.action_classification.video_swin_transformer['frames', ('labels', 'scores', 'features')](model_name='swin_tiny_patch244_window877_kinetics400_1k') |
|
|
|
.select['path', 'labels', 'scores', 'features']() |
|
|
|
.show(formatter={'path': 'video_path'}) |
|
|
|
) |
|
|
@ -57,15 +58,20 @@ import towhee |
|
|
|
|
|
|
|
Create the operator via the following factory method |
|
|
|
|
|
|
|
***action_classification.timesformer( |
|
|
|
model_name='timesformer_k400_8x224', skip_preprocess=False, classmap=None, topk=5)*** |
|
|
|
***action_classification.video_swin_transformer( |
|
|
|
model_name='swin_tiny_patch244_window877_kinetics400_1k', skip_preprocess=False, classmap=None, topk=5)*** |
|
|
|
|
|
|
|
**Parameters:** |
|
|
|
|
|
|
|
***model_name***: *str* |
|
|
|
|
|
|
|
The name of pre-trained model. Supported model names: |
|
|
|
- timesformer_k400_8x224 |
|
|
|
- swin_tiny_patch244_window877_kinetics400_1k |
|
|
|
- swin_base_patch244_window877_kinetics400_1k |
|
|
|
- swin_small_patch244_window877_kinetics400_1k |
|
|
|
- swin_base_patch244_window877_kinetics400_22k |
|
|
|
- swin_base_patch244_window877_kinetics600_22k |
|
|
|
- swin_base_patch244_window1677_sthv2 |
|
|
|
|
|
|
|
***skip_preprocess***: *bool* |
|
|
|
|
|
|
|