Skip to content

Commit 01d2316

Browse files
author
bochinski
committed
creating output directory when saving result if necessary
1 parent b24bae5 commit 01d2316

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import numpy as np
99
import csv
10+
import os
1011

1112

1213
visdrone_classes = {'car': 4, 'bus': 9, 'truck': 6, 'pedestrian': 1, 'van': 5}
@@ -174,7 +175,7 @@ def save_to_csv(out_path, tracks, fmt='motchallenge'):
174175
out_path (str): path to output csv file.
175176
tracks (list): list of tracks to store.
176177
"""
177-
178+
os.makedirs(os.path.dirname(out_path), exist_ok=True)
178179
with open(out_path, "w") as ofile:
179180
if fmt == 'motchallenge':
180181
field_names = ['frame', 'id', 'x', 'y', 'w', 'h', 'score', 'wx', 'wy', 'wz']

0 commit comments

Comments
 (0)