Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix loading category for coco format #135

Merged
merged 1 commit into from
Nov 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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