import torch
import cv2
from clrnet.engine.runner import Runner
from clrnet.utils.config import Config
import cv2
import os
import time
import torch.backends.cudnn as cudnn
cfg = Config.fromfile("configs/clrnet/clr_resnet18_culane.py")
cfg.gpus = 1
cfg.load_from = 'culane_r18.pth'
cfg.resume_from = ''
cfg.finetune_from = ''
cfg.seed = 0
def pre_process_image(path):
img_w = 800
img_h = 320
cut_height = 270
image = cv2.imread(path)
image = image[cut_height:, :, :]
image = cv2.resize(image, (img_w, img_h))
image = torch.Tensor([image])
image = image.permute(0, 3, 1, 2)
return image
def view(predictions):
for lanes in predictions:
img = cv2.imread("/root/CLRNet/v2-b40621ccca1d9a432adf1442dcc69540_b.jpg")
out_file = "1.jpg"
lanes = [lane.to_array(cfg) for lane
CLRNet 车道线检测
最新推荐文章于 2024-04-19 09:55:55 发布
博主在尝试使用CLRNet进行车道线检测时遇到问题,经过代码整合后,推理输出为空列表。期待熟悉该算法的大佬提供解决建议。
摘要由CSDN通过智能技术生成