@@ -5,16 +5,16 @@ wget https://download.openmmlab.com/mmaction/recognition/tsm/tsm_r50_1x1x8_50e_k
5
5
# Step 2: Convert pytorch checkpoints to TensorRT weights
6
6
python gen_wts.py tsm_r50_1x1x8_50e_kinetics400_rgb_20200607-af7fb746.pth --out-filename ./tsm_r50_kinetics400_mmaction2.wts
7
7
8
- # Step 3: Skip this step since we use default settings .
9
-
10
- # Step 4: Inference
11
- # 1) Save local engine file to `./tsm_r50_kinetics400_mmaction2.trt`.
8
+ # Step 3: Test Python API .
9
+ # 3.1 Skip this step since we use default settings.
10
+ # 3.2 Inference
11
+ # 3.2.1 Save local engine file to `./tsm_r50_kinetics400_mmaction2.trt`.
12
12
python tsm_r50.py \
13
13
--tensorrt-weights ./tsm_r50_kinetics400_mmaction2.wts \
14
14
--save-engine-path ./tsm_r50_kinetics400_mmaction2.trt
15
15
16
- # 2) Predict the recognition result using a single video `demo.mp4`.
17
- # Should print `Result class id 6`, aka `arm wrestling`
16
+ # 3.2.2 Predict the recognition result using a single video `demo.mp4`.
17
+ # Should print `Result class id 6`, aka `arm wrestling`
18
18
# Download demo video
19
19
wget https://raw.githubusercontent.com/open-mmlab/mmaction2/master/demo/demo.mp4
20
20
# # use *.wts as input
@@ -24,8 +24,8 @@ wget https://raw.githubusercontent.com/open-mmlab/mmaction2/master/demo/demo.mp4
24
24
python tsm_r50.py --load-engine-path ./tsm_r50_kinetics400_mmaction2.trt \
25
25
--input-video ./demo.mp4
26
26
27
- # 3) Optional: Compare inference result with MMAction2 TSM-R50 model
28
- # Have to install MMAction2 First, please refer to https://github.com/open-mmlab/mmaction2/blob/master/docs/install.md
27
+ # 3.2.3 Optional: Compare inference result with MMAction2 TSM-R50 model
28
+ # Have to install MMAction2 First, please refer to https://github.com/open-mmlab/mmaction2/blob/master/docs/install.md
29
29
# pip3 install pytest-runner
30
30
# pip3 install mmcv
31
31
# pip3 install mmaction2
@@ -41,3 +41,15 @@ python tsm_r50.py --load-engine-path ./tsm_r50_kinetics400_mmaction2.trt \
41
41
# --test-mmaction2 \
42
42
# --mmaction2-config mmaction2_tsm_r50_config.py \
43
43
# --mmaction2-checkpoint tsm_r50_1x1x8_50e_kinetics400_rgb_20200607-af7fb746.pth
44
+
45
+ # Step 4: Test Python API.
46
+ # 4.1 Skip this step since we use default settings.
47
+ # 4.2 Build CPP
48
+ mkdir build && cd build && cmake .. && make
49
+ # 4.3 Generate Engine file
50
+ ./tsm_r50 -s
51
+ # 4.4 Get Predictions
52
+ ./tsm_r50 -d
53
+ # 4.5 Compare C++ Results with Python Results
54
+ cd ..
55
+ python tsm_r50.py --test-cpp --tensorrt-weights ./tsm_r50_kinetics400_mmaction2.wts
0 commit comments