waspinator / pycococreator

Helper functions to create COCO datasets
Apache License 2.0
765 stars 179 forks source link

Error processing image,when use matterport Mask_RCNN #18

Closed lhiceu closed 5 years ago

lhiceu commented 5 years ago

Hi,thanks for your codes. I use your code to produce .json file of my dataset. I have a problem when I use it for Mask RCNN. It may be fail to read the instance(mask) label. I don't know what's wrong about it. So I do need your suggestions,thanks. I modify the coco.py to read my .json file and images.Then error below:

Epoch 1/40
ERROR:root:Error processing image {'source': 'coco', 'path': '/home/he/sundata/SUNCGxS_IMG/train/color/008557.jpg', 'annotations': [{'iscrowd': 0, 'bbox': [46.0, 194.0, 29.0, 20.0], 'category_id': 1, 'area': 496, 'image_id': 7355, 'segmentation': [[53.0, 213.5, 46.5, 211.0, 46.0, 195.5, 73.5, 195.0, 74.0, 210.5, 53.0, 213.5]], 'width': 640, 'height': 480, 'id': 74576}, {'iscrowd': 0, 'bbox': [299.0, 0.0, 235.0, 222.0], 'category_id': 23, 'area': 13517, 'image_id': 7355, 'segmentation': [[332.0, 205.5, 306.5, 203.0, 304.5, 49.0, 305.5, 19.0, 311.5, 18.0, 301.0, 19.5, 298.5, 15.0, 310.0, 14.5, 313.0, 11.5, 318.0, 13.5, 319.0, 10.5, 324.0, 12.5, 326.0, 9.5, 336.0, 11.5, 338.0, 8.5, 345.0, 10.5, 353.0, 9.5, 355.0, 6.5, 371.0, 7.5, 373.0, 4.5, 380.0, 6.5, 451.0, 0, 499.0, 32.5, 501.0, 35.5, 478.5, 46.0, 499.5, 75.0, 494.0, 95.5, 459.5, 54.0, 452.5, 35.0, 449.0, 5.5, 376.5, 14.0, 372.5, 42.0, 365.5, 60.0, 332.5, 104.0, 327.5, 117.0, 334.5, 165.0, 332.0, 205.5], [377.5, 11.0, 450.5, 3.0, 391.0, 7.5, 377.5, 11.0], [368.5, 12.0, 372.5, 11.0, 359.5, 12.0, 368.5, 12.0], [349.5, 14.0, 355.5, 13.0, 342.5, 14.0, 349.5, 14.0], [331.5, 16.0, 337.5, 14.0, 329.5, 15.0, 331.5, 16.0], [511.0, 221.5, 491.5, 218.0, 490.5, 183.0, 500.5, 132.0, 512.0, 116.5, 530.5, 128.0, 533.5, 170.0, 532.5, 186.0, 500.5, 203.0, 511.0, 221.5]], 'width': 640, 'height': 480, 'id': 74577}, {'iscrowd': 0, 'bbox': [198.0, 204.0, 353.0, 209.0], 'category_id': 10, 'area': 32022, 'image_id': 7355, 'segmentation': [[513.0, 412.5, 484.5, 405.0, 488.0, 330.5, 206.0, 279.5, 203.5, 278.0, 203.5, 262.0, 198.5, 260.0, 198.5, 250.0, 275.0, 229.5, 285.0, 230.5, 287.5, 209.0, 298.0, 203.5, 511.0, 221.5, 515.5, 227.0, 512.5, 260.0, 517.0, 257.5, 536.0, 259.5, 550.5, 282.0, 506.5, 368.0, 528.5, 383.0, 515.5, 403.0, 513.0, 412.5], [464.0, 381.5, 452.5, 379.0, 465.0, 365.5, 464.0, 381.5]], 'width': 640, 'height': 480, 'id': 74578}, {'iscrowd': 0, 'bbox': [0.0, 42.0, 188.0, 174.0], 'category_id': 12, 'area': 5764, 'image_id': 7355, 'segmentation': [[123.0, 215.5, 88.5, 209.0, 132.0, 202.5, 131.0, 183.5, 0, 197.0, 0, 186.0, 4.0, 184.5, 130.5, 173.0, 129.5, 144.0, 127.0, 140.5, 110.5, 140.0, 113.0, 137.5, 127.0, 137.5, 128.5, 134.0, 124.5, 68.0, 96.0, 64.5, 96.0, 73.5, 86.5, 73.0, 86.0, 83.5, 39.0, 80.5, 33.5, 77.0, 33.0, 68.5, 24.5, 67.0, 23.0, 57.5, 0.0, 55.5, 0.0, 41.5, 182.5, 63.0, 182.0, 66.5, 173.0, 67.5, 130.0, 67.5, 129.5, 72.0, 133.5, 134.0, 136.0, 137.5, 151.5, 138.0, 135.5, 141.0, 136.5, 172.0, 187.5, 175.0, 181.0, 178.5, 137.0, 182.5, 137.5, 201.0, 154.0, 199.5, 184.0, 202.5, 184.5, 205.0, 123.0, 215.5], [93.5, 71.0, 91.0, 63.5, 26.5, 58.0, 28.0, 66.5, 93.5, 71.0], [85.5, 81.0, 84.0, 72.5, 35.5, 69.0, 37.0, 78.5, 85.5, 81.0]], 'width': 640, 'height': 480, 'id': 74579}, {'iscrowd': 0, 'bbox': [2.0, 150.0, 43.0, 36.0], 'category_id': 1, 'area': 1318, 'image_id': 7355, 'segmentation': [[14.0, 184.5, 5.5, 183.0, 1.5, 151.0, 42.0, 150.5, 44.5, 181.0, 14.0, 184.5]], 'width': 640, 'height': 480, 'id': 74580}, {'iscrowd': 0, 'bbox': [63.0, 44.0, 90.0, 152.0], 'category_id': 20, 'area': 7111, 'image_id': 7355, 'segmentation': [[142.0, 58.5, 136.5, 57.0, 135.5, 48.0, 142.0, 47.5, 143.0, 43.5, 142.0, 58.5], [101.0, 53.5, 89.5, 52.0, 101.0, 50.5, 101.0, 53.5], [144.0, 58.5, 144.0, 51.5, 144.0, 58.5], [93.0, 71.5, 74.0, 70.5, 74.5, 63.0, 91.0, 63.5, 93.5, 65.0, 93.0, 71.5], [79.0, 178.5, 69.5, 178.0, 62.5, 108.0, 70.5, 83.0, 86.0, 83.5, 86.5, 73.0, 96.0, 73.5, 95.5, 65.0, 101.0, 64.5, 104.5, 66.0, 127.5, 112.0, 126.5, 137.0, 110.5, 139.0, 126.5, 141.0, 127.5, 173.0, 79.0, 178.5], [147.0, 137.5, 141.5, 137.0, 137.0, 68.5, 143.5, 70.0, 144.0, 78.5, 145.5, 70.0, 147.0, 137.5], [85.0, 81.5, 73.0, 79.5, 73.5, 72.0, 84.0, 72.5, 85.0, 81.5], [145.0, 172.5, 141.5, 141.0, 147.0, 139.5, 148.0, 148.5, 149.5, 141.0, 150.5, 171.0, 145.0, 172.5], [152.0, 195.5, 137.5, 194.0, 143.5, 192.0, 145.0, 181.5, 151.5, 182.0, 151.5, 189.0, 148.5, 192.0, 152.0, 195.5], [132.0, 194.5, 80.5, 189.0, 129.0, 183.5, 132.0, 194.5], [116.5, 189.0, 113.5, 189.0, 116.5, 189.0]], 'width': 640, 'height': 480, 'id': 74581}, {'iscrowd': 0, 'bbox': [0.0, 205.0, 194.0, 130.0], 'category_id': 26, 'area': 16028, 'image_id': 7355, 'segmentation': [[33.0, 334.5, 30.5, 334.0, 28.5, 321.0, 24.0, 313.5, 0, 308.0, 0.0, 234.5, 187.5, 205.0, 183.5, 229.0, 191.5, 234.0, 193.0, 276.5, 179.0, 276.5, 84.0, 305.5, 84.0, 317.5, 33.0, 334.5]], 'width': 640, 'height': 480, 'id': 74582}, {'iscrowd': 0, 'bbox': [0.0, 64.0, 23.0, 68.0], 'category_id': 8, 'area': 1307, 'image_id': 7355, 'segmentation': [[22.0, 131.5, 0, 131.0, 0.0, 63.5, 15.5, 65.0, 22.0, 131.5]], 'width': 640, 'height': 480, 'id': 74583}, {'iscrowd': 0, 'bbox': [0.0, 209.0, 119.0, 26.0], 'category_id': 13, 'area': 1344, 'image_id': 7355, 'segmentation': [[4.0, 234.5, 0, 234.0, 0.0, 220.5, 82.0, 208.5, 118.5, 214.0, 4.0, 234.5]], 'width': 640, 'height': 480, 'id': 74584}, {'iscrowd': 0, 'bbox': [0.0, 157.0, 7.0, 29.0], 'category_id': 1, 'area': 90, 'image_id': 7355, 'segmentation': [[1.0, 159.5, 0.0, 156.5, 1.0, 159.5], [1.0, 185.5, 0, 171.0, 4.0, 170.5, 6.5, 184.0, 1.0, 185.5]], 'width': 640, 'height': 480, 'id': 74585}, {'iscrowd': 0, 'bbox': [184.0, 182.0, 75.0, 66.0], 'category_id': 1, 'area': 3187, 'image_id': 7355, 'segmentation': [[209.0, 247.5, 205.5, 247.0, 204.0, 240.5, 183.5, 229.0, 187.5, 217.0, 185.5, 209.0, 194.5, 199.0, 193.5, 194.0, 200.0, 188.5, 202.0, 191.5, 201.5, 188.0, 205.0, 185.5, 214.0, 181.5, 216.0, 184.5, 232.0, 184.5, 232.5, 189.0, 241.0, 191.5, 247.5, 198.0, 247.5, 204.0, 250.5, 203.0, 252.5, 210.0, 249.5, 219.0, 257.0, 214.5, 258.5, 217.0, 235.0, 240.5, 209.0, 247.5]], 'width': 640, 'height': 480, 'id': 74586}, {'iscrowd': 0, 'bbox': [0.0, 191.0, 72.0, 30.0], 'category_id': 8, 'area': 1102, 'image_id': 7355, 'segmentation': [[5.0, 220.5, 0, 220.0, 0.0, 197.5, 63.0, 190.5, 71.5, 192.0, 46.0, 195.5, 47.0, 214.5, 5.0, 220.5]], 'width': 640, 'height': 480, 'id': 74587}, {'iscrowd': 0, 'bbox': [328.0, 13.0, 183.0, 206.0], 'category_id': 20, 'area': 26567, 'image_id': 7355, 'segmentation': [[449.0, 13.5, 446.5, 13.0, 449.0, 13.5], [439.0, 14.5, 436.5, 14.0, 439.0, 14.5], [429.0, 15.5, 426.5, 15.0, 429.0, 15.5], [419.0, 16.5, 416.5, 16.0, 419.0, 16.5], [409.0, 17.5, 406.5, 17.0, 409.0, 17.5], [399.0, 18.5, 396.5, 18.0, 399.0, 18.5], [491.0, 218.5, 396.0, 212.5, 334.5, 205.0, 334.5, 102.0, 365.5, 60.0, 376.0, 24.5, 450.0, 17.5, 453.5, 39.0, 459.5, 54.0, 494.5, 96.0, 490.5, 105.0, 510.5, 116.0, 500.5, 132.0, 493.5, 160.0, 490.5, 183.0, 491.0, 218.5], [389.0, 19.5, 386.5, 19.0, 389.0, 19.5], [379.0, 20.5, 376.5, 20.0, 379.0, 20.5], [328.0, 119.5, 328.0, 116.5, 328.0, 119.5]], 'width': 640, 'height': 480, 'id': 74588}, {'iscrowd': 0, 'bbox': [84.0, 276.0, 406.0, 204.0], 'category_id': 6, 'area': 41269, 'image_id': 7355, 'segmentation': [[440.0, 479.5, 436.5, 479.0, 438.5, 434.0, 436.0, 427.5, 399.0, 417.5, 386.0, 424.5, 359.0, 448.5, 220.0, 403.5, 217.5, 378.0, 211.0, 365.5, 183.0, 357.5, 158.0, 368.5, 154.5, 350.0, 137.5, 345.0, 161.5, 334.0, 159.0, 332.5, 117.0, 321.5, 118.5, 349.0, 88.0, 360.5, 83.5, 306.0, 188.0, 275.5, 488.0, 330.5, 482.5, 444.0, 472.0, 459.5, 460.5, 456.0, 462.5, 407.0, 460.0, 406.5, 443.5, 427.0, 440.0, 479.5], [464.5, 385.0, 465.0, 365.5, 449.5, 382.0, 464.5, 385.0]], 'width': 640, 'height': 480, 'id': 74589}, {'iscrowd': 0, 'bbox': [0.0, 309.0, 158.0, 133.0], 'category_id': 10, 'area': 6296, 'image_id': 7355, 'segmentation': [[0.0, 441.5, 0.0, 308.5, 14.0, 309.5, 26.5, 316.0, 33.0, 355.5, 42.0, 354.5, 69.0, 365.5, 77.0, 365.5, 130.0, 344.5, 148.0, 347.5, 156.5, 353.0, 156.0, 369.5, 117.0, 387.5, 89.0, 377.5, 71.0, 375.5, 8.0, 401.5, 4.5, 412.0, 10.5, 436.0, 0.0, 441.5]], 'width': 640, 'height': 480, 'id': 74590}, {'iscrowd': 0, 'bbox': [41.0, 33.0, 104.0, 160.0], 'category_id': 23, 'area': 4363, 'image_id': 7355, 'segmentation': [[136.0, 57.5, 102.0, 53.5, 100.0, 42.5, 74.0, 45.5, 74.0, 50.5, 42.0, 46.5, 40.5, 44.0, 137.0, 32.5, 144.5, 38.0, 135.5, 39.0, 136.0, 57.5], [135.5, 37.0, 131.5, 37.0, 135.5, 37.0], [107.5, 40.0, 104.5, 40.0, 107.5, 40.0], [80.5, 43.0, 99.5, 41.0, 75.5, 43.0, 80.5, 43.0], [73.0, 69.5, 46.0, 67.5, 45.5, 62.0, 50.0, 59.5, 74.0, 62.5, 73.0, 69.5], [126.0, 109.5, 106.5, 74.0, 105.0, 65.5, 124.5, 68.0, 126.0, 109.5], [141.0, 137.5, 136.0, 137.5, 133.5, 134.0, 130.0, 67.5, 136.0, 68.5, 137.5, 72.0, 141.0, 137.5], [72.0, 79.5, 48.0, 78.5, 45.5, 70.0, 73.0, 71.5, 72.0, 79.5], [57.0, 180.5, 49.0, 80.5, 70.5, 83.0, 62.5, 108.0, 69.5, 178.0, 57.0, 180.5], [127.0, 137.5, 128.0, 127.5, 127.0, 137.5], [130.0, 173.5, 127.5, 173.0, 126.5, 164.0, 127.0, 140.5, 129.5, 144.0, 130.0, 173.5], [143.0, 172.5, 135.5, 170.0, 136.0, 140.5, 141.5, 141.0, 143.0, 172.5], [143.0, 192.5, 137.5, 192.0, 137.0, 182.5, 143.5, 183.0, 143.0, 192.5], [132.0, 191.5, 129.5, 191.0, 130.0, 183.5, 132.0, 191.5]], 'width': 640, 'height': 480, 'id': 74591}, {'iscrowd': 0, 'bbox': [452.0, 0.0, 188.0, 480.0], 'category_id': 1, 'area': 55519, 'image_id': 7355, 'segmentation': [[639.0, 479.5, 561.0, 479.5, 543.5, 461.0, 578.5, 418.0, 506.5, 368.0, 550.5, 282.0, 500.5, 203.0, 539.0, 184.5, 540.5, 179.0, 529.5, 126.0, 490.5, 105.0, 493.5, 102.0, 499.5, 75.0, 478.5, 46.0, 501.5, 35.0, 452.0, 0, 639.5, 0.0, 639.0, 479.5]], 'width': 640, 'height': 480, 'id': 74592}, {'iscrowd': 0, 'bbox': [0.0, 358.0, 439.0, 122.0], 'category_id': 10, 'area': 32061, 'image_id': 7355, 'segmentation': [[436.0, 479.5, 0.0, 479.5, 0, 442.0, 10.5, 436.0, 4.5, 412.0, 8.0, 401.5, 71.0, 375.5, 89.0, 377.5, 117.0, 387.5, 178.0, 358.5, 188.0, 357.5, 208.0, 363.5, 213.5, 368.0, 218.5, 384.0, 221.0, 418.5, 235.0, 417.5, 265.0, 427.5, 274.0, 433.5, 286.0, 434.5, 319.0, 445.5, 331.0, 453.5, 335.0, 451.5, 353.0, 457.5, 386.0, 424.5, 399.0, 417.5, 436.0, 427.5, 438.5, 434.0, 436.0, 479.5]], 'width': 640, 'height': 480, 'id': 74593}, {'iscrowd': 0, 'bbox': [0.0, 0.0, 96.0, 16.0], 'category_id': 34, 'area': 807, 'image_id': 7355, 'segmentation': [[4.0, 15.5, 0, 15.0, 0.0, 0, 95.5, 0.0, 4.0, 15.5]], 'width': 640, 'height': 480, 'id': 74594}], 'width': 640, 'height': 480, 'id': 7355}
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/mask_rcnn-2.1-py3.5.egg/mrcnn/model.py", line 1710, in data_generator
    use_mini_mask=config.USE_MINI_MASK)
  File "/usr/local/lib/python3.5/dist-packages/mask_rcnn-2.1-py3.5.egg/mrcnn/model.py", line 1276, in load_image_gt
    source_class_ids = dataset.source_class_ids[dataset.image_info[image_id]["source"]]
KeyError: 'coco'
ERROR:root:Error processing image {'source': 'coco', 'path': '/home/he/sundata/SUNCGxS_IMG/train/color/016359.jpg', 'annotations': [{'iscrowd': 0, 'bbox': [0.0, 431.0, 516.0, 49.0], 'category_id': 30, 'area': 2033, 'image_id': 8885, 'segmentation': [[0.0, 471.5, 0.0, 430.5, 43.5, 435.0, 0.0, 471.5], [515.0, 479.5, 368.0, 479.5, 367.5, 466.0, 515.0, 479.5]], 'width': 640, 'height': 480, 'id': 90126}, {'iscrowd': 0, 'bbox': [580.0, 140.0, 60.0, 287.0], 'category_id': 12, 'area': 8117, 'image_id': 8885, 'segmentation': [[597.0, 426.5, 590.5, 425.0, 589.5, 417.0, 592.5, 396.0, 590.5, 377.0, 592.5, 359.0, 596.5, 355.0, 597.5, 336.0, 579.5, 319.0, 594.5, 144.0, 596.0, 139.5, 639.0, 139.5, 639.0, 150.5, 626.0, 150.5, 624.5, 153.0, 620.5, 201.0, 639.0, 201.5, 639.5, 220.0, 618.5, 220.0, 614.5, 257.0, 639.0, 257.5, 639.5, 282.0, 612.0, 281.5, 608.5, 311.0, 639.5, 314.0, 639.5, 342.0, 606.0, 340.5, 603.5, 360.0, 639.5, 362.0, 639.5, 398.0, 601.0, 394.5, 597.0, 426.5], [611.5, 201.0, 616.5, 148.0, 603.0, 147.5, 597.5, 200.0, 611.5, 201.0], [599.5, 257.0, 605.0, 256.5, 606.5, 253.0, 609.5, 216.0, 597.0, 209.5, 592.5, 256.0, 599.5, 257.0], [594.5, 311.0, 600.5, 310.0, 603.5, 278.0, 592.0, 267.5, 587.5, 309.0, 594.5, 311.0], [627.5, 380.0, 625.5, 379.0, 627.5, 380.0], [614.5, 383.0, 612.5, 382.0, 614.5, 383.0], [631.5, 385.0, 629.5, 384.0, 631.5, 385.0], [617.5, 387.0, 615.5, 386.0, 617.5, 387.0]], 'width': 640, 'height': 480, 'id': 90127}, {'iscrowd': 0, 'bbox': [0.0, 395.0, 370.0, 85.0], 'category_id': 6, 'area': 24783, 'image_id': 8885, 'segmentation': [[367.0, 479.5, 0.0, 479.5, 0, 472.0, 88.0, 397.5, 92.0, 394.5, 102.0, 394.5, 369.0, 416.5, 367.0, 479.5]], 'width': 640, 'height': 480, 'id': 90128}, {'iscrowd': 0, 'bbox': [74.0, 0.0, 32.0, 32.0], 'category_id': 7, 'area': 697, 'image_id': 8885, 'segmentation': [[98.0, 31.5, 73.5, 27.0, 75.5, 6.0, 82.0, 0, 86.0, 4.5, 85.5, 0.0, 88.0, 0, 90.5, 10.0, 95.0, 8.5, 104.5, 16.0, 104.5, 26.0, 98.0, 31.5]], 'width': 640, 'height': 480, 'id': 90129}, {'iscrowd': 0, 'bbox': [426.0, 306.0, 169.0, 119.0], 'category_id': 5, 'area': 16338, 'image_id': 8885, 'segmentation': [[586.0, 424.5, 582.5, 424.0, 578.0, 414.5, 436.0, 403.5, 430.0, 403.5, 429.5, 412.0, 427.0, 412.5, 425.5, 364.0, 428.5, 306.0, 575.0, 313.5, 594.5, 337.0, 586.0, 424.5]], 'width': 640, 'height': 480, 'id': 90130}, {'iscrowd': 0, 'bbox': [503.0, 0.0, 26.0, 20.0], 'category_id': 7, 'area': 457, 'image_id': 8885, 'segmentation': [[517.0, 19.5, 509.0, 19.5, 502.5, 13.0, 502.5, 5.0, 506.0, 0, 527.5, 0.0, 528.5, 15.0, 517.0, 19.5]], 'width': 640, 'height': 480, 'id': 90131}, {'iscrowd': 0, 'bbox': [0.0, 137.0, 61.0, 243.0], 'category_id': 12, 'area': 6372, 'image_id': 8885, 'segmentation': [[31.0, 379.5, 25.5, 379.0, 22.0, 352.5, 0, 350.0, 0, 328.0, 9.5, 323.0, 7.5, 306.0, 0, 305.0, 0, 284.0, 4.5, 282.0, 2.5, 259.0, 0, 255.0, 0.0, 170.5, 1.5, 188.0, 5.5, 188.0, 0.0, 136.5, 47.5, 137.0, 60.5, 289.0, 25.5, 304.0, 31.5, 340.0, 33.5, 377.0, 31.0, 379.5], [44.5, 189.0, 40.5, 144.0, 10.0, 143.5, 13.5, 188.0, 44.5, 189.0], [48.5, 236.0, 45.5, 197.0, 17.0, 200.5, 18.5, 235.0, 48.5, 236.0], [10.5, 235.0, 7.5, 204.0, 4.0, 203.5, 6.5, 235.0, 10.5, 235.0], [53.5, 282.0, 49.0, 244.5, 20.5, 254.0, 24.0, 281.5, 53.5, 282.0], [12.5, 281.0, 15.5, 278.0, 13.5, 259.0, 10.0, 255.5, 12.5, 281.0], [19.5, 322.0, 18.5, 307.0, 15.0, 306.5, 15.5, 320.0, 19.5, 322.0]], 'width': 640, 'height': 480, 'id': 90132}, {'iscrowd': 0, 'bbox': [169.0, 195.0, 259.0, 207.0], 'category_id': 2, 'area': 45540, 'image_id': 8885, 'segmentation': [[425.0, 401.5, 174.0, 382.5, 172.5, 376.0, 186.5, 362.0, 186.5, 353.0, 181.5, 247.0, 180.5, 238.0, 175.5, 237.0, 180.5, 233.0, 179.5, 210.0, 168.5, 202.0, 190.0, 194.5, 426.0, 199.5, 427.5, 209.0, 415.5, 216.0, 414.5, 232.0, 420.5, 233.0, 420.5, 245.0, 414.5, 246.0, 410.5, 354.0, 410.5, 370.0, 425.5, 372.0, 425.0, 401.5]], 'width': 640, 'height': 480, 'id': 90133}, {'iscrowd': 0, 'bbox': [28.0, 287.0, 159.0, 102.0], 'category_id': 5, 'area': 13212, 'image_id': 8885, 'segmentation': [[162.0, 388.5, 158.5, 388.0, 158.5, 381.0, 153.0, 379.5, 60.0, 372.5, 47.0, 372.5, 36.0, 379.5, 27.5, 305.0, 65.0, 286.5, 183.0, 292.5, 186.5, 362.0, 162.0, 388.5]], 'width': 640, 'height': 480, 'id': 90134}, {'iscrowd': 0, 'bbox': [187.0, 0.0, 230.0, 83.0], 'category_id': 25, 'area': 18564, 'image_id': 8885, 'segmentation': [[242.0, 82.5, 189.5, 81.0, 187.0, 0, 416.5, 0.0, 414.5, 71.0, 411.0, 80.5, 242.0, 82.5]], 'width': 640, 'height': 480, 'id': 90135}], 'width': 640, 'height': 480, 'id': 8885}
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/mask_rcnn-2.1-py3.5.egg/mrcnn/model.py", line 1710, in data_generator
    use_mini_mask=config.USE_MINI_MASK)
  File "/usr/local/lib/python3.5/dist-packages/mask_rcnn-2.1-py3.5.egg/mrcnn/model.py", line 1276, in load_image_gt
    source_class_ids = dataset.source_class_ids[dataset.image_info[image_id]["source"]]
KeyError: 'coco'
ERROR:root:Error processing image {'source': 'coco', 'path': '/home/he/sundata/SUNCGxS_IMG/train/color/000418.jpg', 'annotations': [{'iscrowd': 0, 'bbox': [529.0, 462.0, 109.0, 18.0], 'category_id': 1, 'area': 1535, 'image_id': 5581, 'segmentation': [[637.0, 479.5, 531.0, 479.5, 528.5, 464.0, 582.0, 462.5, 623.0, 470.5, 635.0, 474.5, 637.0, 479.5]], 'width': 640, 'height': 480, 'id': 56444}, {'iscrowd': 0, 'bbox': [520.0, 190.0, 82.0, 247.0], 'category_id': 25, 'area': 13836, 'image_id': 5581, 'segmentation': [[577.0, 436.5, 568.5, 433.0, 555.5, 401.0, 537.5, 397.0, 525.5, 365.0, 526.0, 357.5, 536.5, 357.0, 519.5, 319.0, 530.0, 189.5, 536.0, 190.5, 592.0, 228.5, 601.5, 242.0, 586.5, 407.0, 585.5, 412.0, 580.5, 413.0, 577.0, 436.5]], 'width': 640, 'height': 480, 'id': 56445}, {'iscrowd': 0, 'bbox': [479.0, 323.0, 150.0, 157.0], 'category_id': 5, 'area': 11620, 'image_id': 5581, 'segmentation': [[530.0, 479.5, 491.0, 479.5, 489.5, 476.0, 478.5, 406.0, 483.0, 322.5, 522.5, 325.0, 536.5, 357.0, 526.0, 357.5, 525.5, 365.0, 537.5, 397.0, 555.5, 401.0, 572.0, 436.5, 578.5, 435.0, 580.5, 413.0, 585.5, 412.0, 587.0, 397.5, 628.5, 472.0, 582.0, 462.5, 547.0, 461.5, 528.5, 464.0, 530.0, 479.5]], 'width': 640, 'height': 480, 'id': 56446}, {'iscrowd': 0, 'bbox': [117.0, 352.0, 296.0, 128.0], 'category_id': 30, 'area': 28619, 'image_id': 5581, 'segmentation': [[402.0, 479.5, 116.5, 479.0, 208.5, 377.0, 208.0, 351.5, 412.0, 367.5, 402.0, 479.5]], 'width': 640, 'height': 480, 'id': 56447}, {'iscrowd': 0, 'bbox': [0.0, 309.0, 209.0, 171.0], 'category_id': 14, 'area': 29287, 'image_id': 5581, 'segmentation': [[116.0, 479.5, 0, 479.0, 0.0, 308.5, 158.0, 319.5, 179.0, 322.5, 187.0, 327.5, 199.0, 317.5, 205.5, 317.0, 208.5, 377.0, 116.0, 479.5]], 'width': 640, 'height': 480, 'id': 56448}, {'iscrowd': 0, 'bbox': [62.0, 37.0, 127.0, 254.0], 'category_id': 15, 'area': 15151, 'image_id': 5581, 'segmentation': [[188.0, 290.5, 81.5, 284.0, 62.0, 39.5, 177.5, 37.0, 188.0, 290.5], [174.5, 281.0, 147.5, 264.0, 142.5, 176.0, 141.5, 171.0, 136.5, 170.0, 141.5, 168.0, 141.5, 159.0, 135.5, 57.0, 162.5, 49.0, 79.0, 50.5, 95.5, 276.0, 174.5, 281.0]], 'width': 640, 'height': 480, 'id': 56449}, {'iscrowd': 0, 'bbox': [564.0, 0.0, 76.0, 348.0], 'category_id': 20, 'area': 16241, 'image_id': 5581, 'segmentation': [[565.0, 210.5, 563.5, 198.0, 579.5, 4.0, 582.0, 0, 565.0, 210.5], [639.0, 309.5, 599.5, 273.0, 601.5, 242.0, 592.0, 228.5, 575.5, 218.0, 595.0, 0, 639.5, 0.0, 639.0, 309.5], [639.0, 347.5, 596.5, 301.0, 598.0, 284.5, 639.5, 326.0, 639.0, 347.5]], 'width': 640, 'height': 480, 'id': 56450}], 'width': 640, 'height': 480, 'id': 5581}
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/mask_rcnn-2.1-py3.5.egg/mrcnn/model.py", line 1710, in data_generator
    use_mini_mask=config.USE_MINI_MASK)
  File "/usr/local/lib/python3.5/dist-packages/mask_rcnn-2.1-py3.5.egg/mrcnn/model.py", line 1276, in load_image_gt
    source_class_ids = dataset.source_class_ids[dataset.image_info[image_id]["source"]]
KeyError: 'coco'
ERROR:root:Error processing image {'source': 'coco', 'path': '/home/he/sundata/SUNCGxS_IMG/train/color/014976.jpg', 'annotations': [{'iscrowd': 0, 'bbox': [0.0, 82.0, 145.0, 386.0], 'category_id': 5, 'area': 39708, 'image_id': 3308, 'segmentation': [[0.0, 467.5, 0, 91.0, 34.0, 92.5, 43.0, 83.5, 57.0, 81.5, 68.0, 85.5, 76.0, 93.5, 130.0, 96.5, 138.0, 94.5, 144.5, 105.0, 141.0, 115.5, 103.5, 115.0, 116.5, 284.0, 116.0, 289.5, 104.5, 292.0, 113.5, 419.0, 0.0, 467.5]], 'width': 640, 'height': 480, 'id': 33090}, {'iscrowd': 0, 'bbox': [446.0, 15.0, 194.0, 465.0], 'category_id': 15, 'area': 87855, 'image_id': 3308, 'segmentation': [[639.0, 479.5, 445.5, 479.0, 468.0, 0, 639.5, 0.0, 639.0, 479.5]], 'width': 640, 'height': 480, 'id': 33091}, {'iscrowd': 0, 'bbox': [167.0, 277.0, 125.0, 203.0], 'category_id': 24, 'area': 16455, 'image_id': 3308, 'segmentation': [[262.0, 479.5, 189.0, 479.5, 175.5, 471.0, 167.0, 284.5, 199.0, 276.5, 222.0, 280.5, 225.5, 374.0, 239.0, 372.5, 269.0, 384.5, 290.5, 401.0, 291.5, 432.0, 278.5, 456.0, 262.5, 474.0, 262.0, 479.5]], 'width': 640, 'height': 480, 'id': 33092}, {'iscrowd': 0, 'bbox': [0.0, 0.0, 177.0, 480.0], 'category_id': 23, 'area': 39050, 'image_id': 3308, 'segmentation': [[176.0, 479.5, 0, 479.0, 1.0, 466.5, 113.5, 419.0, 104.5, 292.0, 116.0, 289.5, 116.5, 284.0, 103.5, 115.0, 139.0, 116.5, 144.5, 107.0, 143.5, 100.0, 138.0, 94.5, 130.0, 96.5, 76.0, 93.5, 68.0, 85.5, 57.0, 81.5, 43.0, 83.5, 34.0, 92.5, 0.0, 90.5, 0.0, 0, 150.5, 0.0, 176.0, 479.5]], 'width': 640, 'height': 480, 'id': 33093}, {'iscrowd': 0, 'bbox': [253.0, 361.0, 3.0, 19.0], 'category_id': 1, 'area': 54, 'image_id': 3308, 'segmentation': [[255.0, 379.5, 252.5, 378.0, 253.0, 360.5, 255.5, 362.0, 255.0, 379.5]], 'width': 640, 'height': 480, 'id': 33094}], 'width': 640, 'height': 480, 'id': 3308}
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/mask_rcnn-2.1-py3.5.egg/mrcnn/model.py", line 1710, in data_generator
    use_mini_mask=config.USE_MINI_MASK)
  File "/usr/local/lib/python3.5/dist-packages/mask_rcnn-2.1-py3.5.egg/mrcnn/model.py", line 1276, in load_image_gt
    source_class_ids = dataset.source_class_ids[dataset.image_info[image_id]["source"]]
KeyError: 'coco'
ERROR:root:Error processing image {'source': 'coco', 'path': '/home/he/sundata/SUNCGxS_IMG/train/color/015192.jpg', 'annotations': [{'iscrowd': 0, 'bbox': [0.0, 33.0, 142.0, 189.0], 'category_id': 20, 'area': 22160, 'image_id': 7137, 'segmentation': [[6.0, 221.5, 0, 221.0, 0, 37.0, 123.0, 48.5, 133.5, 200.0, 128.5, 203.0, 139.0, 202.5, 141.5, 205.0, 6.0, 221.5], [130.0, 64.5, 130.0, 54.5, 130.0, 64.5], [131.0, 81.5, 131.0, 71.5, 131.0, 81.5], [132.0, 97.5, 132.0, 87.5, 132.0, 97.5], [133.0, 114.5, 133.0, 104.5, 133.0, 114.5], [134.0, 130.5, 134.0, 120.5, 134.0, 130.5], [135.0, 146.5, 135.0, 137.5, 135.0, 146.5], [136.0, 163.5, 136.0, 153.5, 136.0, 163.5], [137.0, 179.5, 137.0, 169.5, 137.0, 179.5], [138.0, 196.5, 138.0, 186.5, 138.0, 196.5], [127.5, 204.0, 119.5, 204.0, 127.5, 204.0], [118.5, 205.0, 110.5, 205.0, 118.5, 205.0], [92.5, 208.0, 109.5, 206.0, 88.5, 208.0, 92.5, 208.0], [83.5, 209.0, 87.5, 208.0, 80.5, 209.0, 83.5, 209.0], [74.5, 210.0, 76.5, 209.0, 74.5, 210.0], [65.5, 211.0, 67.5, 210.0, 65.5, 211.0]], 'width': 640, 'height': 480, 'id': 72306}, {'iscrowd': 0, 'bbox': [183.0, 0.0, 202.0, 19.0], 'category_id': 34, 'area': 2075, 'image_id': 7137, 'segmentation': [[277.0, 18.5, 182.5, 3.0, 187.0, 0, 227.0, 0, 244.0, 3.5, 252.0, 0, 384.5, 0.0, 277.0, 18.5]], 'width': 640, 'height': 480, 'id': 72307}, {'iscrowd': 0, 'bbox': [32.0, 300.0, 608.0, 180.0], 'category_id': 1, 'area': 68029, 'image_id': 7137, 'segmentation': [[639.0, 479.5, 31.5, 479.0, 358.0, 338.5, 364.5, 335.0, 366.0, 329.5, 373.0, 326.5, 381.0, 328.5, 449.0, 299.5, 639.0, 342.5, 639.0, 479.5]], 'width': 640, 'height': 480, 'id': 72308}, {'iscrowd': 0, 'bbox': [564.0, 63.0, 76.0, 280.0], 'category_id': 14, 'area': 15425, 'image_id': 7137, 'segmentation': [[639.0, 342.5, 563.5, 325.0, 577.5, 157.0, 599.5, 156.0, 606.5, 77.0, 639.0, 62.5, 639.0, 342.5]], 'width': 640, 'height': 480, 'id': 72309}, {'iscrowd': 0, 'bbox': [327.0, 305.0, 96.0, 39.0], 'category_id': 30, 'area': 1331, 'image_id': 7137, 'segmentation': [[346.0, 343.5, 330.0, 338.5, 326.5, 333.0, 396.0, 304.5, 422.5, 310.0, 381.0, 328.5, 373.0, 326.5, 366.0, 329.5, 364.0, 335.5, 346.0, 343.5]], 'width': 640, 'height': 480, 'id': 72310}, {'iscrowd': 0, 'bbox': [158.0, 0.0, 94.0, 7.0], 'category_id': 1, 'area': 181, 'image_id': 7137, 'segmentation': [[161.0, 6.5, 158.0, 0, 186.5, 0.0, 185.0, 2.5, 161.0, 6.5], [246.0, 3.5, 227.5, 0.0, 251.5, 0.0, 246.0, 3.5]], 'width': 640, 'height': 480, 'id': 72311}, {'iscrowd': 0, 'bbox': [363.0, 46.0, 75.0, 94.0], 'category_id': 26, 'area': 6487, 'image_id': 7137, 'segmentation': [[433.0, 139.5, 362.5, 137.0, 364.0, 53.5, 437.5, 47.0, 433.0, 139.5]], 'width': 640, 'height': 480, 'id': 72312}], 'width': 640, 'height': 480, 'id': 7137}
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/mask_rcnn-2.1-py3.5.egg/mrcnn/model.py", line 1710, in data_generator
    use_mini_mask=config.USE_MINI_MASK)
  File "/usr/local/lib/python3.5/dist-packages/mask_rcnn-2.1-py3.5.egg/mrcnn/model.py", line 1276, in load_image_gt
    source_class_ids = dataset.source_class_ids[dataset.image_info[image_id]["source"]]
KeyError: 'coco'
ERROR:root:Error processing image {'source': 'coco', 'path': '/home/he/sundata/SUNCGxS_IMG/train/color/008931.jpg', 'annotations': [{'iscrowd': 0, 'bbox': [301.0, 290.0, 242.0, 190.0], 'category_id': 24, 'area': 13430, 'image_id': 3614, 'segmentation': [[539.0, 363.5, 467.5, 356.0, 472.0, 292.5, 487.0, 289.5, 503.0, 290.5, 522.0, 292.5, 531.5, 297.0, 541.5, 328.0, 541.5, 347.0, 540.0, 351.5, 523.0, 350.5, 522.5, 354.0, 539.0, 356.5, 539.0, 363.5], [375.0, 479.5, 336.5, 479.0, 343.5, 451.0, 326.5, 434.0, 300.5, 391.0, 303.5, 371.0, 309.0, 364.5, 328.0, 357.5, 348.0, 355.5, 375.0, 355.5, 408.5, 360.0, 375.0, 479.5]], 'width': 640, 'height': 480, 'id': 36061}, {'iscrowd': 0, 'bbox': [376.0, 349.0, 221.0, 131.0], 'category_id': 18, 'area': 22881, 'image_id': 3614, 'segmentation': [[596.0, 479.5, 376.0, 479.5, 410.5, 354.0, 418.0, 351.5, 539.0, 363.5, 539.0, 356.5, 525.0, 355.5, 522.5, 351.0, 556.0, 348.5, 567.0, 352.5, 565.5, 389.0, 596.0, 479.5]], 'width': 640, 'height': 480, 'id': 36062}, {'iscrowd': 0, 'bbox': [174.0, 417.0, 145.0, 63.0], 'category_id': 30, 'area': 6618, 'image_id': 3614, 'segmentation': [[297.0, 479.5, 173.5, 479.0, 226.0, 418.5, 249.0, 416.5, 307.0, 424.5, 318.5, 431.0, 318.5, 437.0, 297.0, 479.5]], 'width': 640, 'height': 480, 'id': 36063}, {'iscrowd': 0, 'bbox': [298.0, 251.0, 220.0, 117.0], 'category_id': 22, 'area': 15439, 'image_id': 3614, 'segmentation': [[306.0, 367.5, 297.5, 352.0, 297.5, 283.0, 301.5, 273.0, 325.0, 251.5, 377.0, 251.5, 369.0, 253.5, 365.5, 262.0, 377.0, 272.5, 386.5, 276.0, 383.5, 284.0, 388.5, 289.0, 373.5, 303.0, 383.0, 306.5, 402.0, 304.5, 411.0, 292.5, 436.0, 290.5, 452.0, 281.5, 459.5, 275.0, 468.0, 257.5, 510.5, 261.0, 517.0, 292.5, 487.0, 289.5, 474.0, 291.5, 470.5, 295.0, 467.0, 356.5, 418.0, 351.5, 413.0, 351.5, 409.0, 359.5, 375.0, 355.5, 333.0, 356.5, 317.0, 360.5, 306.0, 367.5], [413.0, 273.5, 409.5, 272.0, 415.0, 270.5, 413.0, 273.5]], 'width': 640, 'height': 480, 'id': 36064}, {'iscrowd': 0, 'bbox': [366.0, 150.0, 151.0, 157.0], 'category_id': 21, 'area': 9389, 'image_id': 3614, 'segmentation': [[388.0, 306.5, 373.5, 304.0, 388.5, 289.0, 383.5, 284.0, 386.5, 276.0, 373.0, 269.5, 365.5, 262.0, 365.5, 257.0, 371.0, 252.5, 392.0, 249.5, 416.0, 230.5, 423.0, 228.5, 437.5, 205.0, 455.0, 187.5, 465.0, 184.5, 485.0, 186.5, 481.5, 183.0, 490.5, 154.0, 502.0, 149.5, 511.0, 152.5, 516.5, 161.0, 515.5, 169.0, 495.5, 191.0, 512.5, 212.0, 511.5, 220.0, 500.5, 242.0, 487.0, 253.5, 469.0, 256.5, 459.5, 275.0, 452.0, 281.5, 436.0, 290.5, 411.0, 292.5, 402.0, 304.5, 388.0, 306.5], [428.5, 250.0, 442.5, 239.0, 450.0, 218.5, 421.0, 242.5, 402.5, 248.0, 428.5, 250.0], [481.5, 242.0, 482.0, 239.5, 481.5, 242.0], [413.5, 273.0, 415.0, 270.5, 409.5, 272.0, 413.5, 273.0]], 'width': 640, 'height': 480, 'id': 36065}], 'width': 640, 'height': 480, 'id': 3614}
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/mask_rcnn-2.1-py3.5.egg/mrcnn/model.py", line 1710, in data_generator
    use_mini_mask=config.USE_MINI_MASK)
  File "/usr/local/lib/python3.5/dist-packages/mask_rcnn-2.1-py3.5.egg/mrcnn/model.py", line 1276, in load_image_gt
    source_class_ids = dataset.source_class_ids[dataset.image_info[image_id]["source"]]
KeyError: 'coco'
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.5/dist-packages/keras/utils/data_utils.py", line 568, in data_generator_task
    generator_output = next(self._generator)
  File "/usr/local/lib/python3.5/dist-packages/mask_rcnn-2.1-py3.5.egg/mrcnn/model.py", line 1710, in data_generator
    use_mini_mask=config.USE_MINI_MASK)
  File "/usr/local/lib/python3.5/dist-packages/mask_rcnn-2.1-py3.5.egg/mrcnn/model.py", line 1276, in load_image_gt
    source_class_ids = dataset.source_class_ids[dataset.image_info[image_id]["source"]]
KeyError: 'coco'

Traceback (most recent call last):
  File "samples/house/house.py", line 428, in <module>
    augmentation=augmentation)
  File "/usr/local/lib/python3.5/dist-packages/mask_rcnn-2.1-py3.5.egg/mrcnn/model.py", line 2375, in train
  File "/usr/local/lib/python3.5/dist-packages/keras/legacy/interfaces.py", line 87, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/keras/engine/training.py", line 2011, in fit_generator
    generator_output = next(output_generator)
StopIteration
Mahi-Mai commented 4 years ago

Hello @lhiceu . Could you please share how you solved this problem? I'm looking into using matterport's MRCNN myself, so I'll take any bit of knowledge there is. :) In particular, I'm interested in how you modified the scripts to load this kind of dataset.

Thanks!