|
1 | 1 | from __future__ import annotations
|
2 | 2 |
|
3 | 3 | import numpy as np
|
| 4 | +import json |
4 | 5 | from cvias.image.detection.vllm_detection import VLLMDetection
|
5 | 6 |
|
6 | 7 | from ns_vfs.automaton.video_automaton import VideoAutomaton
|
@@ -101,42 +102,23 @@ def run_nsvs_nsvqa(
|
101 | 102 |
|
102 | 103 |
|
103 | 104 | if __name__ == "__main__":
|
104 |
| - video_path = "/nas/mars/dataset/LongVideoBench/videos/86CxyhFV9MI.mp4" |
105 |
| - subtitle_path = "/nas/mars/dataset/LongVideoBench/subtitles/86CxyhFV9MI_en.json" |
106 |
| - bench = LongVideoBench(video_path, subtitle_path) |
| 105 | + input_data_path = "/nas/mars/experiment_result/nsvqa/1_puls/longvideobench/longvideobench-outputs-updated.json" |
| 106 | + with open(input_data_path, 'r', encoding='utf-8') as f: |
| 107 | + data = json.load(f) |
107 | 108 |
|
108 |
| - import sys |
109 |
| - sys.exit(0) |
110 |
| - sample_data = [ |
111 |
| - { |
112 |
| - "frames": [ |
113 |
| - # Create a 224x224x3 RGB image with some pattern |
114 |
| - np.random.randint( |
115 |
| - 0, 255, (224, 224, 3), dtype=np.uint8 |
116 |
| - ), # Random RGB image |
117 |
| - np.random.randint( |
118 |
| - 0, 255, (224, 224, 3), dtype=np.uint8 |
119 |
| - ), # Random RGB image |
120 |
| - ], |
121 |
| - "subtitle": "test", |
122 |
| - }, |
123 |
| - { |
124 |
| - "frames": [ |
125 |
| - np.random.randint( |
126 |
| - 0, 255, (224, 224, 3), dtype=np.uint8 |
127 |
| - ), # Random RGB image |
128 |
| - ], |
129 |
| - "subtitle": "test", |
130 |
| - }, |
131 |
| - ] |
132 |
| - run_nsvs_nsvqa( |
133 |
| - nsvqa_input_data=sample_data, |
134 |
| - desired_interval_in_sec=None, |
135 |
| - desired_fps=30, |
136 |
| - proposition_set=["car", "truck"], |
137 |
| - ltl_formula='"car" U "truck"', |
138 |
| - output_path="/home/mc76728/repo/Coargus/Neuro-Symbolic-Video-Search-Temporal-Logic/_dev_", |
139 |
| - threshold_satisfaction_probability=0.80, |
140 |
| - frame_scale=None, |
141 |
| - calibration_method="temperature_scaling", |
142 |
| - ) |
| 109 | + for sample in data: |
| 110 | + loader = LongVideoBench(sample["video_path"], sample["subtitle_path"]) |
| 111 | + nsvqa_input = loader.load_all() |
| 112 | + extracted = sample["video_path"].split('/')[-1].split('.')[0] |
| 113 | + |
| 114 | + run_nsvs_nsvqa( |
| 115 | + nsvqa_input_data=nsvqa_input, |
| 116 | + desired_interval_in_sec=None, |
| 117 | + desired_fps=30, |
| 118 | + proposition_set=sample["proposition"], |
| 119 | + ltl_formula=sample["specification"], |
| 120 | + output_path=f"/nas/mars/experiment_result/nsvqa/2_nsvs/longvideobench/{extracted}/", |
| 121 | + threshold_satisfaction_probability=0.80, |
| 122 | + frame_scale=None, |
| 123 | + calibration_method="temperature_scaling", |
| 124 | + ) |
0 commit comments