EasyOCR icon indicating copy to clipboard operation
EasyOCR copied to clipboard

Detection of "Free" Boxes Doesn't Seem to Work

Open GrandTheftWalrus opened this issue 3 years ago • 4 comments

I have a program using EasyOCR that works great, but when I try to change it to use EasyOCR's detection of text with rotation/skewness etc., as opposed to just orthogonal boxes, (or as it's called in the documentation, the 'free_list', which is returned by easyocr.detect()), it does not seem to work. Specifically, here is the code and the output:

The code:

language = "en"
reader = easyocr.Reader([language], recognizer=False)
print(reader.detect(IMAGE_PATH))

The print() output: ([[[1739, 1922, 199, 266], [1965, 2774, 193, 262], [3047, 3168, 130, 241], [1459, 1616, 371, 435], [1649, 1796, 370, 434], [1822, 2161, 364, 433], [2184, 2676, 363, 430], [2718, 3001, 363, 427], [1455, 1546, 465, 517], [1593, 1792, 456, 518], [1813, 1918, 454, 515], [1977, 2156, 450, 516], [2201, 2313, 445, 521], [2345, 2997, 444, 518], [1446, 1670, 541, 603], [1777, 1921, 533, 598], [1957, 2073, 536, 598], [2121, 2590, 527, 601], [2628, 2769, 533, 595], [2803, 2978, 531, 595], [1439, 1650, 624, 685], [1690, 1747, 620, 677], [1787, 2037, 621, 683], [2070, 2233, 601, 686], [2277, 2395, 616, 680], [2447, 3041, 613, 680], [1478, 1579, 715, 772], [1622, 2047, 704, 773], [2190, 2332, 705, 762], [2368, 2608, 693, 765], [2635, 2777, 699, 760], [2806, 3040, 699, 763], [1445, 1758, 786, 859], [1798, 1855, 792, 849], [1877, 2207, 785, 851], [2269, 2888, 781, 848], [2907, 2977, 787, 842], [1431, 2089, 865, 946], [2139, 2372, 868, 934], [2395, 2692, 864, 933], [2731, 3061, 864, 928], [1436, 1727, 956, 1023], [1789, 2302, 954, 1023], [2371, 2541, 953, 1040], [2567, 2753, 957, 1014], [2794, 3043, 946, 1015], [1442, 1582, 1050, 1107], [1614, 1805, 1044, 1106], [1846, 2307, 1042, 1103], [2372, 2416, 1044, 1093], [2439, 3017, 1034, 1098], [1444, 1838, 1127, 1193], [1885, 2210, 1115, 1196], [2241, 2839, 1119, 1186], [2863, 2969, 1117, 1174], [1449, 1877, 1212, 1278], [1925, 2149, 1207, 1274], [2182, 2304, 1213, 1270], [2339, 2744, 1204, 1268], [2781, 2907, 1208, 1259], [1446, 1859, 1292, 1358], [1895, 2022, 1301, 1346], [2045, 2323, 1292, 1353], [2387, 2943, 1282, 1354], [1457, 1645, 1377, 1441], [1668, 1934, 1379, 1441], [1989, 2263, 1375, 1432], [2309, 3021, 1363, 1442], [1444, 1701, 1462, 1526], [1728, 1838, 1462, 1523], [1882, 1988, 1457, 1521], [2024, 2426, 1457, 1521], [2471, 2866, 1449, 1522], [1453, 1817, 1540, 1615], [1860, 1917, 1545, 1605], [1945, 2123, 1545, 1602], [2145, 2200, 1564, 1601], [2209, 2414, 1537, 1604], [2462, 2659, 1538, 1604], [2695, 3024, 1534, 1596], [1444, 1536, 1622, 1686], [1558, 2393, 1603, 1703], [2448, 2938, 1613, 1692], [1453, 2167, 1702, 1780], [2222, 2339, 1703, 1775], [2374, 2943, 1688, 1767], [1444, 1831, 1788, 1866], [1868, 2017, 1794, 1855], [2043, 2641, 1784, 1858], [2681, 2759, 1817, 1857], [2767, 2918, 1781, 1853], [1441, 1686, 1880, 1944], [1745, 2012, 1868, 1945], [2066, 2173, 1870, 1935], [2212, 2774, 1872, 1936], [2795, 3074, 1869, 1937], [1448, 1571, 1966, 2026], [1606, 2042, 1960, 2026], [2110, 2224, 1968, 2023], [2272, 2583, 1954, 2019], [2629, 2737, 1961, 2018], [2778, 2910, 1950, 2016], [1444, 1606, 2042, 2106], [1634, 2657, 2033, 2110], [2709, 2974, 2026, 2105], [1458, 1682, 2126, 2200], [1713, 2206, 2121, 2196], [2270, 2397, 2118, 2186], [2429, 2800, 2117, 2186], [2828, 2994, 2118, 2185], [1466, 1584, 2206, 2278], [1624, 2011, 2210, 2274], [2050, 2157, 2208, 2273], [2194, 2426, 2205, 2271], [2478, 2578, 2202, 2266], [2616, 3013, 2199, 2273], [1464, 1575, 2295, 2356], [1633, 1749, 2296, 2353], [1789, 2084, 2293, 2354], [2194, 2449, 2285, 2362], [2475, 2746, 2287, 2354], [2812, 2923, 2288, 2345]]], [[]])

All of the numbers you see here are the proper output for the orthogonal text boxes, but you can see at the very end of the list, is an empty list which should contain free-form text boxes in the format [[x1,y1],[x2,y2],[x3,y3],[x4,y4]].

I.e., the documentation says it should return: Return horizontal_list, free_list - horizontal_list is a list of regtangular text boxes. The format is [x_min, x_max, y_min, y_max]. free_list is a list of free-form text boxes. The format is [[x1,y1],[x2,y2],[x3,y3],[x4,y4]]. "

Is anybody else having this problem? Does anyone know what the cause is/how to fix it? I hope it doesn't turn out to be the case that I'm just making a total rookie mistake, lul. I looked around the discussion pages and documentation and haven't seemed to find any mention of it. Thanks

GrandTheftWalrus avatar Jun 12 '22 07:06 GrandTheftWalrus

Also having this problem, was curious if a solution was found. The free boxes get posted occasionally, but no consistently.

macksjeremy avatar Jun 22 '22 18:06 macksjeremy

I have a program using EasyOCR that works great, but when I try to change it to use EasyOCR's detection of text with rotation/skewness etc., as opposed to just orthogonal boxes, (or as it's called in the documentation, the 'free_list', which is returned by easyocr.detect()), it does not seem to work. Specifically, here is the code and the output:

The code:

language = "en"
reader = easyocr.Reader([language], recognizer=False)
print(reader.detect(IMAGE_PATH))

The print() output: ([[[1739, 1922, 199, 266], [1965, 2774, 193, 262], [3047, 3168, 130, 241], [1459, 1616, 371, 435], [1649, 1796, 370, 434], [1822, 2161, 364, 433], [2184, 2676, 363, 430], [2718, 3001, 363, 427], [1455, 1546, 465, 517], [1593, 1792, 456, 518], [1813, 1918, 454, 515], [1977, 2156, 450, 516], [2201, 2313, 445, 521], [2345, 2997, 444, 518], [1446, 1670, 541, 603], [1777, 1921, 533, 598], [1957, 2073, 536, 598], [2121, 2590, 527, 601], [2628, 2769, 533, 595], [2803, 2978, 531, 595], [1439, 1650, 624, 685], [1690, 1747, 620, 677], [1787, 2037, 621, 683], [2070, 2233, 601, 686], [2277, 2395, 616, 680], [2447, 3041, 613, 680], [1478, 1579, 715, 772], [1622, 2047, 704, 773], [2190, 2332, 705, 762], [2368, 2608, 693, 765], [2635, 2777, 699, 760], [2806, 3040, 699, 763], [1445, 1758, 786, 859], [1798, 1855, 792, 849], [1877, 2207, 785, 851], [2269, 2888, 781, 848], [2907, 2977, 787, 842], [1431, 2089, 865, 946], [2139, 2372, 868, 934], [2395, 2692, 864, 933], [2731, 3061, 864, 928], [1436, 1727, 956, 1023], [1789, 2302, 954, 1023], [2371, 2541, 953, 1040], [2567, 2753, 957, 1014], [2794, 3043, 946, 1015], [1442, 1582, 1050, 1107], [1614, 1805, 1044, 1106], [1846, 2307, 1042, 1103], [2372, 2416, 1044, 1093], [2439, 3017, 1034, 1098], [1444, 1838, 1127, 1193], [1885, 2210, 1115, 1196], [2241, 2839, 1119, 1186], [2863, 2969, 1117, 1174], [1449, 1877, 1212, 1278], [1925, 2149, 1207, 1274], [2182, 2304, 1213, 1270], [2339, 2744, 1204, 1268], [2781, 2907, 1208, 1259], [1446, 1859, 1292, 1358], [1895, 2022, 1301, 1346], [2045, 2323, 1292, 1353], [2387, 2943, 1282, 1354], [1457, 1645, 1377, 1441], [1668, 1934, 1379, 1441], [1989, 2263, 1375, 1432], [2309, 3021, 1363, 1442], [1444, 1701, 1462, 1526], [1728, 1838, 1462, 1523], [1882, 1988, 1457, 1521], [2024, 2426, 1457, 1521], [2471, 2866, 1449, 1522], [1453, 1817, 1540, 1615], [1860, 1917, 1545, 1605], [1945, 2123, 1545, 1602], [2145, 2200, 1564, 1601], [2209, 2414, 1537, 1604], [2462, 2659, 1538, 1604], [2695, 3024, 1534, 1596], [1444, 1536, 1622, 1686], [1558, 2393, 1603, 1703], [2448, 2938, 1613, 1692], [1453, 2167, 1702, 1780], [2222, 2339, 1703, 1775], [2374, 2943, 1688, 1767], [1444, 1831, 1788, 1866], [1868, 2017, 1794, 1855], [2043, 2641, 1784, 1858], [2681, 2759, 1817, 1857], [2767, 2918, 1781, 1853], [1441, 1686, 1880, 1944], [1745, 2012, 1868, 1945], [2066, 2173, 1870, 1935], [2212, 2774, 1872, 1936], [2795, 3074, 1869, 1937], [1448, 1571, 1966, 2026], [1606, 2042, 1960, 2026], [2110, 2224, 1968, 2023], [2272, 2583, 1954, 2019], [2629, 2737, 1961, 2018], [2778, 2910, 1950, 2016], [1444, 1606, 2042, 2106], [1634, 2657, 2033, 2110], [2709, 2974, 2026, 2105], [1458, 1682, 2126, 2200], [1713, 2206, 2121, 2196], [2270, 2397, 2118, 2186], [2429, 2800, 2117, 2186], [2828, 2994, 2118, 2185], [1466, 1584, 2206, 2278], [1624, 2011, 2210, 2274], [2050, 2157, 2208, 2273], [2194, 2426, 2205, 2271], [2478, 2578, 2202, 2266], [2616, 3013, 2199, 2273], [1464, 1575, 2295, 2356], [1633, 1749, 2296, 2353], [1789, 2084, 2293, 2354], [2194, 2449, 2285, 2362], [2475, 2746, 2287, 2354], [2812, 2923, 2288, 2345]]], [[]])

All of the numbers you see here are the proper output for the orthogonal text boxes, but you can see at the very end of the list, is an empty list which should contain free-form text boxes in the format [[x1,y1],[x2,y2],[x3,y3],[x4,y4]].

I.e., the documentation says it should return: Return horizontal_list, free_list - horizontal_list is a list of regtangular text boxes. The format is [x_min, x_max, y_min, y_max]. free_list is a list of free-form text boxes. The format is [[x1,y1],[x2,y2],[x3,y3],[x4,y4]]. "

Is anybody else having this problem? Does anyone know what the cause is/how to fix it? I hope it doesn't turn out to be the case that I'm just making a total rookie mistake, lul. I looked around the discussion pages and documentation and haven't seemed to find any mention of it. Thanks

Seem to have figured this out. The model doesn't return both, it returns a collection of some horizontal boxes and some free boxes. The boxes that are horizontal are determined by the slope threshold, which automatically rotates the boxes that fit the threshold and thus return those boxes as horizontal, with the boxes that exceed the threshold being returned as free boxes. To obtain all the boxes as free boxes, set the slope threshold to 0, and all boxes will return as free boxes.

macksjeremy avatar Jun 27 '22 18:06 macksjeremy

I have a program using EasyOCR that works great, but when I try to change it to use EasyOCR's detection of text with rotation/skewness etc., as opposed to just orthogonal boxes, (or as it's called in the documentation, the 'free_list', which is returned by easyocr.detect()), it does not seem to work. Specifically, here is the code and the output: The code:

language = "en"
reader = easyocr.Reader([language], recognizer=False)
print(reader.detect(IMAGE_PATH))

The print() output: ([[[1739, 1922, 199, 266], [1965, 2774, 193, 262], [3047, 3168, 130, 241], [1459, 1616, 371, 435], [1649, 1796, 370, 434], [1822, 2161, 364, 433], [2184, 2676, 363, 430], [2718, 3001, 363, 427], [1455, 1546, 465, 517], [1593, 1792, 456, 518], [1813, 1918, 454, 515], [1977, 2156, 450, 516], [2201, 2313, 445, 521], [2345, 2997, 444, 518], [1446, 1670, 541, 603], [1777, 1921, 533, 598], [1957, 2073, 536, 598], [2121, 2590, 527, 601], [2628, 2769, 533, 595], [2803, 2978, 531, 595], [1439, 1650, 624, 685], [1690, 1747, 620, 677], [1787, 2037, 621, 683], [2070, 2233, 601, 686], [2277, 2395, 616, 680], [2447, 3041, 613, 680], [1478, 1579, 715, 772], [1622, 2047, 704, 773], [2190, 2332, 705, 762], [2368, 2608, 693, 765], [2635, 2777, 699, 760], [2806, 3040, 699, 763], [1445, 1758, 786, 859], [1798, 1855, 792, 849], [1877, 2207, 785, 851], [2269, 2888, 781, 848], [2907, 2977, 787, 842], [1431, 2089, 865, 946], [2139, 2372, 868, 934], [2395, 2692, 864, 933], [2731, 3061, 864, 928], [1436, 1727, 956, 1023], [1789, 2302, 954, 1023], [2371, 2541, 953, 1040], [2567, 2753, 957, 1014], [2794, 3043, 946, 1015], [1442, 1582, 1050, 1107], [1614, 1805, 1044, 1106], [1846, 2307, 1042, 1103], [2372, 2416, 1044, 1093], [2439, 3017, 1034, 1098], [1444, 1838, 1127, 1193], [1885, 2210, 1115, 1196], [2241, 2839, 1119, 1186], [2863, 2969, 1117, 1174], [1449, 1877, 1212, 1278], [1925, 2149, 1207, 1274], [2182, 2304, 1213, 1270], [2339, 2744, 1204, 1268], [2781, 2907, 1208, 1259], [1446, 1859, 1292, 1358], [1895, 2022, 1301, 1346], [2045, 2323, 1292, 1353], [2387, 2943, 1282, 1354], [1457, 1645, 1377, 1441], [1668, 1934, 1379, 1441], [1989, 2263, 1375, 1432], [2309, 3021, 1363, 1442], [1444, 1701, 1462, 1526], [1728, 1838, 1462, 1523], [1882, 1988, 1457, 1521], [2024, 2426, 1457, 1521], [2471, 2866, 1449, 1522], [1453, 1817, 1540, 1615], [1860, 1917, 1545, 1605], [1945, 2123, 1545, 1602], [2145, 2200, 1564, 1601], [2209, 2414, 1537, 1604], [2462, 2659, 1538, 1604], [2695, 3024, 1534, 1596], [1444, 1536, 1622, 1686], [1558, 2393, 1603, 1703], [2448, 2938, 1613, 1692], [1453, 2167, 1702, 1780], [2222, 2339, 1703, 1775], [2374, 2943, 1688, 1767], [1444, 1831, 1788, 1866], [1868, 2017, 1794, 1855], [2043, 2641, 1784, 1858], [2681, 2759, 1817, 1857], [2767, 2918, 1781, 1853], [1441, 1686, 1880, 1944], [1745, 2012, 1868, 1945], [2066, 2173, 1870, 1935], [2212, 2774, 1872, 1936], [2795, 3074, 1869, 1937], [1448, 1571, 1966, 2026], [1606, 2042, 1960, 2026], [2110, 2224, 1968, 2023], [2272, 2583, 1954, 2019], [2629, 2737, 1961, 2018], [2778, 2910, 1950, 2016], [1444, 1606, 2042, 2106], [1634, 2657, 2033, 2110], [2709, 2974, 2026, 2105], [1458, 1682, 2126, 2200], [1713, 2206, 2121, 2196], [2270, 2397, 2118, 2186], [2429, 2800, 2117, 2186], [2828, 2994, 2118, 2185], [1466, 1584, 2206, 2278], [1624, 2011, 2210, 2274], [2050, 2157, 2208, 2273], [2194, 2426, 2205, 2271], [2478, 2578, 2202, 2266], [2616, 3013, 2199, 2273], [1464, 1575, 2295, 2356], [1633, 1749, 2296, 2353], [1789, 2084, 2293, 2354], [2194, 2449, 2285, 2362], [2475, 2746, 2287, 2354], [2812, 2923, 2288, 2345]]], [[]]) All of the numbers you see here are the proper output for the orthogonal text boxes, but you can see at the very end of the list, is an empty list which should contain free-form text boxes in the format [[x1,y1],[x2,y2],[x3,y3],[x4,y4]]. I.e., the documentation says it should return: Return horizontal_list, free_list - horizontal_list is a list of regtangular text boxes. The format is [x_min, x_max, y_min, y_max]. free_list is a list of free-form text boxes. The format is [[x1,y1],[x2,y2],[x3,y3],[x4,y4]]. " Is anybody else having this problem? Does anyone know what the cause is/how to fix it? I hope it doesn't turn out to be the case that I'm just making a total rookie mistake, lul. I looked around the discussion pages and documentation and haven't seemed to find any mention of it. Thanks

Seem to have figured this out. The model doesn't return both, it returns a collection of some horizontal boxes and some free boxes. The boxes that are horizontal are determined by the slope threshold, which automatically rotates the boxes that fit the threshold and thus return those boxes as horizontal, with the boxes that exceed the threshold being returned as free boxes. To obtain all the boxes as free boxes, set the slope threshold to 0, and all boxes will return as free boxes.

Ohhhhhh. Sweet, it look like you figured out what was going on. Thanks a lot, eh.

GrandTheftWalrus avatar Jun 30 '22 03:06 GrandTheftWalrus

I have a program using EasyOCR that works great, but when I try to change it to use EasyOCR's detection of text with rotation/skewness etc., as opposed to just orthogonal boxes, (or as it's called in the documentation, the 'free_list', which is returned by easyocr.detect()), it does not seem to work. Specifically, here is the code and the output: The code:

language = "en"
reader = easyocr.Reader([language], recognizer=False)
print(reader.detect(IMAGE_PATH))

The print() output: ([[[1739, 1922, 199, 266], [1965, 2774, 193, 262], [3047, 3168, 130, 241], [1459, 1616, 371, 435], [1649, 1796, 370, 434], [1822, 2161, 364, 433], [2184, 2676, 363, 430], [2718, 3001, 363, 427], [1455, 1546, 465, 517], [1593, 1792, 456, 518], [1813, 1918, 454, 515], [1977, 2156, 450, 516], [2201, 2313, 445, 521], [2345, 2997, 444, 518], [1446, 1670, 541, 603], [1777, 1921, 533, 598], [1957, 2073, 536, 598], [2121, 2590, 527, 601], [2628, 2769, 533, 595], [2803, 2978, 531, 595], [1439, 1650, 624, 685], [1690, 1747, 620, 677], [1787, 2037, 621, 683], [2070, 2233, 601, 686], [2277, 2395, 616, 680], [2447, 3041, 613, 680], [1478, 1579, 715, 772], [1622, 2047, 704, 773], [2190, 2332, 705, 762], [2368, 2608, 693, 765], [2635, 2777, 699, 760], [2806, 3040, 699, 763], [1445, 1758, 786, 859], [1798, 1855, 792, 849], [1877, 2207, 785, 851], [2269, 2888, 781, 848], [2907, 2977, 787, 842], [1431, 2089, 865, 946], [2139, 2372, 868, 934], [2395, 2692, 864, 933], [2731, 3061, 864, 928], [1436, 1727, 956, 1023], [1789, 2302, 954, 1023], [2371, 2541, 953, 1040], [2567, 2753, 957, 1014], [2794, 3043, 946, 1015], [1442, 1582, 1050, 1107], [1614, 1805, 1044, 1106], [1846, 2307, 1042, 1103], [2372, 2416, 1044, 1093], [2439, 3017, 1034, 1098], [1444, 1838, 1127, 1193], [1885, 2210, 1115, 1196], [2241, 2839, 1119, 1186], [2863, 2969, 1117, 1174], [1449, 1877, 1212, 1278], [1925, 2149, 1207, 1274], [2182, 2304, 1213, 1270], [2339, 2744, 1204, 1268], [2781, 2907, 1208, 1259], [1446, 1859, 1292, 1358], [1895, 2022, 1301, 1346], [2045, 2323, 1292, 1353], [2387, 2943, 1282, 1354], [1457, 1645, 1377, 1441], [1668, 1934, 1379, 1441], [1989, 2263, 1375, 1432], [2309, 3021, 1363, 1442], [1444, 1701, 1462, 1526], [1728, 1838, 1462, 1523], [1882, 1988, 1457, 1521], [2024, 2426, 1457, 1521], [2471, 2866, 1449, 1522], [1453, 1817, 1540, 1615], [1860, 1917, 1545, 1605], [1945, 2123, 1545, 1602], [2145, 2200, 1564, 1601], [2209, 2414, 1537, 1604], [2462, 2659, 1538, 1604], [2695, 3024, 1534, 1596], [1444, 1536, 1622, 1686], [1558, 2393, 1603, 1703], [2448, 2938, 1613, 1692], [1453, 2167, 1702, 1780], [2222, 2339, 1703, 1775], [2374, 2943, 1688, 1767], [1444, 1831, 1788, 1866], [1868, 2017, 1794, 1855], [2043, 2641, 1784, 1858], [2681, 2759, 1817, 1857], [2767, 2918, 1781, 1853], [1441, 1686, 1880, 1944], [1745, 2012, 1868, 1945], [2066, 2173, 1870, 1935], [2212, 2774, 1872, 1936], [2795, 3074, 1869, 1937], [1448, 1571, 1966, 2026], [1606, 2042, 1960, 2026], [2110, 2224, 1968, 2023], [2272, 2583, 1954, 2019], [2629, 2737, 1961, 2018], [2778, 2910, 1950, 2016], [1444, 1606, 2042, 2106], [1634, 2657, 2033, 2110], [2709, 2974, 2026, 2105], [1458, 1682, 2126, 2200], [1713, 2206, 2121, 2196], [2270, 2397, 2118, 2186], [2429, 2800, 2117, 2186], [2828, 2994, 2118, 2185], [1466, 1584, 2206, 2278], [1624, 2011, 2210, 2274], [2050, 2157, 2208, 2273], [2194, 2426, 2205, 2271], [2478, 2578, 2202, 2266], [2616, 3013, 2199, 2273], [1464, 1575, 2295, 2356], [1633, 1749, 2296, 2353], [1789, 2084, 2293, 2354], [2194, 2449, 2285, 2362], [2475, 2746, 2287, 2354], [2812, 2923, 2288, 2345]]], [[]]) All of the numbers you see here are the proper output for the orthogonal text boxes, but you can see at the very end of the list, is an empty list which should contain free-form text boxes in the format [[x1,y1],[x2,y2],[x3,y3],[x4,y4]]. I.e., the documentation says it should return: Return horizontal_list, free_list - horizontal_list is a list of regtangular text boxes. The format is [x_min, x_max, y_min, y_max]. free_list is a list of free-form text boxes. The format is [[x1,y1],[x2,y2],[x3,y3],[x4,y4]]. " Is anybody else having this problem? Does anyone know what the cause is/how to fix it? I hope it doesn't turn out to be the case that I'm just making a total rookie mistake, lul. I looked around the discussion pages and documentation and haven't seemed to find any mention of it. Thanks

Seem to have figured this out. The model doesn't return both, it returns a collection of some horizontal boxes and some free boxes. The boxes that are horizontal are determined by the slope threshold, which automatically rotates the boxes that fit the threshold and thus return those boxes as horizontal, with the boxes that exceed the threshold being returned as free boxes. To obtain all the boxes as free boxes, set the slope threshold to 0, and all boxes will return as free boxes.

Ohhhhhh. Sweet, it look like you figured out what was going on. Thanks a lot, eh.

Glad I could help, the issue was annoying me :)

macksjeremy avatar Jun 30 '22 15:06 macksjeremy