Lanenet开源代码,用tusimple数据集进行训练,需要将.json数据集转换为readme中的图像格式。于是,手动写个python脚本转换工具。
lanenet github地址:https://github.com/MaybeShewill-CV/lanenet-lane-detection
tusimple数据集下载地址:http://benchmark.tusimple.ai/#/t/1/dataset
import cv2
import json
import numpy as np
file=open('label_data_0601.json','r')
image_num=0
for line in file.readlines():
data=json.loads(line)
image=cv2.imread(data['raw_file'])
binaryimage=np.zeros((image.shape[0],image.shape[1],1),np.uint8)
instanceimage=binaryimage.copy()
arr_width=data['lanes']
arr_height=data['h_samples']
width_num=len(arr_width)
height_num=len(arr_height)
for i in range(height_num):
lane_hist=0
|