HumanSignal / label-studio-frontend

Data labeling react app that is backend agnostic and can be embedded into your applications — distributed as an NPM package
https://labelstud.io/
Apache License 2.0
422 stars 317 forks source link

Passing a list of images to a label studio component #667

Open emanuilo opened 2 years ago

emanuilo commented 2 years ago

Is it possible to pass multiple images or a list of images to Label studio component? Here is an example of the component for a single image.

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",
      "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);
    }, 

    onSubmitAnnotation: function(LS, annotation) {
      // retrive an annotation 
      console.log(annotation.serializeAnnotation())
    }

  });
makseq commented 2 years ago

Try to use this data:

data: {
  image: ["http://x.com/1.jpg", "http://x.com/2.jpg", "http://x.com/3.jpg"]
}

in this case LS will allow to have multiple layers in one image, e.g. it's convenient for medical images.

Emily-0616 commented 1 year ago

Try to use this data:

data: {
  image: ["http://x.com/1.jpg", "http://x.com/2.jpg", "http://x.com/3.jpg"]
}

in this case LS will allow to have multiple layers in one image, e.g. it's convenient for medical images.

After I switch to another image after processing one image, the annotations still remain. Shouldn't the expectation be that each image should have its own annotation?