Open-Sora: Democratizing Efficient Video Production for All
Python
[fix] add fallback saving to flow score
zhengzangw1295bec2783e
diff --git a/tools/scoring/optical_flow/inference.py b/tools/scoring/optical_flow/inference.pyindex ff5dd21..7437d98 100644--- a/tools/scoring/optical_flow/inference.py+++ b/tools/scoring/optical_flow/inference.py@@ -1,3 +1,5 @@+import cv2+import argparseimport osfrom datetime import timedelta@@ -33,6 +35,10 @@ def merge_scores(gathered_list: list, meta: pd.DataFrame, column):# filter duplicatesunique_indices, unique_indices_idx = np.unique(flat_indices, return_index=True)meta.loc[unique_indices, column] = flat_scores[unique_indices_idx]++ # jun 3 quickfix+ # lose indices in meta not in unique_indices+ meta = meta.loc[unique_indices]return meta@@ -143,6 +149,14 @@ def main():indices_list.extend(indices)scores_list.extend(flow_scores)+ # jun 3 quickfix+ meta_local = merge_scores([(indices_list, scores_list)], dataset.meta, column='flow')+ out_path_local = out_path.replace('.csv', f'_part_{dist.get_rank()}.csv')+ meta_local.to_csv(out_path_local, index=False)++ # wait for all ranks to finish data processing+ dist.barrier()+gathered_list = [None] * dist.get_world_size()dist.all_gather_object(gathered_list, (indices_list, scores_list))if dist.get_rank() == 0: