1 Star 0 Fork 3

egrp1234/semantic-kitti-api

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
count.py 1.77 KB
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/env python3
# This file is covered by the LICENSE file in the root of this project.
import argparse
import os
import yaml
import numpy as np
import collections
from auxiliary.laserscan import SemLaserScan
if __name__ == '__main__':
parser = argparse.ArgumentParser("./count.py")
parser.add_argument(
'--dataset', '-d',
type=str,
required=True,
help='Dataset to calculate scan count. No Default',
)
parser.add_argument(
'--config', '-c',
type=str,
required=False,
default="config/semantic-kitti.yaml",
help='Dataset config file. Defaults to %(default)s',
)
FLAGS, unparsed = parser.parse_known_args()
# print summary of what we will do
print("*" * 80)
print("INTERFACE:")
print("Dataset", FLAGS.dataset)
print("Config", FLAGS.config)
print("*" * 80)
# open config file
try:
print("Opening config file %s" % FLAGS.config)
CFG = yaml.safe_load(open(FLAGS.config, 'r'))
except Exception as e:
print(e)
print("Error opening yaml file.")
quit()
# get training sequences to calculate statistics
sequences = CFG["split"]["train"]
sequences.extend(CFG["split"]["valid"])
sequences.extend(CFG["split"]["test"])
sequences.sort()
print("Analizing sequences", sequences, "to count number of scans")
# iterate over sequences and count scan number
for seq in sequences:
seqstr = '{0:02d}'.format(int(seq))
scan_paths = os.path.join(FLAGS.dataset, "sequences",
seqstr, "velodyne")
if not os.path.isdir(scan_paths):
print("Sequence", seqstr, "doesn't exist! Exiting...")
quit()
scan_names = [os.path.join(dp, f) for dp, dn, fn in os.walk(
os.path.expanduser(scan_paths)) for f in fn]
print(seqstr, ",", len(scan_names))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/egrp1234/semantic-kitti-api.git
git@gitee.com:egrp1234/semantic-kitti-api.git
egrp1234
semantic-kitti-api
semantic-kitti-api
master

搜索帮助