preprocess.py 1.47 KB
Newer Older
Chengyu Wang's avatar
Chengyu Wang committed
1
# ==============================================================================
zhe chen's avatar
zhe chen committed
2
# Binaries and/or source for the following packages or projects
Chengyu Wang's avatar
Chengyu Wang committed
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
30
31
32
# are presented under one or more of the following open source licenses:
# preprocess.py    The OpenLane-V2 Dataset Authors    Apache License, Version 2.0
#
# Contact wanghuijie@pjlab.org.cn if you have any issue.
#
# Copyright (c) 2023 The OpenLane-v2 Dataset Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# =============================================================================='

from openlanev2.io import io
from openlanev2.preprocessing import collect

root_path = './OpenLane-V2'
for file in io.os_listdir(root_path):
    if file.endswith('json'):
        subset = file.split('.')[0]
        for split, segments in io.json_load(f'{root_path}/{file}').items():
            point_interval = 1 if split == 'train' else 20
            collect(root_path, {split: segments}, f'{subset}_{split}', point_interval=point_interval)