Closed timotei closed 4 years ago
@timotei Working on it, sorry for delay, as I just saw this.
@timotei I copied the JSON you provided into: https://jsonformatter.curiousconcept.com/ to validate it, and it is invalid JSON you are producing. Please fix that, and then lets see if Dark Chocolate still produces errors.
(The Annotations key should have multiple boxes if multiple objects are in the image).
JSON Error Output:
Error:Invalid comma, expecting ].[Code 141, Structure 70]
Error:Expecting value, not ].[Code 8, Structure 71]
Error:Invalid comma, expecting ].[Code 141, Structure 131]
Error:Expecting value, not ].[Code 8, Structure 132]
Error:Invalid comma, expecting ].[Code 141, Structure 150]
Error:Expecting value, not ].[Code 8, Structure 151]
@joehoeller Apologizes, I extracted an excerpt from a the bigger JSON 😅 . Should be good now
@joehoeller Any news on this? Should it work? Cause it doesn't right now.
I only support coco json format. Not random shapes ppl decide to use.
@timotei try making your coco json like this: (Using reduce would've been more elegant.)
import json
data = {
"info": {
"description": "Generated GUI COCO dataset",
"url": "",
"version": "1.0",
"year": 2019,
"contributor": "RPA",
"date_created": "2019/12/08"
},
"licenses": [],
"images": [
{
"license": 0,
"file_name": "3d6c6502-859f-4c77-8f86-bc9e4836443e.png",
"coco_url": " ",
"height": 500,
"width": 520,
"date_captured": "2019-12-08 14:49:54",
"flickr_url": "",
"id": 81645724526782010095170042166076916798
}
],
"annotations": [
{
"iscrowd": 0,
"area": 28600,
"category_id": 1,
"id": 73216957984849726665203162571459676114,
"segmentation": [
[
0,
0,
520,
0,
520,
55,
0,
55
]
],
"bbox": [
0,
0,
520,
55
],
"image_id": 81645724526782010095170042166076916798
}
],
"categories": [
{
"supercategory": "part",
"id": 1,
"name": "account_name"
}
]
}
to_coco = json.loads(json.dumps({'images':data['images'], 'annotations': data['annotations'], 'categories': data['categories']}, indent=4))
print(to_coco)
with open('data.json', 'w') as f:
json.dump(to_coco, f)
Outputs:
{
"images":[
{
"license":0,
"file_name":"3d6c6502-859f-4c77-8f86-bc9e4836443e.png",
"coco_url":" ",
"height":500,
"width":520,
"date_captured":"2019-12-08 14:49:54",
"flickr_url":"",
"id":81645724526782010095170042166076916798
}
],
"annotations":[
{
"iscrowd":0,
"area":28600,
"category_id":1,
"id":73216957984849726665203162571459676114,
"segmentation":[
[
0,
0,
520,
0,
520,
55,
0,
55
]
],
"bbox":[
0,
0,
520,
55
],
"image_id":81645724526782010095170042166076916798
}
],
"categories":[
{
"supercategory":"part",
"id":1,
"name":"account_name"
}
]
}
Hi,
I've been trying to use this small converter to transform the coco dataset, but something is not working as expected. Which format are you expecting? It seems it's one where you've got an array with all the information in each element, but COCO actually has the data stored differently (http://cocodataset.org/#format-data):
Here's a snippet of an actual json I generated in COCO format: