Git Product home page Git Product logo

Comments (7)

nightrome avatar nightrome commented on September 12, 2024

Hi, could it be that you haven't updated the Git repository in the last few days? The last changes were made yesterday and I did create the file with that script. Unfortunately I'll have to wait until Monday to investigate this in further detail. Note that the thing and stuff annotations look differently:

  • Things: Copied from COCO (which are polygons). Example:
{
"area":20642.332649999997,
"bbox":[
309.84,
4.57,
182.86,
335.24
],
"category_id":1,
"id":262720,
"image_id":165350,
"iscrowd":0,
"segmentation":[
[
429.21,
...
]
]
}
,
  • There might even be thing annotations in RLE format for crowd-annotated regions, but I can't find any right now.
  • Stuff annotations, encoded in non human-readable RLE format. Example:
{
"area":10917.0,
"bbox":[
[
0.0,
0.0,
201.0,
93.0
]
],
"category_id":102,
"id":2376,
"image_id":306191,
"iscrowd":1,
"segmentation":[
{
"counts":"0j2Va000000000O100000000000000O10000001O1OO10000Mj^O[MWa0d231O0000000000O10000O11O1O001O1O1O001O1O1O00001OJo^OZMTa0b27M3K5O1000000O10000O1000000000000N2O1M3K51O00001O00001O001O001O001O1O001O1O1O001O001O001O001OO100oN[^OFfa09[^OGea08]^OGca09^^OEca0:^^O_Oia0a0X^OQOUb0o0l]OkNYb0T1:001O1O00001O00000000O10000O100O100O1O1O100O1O100O100O11O1O1O2N001O2N1O003MN200001O1O1O001O1O1O1O1O00000000O10000O1000000O1VO^]O^O>5Wb09[]OB^c0>2O100O1000000O10000001O1OO100O1O1O1O100O1O10000O10000O10000O100OQ`^4",
"size":[
640,
429
]
}
]
},

from cocostuff10k.

nightrome avatar nightrome commented on September 12, 2024

Can I ask why your are interested in the format and the script that creates it? If you use the COCO API you should not have to write your own parsing tools..

from cocostuff10k.

absurdvision avatar absurdvision commented on September 12, 2024

I am using your script to convert annotations from my own datasets to coco format and I use RLE for my annotations.

The line anndata['segmentation'] = Rs does not introduce [] into the file. But my images contain only a single annotation, may the encode function provides a list if there are multiple regions ?

from cocostuff10k.

nightrome avatar nightrome commented on September 12, 2024

I agree that the string Rs is always a list, even if it just has one element.
Regarding multiple regions I don't agree. The RLE encoding seems to be able to encode several disconnected regions in one string. e.g. the one below covers 7 disconnected regions.

[{'counts': 'jg81V?2l@3R?7N2o@Bo>`0ONRACm>=31O3MMUAAk>`022N1O00005UAYOc>j02L[AYOd>g04O0N202M2O2OO10O2OMO2O4I7KbW81]hG5L3N2\\OGnA;P>HcAe0[>80002N1O002NO11ON2003M1OO100001O001O00000000MmAiNS>W133MN20000001OO100O10000N20000N2O100M300O100000000000000N2000000O10000M3N2003MO1O11OO100O11O00001O1O001O0000001O0000001O001O1OO12N1O1O1O001O2N00000gAkNW>W10000jAiNS>[1O1OL42NO1MkAkNU>U130000O1O1O10000001O00000000001O000000009G1O1OO1001O1O00001O001OO11O1O1O1OO1001ON22NO100O12N002NN2001O00O1001O1OO11O1O2N00L4000YBYNe=f1\\BZNd=i101OJ`B\\N`=f1\\BZNf=h10O12N1OO10000001O0000O11O00001O001O001OO11OO1001OgNPC1Q=NQC1o<NRC3m<MTC2l<^OdCa0g=O0O2O0O11O0O14MK43NM200102N4KM3M300YO@kAOd0=`=EkA1d09a=MZBMAK[>8i04N4J0122I29DO7O02J4OM400M3NN08J2Hl@MX?1Ta>4j^AKm@3R?0k@0V?7j@FQ?;o@Jn>9O4O10ON20O14VAYOb>o0\\Oc0MO11O1TB]Ni=e100000001OO1N200O11O00N2001O1O001O1O1O1O1O1O1O00O1O12N00001O00O100000000M30000N23M00M31O0000N21ON2LWBbNh=]16HPBmN0MQ>V1oAlNT>T1lAlNT>T14O11O000000001O1O1O0000O1O10kAiNQ>[10O1M30mAiNm=]10M3N200O100M31O002N00O1O1N2\\OeA3[>DfAL4>W>DRB9o=ERB<d>NMGPAO02Q?NWAOj>Ohi50cVJ;j@NZ>g0jAPOf=T1SBROj=\\1N2N0000O11O1O1O1O1O1OL\\B[Ne=b16O12NO12NKVBcNk=\\15MPBeNQ>U1oAkN01T>T150000N200O1N21OO1O100006aAkNW>X1O3MO12lAgNm=]110RBbNj=c1OO10000O1001OO11O00O1O1N23M5KO12N001O2NO1O11OjN]B?c=A]B?c=A]B?c=]O_B_OOS1OmNa=c0aBc0e=WO\\Bh0o=lNTBQ1Z>IXY6BXgI=PAEQ>R1K2@bNlB^1T=gNgBY1Y=hNfBX1Z=hNfBW1[=jNdBX1Z=hNfBY1Y=hNfBV1\\=a0N001O00O10000N21O1O1OXNgBW1[=iNeBX1Z=hNfBf03ZOW=0gBc02@V=MgBK0H7;NO[=2aBDb06a=4lAFT?6hk57QSJU1]O`NRCb1n<_NoBc1Q=]NoBc1Q=fNfBZ1Z=fNgBX1Z=hNeBZ1Z=>01O00O11O0000O11OYNgBX1X=hNhBX1X=hNhBX1X=hNiBX1V=hNjBW1W=eNhBH2c1U=bNSC\\1`=101O01O0N200O1N2O1N5M2L102NYO', 'size': [496L, 640L]}]

from cocostuff10k.

absurdvision avatar absurdvision commented on September 12, 2024

may the encode function provides a list if there are multiple regions ?

This was just a thought.

I agree that the string Rs is always a list, even if it just has one element.

For me the encode function gives out a dict, not a list of dicts. This is the source of confusion. According to code anndata['segmentation'] = Rs whill not put a [] in the JSON. Hence it comes out wrong. I have attached a screen shot of this
untitled

from cocostuff10k.

nightrome avatar nightrome commented on September 12, 2024

Yes, I meant dict when I wrote string :-).
Why don't you just always convert it to a list? (you can check with "isinstance(Rs, list)")
You might also want to update your COCO API, as it seems that some changes were made on Dec 17 2016 to the Mask API.
I'd also suggest using Python 2.x as the code seems to be slightly different for 3.x.

from cocostuff10k.

absurdvision avatar absurdvision commented on September 12, 2024

Why don't you just always convert it to a list? (you can check with "isinstance(Rs, list)")

Yes this is what I am doing now.

You might also want to update your COCO API, as it seems that some changes were made on Dec 17 2016 to the Mask API.

Already up to date.

Thanks for taking time to respond.

from cocostuff10k.

Related Issues (20)

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.