Datasets:
Download source_policy/cvs_get_valid_frames_verified.py from EgoF0102/SceneBench: direct link, hf CLI and curl.
- Browser
- Download file 777 Bytes
-
https://huggingface.co/datasets/EgoF0102/SceneBench/resolve/main/source_policy/cvs_get_valid_frames_verified.py
- Command line
-
hf download hf://datasets/EgoF0102/SceneBench/source_policy/cvs_get_valid_frames_verified.py
-
curl -L -o cvs_get_valid_frames_verified.py https://huggingface.co/datasets/EgoF0102/SceneBench/resolve/main/source_policy/cvs_get_valid_frames_verified.py
777 Bytes
| 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) |