Giter Site home page Giter Site logo

humansignal / label-studio-frontend Goto Github PK

View Code? Open in Web Editor NEW
410.0 21.0 315.0 104.69 MB

Data labeling react app that is backend agnostic and can be embedded into your applications — distributed as an NPM package

Home Page: https://labelstud.io/

License: Apache License 2.0

HTML 0.46% JavaScript 64.44% CSS 0.03% Shell 0.07% SCSS 0.84% Stylus 3.70% TypeScript 30.45% Dockerfile 0.02%
label-studio image-annotation labeling-tool image-labeling image-labeling-tool react-components semantic-segmentation annotation-tool text-labeling audio-classification

label-studio-frontend's Introduction


This repository is deprecated

This repository has been deprecated in favor of https://github.com/HumanSignal/label-studio/tree/develop/web/libs/editor

Now it's read-only. Address all your issues and PRs to https://github.com/HumanSignal/label-studio/.


Label Studio Frontend · GitHub build npm audit

GitHub release · ☀️

WebsiteDocsTwitterJoin Slack Community


Label Studio is an open-source, configurable data annotation tool. ✌️

Frontend, as its name suggests, is the frontend library developed using React and mobx-state-tree, distributed as an NPM package. You can include it in your applications and provide data annotation support to your users. It can be granularly customized and extended.


Install

npm install @heartexlabs/label-studio

Usage

With Webpack

import LabelStudio from '@heartexlabs/label-studio';
import 'label-studio/build/static/css/main.css';

With UNPKG.com

<!-- Include Label Studio stylesheet -->
<link href="https://unpkg.com/@heartexlabs/[email protected]/build/static/css/main.css" rel="stylesheet">

<!-- Create the Label Studio container -->
<div id="label-studio"></div>

<!-- Include the Label Studio library -->
<script src="https://unpkg.com/@heartexlabs/[email protected]/build/static/js/main.js"></script>

Initialization

<!-- Initialize Label Studio -->
<script>
  var labelStudio = new LabelStudio('label-studio', {
    config: `
      <View>
        <Image name="img" value="$image"></Image>
        <RectangleLabels name="tag" toName="img">
          <Label value="Hello"></Label>
          <Label value="World"></Label>
        </RectangleLabels>
      </View>
    `,

    interfaces: [
      "panel",
      "update",
      "submit",
      "controls",
      "side-column",
      "annotations:menu",
      "annotations:add-new",
      "annotations:delete",
      "predictions:menu",
    ],

    user: {
      pk: 1,
      firstName: "James",
      lastName: "Dean"
    },

    task: {
      annotations: [],
      predictions: [],
      id: 1,
      data: {
        image: "https://htx-misc.s3.amazonaws.com/opensource/label-studio/examples/images/nick-owuor-astro-nic-visuals-wDifg5xc9Z4-unsplash.jpg"
      }
    },

    onLabelStudioLoad: function(LS) {
      var c = LS.annotationStore.addAnnotation({
        userGenerate: true
      });
      LS.annotationStore.selectAnnotation(c.id);
    }
  });
</script>

Development

  1. Clone the repository

    git clone [email protected]:heartexlabs/label-studio-frontend.git
    # or: git clone https://github.com/heartexlabs/label-studio-frontend.git
    cd label-studio-frontend
  2. Install required dependencies

    npm install
  3. Start the development server

    npm run start
  4. Check different ways to initiate the development server config & task data in src/env/development.js, changing the data variable is a good place to start.

  5. After you make changes and ready to use it in production, you need to create a production build

    npm run build-bundle

    Now you have one .js file and one .css file in the build/static/ directory

Label Studio for Teams, Startups, and Enterprises 🏢

Label Studio for Teams is our enterprise edition (cloud & on-prem), that includes a data manager, high-quality baseline models, active learning, collaborators support, and more. Please visit the website to learn more.

Ecosystem

Project Description
label-studio Server part, distributed as a pip package
label-studio-frontend Frontend part, written in JavaScript and React, can be embedded into your application
label-studio-converter Encode labels into the format of your favorite machine learning library
label-studio-transformers Transformers library connected and configured for use with label studio

License

This software is licensed under the Apache 2.0 LICENSE © Heartex. 2020

label-studio-frontend's People

Contributors

anithamuthu2022 avatar asashour avatar baigel1 avatar bmartel avatar bradneuberg avatar caitlinwheeless avatar chiganov avatar chitrankmishra avatar dependabot[bot] avatar farioas avatar gfauchart avatar gondragos avatar hlomzik avatar juliosgarbi avatar jverre avatar kaustuk avatar lrlunin avatar maiern avatar makseq avatar ncryer avatar nicholasrq avatar nikitabelonogov avatar niklub avatar smoreface avatar superdev808 avatar tclelford avatar travis1282 avatar twsl avatar victoratpl avatar yyassi-heartex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

label-studio-frontend's Issues

Incorrect position after rotating

Here is a problem while using rotationControl.

<View>
  <Image name="image" value="$image" rotateControl="true"/>
  <RectangleLabels name="label" toName="image">
    <Label value="Airplane" background="green"/>
    <Label value="Car" background="blue"/>
  </RectangleLabels>
</View>

Draw a rectangle
image

Rotate Left
image

Move the image in ImageView component to canvas

I'd like to propose the move of the actual image from an image tag to the canvas, mainly because it would make my feature request HumanSignal/label-studio#1425 much easier to implement using the existing filters in konva.

While this might come at a minor performance penalty, I do think the advantage of interactive filters to support labeling justifies this move.

Any help implementing this is appreciated as I am currently having problems calculating the size of the image.

Text Area cannot be labeled

Hi! I'd like to be able to label text that is inputted by the user via the TextArea tag however this feature is not possible yet. Please see the below example.

With a regular Text tag, I can select a label and highlight a word and it will then highlight that word with the color of the label and save the label. Just like this.
Screenshot (62)

With TextArea however I can select a label and highlight a word but nothing else happens. The label does not apply anything to the highlighted word.
Screenshot (60)

If this functionality can be added to TextArea that would be great! Thank you

Error when clicking reset button

Error message:

Error: [mobx-state-tree] Error while converting `undefined` to `ViewModel`:
value `undefined` is not assignable to type: `ViewModel` (Value is not a plain object).

To reproduce:

  1. Start using ImageBbox example
  2. Click reset button

Local build fails to compile

Following the build descriptions in README.md results in the following:

Failed to compile.

./src/examples/image_bbox/index.js
Module not found: Can't resolve './completions/1.json' in 'path/to/label-studio-frontend/src/examples/image_bbox'

The completions folder indeed seems to be missing.

Decide for one package manager

package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.

The source code includes lock files for npm and yarn. I strongly recommend to completly switch to yarn, as it's faster.
That would include updating all scripts.

The data is incorrect after the delete button

As shown in the figure, after the two delete buttons are clicked, the results obtained through OnSubmitAnnotation and OnUpdateAnnotation events are abnormal. For example, there are two annotation data in total.When I hit Delete, the onUpdateAnnotation event gets 12 results. @nicholasrq
微信图片_20210527100451

Webpack dev server deprecation warning

There are two deprication warnings when starting the webpack dev server:

[DEP_WEBPACK_DEV_SERVER_CONSTRUCTOR] DeprecationWarning: Using 'compiler' as the first argument is deprecated. Please use 'options' as the first argument and 'compiler' as the second argument.
[DEP_WEBPACK_DEV_SERVER_LISTEN] DeprecationWarning: 'listen' is deprecated. Please use async 'start' or 'startCallback' methods.

Reverse zoom

The image zoom direction by scrolling seems to be reverse of what other applications use:

label studio:

  • ctrl+ scroll up == zoom out
  • ctrl + scroll down == zoom in

other software:

  • scroll up == zoom in
  • scroll down == zoom out

Two suggested solutions:

  1. change it for everyone, by changing the sign here: https://github.com/heartexlabs/label-studio-frontend/blob/fd1e7cad9fdab9ca3c55691b2d0ee23905d51d59/src/tools/Zoom.js#L121
  2. make it configurable by the end user - with an xml parameter similar to zoomControl. See #134 for a first proposal for this.

Submit empty data in Transcription per region while TextArea required=true

I'm using Audio Transcription, specifically Transcription Per Region , I was trying to see if I can submit empty data that shouldn't be in the completion result, but actually I can submit it easily, all what is shown a warning message says that transcription TextArea is required, but no actual validation to prevent me from submitting.

I read through the code a little, and I found that you are using AntD TextArea Input, which has no required attribute to make prevent from not providing data.

So I was wondering if there is a way to prevent submitting without empty transcription or this is acceptable from your side?

Steps to reproduce the issue,

  • copy and paste the xml for transcription per region on playground (with required = true)
  • select a region on the Audio form, and leave the transcription area empty
  • press submit
  • warning Modal will appear.

Failed to resolve reference after removing PolygonRegion

Describe the bug
In some of my tasks, there is a problem with Mobx-state-tree when removing PolygonRegion:

mobx-state-tree.module.js:5845 Uncaught Error: [mobx-state-tree] Failed to resolve reference 'xCjDKNM31_' to type '(AudioRegionModel | BrushRegionModel | EllipseRegionModel | HyperTextRegionModel | KeyPointRegionModel | PolygonRegionModel | RectRegionModel | TextAreaRegionModel | TextRegionModel)' (from node: /completionStore/completions/0/regionStore/regions/9)
    at new InvalidReferenceError (mobx-state-tree.module.js:5845)
    at StoredReference.updateResolvedReference (mobx-state-tree.module.js:5820)
    at StoredReference.get [as resolvedValue] (mobx-state-tree.module.js:5830)
    at IdentifierReferenceType.getValue (mobx-state-tree.module.js:6013)
    at ScalarNode.get [as value] (mobx-state-tree.module.js:987)
    at ObjectNode.unbox (mobx-state-tree.module.js:1554)
    at Array.map (<anonymous>)
    at ObservableArrayAdministration.dehanceValues (mobx.module.js:3096)
    at Proxy.arrayExtensions.<computed> (mobx.module.js:3413)
    at _class.<anonymous> (Entities.js:204)
    at _class.render (index.module.js:1070)
    at allowStateChanges (mobx.module.js:978)
    at index.module.js:847
    at trackDerivedFunction (mobx.module.js:761)
    at Reaction.track (mobx.module.js:1795)
    at _class.reactiveRender [as render] (index.module.js:841)
    at finishClassComponent (react-dom.development.js:17160)
    at updateClassComponent (react-dom.development.js:17110)
    at beginWork (react-dom.development.js:18620)
    at HTMLUnknownElement.callCallback (react-dom.development.js:188)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:237)
    at invokeGuardedCallback (react-dom.development.js:292)
    at beginWork$1 (react-dom.development.js:23203)
    at performUnitOfWork (react-dom.development.js:22154)
    at workLoopSync (react-dom.development.js:22130)
    at performSyncWorkOnRoot (react-dom.development.js:21756)
    at react-dom.development.js:11089
    at unstable_runWithPriority (scheduler.development.js:653)
    at runWithPriority$1 (react-dom.development.js:11039)
    at flushSyncCallbackQueueImpl (react-dom.development.js:11084)
    at flushSyncCallbackQueue (react-dom.development.js:11072)
    at discreteUpdates$1 (react-dom.development.js:21893)
    at discreteUpdates (react-dom.development.js:806)
    at dispatchDiscreteEvent (react-dom.development.js:4168)
InvalidReferenceError @ mobx-state-tree.module.js:5845
StoredReference.updateResolvedReference @ mobx-state-tree.module.js:5820
get @ mobx-state-tree.module.js:5830
IdentifierReferenceType.getValue @ mobx-state-tree.module.js:6013
get @ mobx-state-tree.module.js:987
ObjectNode.unbox @ mobx-state-tree.module.js:1554
ObservableArrayAdministration.dehanceValues @ mobx.module.js:3096
arrayExtensions.<computed> @ mobx.module.js:3413
(anonymous) @ Entities.js:204
render @ index.module.js:1070
allowStateChanges @ mobx.module.js:978
(anonymous) @ index.module.js:847
trackDerivedFunction @ mobx.module.js:761
Reaction.track @ mobx.module.js:1795
reactiveRender @ index.module.js:841
finishClassComponent @ react-dom.development.js:17160
updateClassComponent @ react-dom.development.js:17110
beginWork @ react-dom.development.js:18620
callCallback @ react-dom.development.js:188
invokeGuardedCallbackDev @ react-dom.development.js:237
invokeGuardedCallback @ react-dom.development.js:292
beginWork$1 @ react-dom.development.js:23203
performUnitOfWork @ react-dom.development.js:22154
workLoopSync @ react-dom.development.js:22130
performSyncWorkOnRoot @ react-dom.development.js:21756
(anonymous) @ react-dom.development.js:11089
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushSyncCallbackQueueImpl @ react-dom.development.js:11084
flushSyncCallbackQueue @ react-dom.development.js:11072
discreteUpdates$1 @ react-dom.development.js:21893
discreteUpdates @ react-dom.development.js:806
dispatchDiscreteEvent @ react-dom.development.js:4168
Show 3 more frames
index.js:1 The above error occurred in the <_class> component:
    in _class (at Entities.js:281)
    in div (at Entities.js:250)
    in _class (at SideColumn.js:60)
    in div (created by Card)
    in div (created by Card)
    in Card (at SideColumn.js:55)
    in _class (at App.js:139)
    in div (at App.js:135)
    in div (at App.js:125)
    in div (at App.js:111)
    in Provider (at App.js:110)
    in div (at App.js:108)
    in App (created by inject-App-with-store)
    in inject-App-with-store (at src/index.js:65)
    in Provider (at src/index.js:64)

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://fb.me/react-error-boundaries to learn more about error boundaries.
console.<computed> @ index.js:1
logCapturedError @ react-dom.development.js:19527
logError @ react-dom.development.js:19564
update.callback @ react-dom.development.js:20708
callCallback @ react-dom.development.js:12490
commitUpdateQueue @ react-dom.development.js:12511
commitLifeCycles @ react-dom.development.js:19883
commitLayoutEffects @ react-dom.development.js:22803
callCallback @ react-dom.development.js:188
invokeGuardedCallbackDev @ react-dom.development.js:237
invokeGuardedCallback @ react-dom.development.js:292
commitRootImpl @ react-dom.development.js:22541
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
commitRoot @ react-dom.development.js:22381
finishSyncRender @ react-dom.development.js:21807
performSyncWorkOnRoot @ react-dom.development.js:21793
(anonymous) @ react-dom.development.js:11089
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushSyncCallbackQueueImpl @ react-dom.development.js:11084
flushSyncCallbackQueue @ react-dom.development.js:11072
discreteUpdates$1 @ react-dom.development.js:21893
discreteUpdates @ react-dom.development.js:806
dispatchDiscreteEvent @ react-dom.development.js:4168
mobx-state-tree.module.js:5845 Uncaught Error: [mobx-state-tree] Failed to resolve reference 'xCjDKNM31_' to type '(AudioRegionModel | BrushRegionModel | EllipseRegionModel | HyperTextRegionModel | KeyPointRegionModel | PolygonRegionModel | RectRegionModel | TextAreaRegionModel | TextRegionModel)' (from node: /completionStore/completions/0/regionStore/regions/9)
    at new InvalidReferenceError (mobx-state-tree.module.js:5845)
    at StoredReference.updateResolvedReference (mobx-state-tree.module.js:5820)
    at StoredReference.get [as resolvedValue] (mobx-state-tree.module.js:5830)
    at IdentifierReferenceType.getValue (mobx-state-tree.module.js:6013)
    at ScalarNode.get [as value] (mobx-state-tree.module.js:987)
    at ObjectNode.unbox (mobx-state-tree.module.js:1554)
    at Array.map (<anonymous>)
    at ObservableArrayAdministration.dehanceValues (mobx.module.js:3096)
    at Proxy.arrayExtensions.<computed> (mobx.module.js:3413)
    at _class.<anonymous> (Entities.js:204)
    at _class.render (index.module.js:1070)
    at allowStateChanges (mobx.module.js:978)
    at index.module.js:847
    at trackDerivedFunction (mobx.module.js:761)
    at Reaction.track (mobx.module.js:1795)
    at _class.reactiveRender [as render] (index.module.js:841)
    at finishClassComponent (react-dom.development.js:17160)
    at updateClassComponent (react-dom.development.js:17110)
    at beginWork (react-dom.development.js:18620)
    at HTMLUnknownElement.callCallback (react-dom.development.js:188)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:237)
    at invokeGuardedCallback (react-dom.development.js:292)
    at beginWork$1 (react-dom.development.js:23203)
    at performUnitOfWork (react-dom.development.js:22154)
    at workLoopSync (react-dom.development.js:22130)
    at performSyncWorkOnRoot (react-dom.development.js:21756)
    at react-dom.development.js:11089
    at unstable_runWithPriority (scheduler.development.js:653)
    at runWithPriority$1 (react-dom.development.js:11039)
    at flushSyncCallbackQueueImpl (react-dom.development.js:11084)
    at flushSyncCallbackQueue (react-dom.development.js:11072)
    at discreteUpdates$1 (react-dom.development.js:21893)
    at discreteUpdates (react-dom.development.js:806)
    at dispatchDiscreteEvent (react-dom.development.js:4168)
InvalidReferenceError @ mobx-state-tree.module.js:5845
StoredReference.updateResolvedReference @ mobx-state-tree.module.js:5820
get @ mobx-state-tree.module.js:5830
IdentifierReferenceType.getValue @ mobx-state-tree.module.js:6013
get @ mobx-state-tree.module.js:987
ObjectNode.unbox @ mobx-state-tree.module.js:1554
ObservableArrayAdministration.dehanceValues @ mobx.module.js:3096
arrayExtensions.<computed> @ mobx.module.js:3413
(anonymous) @ Entities.js:204
render @ index.module.js:1070
allowStateChanges @ mobx.module.js:978
(anonymous) @ index.module.js:847
trackDerivedFunction @ mobx.module.js:761
Reaction.track @ mobx.module.js:1795
reactiveRender @ index.module.js:841
finishClassComponent @ react-dom.development.js:17160
updateClassComponent @ react-dom.development.js:17110
beginWork @ react-dom.development.js:18620
callCallback @ react-dom.development.js:188
invokeGuardedCallbackDev @ react-dom.development.js:237
invokeGuardedCallback @ react-dom.development.js:292
beginWork$1 @ react-dom.development.js:23203
performUnitOfWork @ react-dom.development.js:22154
workLoopSync @ react-dom.development.js:22130
performSyncWorkOnRoot @ react-dom.development.js:21756
(anonymous) @ react-dom.development.js:11089
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushSyncCallbackQueueImpl @ react-dom.development.js:11084
flushSyncCallbackQueue @ react-dom.development.js:11072
discreteUpdates$1 @ react-dom.development.js:21893
discreteUpdates @ react-dom.development.js:806
dispatchDiscreteEvent @ react-dom.development.js:4168
Show 3 more frames

To Reproduce
Steps to reproduce the behavior:

  1. Download tasks.json, config.xml and completion json file.
  2. Copy directories and files from the .zip archive to examples/ directory of label-studio-frontend.
  3. Run frontend using npm run start.
  4. Click on 2nd polygon (the one that has 88,41 amount inside it).
  5. Remove polygon either via red bin button or using backspace.

Expected behavior

  1. Polygon is removed from ImageView.
  2. Polygon is removed from results list.
  3. Polygon is detached from mobx state trees, and later destroyed so it not clutter the state.

Additional context
This happens only if I remove polygons from the Results list from 2nd to 13th positions. What's really weird, when I delete 2nd region I got error regarding node /completionStore/completions/0/regionStore/regions/9, when I delete 3rd regarding node /completionStore/completions/0/regionStore/regions/19, when 4th - /completionStore/completions/0/regionStore/regions/29 and so on. For 13th region, I got error about regions/119, and for 14th it works, presumably because there is no region 129+ in the results list.

After the error occurred, I looked in console on values of completionStore.regions array. The values till 8th element of this array (including 8th) are fetched, but from 9th till next couple regions there is an error with resolving reference (so the problem is not only with 9th node in this array, but also next ones).

What also interesting, if I remove 1st polygon, and later again 1st polygon (so the 2nd one which removing doesn't work in scenario stated above), everything works well.

I made some debugging, it must have something in common with detaching the PolygonRegion/Region in CompletionStore.js on line 217th. Removing that line causes error not being shown, but I guess in trade off of not removing the node from a tree.

For me, debugging Mobx state tree looks quite hard. I hope you have some tricks about how to do it and you could share some insights with me.

The questions I couldn't find answers are:

  1. Why there is problem with 9, 19, 29th region in regionStore if I remove regions 2, 3, 4th from the results list (some sorting mechanism?).
  2. How to track all places where specific region is referenced from.

Hope you find some answers.

custom language

hi~,Can you convert all the information on the LabelStudio panel to a specific language?

AudioPlus makes page hang on submit when used with predictions

Hi 👋

How to reproduce:

  1. Create a project that uses the AudioPlus component with labels:

    <View>
      <AudioPlus name="audio" value="$audio"/>
      <Labels name="label" toName="audio">
        <Label value="Beep" />
      </Labels>
    </View>
  2. Create two or more tasks with a prediction:

    {
      "data": {
        "audio": "https://app.heartex.ai/static/samples/game.wav"
      },
      "predictions": [
        {
          "result": [{
            "from_name": "label",
            "to_name": "audio",
            "type": "labels",
            "value": {
              "start": 1,
              "end": 2,
              "labels": ["Beep"]
            }
          }],
          "score": 1
        }
      ]
    }
    
  3. Label the task. Keep the predicted region as it is and click submit.

  4. The page will load indefinitely and there will be an error in the console.

    image

This error occurs here.

_ws_region is set here. However, it wasn't created through the user interface so wsRegion doesn't have a remove() method. Instead, I think it contains this object.

Thanks!

Error when deleting completion

Really like the package, thanks for making something so great !

I noticed an error when deleting completions: Cannot read property 'selected' of undefined

To reproduce:

  1. Start frontend using ImagePolygons example
  2. Create new completion
  3. Delete existing completion (not the new one)
  4. Error message appears

Mutli channel scroll

I have a scroll issue for multi channel in time series project. (for example 3 channels)
When I control overview at the bottom of the screen, the scroll goes up to the TOP.
And it is very uncomfortable.
Is there any way to fix the scroll?? Or do you have plans to provide future?

Convenient time series labeling with only one label

When you are annotating time-series with one label (e.g. anomaly detection) it is very inconvenient to select the label all the time. One can avoid it by selecting the "Keep label selected after creating a region" option but when the region is removed the label is deselected again.

It would be very convenient to have an option to keep one label always on. You do not need to select the label as you have only one possibility and the label is not deselected on delete. It would be also nice if you can set up the default label that is selected when the view is shown for the first time.

Cannot zoom the image properly

Hi all,

This is a very tormenting issue, since I want to operate on images with small height.
The issues is, that there is no way of fitting the height of the image to the viewing window.

ezgif com-gif-maker (1)

I still don't know how to add this DOM to my front-end code

I would like to know how this thing is displayed in the front-end code. I copied the code directly, and it seems that there will be errors. I look forward to your reply

main.js:2 Uncaught ReferenceError: exports is not defined

at main.js:2

(anonymous) @ main.js:2
a.html:29 Uncaught ReferenceError: LabelStudio is not defined
at a.html:29

Is it possible to avoid modifying global styles?

What is happening?

When integrating Label Studio into an existing web application, the global styles (e.g. body, h1, h6, etc. ) are modified. This causes the entire application (even outside of Label Studio) to be styled.
The modification occurs because of the use of Ant Design; imported in label-studio-frontend/src/assets/styles/global.scss

What is expected?

It would be desirable that the Label Studio style is scoped and not affect the rest of the application.

Version

0.8.0

Environment

Any

Choice duplicates when using Keypoint and Rectangel together

Hi all,

I'm facing an issue that stuck me for days. It will be very appreciated if anyone provide any idea to help this issue!

Issue: Doubles choices result will happen when there are KeyPointLabels with Choices and RectangleLabels in the config file.
Version: 0.7.3
The example of the config file is as below

<View>
  <Image name="image" value="$image" zoom="true" zoomControl="true"/>
  <KeyPointLabels name="label" toName="image"
                  strokewidth="2" opacity="1" >
      <Label value="Left Eye State" background="red"/>
      <Label value="Right Eye State" background="blue"/>
  </KeyPointLabels>
  <View visibleWhen="region-selected" whenLabelValue="Left Eye State">
    <Header value="Enter Eye Status:"/>
    <Choices name="leye-status" toName="image"
             perRegion="true">
      <Choice value="Eye Open" alias="1"/>
      <Choice value="Eye Half-Open" alias="2"/>
      <Choice value="Eye Barely-Open" alias="3"/>
      <Choice value="Eye Closed" alias="4"/>
      <Choice value="Occluded" alias="5"/>
    </Choices>
    </View>
  <Header value="FaceDetection:"/>
    <RectangleLabels name="face-boxes" toName="image">
        <Label value="TightBoundingBox" background="green"/>
    </RectangleLabels>
</View>

And the Choices are like the image below
image
When I delete perRegion="true" from Choices tag, it will work. But I need the information generated by perRegion="true".

Thanks in advance for any help!

Selected property of Choice within Taxonomy does not work

Hello! I believe there is a bug with selected property of Choice tag when used within Taxonomy. It can be reproduced in the playground and occurs in multiple different versions.

Bug description
When Choice is provided with selected="true" property it works with no problems within Choices, but not within Taxonomy.

Bug cause
After briefly looking through the code, it seems that this property is not supported at all within Taxonomy. It does not add pre-selections on lines 570-572 in AnnotationStore (which seems to be easily solvable by making it support both choices and taxonomy). In order to do that, it needs to know node.preselectedValues, which even after importing SelectedModelMixin I could not get working, as it fails to get an array containing the full path - and gets only the last choice instead.

Dialogue colours are hard to distinguish

The behaviour of the <Paragraphs> tag is to generate a background colour for each speaker based on their name. This is cool, but the colours are a bit too muted and it makes it hard for people to distinguish between speakers at a glance. If you're annotating a conversation where different speakers have different possible annotations, this is quite a hinderance.

Here's the example from the Labelling Interface Config page:

image

Although they're different colours, it's difficult to tell them apart. This is a marked difference from the example in the docs:
image

A (very) simple solution to this is to increase the alpha value a little in the colour generator so the different colours are more distinct.

Inconsistent completions - NER HTML tagging

Exported completions are different depending on order of selection.
Tested on labelstudio.io/playground/
With config

<View>
  <HyperTextLabels name="ner" toName="text">
    <Label value="Person" background="green"/>
    <Label value="Organization" background="blue"/>
  </HyperTextLabels>

  <View style="border: 1px solid #CCC;
               border-radius: 10px;
               padding: 5px">
    <HyperText name="text" value="$text"/>
  </View>
</View>

I tagged the same regions with the same labels but in different order.
These are the results:
Zrzut ekranu 2021-01-29 o 11 57 12

Note: different start/end index and different offset.

_sandbox_config is missing

Trying to develop new features requires this import import { SandboxConfig } from "../examples/_sandbox_config"; which is missing. Can someone please provide the missing file?

Variability of fill figure transparency

Main idea to make it possible to configure the inner opacity of figures. For many cases it can be very useful to work with borders only. One of the possible realisation (in coordination with @deppp) is a parameter fillOpacity in a Label-Tag. For my part it's will be implemented for in project existing geometric figures (Rectangle, Ellipse, Polygon).

RichText Tag crashes when ValueType is set to "url" and the annotations includes a relation

HI,
I have an issue with the new RichText tag. When using it with the valueType set to "url" and the annotations includes a relation, the component crashes.

That's the error:

TypeError: Cannot read property '0' of undefined
    at Object.get regionElement (RichTextRegion.js:32)
    at e.computeValue (mobx.module.js:1280)
    at e.get (mobx.module.js:1210)
    at e.read (mobx.module.js:4136)
    at Object.get (mobx.module.js:4400)
    at new DOMWatcher (DOMWatcher.js:4)
    at new RelationShape (RelationShape.js:13)
    at f (NodesConnector.js:35)
    at Object.p [as connect] (NodesConnector.js:48)
    at RelationItem (RelationsOverlay.js:98)

The config file is as below:

<View>
  <HyperTextLabels name="label" toName="text">
    <Label value="Organization" background="orange"/>
    <Label value="Person" background="green"/>
    <Label value="Datetime" background="blue"/>
  </HyperTextLabels>
  <View>
    <HyperText name="text" value="$text" valueType="url" />
  </View>
</View>

The problem is not showing up when the data (html for instance) is passed directly in the value parameter.

@nicholasrq

how to integrate users / include user info in completion

It would be super helpful to have some documentation around how to include user info in the completions. The sidebar display seems to be prepared to read a createdBy key from the completion, however this information does not seem to be retrieved from my actual completion json file.

The example in the readme seems to indicate that one is supposed to include the user information in the front end to be passed with the completion submission. However, this doesn't seem like the right approach, since this would be imminently hackable by a malicious user. Instead, I have injected the current user's information into the completion object in a modified completion endpoint in the API on the server side. However, as stated above, the createdBy key, which now exists in my completion data, does not seem to be getting used in the sidebar display.

Content Security Policy Error on Build Process for config.xml Files

Hello community
I'm trying to use LSF in my single-spa project. To do so, I had to manage some changes on LSF and convert it to a microfrontend. The important ones are described here and here. The goal is to use in-browser import maps
to import one microfrontend in another one similar to JS import specifiers.
I have successfully managed the process and now I'm able to import LSF in my other microfrontend app and the UI renders. However now there is only one problem initializing the app state.

While initializing the state tree of mobx store, LSF uses treeToModel and runTemplate functions to generate the model using the config provided via params. The problem rises from the config param which is a XML like file (actually some JSX markups in a custom file with a .XML suffix). I manage to import these files in the Webpack build process using raw-loader. However I got these errors on the build process using the below config.xml:

<View>
  <Image name="img" value="$image"></Image>
  <RectangleLabels name="tag" toName="img" fillOpacity="0.5" strokeWidth="5">
    <Label value="Planet"></Label>
    <Label value="Moonwalker" background="blue"></Label>
  </RectangleLabels>
</View>
'Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline' https: localhost:*".
'  in 

Code:
 with(obj) { var r=[]; r.push(image); return r.join(""); } 

And the same CSP error for these lines:

with(obj) { var r=[]; r.push("Planet"); return r.join(""); } 

&

 with(obj) { var r=[]; r.push("Moonwalker"); return r.join(""); } 

I think the markup extraction process in the runTemplate function causes the situation:

function runTemplate(html, options) {
  if (!options) options = {};

  var re = /[$](.+)/g,
    reExp = /(^( )?(var|if|for|else|switch|case|break|{|}|;))(.*)?/g,
    code = "with(obj) { var r=[];\n",
    cursor = 0,
    result,
    match;

  var add = function(line, js) {
    js
      ? (code += line.match(reExp) ? line + "\n" : "r.push(" + line + ");\n")
      : (code += line !== "" ? 'r.push("' + line.replace(/"/g, '\\"') + '");\n' : "");
    return add;
  };

  while ((match = re.exec(html))) {
    add(html.slice(cursor, match.index))(match[1], true);
    cursor = match.index + match[0].length;
  }

  if (!html) return "";

  add(html.substr(cursor, html.length - cursor));
  code = (code + 'return r.join(""); }').replace(/[\r\t\n]/g, " ");

  try {
    result = new Function("obj", code).apply(options, [options]); // eslint-disable-line no-new-func
  } catch (err) {
    console.error("'" + err.message + "'", " in \n\nCode:\n", code, "\n");
  }

  return result;
}

It seems that new Function() call triggers the CSP error.

Do you have any suggestion for a start point to do so? Or any other idea about how to proceed?

Improve image segmentation interface

Currently, image segmentation still feels a bit 'clunky' and is only usable for the most basic tasks. Some ideas to improve the experience:

  • Images are presented in a relatively small container, especially when working with lower resolution images. In these cases both zooming and increasing the image size in the labelling setup cause the image to be 'cropped', while the majority of the screen real estate remains unused. Below an example with from top to bottom: 'vanilla', zoomed, and width set to 150%.
    Screenshot from 2021-01-06 19-52-48
    Screenshot from 2021-01-06 19-53-06
    Screenshot from 2021-01-06 19-53-50
  • Panning with the middle mouse button and a label selected generates mouse clicks, thus new regions.
  • Being able to combine different tools such as polygons and brushes together is extremely valuable, by for example allowing you to first 'rough out' a shape using the polygon tool and then refining with brushes & erasers
  • Content-aware tools such as a magic wand would greatly speed up segmentation.

[FEATURE REQUEST] Add callbacks for modified completions

I am working on an app where we needed to replace the default controls with our own.

Needing to track whether the state is dirty or not (completions changed, were added or deleted) to encourage the user to save the page, we find ourselves in need of a mechanism that will callback whenever a change occured.

RichText view inserts extra <br> tags when HTML code contains newlines

Thanks for all the work you've put into this awesome tool!
I'm labeling some HTML elements with Choices and I'm encountering an issue where extra line breaks are inserted with the HTML contents.
I think it's because of line 139 in /src/tags/object/RichText/view.js, which currently reads:

const val = (item.type === 'text' ? htmlEscape(content) : content).replace(/\n|\r/g, newLineReplacement);

I think it make sense to change the line as per below:

const val = item.type === 'text' ? htmlEscape(content).replace(/\n|\r/g, newLineReplacement) : content;

I think only text needs to have its newlines converted to <br/>, since HTML content should already have <br/> tags where they are wanted and whitespace in HTML is mostly ignored.
Does this make sense? Should I create a pull request?
You can see the extra <br> tags I'm taking about if you pause the e2e NER test right after initialization (line 59), notice the extra <br> tags rendered when there are none in the source HTML:
richTextDivWithExtraBrTags
Would it make sense to add a test that asserts that the number of <br> elements in rendered HTML is same as in source HTML?

consistent coordstype between input annotations and output

Hi,
I was trying to improve the streamlit component: https://github.com/deneland/streamlit-labelstudio
The main thing that it lacks is the ability to take a previous annotation. I just want to give back the annotations that I got to labelstudio.

I noticed that there is a difference in format between what comes out of this frontend and what needs to be given back in annotations in task configuration. I did this formatting change and am passing in annotations in task. Now I am able to see the previous annotations. However there seems to be a problem.

The coordinates that come out seems to be in pixels (coordstype: 'px'), but it seems the input annotations given in task should be in percentage. Is there a way to make this consistent - either percentage all the time or pixels all the time.

Issue with nested data labellings

I have a conditional data labelling config where some of the labels appear only if a particular choice is selected. I'm using a View tag with visibleWhen="choice-selected" option. The config file works on the label studio playground but when I try to embed it as per the example here, I get an error with message:

Types.js:18 Uncaught Error: Not expecting tag: view.

However, if I remove the View tag, it works fine. Can somebody suggest what could be the issue? Thanks.

Timeline Segmentation Crashes

Ahoi label studio gang. 🙂
Having some issues using Video Timeline Segmentation template

I followed steps from the website to run things in docker

docker run -it -p 8080:8080 -v `pwd`/mydata:/label-studio/data heartexlabs/label-studio:latest

version:

{
  "package": {
    "version": "1.0.1",
    "short_version": "1.0",
    "latest_version_from_pypi": "1.0.0.post3",
    "latest_version_upload_time": "2021-03-22T13:00:56",
    "current_version_is_outdated": false
  },
  "backend": {
    "commit": "fdeb96",
    "date": "2021-04-01 04:01:21 +0300",
    "branch": "master",
    "version": "1.0.0+74.gfdeb965.dirty"
  },
  "label-studio-frontend": {
    "commit": "ed104bfb148d6f40460ace666650dda7307b87c4",
    "branch": "master",
    "date": "2021-03-23T17:24:07Z"
  },
  "dm2": {
    "commit": "0ec820ee1044835e2d76bde4fbcbe9b2c48429ca",
    "branch": "master",
    "date": "2021-04-01T00:33:31Z"
  }
}

Steps see video.

_error.mp4

@hlomzik can you help?

thanks for your support

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.