Code Monkey home page Code Monkey logo

Comments (6)

Bovey0809 avatar Bovey0809 commented on May 18, 2024

Sorry for disturbing, I found the reason of the bug, it came from a invalid annotation. I fix the issue by double-check the labels. Here is the script to figure out the invalid points.

from shapely.geometry import Polygon, LinearRing

import glob

import random

anno_root = 'annotations/training/'

filelist = glob.glob(anno_root+"*.txt")

assert len(filelist) > 0

def check_polygon(filename):
    t = open(filename)
    for line in t.readlines():
        cors = line.strip().split(',')
        assert (len(cors) % 2) == 0, "invalid cors"
        pts = [(int(cors[j]), int(cors[j+1])) for j in range(0, len(cors)-1, 2)]
        try:
            pgt = Polygon(pts)
        except Exception as e:
            print('Not a valid polygon', pgt)
            continue
        if not pgt.is_valid:
            print('GT polygon has intersecting sides', pts)
            continue
        pRing = LinearRing(pts)
        if not pRing.is_ccw:
            pts.reverse()
    t.close()
# test
check_polygon(random.choice(filelist))

for i in filelist:
    check_polygon(i)

from mmocr.

FFoCC avatar FFoCC commented on May 18, 2024

@Bovey0809 Hi. I have the same problem. This error shows what is wrong with the data? I have filtered the data with your check code, but I still have this problem.

line 205, in resample_line
    while current_line_len >= length_cumsum[current_edge_ind + 1]:
IndexError: index 3 is out of bounds for axis 0 with size 3

from mmocr.

HolyCrap96 avatar HolyCrap96 commented on May 18, 2024

@FFoCC Thanks for your feedback. Could you provide the polyline data that the code wrongly processed?

from mmocr.

FFoCC avatar FFoCC commented on May 18, 2024

@HolyCrap96 I don't know which piece of data is wrong. It is strange that sometimes my dataset can work with three epochs and a fourth error.
e42333
e42222

from mmocr.

FFoCC avatar FFoCC commented on May 18, 2024

@HolyCrap96 Here are two examples of my data. Is there anything wrong with them?

{"file_name": "training/210519_0670.jpg", "height": 3968, "width": 2976, "annotations": [{"iscrowd": 0, "category_id": 1, "bbox": [897.0, 914.0, 578.0, 139.0], "segmentation": [[897, 914, 1475, 914, 1475, 1053, 897, 1053]]}, {"iscrowd": 0, "category_id": 1, "bbox": [918.0, 2081.0, 1079.0, 187.0], "segmentation": [[923, 2142, 1143, 2128, 1178, 2122, 1409, 2132, 1476, 2123, 1538, 2123, 1572, 2126, 1595, 2123, 1621, 2114, 1641, 2114, 1660, 2109, 1709, 2099, 1893, 2084, 1957, 2081, 1997, 2172, 1956, 2199, 1884, 2218, 1812, 2240, 1145, 2264, 969, 2268, 918, 2263]]}, {"iscrowd": 0, "category_id": 1, "bbox": [1087.0, 1260.0, 420.0, 178.0], "segmentation": [[1087, 1260, 1507, 1260, 1507, 1438, 1087, 1438]]}, {"iscrowd": 0, "category_id": 1, "bbox": [1132.0, 2468.0, 428.0, 165.0], "segmentation": [[1132, 2468, 1560, 2468, 1560, 2633, 1132, 2633]]}, {"iscrowd": 0, "category_id": 1, "bbox": [2086.0, 287.0, 237.0, 137.0], "segmentation": [[2086, 287, 2323, 287, 2323, 424, 2086, 424]]}]}
{"file_name": "training/397756.jpg", "height": 1800, "width": 850, "annotations": [{"iscrowd": 0, "category_id": 1, "bbox": [314.0, 829.0, 77.0, 27.0], "segmentation": [[314, 829, 391, 829, 391, 856, 314, 856]]}, {"iscrowd": 0, "category_id": 1, "bbox": [399.0, 826.0, 27.0, 31.0], "segmentation": [[399, 826, 426, 826, 426, 857, 399, 857]]}, {"iscrowd": 0, "category_id": 1, "bbox": [225.0, 909.0, 227.0, 48.0], "segmentation": [[225, 925, 445, 909, 452, 942, 229, 957]]}, {"iscrowd": 0, "category_id": 1, "bbox": [276.0, 1008.0, 116.0, 30.0], "segmentation": [[276, 1008, 392, 1008, 392, 1038, 276, 1038]]}, {"iscrowd": 0, "category_id": 1, "bbox": [252.0, 1089.0, 124.0, 49.0], "segmentation": [[252, 1089, 376, 1089, 376, 1138, 252, 1138]]}, {"iscrowd": 0, "category_id": 1, "bbox": [819.0, 471.0, 31.0, 43.0], "segmentation": [[819, 471, 850, 471, 850, 514, 819, 514]]}]}

from mmocr.

gaotongxiao avatar gaotongxiao commented on May 18, 2024

Probably get fixed in #448, which is a part of MMOCR 0.3.0.

from mmocr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.