waspinator / pycococreator

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

Error processing image, ValueError: Input image expected to be RGB, RGBA or gray. #5

Closed austinmw closed 6 years ago

austinmw commented 6 years ago

I'm getting this error very intermittently during training (approx. 10 times per 1000 iterations). I have variable size images and masks, so I'm thinking this may be an issue with some of the very large images in my dataset (for example, sizes 5456x3632, 2592x1944, etc.). It continues to train without crashing due to the error, but I'm unsure if there will be any negative consequences later on.

ERROR:root:Error processing image {'id': 3452, 'source': 'coco', 'path': '/home/docker_user/data/typeb_data/train2018/00001207.jpg', 'width': 5456, 'height': 3632, 'annotations': [{'id': 8215, 'image_id': 3452, 'category_id': 1, 'iscrowd': 0, 'area': 2581761, 'bbox': [2971.0, 657.0, 2217.0, 2258.0], 'segmentation': [[4691.0, 2914.5, 4657.0, 2912.5, 4640.0, 2909.5, 4595.0, 2909.5, 4571.0, 2903.5, 4522.0, 2879.5, 4503.0, 2841.5, 4491.0, 2839.5, 4475.0, 2833.5, 4446.5, 2818.0, 4443.5, 2767.0, 4438.5, 2735.0, 4432.5, 2722.0, 4416.5, 2710.0, 4411.5, 2696.0, 4400.5, 2676.0, 4397.5, 2662.0, 4400.5, 2642.0, 4408.0, 2632.5, 4424.0, 2631.5, 4431.0, 2639.5, 4455.0, 2643.5, 4470.0, 2643.5, 4508.0, 2630.5, 4510.5, 2627.0, 4511.5, 2617.0, 4516.5, 2603.0, 4539.5, 2552.0, 4523.5, 2530.0, 4501.0, 2512.5, 4454.0, 2491.5, 4420.0, 2471.5, 4399.5, 2449.0, 4388.5, 2427.0, 4375.5, 2394.0, 4362.5, 2368.0, 4352.0, 2360.5, 4348.5, 2355.0, 4343.5, 2324.0, 4355.5, 2302.0, 4370.5, 2280.0, 4363.0, 2251.5, 4343.5, 2256.0, 4337.5, 2282.0, 4322.5, 2312.0, 4298.5, 2340.0, 4323.5, 2445.0, 4323.0, 2447.5, 4316.0, 2449.5, 3752.0, 2482.5, 3726.0, 2481.5, 3725.5, 2475.0, 3729.5, 2470.0, 3795.5, 2398.0, 3817.5, 2370.0, 3819.5, 2347.0, 3819.5, 2338.0, 3817.5, 2331.0, 3808.0, 2324.5, 3786.0, 2319.5, 3731.5, 2383.0, 3698.5, 2411.0, 3692.5, 2460.0, 3699.5, 2481.0, 3708.5, 2486.0, 3717.5, 2504.0, 3715.5, 2533.0, 3717.5, 2566.0, 3715.5, 2579.0, 3714.5, 2614.0, 3710.5, 2630.0, 3669.5, 2660.0, 3658.0, 2684.5, 3627.0, 2707.5, 3589.0, 2727.5, 3548.0, 2758.5, 3481.0, 2758.5, 3381.0, 2704.5, 3343.5, 2657.0, 3318.0, 2632.5, 3296.0, 2617.5, 3251.0, 2623.5, 3196.0, 2619.5, 3161.0, 2606.5, 3119.0, 2583.5, 3094.5, 2547.0, 3051.5, 2510.0, 3027.5, 2478.0, 3009.5, 2442.0, 3000.5, 2408.0, 2977.5, 2379.0, 2972.5, 2333.0, 2970.5, 2262.0, 2973.5, 2150.0, 2996.0, 2127.5, 3021.5, 2108.0, 3037.5, 2080.0, 3045.5, 2059.0, 3058.0, 2039.5, 3095.0, 2021.5, 3116.0, 2004.5, 3139.0, 1963.5, 3204.5, 1931.0, 3200.5, 1922.0, 3185.5, 1910.0, 3192.5, 1882.0, 3203.5, 1859.0, 3208.5, 1853.0, 3241.5, 1817.0, 3266.0, 1795.5, 3281.5, 1779.0, 3284.5, 1748.0, 3294.5, 1730.0, 3336.0, 1710.5, 3351.0, 1706.5, 3392.0, 1683.5, 3450.0, 1671.5, 3448.5, 1651.0, 3455.5, 1631.0, 3480.0, 1618.5, 3561.0, 1609.5, 3584.0, 1595.5, 3642.0, 1595.5, 3665.5, 1593.0, 3663.0, 1574.5, 3652.0, 1574.5, 3632.0, 1580.5, 3612.0, 1570.5, 3584.5, 1543.0, 3564.5, 1502.0, 3545.5, 1477.0, 3540.5, 1465.0, 3519.5, 1403.0, 3499.5, 1350.0, 3479.5, 1286.0, 3475.5, 1208.0, 3482.5, 1080.0, 3518.5, 940.0, 3556.5, 887.0, 3617.5, 816.0, 3699.0, 751.5, 3815.0, 697.5, 3909.0, 669.5, 4044.0, 664.5, 4087.0, 656.5, 4171.0, 664.5, 4261.0, 682.5, 4266.0, 684.5, 4354.0, 748.5, 4426.5, 823.0, 4504.5, 1012.0, 4522.5, 1098.0, 4517.5, 1195.0, 4480.5, 1320.0, 4391.5, 1451.0, 4354.5, 1513.0, 4347.5, 1531.0, 4305.5, 1662.0, 4328.0, 1669.5, 4390.0, 1682.5, 4433.0, 1697.5, 4477.0, 1725.5, 4500.0, 1754.5, 4524.5, 1772.0, 4538.5, 1851.0, 4574.0, 1871.5, 4661.5, 1963.0, 4672.5, 1975.0, 4701.5, 2025.0, 4728.0, 2035.5, 4764.0, 2059.5, 4820.0, 2100.5, 4858.5, 2147.0, 4886.0, 2187.5, 4928.0, 2208.5, 4930.5, 2211.0, 4972.0, 2273.5, 4996.0, 2279.5, 5020.0, 2282.5, 5102.0, 2338.5, 5156.5, 2406.0, 5183.5, 2459.0, 5187.5, 2496.0, 5157.5, 2543.0, 5145.5, 2587.0, 5133.5, 2603.0, 5124.5, 2628.0, 5122.0, 2631.5, 5090.0, 2648.5, 5077.0, 2653.5, 5058.0, 2686.5, 5037.0, 2700.5, 5011.0, 2724.5, 4989.0, 2741.5, 4983.0, 2744.5, 4947.0, 2751.5, 4919.5, 2792.0, 4853.0, 2868.5, 4795.0, 2895.5, 4771.0, 2902.5, 4737.0, 2909.5, 4709.0, 2903.5, 4691.0, 2914.5]], 'width': 5456, 'height': 3632}, {'id': 8216, 'image_id': 3452, 'category_id': 2, 'iscrowd': 0, 'area': 2590712, 'bbox': [2968.0, 658.0, 2218.0, 2256.0], 'segmentation': [[4669.0, 2913.5, 4641.0, 2909.5, 4588.0, 2909.5, 4553.0, 2901.5, 4527.5, 2874.0, 4510.0, 2848.5, 4498.0, 2839.5, 4470.0, 2831.5, 4459.5, 2812.0, 4439.5, 2800.0, 4437.5, 2785.0, 4437.5, 2728.0, 4419.5, 2718.0, 4400.5, 2677.0, 4390.5, 2663.0, 4402.0, 2642.5, 4424.0, 2631.5, 4436.0, 2644.5, 4439.0, 2644.5, 4469.0, 2639.5, 4512.0, 2628.5, 4517.5, 2617.0, 4524.5, 2582.0, 4543.5, 2558.0, 4532.0, 2539.5, 4507.0, 2528.5, 4481.0, 2508.5, 4432.0, 2484.5, 4412.5, 2462.0, 4400.5, 2440.0, 4381.5, 2414.0, 4370.5, 2373.0, 4368.0, 2368.5, 4348.5, 2355.0, 4343.5, 2336.0, 4344.5, 2316.0, 4354.5, 2298.0, 4359.5, 2285.0, 4362.5, 2263.0, 4362.5, 2259.0, 4360.0, 2255.5, 4342.5, 2254.0, 4344.5, 2264.0, 4334.5, 2300.0, 4311.5, 2322.0, 4303.5, 2338.0, 4322.5, 2443.0, 4322.0, 2445.5, 4314.0, 2446.5, 3715.0, 2484.5, 3718.5, 2479.0, 3789.5, 2400.0, 3804.5, 2376.0, 3817.5, 2359.0, 3821.5, 2346.0, 3811.0, 2334.5, 3790.0, 2319.5, 3720.0, 2385.5, 3696.5, 2412.0, 3697.5, 2437.0, 3695.5, 2477.0, 3702.5, 2491.0, 3719.5, 2510.0, 3719.5, 2538.0, 3714.5, 2547.0, 3719.5, 2558.0, 3719.5, 2562.0, 3715.5, 2581.0, 3711.5, 2637.0, 3669.0, 2661.5, 3649.0, 2698.5, 3631.0, 2707.5, 3603.0, 2717.5, 3592.0, 2727.5, 3560.0, 2747.5, 3524.0, 2761.5, 3487.0, 2753.5, 3456.0, 2752.5, 3402.0, 2722.5, 3369.5, 2697.0, 3343.5, 2641.0, 3332.5, 2626.0, 3308.0, 2612.5, 3287.0, 2613.5, 3252.0, 2619.5, 3206.0, 2624.5, 3200.0, 2624.5, 3165.0, 2617.5, 3127.0, 2581.5, 3099.0, 2560.5, 3079.0, 2550.5, 3056.0, 2536.5, 3032.5, 2495.0, 3010.5, 2472.0, 2999.5, 2420.0, 2972.5, 2340.0, 2972.5, 2303.0, 2967.5, 2229.0, 2976.5, 2154.0, 2983.5, 2140.0, 3012.5, 2106.0, 3017.0, 2101.5, 3041.5, 2089.0, 3039.5, 2080.0, 3045.5, 2069.0, 3050.5, 2048.0, 3069.0, 2028.5, 3105.0, 2020.5, 3129.0, 1978.5, 3157.0, 1960.5, 3179.0, 1943.5, 3206.5, 1928.0, 3199.5, 1923.0, 3191.5, 1913.0, 3186.5, 1894.0, 3199.5, 1877.0, 3206.5, 1862.0, 3235.5, 1824.0, 3272.5, 1787.0, 3275.5, 1770.0, 3289.0, 1739.5, 3305.0, 1729.5, 3344.0, 1711.5, 3360.0, 1698.5, 3371.0, 1692.5, 3399.0, 1680.5, 3436.0, 1669.5, 3444.0, 1669.5, 3461.0, 1621.5, 3509.0, 1612.5, 3551.0, 1611.5, 3569.0, 1606.5, 3586.0, 1596.5, 3661.5, 1593.0, 3659.0, 1568.5, 3632.0, 1583.5, 3605.5, 1566.0, 3577.5, 1524.0, 3552.5, 1491.0, 3508.5, 1387.0, 3492.5, 1355.0, 3476.5, 1278.0, 3476.5, 1218.0, 3473.5, 1161.0, 3502.5, 979.0, 3504.5, 973.0, 3510.5, 964.0, 3599.0, 835.5, 3786.0, 705.5, 3867.0, 673.5, 4048.0, 662.5, 4088.0, 661.5, 4125.0, 657.5, 4153.0, 660.5, 4187.0, 673.5, 4287.0, 695.5, 4317.0, 715.5, 4346.0, 739.5, 4421.5, 810.0, 4466.5, 885.0, 4496.5, 941.0, 4516.5, 985.0, 4529.5, 1155.0, 4505.5, 1248.0, 4492.5, 1323.0, 4475.0, 1333.5, 4465.0, 1338.5, 4455.0, 1340.5, 4452.5, 1343.0, 4402.5, 1444.0, 4385.5, 1462.0, 4371.5, 1503.0, 4352.5, 1527.0, 4342.5, 1568.0, 4298.5, 1669.0, 4333.0, 1669.5, 4374.0, 1672.5, 4408.0, 1684.5, 4448.0, 1704.5, 4500.0, 1741.5, 4544.5, 1788.0, 4545.5, 1847.0, 4547.5, 1850.0, 4564.0, 1870.5, 4609.5, 1897.0, 4710.5, 2035.0, 4780.0, 2068.5, 4832.0, 2110.5, 4835.5, 2114.0, 4883.5, 2196.0, 4976.0, 2268.5, 4979.0, 2270.5, 5025.0, 2274.5, 5103.0, 2328.5, 5146.5, 2378.0, 5165.5, 2427.0, 5185.5, 2464.0, 5179.5, 2512.0, 5175.0, 2518.5, 5159.5, 2531.0, 5155.5, 2571.0, 5153.5, 2578.0, 5139.5, 2600.0, 5092.5, 2649.0, 5054.0, 2692.5, 4998.0, 2735.5, 4946.0, 2756.5, 4931.5, 2775.0, 4913.5, 2803.0, 4875.0, 2839.5, 4839.0, 2866.5, 4802.0, 2882.5, 4777.0, 2895.5, 4746.0, 2905.5, 4695.0, 2905.5, 4669.0, 2913.5]], 'width': 5456, 'height': 3632}]}
Traceback (most recent call last):
  File "/root/anaconda3/lib/python3.6/site-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1695, in data_generator
    use_mini_mask=config.USE_MINI_MASK)
  File "/root/anaconda3/lib/python3.6/site-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1209, in load_image_gt
    image = dataset.load_image(image_id)
  File "/root/anaconda3/lib/python3.6/site-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/utils.py", line 367, in load_image
    image = skimage.color.gray2rgb(image)
  File "/root/anaconda3/lib/python3.6/site-packages/skimage/color/colorconv.py", line 862, in gray2rgb
    raise ValueError("Input image expected to be RGB, RGBA or gray.")
ValueError: Input image expected to be RGB, RGBA or gray.
austinmw commented 6 years ago

So somebody found that this isn't a bug it the data apparently it's a bug in skimage.io.imread called from mrcnn/utils.py which can't correctly output large images' shape: https://github.com/matterport/Mask_RCNN/issues/525