Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Improvement] Set RandAugment as Imgaug default transforms. #585

Merged
merged 13 commits into from Mar 25, 2021

Conversation

irvingzhang0512
Copy link
Contributor

@irvingzhang0512 irvingzhang0512 commented Feb 1, 2021

Use imgaug to reimplement RandAugment.

According to VideoMix, RandAugment helps a little.

image

Results

  • sthv1 & tsm-r50, 8V100, 50epochs
configs top1 acc(efficient/accuracy) top5 acc(efficient/accuracy)
mmaction2 model zoo 45.58 / 47.70 75.02 / 76.12
testing with model zoo ckpt 45.47 / 47.55 74.56 / 75.79
training with default config 45.82 / 47.90 74.38 / 76.02
flip 47.10 / 48.51 75.02 / 76.12
randaugment 47.16 / 48.90 76.07 / 77.92
flip+randaugment 47.85/50.31 76.78/78.18
  • Kinetics400, 8 V100, test with 256x256 & three crops
Models top1/5 accuracy Training lost(epoch 100) training time
TSN-R50-1x1x8-Vanilla 70.74%/89.37% 0.8 2days 12hours
TSN-R50-1x1x8-RandAugment 71.07%/89.40% 1.3 2days 22hours
I3D-R50-32x2x1-Vanilla 74.48%/91.62% 1.1 3days 10hours
I3D-R50-32x2x1-RandAugment 74.23%/91.45% 1.5 4days 10hours

@codecov
Copy link

codecov bot commented Feb 1, 2021

Codecov Report

Merging #585 (2e25cc3) into master (681920e) will increase coverage by 0.04%.
The diff coverage is 100.00%.

❗ Current head 2e25cc3 differs from pull request most recent head 6d90b43. Consider uploading reports for the commit 6d90b43 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #585      +/-   ##
==========================================
+ Coverage   85.44%   85.49%   +0.04%     
==========================================
  Files         130      130              
  Lines        9336     9339       +3     
  Branches     1564     1564              
==========================================
+ Hits         7977     7984       +7     
+ Misses        962      959       -3     
+ Partials      397      396       -1     
Flag Coverage Δ
unittests 85.48% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmaction/datasets/pipelines/augmentations.py 94.85% <100.00%> (+0.52%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 681920e...6d90b43. Read the comment docs.

@irvingzhang0512
Copy link
Contributor Author

@innerlee This pr is ready for review.
It would be great if someone could train kinetics-400 with/without RandAugment.

@innerlee
Copy link
Contributor

innerlee commented Feb 4, 2021

@congee524 would you like to do a comparison with this aug on/off on tsn&i3d?

@congee524
Copy link
Contributor

@congee524 would you like to do a comparison with this aug on/off on tsn&i3d?

oh, hh,I forgot about it. (ノ´д`)

Because of the shortage of resources, it may start this Saturday.

@congee524
Copy link
Contributor

#492

@irvingzhang0512
Copy link
Contributor Author

irvingzhang0512 commented Feb 8, 2021

I did some tests myself, with tsn_r50_video_1x1x8_100e_kinetics400_rgb.py(test with 256 ThreeCrop)

Training loss(epoch 100) is quite large. Maybe more epochs and tuning lr could help to get better results.

Models top1/5 accuracy Training lost(epoch 100) training time
TSN-R50-1x1x8-Vanilla 70.74%/89.37% 0.8 2days 12hours
TSN-R50-1x1x8-RandAugment 71.07%/89.40% 1.3 2days 22hours
I3D-R50-32x2x1-Vanilla 74.48%/91.62% 1.1 3days 10hours
I3D-R50-32x2x1-RandAugment 74.23%/91.45% 1.5 4days 10hours

@congee524
Copy link
Contributor

I did some tests myself, with tsn_r50_video_1x1x8_100e_kinetics400_rgb.py

Results(test with 256 ThreeCrop)

Models top1/5 accuracy
Vanilla 70.74%/89.37%
RandAugment 71.07%/89.40%

iφ(* ̄0 ̄), I‘m working on i3d

@irvingzhang0512
Copy link
Contributor Author

I did some tests myself, with tsn_r50_video_1x1x8_100e_kinetics400_rgb.py
Results(test with 256 ThreeCrop)
Models top1/5 accuracy
Vanilla 70.74%/89.37%
RandAugment 71.07%/89.40%

iφ(* ̄0 ̄), I‘m working on i3d

Hope randaugment could help.
Unfortunately, the server must be shut down during the holidays(tears), otherwise I can train more models...

@congee524
Copy link
Contributor

@irvingzhang0512 Hi, when I was training the ckpt of i3d with imgaug, I found that the training speed was very slow because the CPU was running at full load. Is this method CPU intensive?

@irvingzhang0512
Copy link
Contributor Author

irvingzhang0512 commented Feb 9, 2021

@irvingzhang0512 Hi, when I was training the ckpt of i3d with imgaug, I found that the training speed was very slow because the CPU was running at full load. Is this method CPU intensive?

Yes. It takes me 3 days to train tsn + 1x1x8 + randaugment with 8 V100 gpus.
I do notice that during training data_time increases. But I forget how much time it takes to train tsn without randaugment.

@irvingzhang0512
Copy link
Contributor Author

Update some training results. RandAugment doesn't improve accuracy for I3D. Training more epochs may help.

Models top1/5 accuracy Training lost(epoch 100) training time
I3D-R50-32x2x1-Vanilla 74.48%/91.62% 1.1 3days 10hours
I3D-R50-32x2x1-RandAugment 74.23%/91.45% 1.5 4days 10hours

@innerlee
Copy link
Contributor

My bet is movie transition fx #436 (comment) will be more helpful

@congee524
Copy link
Contributor

Update some training results. RandAugment doesn't improve accuracy for I3D. Training more epochs may help.

Models top1/5 accuracy Training lost(epoch 100) training time
I3D-R50-32x2x1-Vanilla 74.48%/91.62% 1.1 3days 10hours
I3D-R50-32x2x1-RandAugment 74.23%/91.45% 1.5 4days 10hours

Could you provide your training log? I have trained 66 epoch Maybe the performance will be better

@irvingzhang0512
Copy link
Contributor Author

I3D_Vanilla.log
I3D_RandAugment.log

FYI, there is a huge gap between our kinetics-400...

@congee524
Copy link
Contributor

I3D_Vanilla.log
I3D_RandAugment.log

FYI, there is a huge gap between our kinetics-400...

It looks similar. Maybe I can stop the program :-P

@irvingzhang0512
Copy link
Contributor Author

It looks similar. Maybe I can stop the program :-P

Since our datasets are quite different, it's better to upload ckpts trained by your dataset.

@congee524
Copy link
Contributor

It looks similar. Maybe I can stop the program :-P

Since our datasets are quite different, it's better to upload ckpts trained by your dataset.

OK, about 4 days left.

@congee524
Copy link
Contributor

@irvingzhang0512 My result is 72.82%/90.64%. Maybe your ckpt should be uploaded.

@irvingzhang0512
Copy link
Contributor Author

@irvingzhang0512 My result is 72.82%/90.64%. Maybe your ckpt should be uploaded.

Worse than model without randaugment?
Since our datasets are different, my ckpt makes no sense in current mmaction2 model zoo.

@congee524
Copy link
Contributor

@irvingzhang0512 My result is 72.82%/90.64%. Maybe your ckpt should be uploaded.

Worse than model without randaugment?
Since our datasets are different, my ckpt makes no sense in current mmaction2 model zoo.

Yes, from 73.27 to 72.82.
Is the resolution of your dataset short-side 320? I use short-side 256.

@irvingzhang0512
Copy link
Contributor Author

I use short-side 256. But our training&val samples(videos) are quite different.

#415 (comment)

@irvingzhang0512
Copy link
Contributor Author

Yes, from 73.27 to 72.82.
Is the resolution of your dataset short-side 320? I use short-side 256.

I'll try randaugment in other datasets(sth) this month

@irvingzhang0512
Copy link
Contributor Author

kindly ping @congee524

training tsm-r50 on sthv1 with randaugment, get very good results. ckpt/json/log is here

image

Maybe this ckpt is enough for this pr?

@congee524
Copy link
Contributor

@irvingzhang0512 Sorry for my late reply...

When I use Imgaug with default transforms, The training time has increased a lot (about 18 days on 8 V100), which may be due to weak CPU performance. But the performance didn't improve (72.49/90.65).

@congee524
Copy link
Contributor

Maybe Kinetics is large enough, so the image enhancement effect is very small, and simple randmultiscale, flip is enough.

For sthv1 and shtv2, since we didn't apply flip on them, Imgaug performs well.

I have found that the results of imgaug and flip with label transform on sthv1 are similar.

@irvingzhang0512
Copy link
Contributor Author

Maybe Kinetics is large enough, so the image enhancement effect is very small, and simple randmultiscale, flip is enough.

For sthv1 and shtv2, since we didn't apply flip on them, Imgaug performs well.

I have found that the results of imgaug and flip with label transform on sthv1 are similar.

Maybe we can add sthv1/tsm-r50/randaugment ckpt/log/json to model zoo instead of i3d-r50/kinetics/randaugment.

BTW, train sthv1 & tsm-r50 with flip & randaugment, get 47.85/50.31 top-1 accu1 and 76.78/78.18

@congee524
Copy link
Contributor

I'll test your ckpt on our sthv1 now. (ง •_•)ง

@congee524
Copy link
Contributor

Maybe Kinetics is large enough, so the image enhancement effect is very small, and simple randmultiscale, flip is enough.
For sthv1 and shtv2, since we didn't apply flip on them, Imgaug performs well.
I have found that the results of imgaug and flip with label transform on sthv1 are similar.

Maybe we can add sthv1/tsm-r50/randaugment ckpt/log/json to model zoo instead of i3d-r50/kinetics/randaugment.

BTW, train sthv1 & tsm-r50 with flip & randaugment, get 47.85/50.31 top-1 accu1 and 76.78/78.18

BTW, could you provide the ckpt of tsm_50_flip_randaugment ?

@congee524
Copy link
Contributor

tsm_r50_randaugment on our dataset: 47.07/48.90 75.81/77.64

@irvingzhang0512
Copy link
Contributor Author

I do know there is a gap between our sthv1 datasets, which is odd. We could directly download sthv1 rawframes from official website. So we are supposed to have exact the same dataset...

configs top1 acc(efficient/accuracy) top5 acc(efficient/accuracy)
mmaction2 model zoo 45.58 / 47.70 75.02 / 76.12
testing with model zoo ckpt 45.47 / 47.55 74.56 / 75.79
training with default config 45.82 / 47.90 74.38 / 76.02

@congee524
Copy link
Contributor

@dreamerlin may help to upload the ckpt/log/json :p

@congee524
Copy link
Contributor

https://wp.cethik.com:443/link/204D82F1146AF450E22C4E2BCEF67774

It seems not the tsm_50_flip_randaugment.

@irvingzhang0512
Copy link
Contributor Author

irvingzhang0512 commented Mar 24, 2021

@congee524
Copy link
Contributor

tsm_r50_flip_randaugment on our dataset:
47.75/50.16 76.52/77.89

@dreamerlin
Copy link
Collaborator

@congee524
Copy link
Contributor

@innerlee This PR is ready.

@innerlee innerlee merged commit 8a79e52 into open-mmlab:master Mar 25, 2021
@innerlee
Copy link
Contributor

Thanks!

@irvingzhang0512 irvingzhang0512 deleted the imgaug-randaugment branch March 25, 2021 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants