If annotation is for polylines, do I use segmentation or detection?

If annotation is for polylines, do I use segmentation or detection? Does yolo v8 work with polylines?
I tried training polyline images+annotations with segmentation and mask mAP is incredibly low (0.000xxx). Also, using the trained model to detect lines, the predict results show bounding boxes and only some predict results include red lines.