# Import labelstudio segmentation from a different machine

**URL:** <https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228>\
**Category:** Label Studio Support\
**Created:** [June 3, 2024, 5:07pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228 "2024-06-03T17:07:52Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![lmsasu](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@lmsasu](https://community.labelstud.io/u/lmsasu)\
**Post date:** [June 3, 2024, 5:07pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228/1 "2024-06-03T17:07:52Z")

</div>

For an image segmentation task, how can a user export both images and performed annotations (done in LS) and pass them to me? I guess exporting them as COCO should work, as the resulting zip file has both images and a JSON with annotations, but how do I import it on my machine?

---

<div class="post-metadata">

**Author:** ![makseq](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/makseq/32/26_2.png) [@makseq](https://community.labelstud.io/u/makseq)\
**Post date:** [June 3, 2024, 5:10pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228/2 "2024-06-03T17:10:25Z")

</div>

> [@lmsasu](#):
>
> or an image segmentation task, how can a user export both images and performed annotations (done in LS) and pass them to me? I guess exporting them as COCO should work, as the resulting zip file has both images and a JSON with annotations, but how do I import it on my machine?

Why do you need COCO for this? I would highly recommend to use native LS JSON format.

---

<div class="post-metadata">

**Author:** ![lmsasu](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@lmsasu](https://community.labelstud.io/u/lmsasu)\
**Post date:** [June 3, 2024, 5:14pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228/3 "2024-06-03T17:14:32Z")

</div>

Thanks for your reply. I also have the LS JSON, and the data are imported from local storage. How do I import the annotations from LS JSON?

---

<div class="post-metadata">

**Author:** ![makseq](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/makseq/32/26_2.png) [@makseq](https://community.labelstud.io/u/makseq)\
**Post date:** [June 3, 2024, 5:15pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228/4 "2024-06-03T17:15:55Z")

</div>

Just re-connect local storage with images and then import Label Studio JSON file using Data Manager =\> Import.

---

<div class="post-metadata">

**Author:** ![lmsasu](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@lmsasu](https://community.labelstud.io/u/lmsasu)\
**Post date:** [June 3, 2024, 6:15pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228/5 "2024-06-03T18:15:49Z")

</div>

If I got it correctly, “Data Manager =\> Import” means: from project’s settings page “Import” then upload JSON file. Here I get a validation error starting w/

> Error at item 0: “undefined$” key is expected in task data [assume: item[“data”] = task root with values] :: {‘id’: 1202, ‘annotations’: [{‘id’: 757, ‘completed\_by’: 1, ‘result’: [{‘original\_width’: 3024, ‘original\_height’: 4032, ‘image\_rotation’: 0, ‘value’: {‘points’: [[41.177519616523426, 44.816646570584304], [40.53802169684623, 45.21633277038256], [40.697896176765525, 45.49611311024133], [40.43143871023336, 46.09564240993871], [40.53802169684623,

Or should I do smth else?

---

<div class="post-metadata">

**Author:** ![makseq](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/makseq/32/26_2.png) [@makseq](https://community.labelstud.io/u/makseq)\
**Post date:** [June 3, 2024, 6:18pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228/6 "2024-06-03T18:18:29Z")

</div>

What labeling config do you have?

---

<div class="post-metadata">

**Author:** ![makseq](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/makseq/32/26_2.png) [@makseq](https://community.labelstud.io/u/makseq)\
**Post date:** [June 3, 2024, 6:19pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228/7 "2024-06-03T18:19:44Z")

</div>

Could you show the full error message?

---

<div class="post-metadata">

**Author:** ![lmsasu](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@lmsasu](https://community.labelstud.io/u/lmsasu)\
**Post date:** [June 3, 2024, 6:23pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228/8 "2024-06-03T18:23:03Z")

</div>

Semantic segmentations with polygons; the labels are loaded manually (although I expect to be fetched from json).

---

<div class="post-metadata">

**Author:** ![makseq](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/makseq/32/26_2.png) [@makseq](https://community.labelstud.io/u/makseq)\
**Post date:** [June 3, 2024, 6:24pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228/9 "2024-06-03T18:24:14Z")

</div>

I need to see the labeling config code here

---

<div class="post-metadata">

**Author:** ![lmsasu](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@lmsasu](https://community.labelstud.io/u/lmsasu)\
**Post date:** [June 3, 2024, 6:28pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228/11 "2024-06-03T18:28:08Z")

</div>

the code for config:

```auto
<View>

  <Header value="Select label and click the image to start"/>
  <Image name="image" value="$image" zoom="true"/>

  <PolygonLabels name="label" toName="image" strokeWidth="3" pointSize="small" opacity="0.9">
    
    
  <Label value="Background" background="#FFA39E"/><Label value="Trees without damages" background="#D4380D"/><Label value="DA&lt;25" background="#FFC069"/><Label value="DA100" background="#AD8B00"/><Label value="DA200" background="#D3F261"/><Label value="DA&gt;200" background="#389E0D"/><Label value="DC&lt;25" background="#5CDBD3"/><Label value="DC100" background="#096DD9"/><Label value="DC200" background="#ADC6FF"/><Label value="DC&gt;200" background="#9254DE"/><Label value="DZ&lt;25" background="#F759AB"/><Label value="DZ100" background="#FFA39E"/><Label value="DZ200" background="#D4380D"/><Label value="DZ&gt;200" background="#FFC069"/></PolygonLabels>

</View>

```

---

<div class="post-metadata">

**Author:** ![makseq](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/makseq/32/26_2.png) [@makseq](https://community.labelstud.io/u/makseq)\
**Post date:** [June 3, 2024, 6:35pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228/12 "2024-06-03T18:35:14Z")

</div>

Where did you get this json file?

---

<div class="post-metadata">

**Author:** ![sajarin](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/sajarin/32/56_2.png) [@sajarin](https://community.labelstud.io/u/sajarin)\
**Post date:** [June 3, 2024, 6:35pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228/13 "2024-06-03T18:35:28Z")

</div>

Can also share a snippet of the json that you’re trying to import?

---

<div class="post-metadata">

**Author:** ![lmsasu](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@lmsasu](https://community.labelstud.io/u/lmsasu)\
**Post date:** [June 3, 2024, 6:38pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228/14 "2024-06-03T18:38:35Z")

</div>

```auto
[{"id":1202,"annotations":[{"id":757,"completed_by":1,"result":[{"original_width":3024,"original_height":4032,"image_rotation":0,"value":{"points":[[41.177519616523426,44.816646570584304],[40.53802169684623,45.21633277038256],[40.697896176765525,45.49611311024133],[40.43143871023336,46.09564240993871],[40.53802169684623,46.615234469676444],[40.32485572362049,47.174795149393994],[40.218272737007624,48.21397926886945],[40.271564230314056,48.853477188546655],[40.271564230314056,49.53294372820368],[40.05839825708832,50.29234750782037],[39.845232283862586,51.091719907416866],[39.57877481733042,51.81115506705372],[39.73023738860619,52.11248391721032],[39.58641414521037,52.40526694840896],[39.58641414521037,52.71345961282857],[39.36272639543492,52.87926216039954],[39.29492400926261,53.25217528434728],[39.340125600044146,53.62508840829502],[39.453129576998,53.94714974261351],[39.56613355395186,54.37091465619047],[39.43052878160724,54.574321814707424],[39.36272639543492,54.79467956976746],[39.219459083091586,55.775173409839375],[39.166167589785154,56.694451669375354],[39.43262505631731,57.73363578885081],[39.219459083091586,58.53300818844732],[39.48591654962375,59.37234920802366],[39.64579102954306,60.371564707519276],[39.69908252284949,61.33081158703509],[39.69908252284949,62.36999570651054],[39.69908252284949,63.369211206006185],[39.91224849607523,64.24852084556233],[40.445163429139555,64.72814428532024],[41.40441030865537,64.56826980540093],[42.25707420155831,64.16858360560268],[42.789989134622644,63.32924258602636],[43.21632108107411,62.4499329464702],[43.58936153421915,61.250874347075445],[44.01569348067061,60.29162746755963],[44.601899907041386,58.93269438824558],[45.028231853492855,57.8535416487903],[45.561146786557195,56.65448304939553],[45.77431275978292,55.57533030994025],[46.0407702263151,54.73598929036392],[46.27278520343011,53.51689885449391],[46.14381978962855,52.74310637168449],[46.01485437582697,51.67914170782154],[45.950371668926195,50.32500486290507],[46.46623332413247,49.40612628956888],[46.917612272437964,48.342161625705934],[46.853129565537174,47.326558992018576],[46.595198737934034,46.601128539384746],[47.24002580694188,46.504404479033575],[47.5624393414458,45.4888018453462],[47.75588746214815,44.61828530218562],[47.52892015353361,44.71834173170567],[47.43630026941051,45.03093384062113],[47.220187206456615,45.0656662971673],[46.84970766996421,45.100398753713456],[46.602721312302606,45.1582861812904],[46.20136848110252,45.29721600747505],[45.753705707840865,45.227751094382725],[45.429536113410016,45.21617360886733],[45.012746634856065,45.21617360886733],[44.827506866609866,45.21617360886733],[44.65770374571751,45.0656662971673],[44.56508386159441,44.89200401443648],[44.44159068276362,44.70676424619028],[44.287224209225116,44.5099469924287],[44.04023785156352,44.35943968072866],[43.42716043979609,43.9248220170447],[43.03008254541654,44.0489088590383],[42.73227412463188,43.999274122240855],[42.500645352910475,44.14817833263319],[42.16974710759419,44.14817833263319],[41.905028511341165,43.90000464864597],[41.73957938868301,44.14817833263319],[41.507950616961615,44.29708254302551],[41.34250149430347,44.42116938501913]],"closed":true,

```

---

<div class="post-metadata">

**Author:** ![makseq](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/makseq/32/26_2.png) [@makseq](https://community.labelstud.io/u/makseq)\
**Post date:** [June 3, 2024, 6:46pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228/18 "2024-06-03T18:46:07Z")

</div>

We need just a part with “data” dictionary. Where did you get this json?

---

<div class="post-metadata">

**Author:** ![lmsasu](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@lmsasu](https://community.labelstud.io/u/lmsasu)\
**Post date:** [June 3, 2024, 6:46pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228/19 "2024-06-03T18:46:26Z")

</div>

It’s from a coworker.

---

<div class="post-metadata">

**Author:** ![sajarin](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/sajarin/32/56_2.png) [@sajarin](https://community.labelstud.io/u/sajarin)\
**Post date:** [June 3, 2024, 6:46pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228/20 "2024-06-03T18:46:55Z")

</div>

Thanks for the snippet @lmsasu, I think the reason the import is failing is because your labelling config expects an image object and your json import does not contain any image path, which leads to an undefined error.

Your json be in this type of format:

```auto
   [
     {
       "data": {
         "image": "path/to/your/image.jpg"
       },
       "annotations": [
         {
           "id": 757,
           "completed_by": 1,
           "result": [
             {
               "original_width": 3024,
               "original_height": 4032,
               "image_rotation": 0,
               "value": {
                 "points": [
                   [41.177519616523426, 44.816646570584304],
                   [40.53802169684623, 45.21633277038256],
                   [40.697896176765525, 45.49611311024133],
                   [40.43143871023336, 46.09564240993871],
                   [40.53802169684623, 46.21633277038256]
                 ],
                 "polygonlabels": ["Background"]
               },
               "from_name": "label",
               "to_name": "image",
               "type": "polygonlabels"
             }
           ]
         }
       ]
     }
   ]

```

---

<div class="post-metadata">

**Author:** ![makseq](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/makseq/32/26_2.png) [@makseq](https://community.labelstud.io/u/makseq)\
**Post date:** [June 3, 2024, 6:47pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228/21 "2024-06-03T18:47:21Z")

</div>

He needs normally export json from the data manager page =\> Export =\> JSON.

---

<div class="post-metadata">

**Author:** ![sajarin](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/sajarin/32/56_2.png) [@sajarin](https://community.labelstud.io/u/sajarin)\
**Post date:** [June 3, 2024, 7:07pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228/22 "2024-06-03T19:07:50Z")

</div>

You can view this doc to see how to export in Label Studio: [Label Studio Documentation — Export Annotations](https://labelstud.io/guide/export#Export-using-the-UI-in-Community-Edition-of-Label-Studio)

Data Manager for the Community Edition of Label Studio just refers to the default view of the project.

---

<div class="post-metadata">

**Author:** ![lmsasu](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@lmsasu](https://community.labelstud.io/u/lmsasu)\
**Post date:** [June 3, 2024, 7:09pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228/23 "2024-06-03T19:09:29Z")

</div>

you mean: project page → export → “export data” popup → json? not sure what “data manager page” means

---

<div class="post-metadata">

**Author:** ![lmsasu](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@lmsasu](https://community.labelstud.io/u/lmsasu)\
**Post date:** [June 3, 2024, 7:31pm UTC](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228/24 "2024-06-03T19:31:16Z")

</div>

This is how the JSON file I got was produced.  
To summarize:

1. I define a new project
2. In its settings page I define “source cloud storage” as “Local files” and import the images into it. “Treat every bucket object as a source file” must be selected, otherwise I get an error.
3. I define in “Labeling interface” the template, e.g. “semantic segmentation with polygons”. I manually add here the labels used for segmentation.
4. In project’s page click “import” and upload the LS JSON file.

If I do like this, then the images are loaded twice, but: in the first images i see as pictures (but no annotation), and after importing LS JSON i see the same files, with 1 annotation task per file, but the image itself is not linked to the entry:

 ![LS](https://canada1.discourse-cdn.com/flex035/uploads/labelstudio/original/1X/b17e21126598f3b6e53745e8747e97ef7284ab76.png)

How could I get both the images and their annotations from JSON?

[Next page](https://community.labelstud.io/t/import-labelstudio-segmentation-from-a-different-machine/228.md?page=2)
