forked from wzmsltw/BSN-boundary-sensitive-network.pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtem_jobs.py
1985 lines (1785 loc) · 92.1 KB
/
tem_jobs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""Run the jobs in this file.
Example running all:
python tem_jobs.py
Example for running thumosfeatures:
python main.py --module TEM --mode train --name dbg.thumos --counter 0 --data_workers 8 --seed 0 --num_gpus 2 --checkpoint_path /checkpoint/cinjon/spaceofmotion/bsn/checkpoint --video_info /private/home/cinjon/Code/BSN-boundary-sensitive-network.pytorch/data/thumos14_annotations --feature_dirs /private/home/cinjon/Code/BSN-boundary-sensitive-network.pytorch/data/thumos14_feature_anet_200/flow/csv,/private/home/cinjon/Code/BSN-boundary-sensitive-network.pytorch/data/thumos14_feature_anet_200/rgb/csv --dataset thumosfeatures
"""
import os
import sys
from run_on_cluster import fb_run_batch
base_dir = '/checkpoint/cinjon/spaceofmotion/bsn'
checkpoint_path = os.path.join(base_dir, 'checkpoint', 'tem')
email = '[email protected]'
code_directory = '/private/home/cinjon/Code/BSN-boundary-sensitive-network.pytorch'
anno_directory = '/private/home/cinjon/Code/BSN-boundary-sensitive-network.pytorch/data/gymnastics_annotations'
func = fb_run_batch
def do_fb_jobarray(counter, job, representation_module, time, find_counter, do_job=False, resnet_dfc=False, resnet_nfc=True, ccc_feat='dfc', amdim_feat='both', finetuned=False, corrflow_feat='both'):
num_gpus = 8 # NOTE!
num_cpus = num_gpus * 10
gb = num_gpus * 64
directory = '/checkpoint/cinjon/spaceofmotion'
slurm_logs = os.path.join(directory, 'bsn', 'slurm_logs')
slurm_scripts = os.path.join(directory, 'bsn', 'slurm_scripts')
comet_dir = os.path.join(directory, 'bsn', 'comet', job['module'].lower(), job['dataset'], representation_module)
if not os.path.exists(comet_dir):
os.makedirs(comet_dir)
job['local_comet_dir'] = comet_dir
job['time'] = time
job['data_workers'] = min(int(2.5 * num_gpus), num_cpus - num_gpus)
if job['dataset'] == 'activitynet':
job['data_workers'] *= 1.5
job['data_workers'] = int(job['data_workers'])
job['data_workers'] = max(job['data_workers'], 12)
representation_checkpoint, representation_tags = _get_representation_info(representation_module)
if finetuned:
if representation_module == 'ccc':
representation_checkpoint = '/checkpoint/cinjon/spaceofmotion/ccc/ccc.ftgym.pth'
else:
raise
jobarray = []
for do_feat_conversion in [False, True]:
for do_augment in [True, False]:
do_gradient_checkpointing = False
if do_feat_conversion:
if representation_module == 'resnet' and not resnet_dfc:
continue
if representation_module == 'ccc' and ccc_feat == 'nfc':
continue
if representation_module == 'amdim' and amdim_feat == 'nfc':
continue
if representation_module == 'corrflow' and corrflow_feat == 'nfc':
continue
else:
if representation_module == 'ccc' and ccc_feat == 'dfc':
continue
if representation_module == 'corrflow' and corrflow_feat == 'dfc':
continue
if representation_module == 'amdim':
if amdim_feat == 'dfc':
continue
do_gradient_checkpointing = True
if representation_module == 'resnet' and not resnet_nfc:
continue
for tem_milestones in ['5,15', '5,20']:
for tem_step_gamma in [0.1, 0.5]:
for lr in [1e-4, 3e-4]:
for tem_l2_loss in [0, 0.01, 0.005]:
for tem_weight_decay in [0, 1e-4]:
if tem_weight_decay > 0 and tem_l2_loss > 0:
continue
if tem_weight_decay == 0 and tem_l2_loss == 0:
continue
counter += 1
_job = {k: v for k, v in job.items()}
_job['counter'] = counter
if representation_module == 'corrflow':
if do_feat_conversion:
tem_batch_size = 4
else:
tem_batch_size = 1
elif representation_module == 'resnet':
# Increased this after the 3hr ones...
tem_batch_size = 6
elif not do_feat_conversion:
if representation_module == 'ccc':
tem_batch_size = 1
else:
tem_batch_size = 2
else:
tem_batch_size = 4
_job['tem_batch_size'] = tem_batch_size
_job['do_gradient_checkpointing'] = do_gradient_checkpointing
_job['representation_module'] = representation_module
if representation_tags:
_job['representation_tags'] = representation_tags
if representation_checkpoint:
_job['representation_checkpoint'] = representation_checkpoint
_job['num_gpus'] = num_gpus
_job['name'] = '%s.%s-%05d' % (_job['name'], representation_module, counter)
_job['num_cpus'] = num_gpus * 10
_job['gb'] = 64 * num_gpus
_job['tem_training_lr'] = lr
_job['tem_lr_milestones'] = tem_milestones
_job['do_augment'] = do_augment
_job['tem_step_gamma'] = tem_step_gamma
_job['tem_l2_loss'] = tem_l2_loss
_job['tem_weight_decay'] = tem_weight_decay
_job['do_feat_conversion'] = do_feat_conversion
if find_counter == counter:
return counter, _job
# NOTE: This is happening.
if tem_l2_loss == 0:
jobarray.append(counter)
if not find_counter and do_job:
jobname = 'temtr.%s.%s.%s.%dhr.cnt%d' % (_job['dataset'], _job['name'], representation_module, time, counter)
jobcommand = "python main.py --mode jobarray_train"
print("Size: ", len(jobarray), jobcommand, " /.../ ", jobname)
slurmfile = os.path.join(slurm_scripts, jobname + '.slurm')
hours = int(time)
minutes = int((time - hours) * 60)
with open(slurmfile, 'w') as f:
f.write("#!/bin/bash\n")
f.write("#SBATCH --job-name=%s\n" % jobname)
f.write("#SBATCH --array=%s\n" % ','.join([str(c) for c in jobarray]))
f.write("#SBATCH --mail-type=END,FAIL\n")
f.write("#SBATCH [email protected]\n")
f.write("#SBATCH --cpus-per-task=%d\n" % num_cpus)
f.write("#SBATCH --time=%d:%d:00\n" % (hours, minutes))
f.write("#SBATCH --gres=ntasks-per-node=1\n")
f.write("#SBATCH --gres=gpu:%d\n" % num_gpus)
f.write("#SBATCH --mem=%dG\n" % gb)
f.write("#SBATCH --nodes=%d\n" % 1)
f.write("#SBATCH --output=%s\n" % os.path.join(
slurm_logs, jobname + ".%A.%a.out"))
f.write("#SBATCH --error=%s\n" % os.path.join(
slurm_logs, jobname + ".%A.%a.err"))
f.write("module purge" + "\n")
f.write("module load cuda/10.0\n")
f.write("source activate onoff\n")
f.write("SRCDIR=%s\n" % code_directory)
f.write("cd ${SRCDIR}\n")
f.write(jobcommand + "\n")
s = "sbatch %s" % os.path.join(slurm_scripts, jobname + ".slurm")
os.system(s)
return counter, None
def _get_representation_info(module):
return {
'corrflow': (
'/checkpoint/cinjon/spaceofmotion/supercons/corrflow.kineticsmodel.pth', None
),
'resnet': (None, None),
'ccc': (
'/checkpoint/cinjon/spaceofmotion/bsn/TimeCycleCkpt14.pth', None
),
'amdim': (
'/checkpoint/cinjon/amdim/_ckpt_epoch_434.ckpt',
'/checkpoint/cinjon/amdim/meta_tags.csv'
),
'tsn': (
'/private/home/cinjon/Code/mmaction/modelzoo/tsn_2d_rgb_bninception_seg3_f1s1_b32_g8-98160339.pth',
None
)
}.get(module)
def run(find_counter=None):
counter = 0
job = {
'name': '2019.8.28.bsn',
'video_anno': os.path.join(anno_directory, 'anno_fps12.on.json'),
'video_info': os.path.join(anno_directory, 'video_info_new.csv'),
'do_representation': True,
'module': 'TEM',
'time': 16,
'tem_compute_loss_interval': 50
}
for tem_train_subset in ['overfit', 'train']:
for num_gpus in [8, 4]:
for lr in [1e-3, 3e-3, 1e-2]:
for nvf in [25]:
for svf in [6, 8, 10]:
for num_run in range(2):
if num_gpus == 4 and num_run > 0:
continue
counter += 1
_job = {k: v for k, v in job.items()}
_job['num_gpus'] = num_gpus
_job['tem_training_lr'] = lr
_job['name'] = '%s-%05d.%d' % (_job['name'], counter, num_run)
_job['num_cpus'] = num_gpus * 10
_job['gb'] = 64 * num_gpus
_job['num_videoframes'] = nvf
_job['skip_videoframes'] = svf
_job['tem_train_subset'] = tem_train_subset
_job['time'] = 1.1 if tem_train_subset == 'overfit' else 4
if find_counter == counter:
return _job
# func(_job, counter, email, code_directory)
job = {
'name': '2019.8.29.bsn',
'video_anno': os.path.join(anno_directory, 'anno_fps12.on.json'),
'video_info': os.path.join(anno_directory, 'video_info_new.csv'),
'do_representation': True,
'module': 'TEM',
'tem_compute_loss_interval': 50
}
for tem_train_subset in ['overfit', 'train']:
for num_gpus in [8]:
for lr in [2e-3]:
for nvf in [25, 30]:
for svf in [6, 8, 10]:
counter += 1
_job = {k: v for k, v in job.items()}
_job['num_gpus'] = num_gpus
_job['tem_training_lr'] = lr
_job['name'] = '%s-%05d' % (_job['name'], counter)
_job['num_cpus'] = num_gpus * 10
_job['gb'] = 64 * num_gpus
_job['num_videoframes'] = nvf
_job['skip_videoframes'] = svf
_job['tem_train_subset'] = tem_train_subset
_job['time'] = 3 if tem_train_subset == 'overfit' else 8
if find_counter == counter:
return _job
# func(_job, counter, email, code_directory)
job = {
'name': '2019.8.30',
'video_anno': os.path.join(anno_directory, 'anno_fps12.on.json'),
'video_info': os.path.join(anno_directory, 'video_info_new.csv'),
'do_representation': True,
'module': 'TEM',
'tem_compute_loss_interval': 50
}
for num_run in range(2):
for tem_train_subset in ['overfit', 'train']:
for num_gpus in [8]:
for lr in [2e-3, 1e-2]:
for nvf in [25]:
for svf in [5]:
counter += 1
if counter in [69, 70, 73, 74]:
continue
_job = {k: v for k, v in job.items()}
_job['num_gpus'] = num_gpus
_job['tem_training_lr'] = lr
_job['name'] = '%s-%05d.%d' % (_job['name'], counter, num_run)
_job['num_cpus'] = num_gpus * 10
_job['gb'] = 64 * num_gpus
_job['num_videoframes'] = nvf
_job['skip_videoframes'] = svf
_job['tem_train_subset'] = tem_train_subset
_job['time'] = 2
if find_counter == counter:
return _job
# if not find_counter:
# func(_job, counter, email, code_directory)
# Not sure what happened in teh above. The below is redoing but letting training be over many more frames.
# Pretty much changed training to do frames [0 + skip*nf, skip + skip*nf, 2*skip + skip*nf, ...]
# but enforce that testing is only on windows [0 + skip*nf, skip*nf + skip*nf, 2*skip*nf + skip*nf, ...],
# i.e. non-overlapping windows.
job = {
'name': '2019.8.30',
'video_anno': os.path.join(anno_directory, 'anno_fps12.on.json'),
'video_info': os.path.join(anno_directory, 'video_info_new.csv'),
'do_representation': True,
'module': 'TEM',
'tem_compute_loss_interval': 50,
'num_videoframes': 25,
'skip_videoframes': 5,
}
for num_run in range(2):
for tem_train_subset in ['overfit', 'train']:
for num_gpus in [8]:
for lr in [2e-3, 6e-3]:
for tem_step_gamma in [0.1, 0.5]:
for tem_step_size in [7, 10]:
counter += 1
_job = {k: v for k, v in job.items()}
_job['num_gpus'] = num_gpus
_job['tem_training_lr'] = lr
_job['name'] = '%s-%05d.%d' % (_job['name'], counter, num_run)
_job['num_cpus'] = num_gpus * 10
_job['gb'] = 64 * num_gpus
_job['tem_step_gamma'] = tem_step_gamma
_job['tem_step_size'] = tem_step_size
_job['tem_train_subset'] = tem_train_subset
if tem_train_subset == 'overfit':
time = 2
elif tem_train_subset == 'train' and num_run == 0:
time = 3
else:
time = 13
_job['time'] = time
if find_counter == counter:
return _job
# if not find_counter:
# func(_job, counter, email, code_directory)
job = {
'name': '2019.09.02',
'video_anno': os.path.join(anno_directory, 'anno_fps12.on.json'),
'video_info': os.path.join(anno_directory, 'video_info_new.csv'),
'do_representation': True,
'module': 'TEM',
'tem_compute_loss_interval': 50,
'num_videoframes': 25,
'skip_videoframes': 5,
'tem_step_size': 10,
'tem_step_gamma': 0.5
}
for num_run in range(2):
for tem_train_subset in ['overfit', 'train']:
for num_gpus in [8]:
for lr in [2e-3, 4e-3, 6e-3, 1e-2]:
if tem_train_subset == 'overfit' and num_run > 0:
continue
if tem_train_subset == 'overfit' and lr < 6e-3:
continue
if tem_train_subset == 'train' and lr > 4e-3:
continue
counter += 1
_job = {k: v for k, v in job.items()}
_job['num_gpus'] = num_gpus
_job['tem_training_lr'] = lr
_job['name'] = '%s-%05d.%d' % (_job['name'], counter, num_run)
_job['num_cpus'] = num_gpus * 10
_job['gb'] = 64 * num_gpus
_job['tem_train_subset'] = tem_train_subset
if tem_train_subset == 'overfit':
time = 8
elif num_run == 0:
time = 8
else:
time = 18
_job['time'] = time
if find_counter == counter:
return _job
if not find_counter:
pass
# func(_job, counter, email, code_directory)
# print("Counter: ", counter)
job = {
'name': '2019.09.06',
'video_info': '/private/home/cinjon/Code/BSN-boundary-sensitive-network.pytorch/data/thumos14_annotations',
'feature_dirs': '/private/home/cinjon/Code/BSN-boundary-sensitive-network.pytorch/data/thumos14_feature_anet_200/flow/csv,/private/home/cinjon/Code/BSN-boundary-sensitive-network.pytorch/data/thumos14_feature_anet_200/rgb/csv',
'dataset': 'thumosfeatures',
'module': 'TEM',
'mode': 'train',
'tem_compute_loss_interval': 10,
'tem_step_size': 10,
'tem_step_gamma': 0.5
}
for num_runs in range(2):
for num_gpus in [8]:
for lr in [1e-3, 3e-3, 1e-2]:
for tem_step_gamma in [0.1, 0.5]:
for tem_step_size in [7, 10]:
for tem_weight_decay in [1e-4, 3e-4, 1e-5]:
counter += 1
_job = {k: v for k, v in job.items()}
_job['num_gpus'] = num_gpus
_job['tem_training_lr'] = lr
_job['tem_step_gamma'] = tem_step_gamma
_job['tem_weight_decay'] = tem_weight_decay
_job['tem_step_size'] = tem_step_size
_job['name'] = '%s-%05d' % (_job['name'], counter)
_job['num_cpus'] = num_gpus * 10
_job['gb'] = 64 * num_gpus
_job['time'] = 8 if num_runs == 0 else 16
if find_counter == counter:
return _job
# if not find_counter:
# func(_job, counter, email, code_directory)
# print("Counter: ", counter) # 184.
# The jobs below are trying to dupliacte the TEM settings from the paper.
job = {
'name': '2019.09.10',
'video_info': '/private/home/cinjon/Code/BSN-boundary-sensitive-network.pytorch/data/thumos14_annotations',
'feature_dirs': '/private/home/cinjon/Code/BSN-boundary-sensitive-network.pytorch/data/thumos14_feature_anet_200/flow/csv,/private/home/cinjon/Code/BSN-boundary-sensitive-network.pytorch/data/thumos14_feature_anet_200/rgb/csv',
'dataset': 'thumosfeatures',
'module': 'TEM',
'mode': 'train',
'tem_compute_loss_interval': 10,
'tem_training_lr': 1e-3,
'tem_step_size': 10,
'tem_step_gamma': 0.1,
'tem_epoch': 20,
'tem_batch_size': 16,
}
for num_run in range(2):
for num_gpus in [1, 4]:
for weight_decay in [1e-4, 5e-4, 1e-3, 5e-3]:
counter += 1
_job = {k: v for k, v in job.items()}
_job['num_gpus'] = num_gpus
_job['tem_weight_decay'] = tem_weight_decay
_job['name'] = '%s-%05d' % (_job['name'], counter)
_job['num_cpus'] = num_gpus * 10
_job['gb'] = 64 * num_gpus
_job['time'] = 3
if find_counter == counter:
return _job
# elif not find_counter:
# func(_job, counter, email, code_directory)
# print("Counter: ", counter) # 200
# The jobs below are trying to do ThumosImages w CorrFlow.
# They use the representation change.
job = {
'name': '2019.09.10',
'video_info': '/private/home/cinjon/Code/BSN-boundary-sensitive-network.pytorch/data/thumos14_annotations',
'dataset': 'thumosimages',
'module': 'TEM',
'mode': 'train',
'tem_compute_loss_interval': 10,
'tem_step_size': 10,
'tem_epoch': 21,
'tem_batch_size': 8,
'do_representation': True,
'do_feat_conversion': True,
'representation_module': 'corrflow',
'representation_checkpoint': '/checkpoint/cinjon/spaceofmotion/supercons/corrflow.kineticsmodel.pth',
}
for num_run in range(2):
for num_gpus in [8]:
for weight_decay in [1e-4, 5e-4, 1e-3, 5e-3]:
for tem_training_lr in [1e-3, 3e-3]:
for tem_step_gamma in [0.75, 0.5, 0.1]:
counter += 1
_job = {k: v for k, v in job.items()}
_job['num_gpus'] = num_gpus
_job['tem_weight_decay'] = tem_weight_decay
_job['tem_training_lr'] = tem_training_lr
_job['tem_step_gamma'] = tem_step_gamma
_job['name'] = '%s-%05d' % (_job['name'], counter)
_job['num_cpus'] = num_gpus * 10
_job['gb'] = 64 * num_gpus
_job['time'] = 5 if num_run == 0 else 15
if find_counter == counter:
return _job
# elif not find_counter:
# func(_job, counter, email, code_directory)
# print("Counter: ", counter) # 248
# The jobs below are trying to do ThumosImages w CorrFlow.
# They however use the FULL representation from CF, which has
# a size of 225280. Need to reduce the batch size to match.
job = {
'name': '2019.09.10',
'video_info': '/private/home/cinjon/Code/BSN-boundary-sensitive-network.pytorch/data/thumos14_annotations',
'dataset': 'thumosimages',
'module': 'TEM',
'mode': 'train',
'tem_compute_loss_interval': 10,
'tem_step_size': 10,
'tem_epoch': 21,
'tem_batch_size': 4,
'do_representation': True,
'do_feat_conversion': False,
'representation_module': 'corrflow',
'representation_checkpoint': '/checkpoint/cinjon/spaceofmotion/supercons/corrflow.kineticsmodel.pth',
}
for num_run in range(2):
for num_gpus in [8]:
for weight_decay in [1e-4, 5e-4, 1e-3, 5e-3]:
for tem_training_lr in [1e-3, 3e-3]:
for tem_step_gamma in [0.75, 0.5, 0.1]:
counter += 1
_job = {k: v for k, v in job.items()}
_job['num_gpus'] = num_gpus
# Sigh, fuck me.
_job['tem_weight_decay'] = tem_weight_decay
_job['tem_training_lr'] = tem_training_lr
_job['tem_step_gamma'] = tem_step_gamma
_job['name'] = '%s-%05d' % (_job['name'], counter)
_job['num_cpus'] = num_gpus * 10
_job['gb'] = 64 * num_gpus
_job['time'] = 5 if num_run == 0 else 15
if find_counter == counter:
return _job
# elif not find_counter:
# func(_job, counter, email, code_directory)
# print("Counter: ", counter) # 296
# The jobs below are trying to do ThumosImages w CorrFlow.
# They use the representation change.
job = {
'name': '2019.09.10',
'video_info': '/private/home/cinjon/Code/BSN-boundary-sensitive-network.pytorch/data/thumos14_annotations',
'dataset': 'thumosimages',
'module': 'TEM',
'mode': 'train',
'tem_compute_loss_interval': 10,
'tem_step_size': 10,
'tem_epoch': 21,
'tem_batch_size': 8,
'do_representation': True,
'do_feat_conversion': True,
'representation_module': 'corrflow',
'representation_checkpoint': '/checkpoint/cinjon/spaceofmotion/supercons/corrflow.kineticsmodel.pth',
}
for num_run in range(2):
for num_gpus in [8]:
for tem_weight_decay in [1e-4, 5e-4, 1e-3]:
for tem_training_lr in [1e-3, 3e-4]:
for tem_step_gamma in [0.75, 0.5, 0.1]:
counter += 1
_job = {k: v for k, v in job.items()}
_job['num_gpus'] = num_gpus
_job['tem_weight_decay'] = tem_weight_decay
_job['tem_training_lr'] = tem_training_lr
_job['tem_step_gamma'] = tem_step_gamma
_job['name'] = '%s-%05d' % (_job['name'], counter)
_job['num_cpus'] = num_gpus * 10
_job['gb'] = 64 * num_gpus
_job['time'] = 5
if find_counter == counter:
return _job
# elif not find_counter:
# func(_job, counter, email, code_directory)
# print("Counter: ", counter) # 332
# The jobs below are trying to do ThumosImages w CorrFlow.
# They however use the FULL representation from CF, which has
# a size of 225280. Need to reduce the batch size to match.
job = {
'name': '2019.09.10',
'video_info': '/private/home/cinjon/Code/BSN-boundary-sensitive-network.pytorch/data/thumos14_annotations',
'dataset': 'thumosimages',
'module': 'TEM',
'mode': 'train',
'tem_compute_loss_interval': 10,
'tem_step_size': 10,
'tem_epoch': 40,
'tem_batch_size': 4,
'do_representation': True,
'do_feat_conversion': False,
'representation_module': 'corrflow',
'representation_checkpoint': '/checkpoint/cinjon/spaceofmotion/supercons/corrflow.kineticsmodel.pth',
}
for num_run in range(2):
for num_gpus in [8]:
for tem_weight_decay in [1e-4, 5e-4, 1e-3]:
for tem_training_lr in [1e-3, 3e-4]:
for tem_step_gamma in [0.75, 0.5, 0.1]:
counter += 1
_job = {k: v for k, v in job.items()}
_job['num_gpus'] = num_gpus
_job['tem_weight_decay'] = tem_weight_decay
_job['tem_training_lr'] = tem_training_lr
_job['tem_step_gamma'] = tem_step_gamma
_job['name'] = '%s-%05d' % (_job['name'], counter)
_job['num_cpus'] = num_gpus * 10
_job['gb'] = 64 * num_gpus
_job['time'] = 8
if find_counter == counter:
return _job
# elif not find_counter:
# func(_job, counter, email, code_directory)
# print("Counter: ", counter) # 368
# These are doing the full gymnastics dataset.
job = {
'name': '2019.09.15',
'video_anno': os.path.join(anno_directory, 'anno_fps12.on.sep052019.json'),
'video_info': os.path.join(anno_directory, 'video_info.sep052019.fps12.csv'),
'do_representation': True,
'module': 'TEM',
'mode': 'train',
'tem_compute_loss_interval': 10,
'num_videoframes': 100,
'skip_videoframes': 2,
'tem_batch_size': 4,
'tem_step_size': 10,
'tem_step_gamma': 0.5,
'tem_epoch': 30,
'tem_train_subset': 'train',
'do_representation': True,
'representation_module': 'corrflow',
'representation_checkpoint': '/checkpoint/cinjon/spaceofmotion/supercons/corrflow.kineticsmodel.pth',
'checkpoint_path': checkpoint_path
}
for num_rumn in range(2):
for do_feat_conversion in [False, True]:
for tem_step_gamma in [0.75, 0.5]:
for tem_step_size in [10, 8]:
for num_gpus in [8]:
for lr in [1e-4, 3e-4]:
counter += 1
_job = {k: v for k, v in job.items()}
_job['num_gpus'] = num_gpus
_job['tem_training_lr'] = lr
_job['tem_step_gamma'] = tem_step_gamma
_job['tem_step_size'] = tem_step_size
_job['name'] = '%s-%05d' % (_job['name'], counter)
_job['num_cpus'] = num_gpus * 10
_job['gb'] = 64 * num_gpus
_job['tem_batch_size'] = 4 if do_feat_conversion else 1
_job['do_feat_conversion'] = do_feat_conversion
_job['time'] = 16 if do_feat_conversion else 24
if find_counter == counter:
return _job
# if not find_counter:
# func(_job, counter, email, code_directory)
# print("Counter: ", counter) # 368
# These are doing the full gymnastics dataset, but with augmentation.
# We skip the non- augment ones that are on do_feat_conversion because those were done before.
# The others were also done above but did not go for enough epochs because they take a while.
job = {
'name': '2019.09.17',
'video_anno': os.path.join(anno_directory, 'anno_fps12.on.sep052019.json'),
'video_info': os.path.join(anno_directory, 'video_info.sep052019.fps12.csv'),
'do_representation': True,
'module': 'TEM',
'mode': 'train',
'tem_compute_loss_interval': 10,
'num_videoframes': 100,
'skip_videoframes': 2,
'tem_batch_size': 4,
'tem_step_size': 10,
'tem_step_gamma': 0.5,
'tem_epoch': 30,
'tem_train_subset': 'train',
'do_representation': True,
'representation_module': 'corrflow',
'representation_checkpoint': '/checkpoint/cinjon/spaceofmotion/supercons/corrflow.kineticsmodel.pth',
'checkpoint_path': checkpoint_path
}
for do_augment in [True, False]:
for do_feat_conversion in [False, True]:
for tem_step_gamma in [0.75, 0.5]:
for tem_step_size in [10, 8]:
for num_gpus in [8]:
for lr in [1e-4, 3e-4]:
if not do_augment and do_feat_conversion:
continue
counter += 1
_job = {k: v for k, v in job.items()}
_job['num_gpus'] = num_gpus
_job['tem_training_lr'] = lr
_job['tem_step_gamma'] = tem_step_gamma
_job['tem_step_size'] = tem_step_size
_job['name'] = '%s-%05d' % (_job['name'], counter)
_job['num_cpus'] = num_gpus * 10
_job['gb'] = 64 * num_gpus
_job['tem_batch_size'] = 4 if do_feat_conversion else 1
_job['do_feat_conversion'] = do_feat_conversion
_job['do_augment'] = do_augment
_job['time'] = 16 if do_feat_conversion else 24
if find_counter == counter:
return _job
# if not find_counter:
# func(_job, counter, email, code_directory)
# print("Counter: ", counter) # 424
# These are doing the thumos images with augmentation and without, with do_feat_conversion and w/o.
# These are important because we beleive this is working properly now based on reproduction.
job = {
'name': '2019.09.29',
'video_info': '/private/home/cinjon/Code/BSN-boundary-sensitive-network.pytorch/data/thumos14_annotations',
'dataset': 'thumosimages',
'module': 'TEM',
'mode': 'train',
'tem_compute_loss_interval': 1,
'tem_epoch': 30,
'do_representation': True,
'num_videoframes': 100,
'skip_videoframes': 5,
'representation_module': 'corrflow',
'representation_checkpoint': '/checkpoint/cinjon/spaceofmotion/supercons/corrflow.kineticsmodel.pth',
'checkpoint_path': checkpoint_path,
'tem_nonlinear_factor': 0.1
}
for do_augment in [True, False]:
for do_feat_conversion in [True, False]:
for tem_milestones in ['5,15', '5,20', '10,25']:
for tem_step_gamma in [0.1, 0.5]:
for tem_l2_loss in [0.01, 0.005, 0.001]:
for lr in [1e-4, 1e-3]:
counter += 1
_job = {k: v for k, v in job.items()}
batch_size = 4 if do_feat_conversion else 1
num_gpus = min(int(16 / batch_size), 8)
_job['tem_batch_size'] = batch_size
_job['num_gpus'] = num_gpus
_job['tem_training_lr'] = lr
_job['tem_lr_milestones'] = tem_milestones
_job['name'] = '%s-%05d' % (_job['name'], counter)
_job['num_cpus'] = num_gpus * 10
_job['gb'] = 64 * num_gpus
_job['do_feat_conversion'] = do_feat_conversion
_job['do_augment'] = do_augment
_job['tem_step_gamma'] = tem_step_gamma
_job['tem_l2_loss'] = tem_l2_loss
_job['time'] = 16 if do_feat_conversion else 24
if find_counter == counter:
return _job
# if not find_counter:
# func(_job, counter, email, code_directory)
# print("Counter: ", counter) # 568
# Gymnastics models now that things are working.
job = {
'name': '2019.09.29',
'video_anno': os.path.join(anno_directory, 'anno_fps12.on.sep052019.json'),
'video_info': os.path.join(anno_directory, 'video_info.sep052019.fps12.csv'),
'dataset': 'gymnastics',
'module': 'TEM',
'mode': 'train',
'tem_compute_loss_interval': 10,
'tem_epoch': 30,
'do_representation': True,
'num_videoframes': 100,
'skip_videoframes': 5,
'representation_module': 'corrflow',
'representation_checkpoint': '/checkpoint/cinjon/spaceofmotion/supercons/corrflow.kineticsmodel.pth',
'checkpoint_path': checkpoint_path,
'tem_nonlinear_factor': 0.1
}
for do_augment in [True, False]:
for do_feat_conversion in [True, False]:
for tem_milestones in ['5,15', '5,20', '10,25']:
for tem_step_gamma in [0.1, 0.5]:
for tem_l2_loss in [0.01, 0.005, 0.001]:
for lr in [1e-4, 1e-3]:
counter += 1
_job = {k: v for k, v in job.items()}
batch_size = 4 if do_feat_conversion else 1
num_gpus = min(int(16 / batch_size), 8)
_job['tem_batch_size'] = batch_size
_job['num_gpus'] = num_gpus
_job['tem_training_lr'] = lr
_job['tem_lr_milestones'] = tem_milestones
_job['name'] = '%s-%05d' % (_job['name'], counter)
_job['num_cpus'] = num_gpus * 10
_job['gb'] = 64 * num_gpus
_job['do_feat_conversion'] = do_feat_conversion
_job['do_augment'] = do_augment
_job['tem_step_gamma'] = tem_step_gamma
_job['tem_l2_loss'] = tem_l2_loss
_job['time'] = 16 if do_feat_conversion else 24
if find_counter == counter:
return _job
# if not find_counter:
# func(_job, counter, email, code_directory)
# print("Counter: ", counter) # 712
# The jobs below are going back to the old way of doing the CorrFlow jobs. We want
# to reproduce that in order to feel comfrotable that we're good to go.
# Note though that they are using milestones and not Step.
job = {
'name': '2019.09.30',
'video_info': '/private/home/cinjon/Code/BSN-boundary-sensitive-network.pytorch/data/thumos14_annotations',
'dataset': 'thumosimages',
'module': 'TEM',
'mode': 'train',
'tem_compute_loss_interval': 10,
'tem_epoch': 21,
'do_representation': True,
'representation_module': 'corrflow',
'representation_checkpoint': '/checkpoint/cinjon/spaceofmotion/supercons/corrflow.kineticsmodel.pth',
'tem_weight_decay': 1e-4,
'tem_training_lr': 3e-4,
}
for num_gpus in [8]:
for tem_milestones in ['5,15', '5,20', '10,20']:
for do_augment in [False, True]:
for tem_l2_loss in [0, 1e-4, 3e-4]:
for tem_step_gamma in [0.5, 0.1]:
for do_feat_conversion in [True, False]:
counter += 1
_job = {k: v for k, v in job.items()}
tem_batch_size = 8 if do_feat_conversion else 4
_job['num_gpus'] = num_gpus
_job['tem_lr_milestones'] = tem_milestones
_job['do_augment'] = do_augment
_job['tem_l2_loss'] = tem_l2_loss
_job['tem_step_gamma'] = tem_step_gamma
_job['do_feat_conversion'] = do_feat_conversion
_job['name'] = '%s-%05d' % (_job['name'], counter)
_job['num_cpus'] = num_gpus * 10
_job['gb'] = 64 * num_gpus
_job['time'] = 6
if find_counter == counter:
return _job
# elif not find_counter:
# func(_job, counter, email, code_directory)
# print("Counter: ", counter)
# The prior gymnastics models, now updated to work like the Thumos ones.
# These ... were correct buttttt the reported results are not because the cost was changed
# along with the train, so it's kinda hard to see what's going on. Going to do these over
# and at the same time reduce the learning rate.
job = {
'name': '2019.10.03',
'video_info': '/private/home/cinjon/Code/BSN-boundary-sensitive-network.pytorch/data/gymnastics_annotations',
'dataset': 'gymnastics',
'module': 'TEM',
'mode': 'train',
'tem_compute_loss_interval': 10,
'tem_epoch': 30,
'do_representation': True,
'num_videoframes': 100,
'skip_videoframes': 5,
'representation_module': 'corrflow',
'representation_checkpoint': '/checkpoint/cinjon/spaceofmotion/supercons/corrflow.kineticsmodel.pth',
'checkpoint_path': checkpoint_path,
'tem_nonlinear_factor': 0.1,
}
num_gpus = 8
for do_augment in [True, False]:
for do_feat_conversion in [True, False]:
for tem_milestones in ['5,15', '5,20']:
for tem_step_gamma in [0.1, 0.5]:
for lr in [1e-4, 3e-4]:
for tem_l2_loss in [0, 0.01, 0.005, 0.001]:
for tem_weight_decay in [0, 1e-4]:
if tem_weight_decay > 0 and tem_l2_loss > 0:
continue
if tem_weight_decay == 0 and tem_l2_loss == 0:
continue
counter += 1
_job = {k: v for k, v in job.items()}
batch_size = 4 if do_feat_conversion else 1
_job['tem_batch_size'] = batch_size
_job['num_gpus'] = num_gpus
_job['name'] = '%s-%05d' % (_job['name'], counter)
_job['num_cpus'] = num_gpus * 10
_job['gb'] = 64 * num_gpus
_job['tem_training_lr'] = lr
_job['tem_lr_milestones'] = tem_milestones
_job['do_feat_conversion'] = do_feat_conversion
_job['do_augment'] = do_augment
_job['tem_step_gamma'] = tem_step_gamma
_job['tem_l2_loss'] = tem_l2_loss
_job['tem_weight_decay'] = tem_weight_decay
_job['time'] = 16 if do_feat_conversion else 24
if find_counter == counter:
return _job
# if not find_counter:
# func(_job, counter, email, code_directory)
# print("Counter: ", counter) # 912
# The thumosimages and gymnastics models, but using CCC do_representation and only do_feat_conversion.
job = {
'name': '2019.10.04.ccc',
'video_info': '/private/home/cinjon/Code/BSN-boundary-sensitive-network.pytorch/data/gymnastics_annotations',
'module': 'TEM',
'mode': 'train',
'tem_compute_loss_interval': 10,
'tem_epoch': 30,
'do_representation': True,
'do_feat_conversion': True,
'num_videoframes': 100,
'skip_videoframes': 5,
'representation_module': 'ccc',
'representation_checkpoint': '/checkpoint/cinjon/spaceofmotion/bsn/TimeCycleCkpt14.pth',
'checkpoint_path': checkpoint_path,
'tem_nonlinear_factor': 0.1,
}
num_gpus = 8
for dataset in ['gymnastics', 'thumosimages']:
for do_augment in [True, False]:
for tem_milestones in ['5,15', '5,20']:
for tem_step_gamma in [0.1, 0.5]:
for lr in [1e-4, 3e-4]:
for tem_l2_loss in [0, 0.01, 0.005, 0.001]:
for tem_weight_decay in [0, 1e-4]:
if tem_weight_decay > 0 and tem_l2_loss > 0:
continue
if tem_weight_decay == 0 and tem_l2_loss == 0:
continue
counter += 1
_job = {k: v for k, v in job.items()}
if dataset == 'thumosimages':
_job['video_info'] = '/private/home/cinjon/Code/BSN-boundary-sensitive-network.pytorch/data/thumos14_annotations'
batch_size = 2
_job['tem_batch_size'] = batch_size
_job['num_gpus'] = num_gpus
_job['name'] = '%s-%05d' % (_job['name'], counter)
_job['num_cpus'] = num_gpus * 10
_job['gb'] = 64 * num_gpus
_job['tem_training_lr'] = lr
_job['tem_lr_milestones'] = tem_milestones
_job['do_augment'] = do_augment
_job['tem_step_gamma'] = tem_step_gamma
_job['tem_l2_loss'] = tem_l2_loss
_job['tem_weight_decay'] = tem_weight_decay
_job['dataset'] = dataset
_job['time'] = 16
if find_counter == counter:
return _job
# if not find_counter:
# func(_job, counter, email, code_directory)
# print("Counter: ", counter) # 1040
# The ResNet jobs for thumosimages and gymnastics. This does not need a feat_conversion.
job = {
'name': '2019.10.19.resnet',
'module': 'TEM',
'mode': 'train',
'tem_compute_loss_interval': 10,
'tem_epoch': 30,
'do_representation': True,
'do_feat_conversion': False,
'num_videoframes': 100,
'skip_videoframes': 5,
'representation_module': 'resnet',
'checkpoint_path': checkpoint_path,
'tem_nonlinear_factor': 0.1,