albumentations icon indicating copy to clipboard operation
albumentations copied to clipboard

feature request: add support for polylines /contours

Open DanTaranis opened this issue 2 years ago • 4 comments

your tool is awesome!!

a very common type of label is polylines/polygones/contours (all really the same thing). Please please add support for it like you support bounding boxes.

DanTaranis avatar Mar 02 '22 08:03 DanTaranis

Could you represent polygons as keypoints?

enaskopelja avatar Mar 08 '22 12:03 enaskopelja

interesting.possibly. it depends how you defined key-points. Usually key-points types assume a consistent number of points. Polygons can be any number (> 3) of points.

DanTaranis avatar Mar 08 '22 12:03 DanTaranis

The way albumentation treats keypoints shouldn't make this a problem since you also encounter that problem when having multiple different people in the same image or keypoints that aren't visible (out of frame). You can apply this same logic to polygons (set remove_invisible to False in A.compose though!): and then you simply clip the values of your polygon's vertices to the edges of your picture and you should obtain a transformed polygon ;)

vanderschuea avatar Jun 07 '22 12:06 vanderschuea

@enaskopelja @vanderschuea I finally tried this today (rather than turning the polylines into a segmentation map and working with that)

I ran into the following issues:

  1. keypoints allows 1 set of keypoints to be transformed . I have multiple polylines.
  2. The decision if to keep a point is per point rather than per polyline so I might end up with part of a polyline that should strech to the edge of the image but doesn't. There needs to be polyline aware logic for cutting the polyline - more similar to how the bounding box methods work.
  3. (minor) kyepoints expects int? what's wrong with floats?

DanTaranis avatar Aug 09 '22 10:08 DanTaranis