Load video list and prompt information based on a specified dimension from a JSON file. Parameters: - json_dir (str): The directory path where the JSON file is located. - dimension (str): The dimension for evaluation Returns: - prompt_dict_ls (list): A list of dict
(json_dir, dimension)
| 140 | os.makedirs(path, exist_ok=True) |
| 141 | |
| 142 | def load_dimension_info(json_dir, dimension): |
| 143 | """ |
| 144 | Load video list and prompt information based on a specified dimension from a JSON file. |
| 145 | |
| 146 | Parameters: |
| 147 | - json_dir (str): The directory path where the JSON file is located. |
| 148 | - dimension (str): The dimension for evaluation |
| 149 | |
| 150 | Returns: |
| 151 | - prompt_dict_ls (list): A list of dictionaries, each containing a prompt and its corresponding evaluation file. |
| 152 | |
| 153 | The function reads the JSON file to extract video information. It filters the prompts based on the specified |
| 154 | dimension. |
| 155 | |
| 156 | Notes: |
| 157 | - The JSON file is expected to contain a list of dictionaries with keys 'dimension', 'evaluation_file', and prompts. |
| 158 | """ |
| 159 | prompt_dict_ls = [] |
| 160 | full_prompt_list = load_json(json_dir) |
| 161 | for prompt_dict in full_prompt_list: |
| 162 | if dimension == prompt_dict['dimension'] and 'evaluation_file' in prompt_dict: |
| 163 | prompt = prompt_dict['prompt'] |
| 164 | cur_evaluation_file = prompt_dict['evaluation_file'] |
| 165 | entry = { |
| 166 | 'prompt': prompt, |
| 167 | 'evaluation_file': cur_evaluation_file, |
| 168 | 'id': prompt_dict.get('id'), |
| 169 | 'dimension': prompt_dict.get('dimension'), |
| 170 | 'category': prompt_dict.get('category'), |
| 171 | 'motion_duration': prompt_dict.get('motion_duration'), |
| 172 | } |
| 173 | if 'auxiliary_info' in prompt_dict: |
| 174 | entry['auxiliary_info'] = prompt_dict['auxiliary_info'] |
| 175 | prompt_dict_ls.append(entry) |
| 176 | return prompt_dict_ls |
no test coverage detected