File size: 2,063 Bytes
8e29a6e | 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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | import torch
import os
from ivebench import VEBench
from datetime import datetime
import argparse
def parse_args():
parser = argparse.ArgumentParser(description='IVEBench - Video Editing Benchmark',
formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument(
"--output_path",
type=str,
default='',
help="Output path to save the evaluation results",
)
parser.add_argument(
"--source_videos_path",
type=str,
default='',
help="Folder that contains the source video frames",
)
parser.add_argument(
"--target_videos_path",
type=str,
default='',
help="Folder that contains the edited video frames",
)
parser.add_argument(
"--info_json_path",
type=str,
default='',
help="Path to the JSON file containing video information and prompts",
)
parser.add_argument(
"--metric",
nargs='+',
default=None,
help="List of evaluation metrics, usage: --metric <metric_1> <metric_2>",
)
parser.add_argument(
"--name",
type=str,
default="ivebench_eval",
help="Name prefix for output files",
)
args = parser.parse_args()
return args
def main():
args = parse_args()
print(f'Arguments: {args}')
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
my_VEBench = VEBench(device, args.output_path)
print(f'Starting IVEBench evaluation on device: {device}')
current_time = datetime.now().strftime('%Y-%m-%d-%H-%M-%S')
eval_name = f'{args.name}_{current_time}'
my_VEBench.evaluate(
source_videos_path=args.source_videos_path,
target_videos_path=args.target_videos_path,
info_json_path=args.info_json_path,
name=eval_name,
metric_list=args.metric
)
print('Evaluation completed successfully!')
if __name__ == "__main__":
main() |