diff --git a/PyTorch/contrib/cv/video/SlowFast/README.md b/PyTorch/contrib/cv/video/SlowFast/README.md index 0029cd0acd22215893a9dc06bf8b8b47a9ca1292..1efe488b875c29a40f179fa111e8ecca280d31c3 100644 --- a/PyTorch/contrib/cv/video/SlowFast/README.md +++ b/PyTorch/contrib/cv/video/SlowFast/README.md @@ -68,12 +68,12 @@ Log Path: - slowfast_eval_8p.log # 8p 测试模型验证集精度日志 - slowfast_finetune_1p.log # 1p 下 fine-tuning 日志 -## TSM-NonLocal 训练结果 +## SlowFast 训练结果 | top1 acc (单view) | FPS | Epochs | AMP_Type | Device | | :---: | :-----: | :---: | :------: | :------: | -| - | 11 | 1 | O1 | 1p Npu | -| 33.43 (30 epochs) | 81 | 256 | O1 | 8p Npu | +| - | 18 | 1 | O1 | 1p Npu | +| 31.43 (30 epochs) | 95 | 256 | O1 | 8p Npu | | - | 14 | 1 | O1 | 1p Gpu | | 30.24 (30 epochs) | 86 | 256 | O1 | 8p Gpu | diff --git a/PyTorch/contrib/cv/video/SlowFast/config/slowfast_r50_8x8x1_256e_kinetics400_rgb.py b/PyTorch/contrib/cv/video/SlowFast/config/slowfast_r50_8x8x1_256e_kinetics400_rgb.py index 7aeb7b41a0257200aba733ae30e907e6e72e843a..8090ca9cc9b953ce602b32ccf2de8cade398a307 100644 --- a/PyTorch/contrib/cv/video/SlowFast/config/slowfast_r50_8x8x1_256e_kinetics400_rgb.py +++ b/PyTorch/contrib/cv/video/SlowFast/config/slowfast_r50_8x8x1_256e_kinetics400_rgb.py @@ -113,6 +113,6 @@ work_dir = './work_dirs/slowfast_r50_3d_8x8x1_256e_kinetics400_rgb' DEVICE_ID = 0 AMP = True OPT_LEVEL = "O1" -LOSS_SCALE = 128.0 +LOSS_SCALE = "dynamic" dist_params = dict(backend='hccl') diff --git a/PyTorch/contrib/cv/video/SlowFast/requirements.txt b/PyTorch/contrib/cv/video/SlowFast/requirements.txt index 3378c79f4c296807e850be8b48b61f1752c838db..c9c97915cf1a98eb7e11ab6c44f36805311edfe2 100644 --- a/PyTorch/contrib/cv/video/SlowFast/requirements.txt +++ b/PyTorch/contrib/cv/video/SlowFast/requirements.txt @@ -1,5 +1,5 @@ -torch==1.5.0 -torchvision==0.6.0 +torch==1.8.1 +torchvision==0.9.1 addict==2.4.0 decorator==5.1.0 decord==0.6.0 diff --git a/PyTorch/contrib/cv/video/SlowFast/test.py b/PyTorch/contrib/cv/video/SlowFast/test.py index 2d859e1e19a5b15a62032b45b28c11a4746ae823..735f508b57b2076a1fabf687c23edc7f665a3b19 100644 --- a/PyTorch/contrib/cv/video/SlowFast/test.py +++ b/PyTorch/contrib/cv/video/SlowFast/test.py @@ -19,6 +19,8 @@ import warnings import mmcv import torch +if torch.__version__>= '1.8.1': + import torch_npu import numpy as np from apex import amp from mmcv import Config, DictAction diff --git a/PyTorch/contrib/cv/video/SlowFast/test/train_full_8p.sh b/PyTorch/contrib/cv/video/SlowFast/test/train_full_8p.sh index 393551ed168e6aff95e0c3544eaea623e21ad3f1..da430bba02f50589f7902e6043bd14a2561d1f06 100644 --- a/PyTorch/contrib/cv/video/SlowFast/test/train_full_8p.sh +++ b/PyTorch/contrib/cv/video/SlowFast/test/train_full_8p.sh @@ -64,7 +64,7 @@ currentDir=$(cd "$(dirname "$0")";pwd) source ${currentDir}/env_npu.sh -taskset -c 0-47 python3.7.5 -m torch.distributed.launch --nproc_per_node=$gpus --master_port=$port \ +nohup taskset -c 0-47 python -m torch.distributed.launch --nproc_per_node=$gpus --master_port=$port \ ${currentDir}/../train.py --validate --launcher pytorch --cfg-options data.videos_per_gpu=${batch_size} \ --gpu-ids 0 --data_root ${data_path} --work-dir ./result > ${test_path_dir}/output/${ASCEND_DEVICE_ID}/slowfast_train_full_8p_${ASCEND_DEVICE_ID}.log 2>&1 & diff --git a/PyTorch/contrib/cv/video/SlowFast/test/train_performance_1p.sh b/PyTorch/contrib/cv/video/SlowFast/test/train_performance_1p.sh index 6c959cf6268cd350971c67c1f3a158636cfd5dcd..a46c1af1d325df14f19244cbc0f56be5759ada57 100644 --- a/PyTorch/contrib/cv/video/SlowFast/test/train_performance_1p.sh +++ b/PyTorch/contrib/cv/video/SlowFast/test/train_performance_1p.sh @@ -69,7 +69,7 @@ currentDir=$(cd "$(dirname -- "$0")";pwd) source ${currentDir}/env_npu.sh -python3.7.5 -u ${currentDir}/../train.py --data_root ${data_path} --cfg-options optimizer.lr=0.05 total_epochs=1 data.videos_per_gpu=${batch_size} \ +python -u ${currentDir}/../train.py --data_root ${data_path} --cfg-options optimizer.lr=0.05 total_epochs=1 data.videos_per_gpu=${batch_size} \ --resume-from . > ${test_path_dir}/output/${ASCEND_DEVICE_ID}/slowfast_train_per_1p_${ASCEND_DEVICE_ID}.log 2>&1 & diff --git a/PyTorch/contrib/cv/video/SlowFast/train.py b/PyTorch/contrib/cv/video/SlowFast/train.py index d70921410f17d95ccf11cb0ccbc8ff5171c78d9a..64e6526f65469fdd74f78ff50dd18a8916111735 100644 --- a/PyTorch/contrib/cv/video/SlowFast/train.py +++ b/PyTorch/contrib/cv/video/SlowFast/train.py @@ -26,6 +26,8 @@ import torch.distributed as dist import mmcv import torch +if torch.__version__>= '1.8.1': + import torch_npu from mmcv import Config, DictAction from mmcv.runner import get_dist_info, init_dist, set_random_seed from mmcv.utils import get_git_hash