self-lane

import matplotlib.pyplot as plt
import matplotlib.image  as mpimg
import numpy as np
import cv2
import math
import os
import json

image = cv2.imread('/home/dell/lane1.jpg')
image = cv2.cvtColor(image,cv2.COLOR_RGB2GRAY)
image = cv2.GaussianBlur(image,(3,3),0)
img = cv2.Canny(image, 10, 80)

#mask
mask = np.zeros_like(img)
if len(img.shape)>2:
    channel = img.shape[2]
    ignore_mask_color = (255,) * channel_count
else:
    ignore_mask_color = 255
print(img.shape[0])
vertices = np.array([[(0,img.shape[0]),(100,img.shape[0]*0.8),(250,img.shape[0]*0.8),(img.shape[1],img.shape[0]),(0,img.shape[0])]])

cv2.fillPoly(mask, vertices, ignore_mask_color)
masked_image = cv2.bitwise_and(img, mask)  # 与操作
#line
lines=cv2.HoughLinesP(masked_image,rho=2, theta=np.pi / 180, threshold=100, min_line_len=10, max_line_gap=10)
hline_show = {'hlines': 'on', 'avg': 'on', 'steps': 'on'}
if hline_show['steps']=='on':
    

#
#cv2.imshow('image',image)
#cv2.waitKey(0)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Training deep models for lane detection is challenging due to the very subtle and sparse supervisory signals in- herent in lane annotations. Without learning from much richer context, these models often fail in challenging sce- narios, e.g., severe occlusion, ambiguous lanes, and poor lighting conditions. In this paper, we present a novel knowl- edge distillation approach, i.e., Self Attention Distillation (SAD), which allows a model to learn from itself and gains substantial improvement without any additional supervision or labels. Specifically, we observe that attention maps ex- tracted from a model trained to a reasonable level would encode rich contextual information. The valuable contex- tual information can be used as a form of ‘free’ supervision for further representation learning through performing top- down and layer-wise attention distillation within the net- work itself. SAD can be easily incorporated in any feed- forward convolutional neural networks (CNN) and does not increase the inference time. We validate SAD on three pop- ular lane detection benchmarks (TuSimple, CULane and BDD100K) using lightweight models such as ENet, ResNet- 18 and ResNet-34. The lightest model, ENet-SAD, per- forms comparatively or even surpasses existing algorithms. Notably, ENet-SAD has 20 × fewer parameters and runs 10 × faster compared to the state-of-the-art SCNN [16], while still achieving compelling performance in all bench- marks. Our code is available at https://github. com/cardwing/Codes-for-Lane-Detection.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值