HumanSignal / HumanSignal/label-studio

Feature proposal: Add Line Region / Tag / Tool / Type / Result

Open
#6,872 7 comments 14 reactions 0 assignees View on GitHub
community_feature-request
Dominant language
TypeScript
Stars
28.3k
Forks
3.7k
Avg merge
14h
Merged PRs (30d)
15

Description

**Reasoning**
For one of our projects we need annotations which consist of a `KeyPoint` with a direction. Some would call it a [geometric vector](https://en.wikipedia.org/wiki/Euclidean_vector). The most practical way I found to implement this is with a dedicated `Line` Region with two points (or `Arrow`). The direction can then be easily calculated using the two points. With this POC I've created a new Line Region / Tag / Tool / Type and Result. A`Line` can be added to the editor with the dedicated control tag (including a configurable arrow flag):
```xml


....

```
The POC is demonstrated in the following video:

https://github.com/user-attachments/assets/6f4085c6-f890-4769-9f59-aea46572110f

**Code**
I've inspected the current `Polygon` Region / Tag / Tool / Type code, as a subset of the logic to draw polygons is also needed to draw lines. So the goal was to reuse as much code (for adding points, drag points etc) so that's what I tried to do. Some adjustments had to be made to the `PolygonRegion`, to make reuse possible. (As to be seen in this commit: https://github.com/maerteijn/label-studio/pull/2/commits/e7ec3c6fe4b4e24a297500c6f92daab7c071991a )

The full implementation of the POC can be found here: https://github.com/maerteijn/label-studio/pull/2/commits

You can run the example by yourself:
- Clone the [fork](https://github.com/maerteijn/label-studio/) and checkout the `poc/add-editor-support-for-lines` branch, then run `cd web && npm run lsf:serve`
- Browse to http://localhost:3000 to test out the example.

**Related**
Related feature requests which this POC partly solves or at least makes it more easy to implement:
- https://github.com/HumanSignal/label-studio/issues/2563
- https://github.com/HumanSignal/label-studio/issues/3655

**Feedback**
Any feedback from the developers would be very welcome. And I'd like to know if there is a chance a PR with this will be accepted (when acceptance criteria are met like tests etc). if so, then I could prepare a PR with the `Line` functionality as desired.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.