File size: 777 Bytes
7735593
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os
import utils
import pandas as pd

"""
DESCRIPTION:

This script extracts the index of the last valid frame, which corresponds with the last frame 
before the Clipping and Cutting Phase.
"""

dataset_path = utils.get_dataset_path()
dataset_path = os.path.join(dataset_path, "phase_annotations")
annotations_path = os.listdir(dataset_path)
result = pd.DataFrame(columns=["video_name", "final_frame"])
for annotation in annotations_path:
    print(f"Proccesing video {annotation}")
    data = pd.read_csv(os.path.join(dataset_path, annotation), sep='\t')
    frame_index = data[data["Phase"] == "ClippingCutting"]["Frame"].iloc[0] - 1
    result.loc[len(result)] = [annotation.split('-')[0], frame_index]

result.to_csv("../results/videos_frames_index.csv", index=False)