-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsave_data.py
More file actions
25 lines (19 loc) · 753 Bytes
/
save_data.py
File metadata and controls
25 lines (19 loc) · 753 Bytes
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
import os
import pickle
# ---------------------------------------------------
# prob_list_x : List[List[float]]
# gt : List[str]
# image_paths : List[str]
# ---------------------------------------------------
def save_data(prob_list_x, gt, image_paths):
assert len(prob_list_x) == len(gt) == len(image_paths), \
"All three lists must have equal length. prob_list_x, gt, image_paths"
data = {
"features": prob_list_x, # List[List[float]]
"labels": gt, # List[str]
"image_paths": image_paths # List[str]
}
pickle_path = "./saved_features_with_abs_paths.pickle"
with open(pickle_path, "wb") as f:
pickle.dump(data, f)
print(f"pickle 파일 저장 완료: {pickle_path}")