Esempio n. 1
0
def load_work_list():
    anno_dir = './nfs/lidar_data/labeled_data/'
    for path in os.listdir(anno_dir):
        subdir = os.path.join(anno_dir, path)
        if not os.path.exists(subdir) or path.find('lijie') > -1 or path.find('2018-01') > -1:
            continue
        bag_name = "bag-" + path.replace('.json', '')
        update_time = int(os.stat(subdir).st_mtime)
        create_time = int(os.stat(subdir).st_ctime)
        find_bag_name = ModelUtil.query_one(db_name, table_name, {"bag_name": bag_name})
        if (find_bag_name is not None and find_bag_name['update_time'] != update_time) or find_bag_name is None:
            box_num = f_workload(subdir, ['0', '0', '0', '0', '0', '150'])
            box_num = str(int(round(box_num / 3.0, 2)))
        else:
            box_num = find_bag_name['box_num']
        if find_bag_name is None:
            item = dict(
                bag_name=bag_name,
                box_num=box_num,
                update_time=update_time,
                create_time=create_time
            )
            ModelUtil.add(db_name, table_name, item)
            ModelUtil.create_index(db_name, table_name, ['bag_name', 'box_num'])
            print('add %s' % item)
        elif find_bag_name is not None and find_bag_name['box_num'] != box_num:
            find_bag_name['box_num'] = box_num
            find_bag_name['update_time'] = update_time
            ModelUtil.update(db_name, table_name, find_bag_name)
            print('update: %s' % find_bag_name)
    update_request_work_time()
Esempio n. 2
0
def load_task_list():
    anno_dir = './nfs/lidar_data/raw_data/'
    for path in os.listdir(anno_dir):
        item = {
            "marker": '',
            "reviewer": '',
            "bag_name": "bag-" + path.replace('.bag', ''),
            "status": 0
        }
        if ModelUtil.exists(db_name, table_name,
                            {"bag_name": "bag-" + path.replace('.bag', '')}):
            continue
        ModelUtil.add(db_name, table_name, item)
        ModelUtil.create_index(db_name, table_name, ['bag_name'])
    print('update done')