赞
踩
- 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
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。