Skip to content

Commit

Permalink
Merge pull request #17 from escorciav/dev
Browse files Browse the repository at this point in the history
[src] Override flag
  • Loading branch information
frostinassiky authored Jun 26, 2020
2 parents 7d88c49 + 376d7ad commit 78447de
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gtad_lib/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def __init__(self, opt, subset="train", mode="train"):
self.video_info_path = opt["video_info"]
self.video_anno_path = opt["video_anno"]
self.feat_dim = opt['feat_dim']
# Assuming someone wont outsmart this by mutating the dict 😝.
# Consider to use YACS and FB code structure in the future.
self.cfg = opt

#### THUMOS
self.skip_videoframes = opt['skip_videoframes']
Expand Down Expand Up @@ -168,7 +171,7 @@ def _get_data(self):
len(video_name_list), self.mode)
)
print(saved_data_path)
if True and os.path.exists(saved_data_path):
if not self.cfg['override'] and os.path.exists(saved_data_path):
print('Got saved data.')
with open(saved_data_path, 'rb') as f:
self.data, self.durations = pickle.load(f)
Expand Down
8 changes: 8 additions & 0 deletions gtad_lib/opts.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ def parse_opt():
type=float,
default=0.46)

# Override
# In principle it should override the cache. However, the logic is to
# always save a cache. Thus, the flag only prevents loading the cache 😂
parser.add_argument(
'--override', default=False, action='store_true',
help='Prevent use of cached data'
)

args = parser.parse_args()

return args
Expand Down

0 comments on commit 78447de

Please sign in to comment.