问题描述:
mindspore.dataset.CocoDataset返回的dataset的‘category_id’数据是一维向量还是标量
解决方案:
返回的是一个 N * 1二维数组
举例如下:
假设annotations是如下:
[{
"segmentation": [
[10.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0]
],
"category_id": 1,
"iscrowd": 0,
"image_id": 391895,
"bbox": [10, 10, 10, 10],
"area": 100,
"id": 10000
}, {
"segmentation": [
[20.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0, 31.0]
],
"category_id": 2,
"iscrowd": 0,
"image_id": 318219,
"bbox": [20, 20, 20, 20],
"area": 400,
"id": 10001
}, {
"segmentation": [
[40.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 40.0, 41.0, 42.0]
],
"category_id": 3,
"iscrowd": 0,
"image_id": 554625,
"bbox": [30, 30, 30, 30],
"area": 900,
"id": 10002
}, {
"segmentation": [
[50.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0, 61.0, 62.0, 63.0]
],
"category_id": 4,
"iscrowd": 0,
"image_id": 574769,
"bbox": [40, 40, 40, 40],
"area": 1600,
"id": 10003
}, {
"segmentation": [
[60.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0, 68.0, 69.0, 70.0, 71.0, 72.0, 73.0, 74.0]
],
"category_id": 5,
"iscrowd": 0,
"image_id": 60623,
"bbox": [50, 50, 50, 50],
"area": 2500,
"id": 10004
}, {
"segmentation": [
[60.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0],
[68.0, 69.0, 70.0, 71.0, 72.0, 73.0, 74.0]
],
"category_id": 6,
"iscrowd": 0,
"image_id": 309022,
"bbox": [60, 60, 60, 60],
"area": 3600,
"id": 10005
}, {
"segmentation": [
[70.0, 72.0, 73.0, 74.0, 75.0]
],
"category_id": 7,
"iscrowd": 0,
"image_id": 391895,
"bbox": [70, 70, 70, 70],
"area": 4900,
"id": 10006
}, {
"segmentation": {
"counts": [10.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0],
"size": [200, 300]
},
"category_id": 8,
"iscrowd": 1,
"image_id": 318219,
"bbox": [80, 80, 80, 80],
"area": 6400,
"id": 10007
}]
那边返回的 category_id 是如下:
[[1] [7]],
[[2] [8]],
[[3]],
[[4]],
[[5]],
[[6]]