MCPcopy Index your code
hub / github.com/MotrixLab/ViMoGen / load_dimension_info

Function load_dimension_info

mbench/utils.py:142–176  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

140 os.makedirs(path, exist_ok=True)
141
142def 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

Callers 9

compute_pose_qualityFunction · 0.90
compute_body_penetrationFunction · 0.90
compute_jitter_degreeFunction · 0.90
compute_foot_floatingFunction · 0.90
compute_foot_slidingFunction · 0.90
compute_dynamic_degreeFunction · 0.90

Calls 1

load_jsonFunction · 0.85

Tested by

no test coverage detected