File size: 1,393 Bytes
c28dddb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os
import subprocess
import argparse
from tqdm.contrib.concurrent import process_map
from functools import partial

def run_retrieve(src_dir, json_name, data_root):
    fn_call = ['python', 'scripts/mesh_retrieval/retrieve.py', '--src_dir', src_dir, '--json_name', json_name, '--gt_data_root', data_root]
    try:
        subprocess.run(fn_call, check=True,  stderr=subprocess.STDOUT)
    except subprocess.CalledProcessError as e:
        print(f'Error from run_retrieve: {src_dir}')
        print(f'Error: {e}')
    return ' '.join(fn_call)

if __name__ == '__main__':
    root_path = '/home/users/ruiqi.wu/manipulate_3d_generate/data/gpt_blender/'
    for class_name in os.listdir(root_path):
        if class_name == 'StroageFurniture':
            for model_id in os.listdir(os.path.join(root_path, class_name)):
                json_path = os.path.join(root_path, class_name, model_id, 'object.json')
                object_path = os.path.join(root_path, class_name, model_id, 'object.ply')
                if os.path.exists(json_path):
                    if not os.path.exists(object_path):
                        print(json_path)
                        src_dir = os.path.join(root_path, class_name, model_id)
                        json_name = 'object.json'
                        data_root = '../singapo'
                        run_retrieve(src_dir, json_name, data_root)