zoukankan      html  css  js  c++  java
  • 车道线识别之 tusimple 数据集介绍

    Tusimple 是一家做自动驾驶的公司,他也公布了一些其在自动驾驶领域积累的数据,其中有一些是和车道线检测相关的。20186 月份,其举办了一次以摄像头图像数据做车道检测的比赛,公开了一部分数据及其标注。数据下载数据是:https://github.com/TuSimple/tusimple-benchmark/issues/3

    在其doc中可以发现数据个数的一些说明

    标注json 文件中每一行包括三个字段 

    raw_file : 每一个数据段的第20帧图像的的 path 路径

    lanes h_samples 是数据具体的标注内容,为了压缩,h_sample 是纵坐标(应该是从上到下拍好顺序的),lanes 是每个车道的横坐标,是个二维数组。

    -2 表示这个点是无效的点

    上面的数据就有 4 条车道线,第一条车道线的第一个点的坐标是(632280)。 

    标注的过程应该是,将图片的下半部分如70%*height 等分成N份。然后取车道线(如论虚实)与该标注线交叉的点

    利用以下脚本可以处理得到标注的数据,这个脚本稍微改动下也可以作为深度学习输入的图像。

    # -*- coding: utf-8 -*-  
    import cv2
    import json
    import numpy as np
     
    base_path = "/Users/jcl/workspace/lane_detection/"
    
    file=open(base_path+'test_label.json','r')
    image_num=0
    
    for line in file.readlines():
        data=json.loads(line)
        # print data['raw_file']
        # 取第 29 帧 看一下处理的效果
        if image_num == 29:
            image=cv2.imread(base_path+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)
            # print width_num
            # print height_num
            # 遍历纵坐标
            for i in range(height_num):
                lane_hist=40
                # 遍历各个车道的横坐标
                for j in range(width_num):
                    # 端点坐标赋值
                    if arr_width[j][i-1]>0 and arr_width[j][i]>0:
                        binaryimage[int(arr_height[i]),int(arr_width[j][i])]=255
                        instanceimage[int(arr_height[i]),int(arr_width[j][i])]=lane_hist
                        if i>0:
                            # 画线,线宽10像素
                            cv2.line(binaryimage, (int(arr_width[j][i-1]),int(arr_height[i-1])), (int(arr_width[j][i]),int(arr_height[i])), 255, 10)
                            cv2.line(instanceimage,(int(arr_width[j][i-1]),int(arr_height[i-1])), (int(arr_width[j][i]),int(arr_height[i])), lane_hist, 10)
                    lane_hist+=50
            cv2.imshow('image.jpg',image)
            cv2.waitKey()
            cv2.imshow('binaryimage.jpg',binaryimage)
            cv2.waitKey()
            cv2.imshow('instanceimage.jpg',instanceimage)
            cv2.waitKey()
            break
            # string1=base_path+"gt_image_binary/"+str(image_num)+".png"
            # string2=base_path+"gt_image_instance/"+str(image_num)+".png"
            # string3=base_path+"raw_image/"+str(image_num)+".png"
            # cv2.imwrite(string1,binaryimage)
            # cv2.imwrite(string2,instanceimage)
            # cv2.imwrite(string3,image)
        image_num = image_num + 1
        
    file.close()
    print "total image_num:"+str(image_num)
    

    处理完之后图片输出如下所示:

     

     

    Tusimple 数据的标注特点:

    1、车道线实际上不只是道路上的标线,虚线被当作了一种实线做处理的。这里面双实线、白线、黄线这类信息是没有被标注的

    2、每条线实际上是点序列的坐标集合,而不是区域集合

  • 相关阅读:
    02点睛Spring4.1-Java Config
    01点睛Spring4.1-依赖注入
    00点睛Spring4.1-环境搭建
    Cas(09)——通过Proxy访问其它Cas应用
    Cas(08)——单点登出
    Cas(07)——建立使用Cas进行单点登录的应用
    Cas(06)——基于数据库的认证
    Cas(05)——修改Cas Server的其它配置
    remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
    解放双手—Cobbler批量自动化部署多版本系统
  • 原文地址:https://www.cnblogs.com/oftenlin/p/10670534.html
Copyright © 2011-2022 走看看