当前位置:   article > 正文

CLRNet 车道线检测_clrnet代码实现

clrnet代码实现
  1. import torch
  2. import cv2
  3. from clrnet.engine.runner import Runner
  4. from clrnet.utils.config import Config
  5. import cv2
  6. import os
  7. import time
  8. import torch.backends.cudnn as cudnn
  9. cfg = Config.fromfile("configs/clrnet/clr_resnet18_culane.py")
  10. cfg.gpus = 1
  11. cfg.load_from = 'culane_r18.pth'
  12. cfg.resume_from = ''
  13. cfg.finetune_from = ''
  14. cfg.seed = 0
  15. def pre_process_image(path):
  16. img_w = 800
  17. img_h = 320
  18. cut_height = 270
  19. image = cv2.imread(path)
  20. image = image[cut_height:, :, :]
  21. image = cv2.resize(image, (img_w, img_h))
  22. image = torch.Tensor([image])
  23. image = image.permute(0, 3, 1, 2)
  24. return image
  25. def view(predictions):
  26. for lanes in predictions:
  27. img = cv2.imread("/root/CLRNet/v2-b40621ccca1d9a432adf1442dcc69540_b.jpg")
  28. out_file = "1.jpg"
  29. lanes = [lane.to_array(cfg) for lane
本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号