ibaiGorordo / TfLite-Ultra-Fast-Lane-Detection-Inference

Example scripts for the detection of lanes using the ultra fast lane detection model in Tensorflow Lite.
MIT License
21 stars 2 forks source link

Name 'lanes_points' is not defined #1

Closed Yen-Lung-Huang closed 2 years ago

Yen-Lung-Huang commented 2 years ago

Hello, thanks for the code. I'm running "imageLaneDetection.py" with culan tflite model and change model_type value in imageLaneDetection.py like:

model_type = ModelType.CULANE

then, i got these on terminal:

163: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
  return np.array(lane_points_mat), np.array(lanes_detected)
Traceback (most recent call last):
  File "imageLaneDetection.py", line 18, in <module>
    output_img = lane_detector.detect_lanes(img)
  File "/home/ubuntu/Codes/TfLite-Ultra-Fast-Lane-Detection-Inference/ultrafastLaneDetector/ultrafastLaneDetector.py", line 82, in detect_lanes
    visualization_img = self.draw_lanes(image, self.lanes_points, self.lanes_detected, self.cfg, draw_points)
  File "/home/ubuntu/Codes/TfLite-Ultra-Fast-Lane-Detection-Inference/ultrafastLaneDetector/ultrafastLaneDetector.py", line 175, in draw_lanes
    cv2.fillPoly(lane_segment_img, pts = [np.vstack((lanes_points[1],np.flipud(lanes_points[2])))], color =(255,191,0))
NameError: name 'lanes_points' is not defined

image

is the error message means the "lanes_points" variable in ultrafastLaneDetector.py is not defined? Where should I define the "lanes_points" in code?

ibaiGorordo commented 2 years ago

yeah, that should have been lane_points_mat instead of lanes_points (I copy pasted this part from my other repository, but forgot to modify it).

I think it should work now.

Yen-Lung-Huang commented 2 years ago

Yes, it works well! Thank you very much. image