开源数据集中每个json之间的时间间隔?
array-svg opened this issue · 5 comments
由于我们的车辆模型和传感器配置的改变,所以希望对您开源出来的数据集进行再生成。我们读取您这边开源数据集中json的数据集的控制量,搭配我们给定的新的车辆模型的传感器配置生成新的图片和其他传感器数据。但是遇到的问题是,按照给定的data_collect的频率 10hz, 然后读取给定的json控制量去控车,发现并没有完美复现数据集开源的结果。所以想问问您这边开源出来的数据集每个json之间的时间间隔
@array-svg 10Hz.
from pathlib import Path
def list_files_in_directory(directory_path):
return [str(file) for file in Path(directory_path).rglob('*') if file.is_file()]
directory_path = '/home/xxxi01/Downloads/route/ParkingCutIn_Town12_Route1711_Weather15/anno/'
files = list_files_in_directory(directory_path)
import os, re
def extract_number(file_path):
filename = os.path.basename(file_path)
match = re.search(r'\d+', filename) # 查找文件名中的数字
return int(match.group()) if match else -1 # 没有找到数字则返回 -1
files = sorted(files, key=extract_number)
x = []
y = []
for file in files:
import gzip
import json
with gzip.open(file, 'rt', encoding='utf-8') as gz_file:
data = json.load(gz_file)
x.append(data['x'])
y.append(data['y'])
print("file: ", file)
print("x: ", data['x'])
print("y: ", data['y'])
print("len(x): ", len(x))
print("len(y): ", len(y))
import matplotlib.pyplot as plt
before = -1
plt.scatter(x[:before], y[:before], marker='o', linestyle='-', color='b') # 画线
plt.title('Line Plot of x vs y') # 图表标题
plt.xlabel('x') # x 轴标签
plt.ylabel('y') # y 轴标签
plt.grid(True)
plt.show()
这是我使用的绘图脚本
@array-svg The movement is around 1 meter, which means the vehicle is almost static. Note that CARLA IMU sensor intentionally adds noise to challenge the robustness of users. You may use the GT location which is noiseless.
好的感谢!已解决!