Skip to content

Commit

Permalink
Merge pull request #135 from alecGraves/master
Browse files Browse the repository at this point in the history
fix loading category for coco format
  • Loading branch information
amitguptagwl committed Nov 7, 2018
2 parents 429ec9a + f51ffbc commit 73ce68f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions dataformaters/coco.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ var cocoFormater = {
height : annotation.bbox[3],
w : annotation.bbox[2],
h : annotation.bbox[3],
cx : annotation.bbox[0]+annotation.bbox[2] / 2, // x max
cy : annotation.bbox[1]+annotation.bbox[3] / 2, // y max
cx : annotation.bbox[0]+annotation.bbox[2] / 2,
cy : annotation.bbox[1]+annotation.bbox[3] / 2,
}
}
let id = "SvgjsRect",
Expand All @@ -63,16 +63,17 @@ var cocoFormater = {
}
points = polyPoints;
}

labellingData[ image.file_name ].shapes.push({
"id": id+idNumber.toString(),
"label": "",
"label": "unlabelled",
"attributes": [],
"tags": [],
"type": type,
"bbox": annotation.bbox,
"points": points,
"featurePoints": [],
"category": "undefined"
"category": categories.filter((x)=>x.id == annotation.category_id)[0].name
});
idNumber++;
}
Expand Down Expand Up @@ -127,7 +128,7 @@ var cocoFormater = {
];
area = calcArea(points);
}

cocoData.annotations.push({
segmentation : [
points
Expand All @@ -139,7 +140,8 @@ var cocoFormater = {
"category_id": categories.indexOf(shape.category) + 1,
"id": shape_i+1,
"ignore": 0
})
});

}
}

Expand Down

0 comments on commit 73ce68f

Please sign in to comment.