coco数据集格式化查看

ubuntu如何快速格式化json文件 https://jingyan.baidu.com/article/15622f242d1db5fdfcbea5bd.html
安装jq工具

sudo apt-get update
sudo apt-get install jq

格式化json文件输出到新文件

cat 文件名 | jq . >newfile.json

例子:

cat instances_val2014.json | jq . >111.json

然后就可以用文本打开了。之前试了用vscode安装各种json插件都不行。
打开的截取的片段:

{ "license": 4, "file_name": "COCO_train2014_000000475546.jpg", "coco_url": "http://images.cocodataset.org/train2014/COCO_train2014_000000475546.jpg", "height": 375, "width": 500, "date_captured": "2013-11-25 21:20:23", "flickr_url": "http://farm1.staticflickr.com/167/423175046_6cd9d0205a_z.jpg", "id": 475546 } ], "licenses": [ { "url": "http://creativecommons.org/licenses/by-nc-sa/2.0/", "id": 1, "name": "Attribution-NonCommercial-ShareAlike License" }, { "url": "http://creativecommons.org/licenses/by-nc/2.0/", "id": 2, "name": "Attribution-NonCommercial License" }, { "url": "http://creativecommons.org/licenses/by-nc-nd/2.0/", "id": 3, "name": "Attribution-NonCommercial-NoDerivs License" }, { "url": "http://creativecommons.org/licenses/by/2.0/", "id": 4, "name": "Attribution License" }, { "url": "http://creativecommons.org/licenses/by-sa/2.0/", "id": 5, "name": "Attribution-ShareAlike License" }, { "url": "http://creativecommons.org/licenses/by-nd/2.0/", "id": 6, "name": "Attribution-NoDerivs License" }, { "url": "http://flickr.com/commons/usage/", "id": 7, "name": "No known copyright restrictions" }, { "url": "http://www.usa.gov/copyright.shtml", "id": 8, "name": "United States Government Work" } ], "annotations": [ { "segmentation": [ [ 312.29, 562.89, 402.25, 511.49, 400.96, 425.38, 398.39, 372.69, 388.11, 332.85, 318.71, 325.14, 295.58, 305.86, 269.88, 314.86, 258.31, 337.99, 217.19, 321.29, 182.49, 343.13, 141.37, 348.27, 132.37, 358.55, 159.36, 377.83, 116.95, 421.53, 167.07, 499.92, 232.61, 560.32, 300.72, 571.89 ] ], "area": 54652.9556, "iscrowd": 0, "image_id": 480023, "bbox": [ 116.95, 305.86, 285.3, 266.03 ], "category_id": 58, "id": 86 }, { "segmentation": [ [ 252.46, 208.17, 267.96, 210.11, 280.14, 213.98, 285.68, 221.45, 279.59, 227.27, 270.73, 223.12, 256.61, 218.69, 253.02, 217.3, 248.03, 220.07, 245.54, 215.92, 245.82, 209.55, 249.69, 208.45 ] ], "area": 421.47274999999996, "iscrowd": 0, "image_id": 50518, "bbox": [ 245.54, 208.17, 40.14, 19.1 ], "category_id": 58, "id": 89 }, { "segmentation": [ [ 292.92, 25.6, 288.4, 41.42, 289.91, 61.75, 289.16, 180.72, 314.76, 289.16, 347.14, 324.55, 356.17, 334.34, 384.79, 328.31, 391.57, 327.56, 394.58, 326.05, 402.86, 328.31, 432.98, 337.35, 429.22, 343.37, 438.25, 349.4, 454.82, 343.37, 458.58, 330.57, 460.09, 333.58, 487.2, 323.8, 499.25, 312.5, 500, 300.45, 500, 281.63, 499.25, 266.57, 499.25, 236.45, 498.49, 206.33, 498.49, 185.24, 491.72, 168.67, 448.04, 83.58, 418.67, 48.19, 399.1, 28.61, 396.08, 24.85, 378.77, 36.14, 376.51, 36.9, 354.67, 30.12, 338.1, 32.38, 340.36, 36.9, 330.57, 45.18, 329.82, 48.95, 327.56, 48.95, 326.05, 44.43, 324.55, 30.87, 320.78, 19.58, 316.27, 18.07, 307.23, 18.07, 302.71, 23.34, 298.19, 24.1, 295.18, 24.85 ] ], "area": 53535.29024999999, "iscrowd": 0, "image_id": 142589, "bbox": [ 288.4, 18.07, 211.6, 331.33 ], "category_id": 58, "id": 93 },
上一篇:6.12冲刺博客


下一篇:Matlab激活