Open QuickLearner171998 opened 4 years ago
This happens because nothing is detected.
I modified this https://github.com/Wovchena/text-detection-fots.pytorch/blob/04b969c87491630dce38cdb48932aa33115798c6/datasets.py#L159
to
img = cv2.imread(os.path.join(os.path.join(self.root, self.img_dir), self.image_prefix[idx] + '.jpg'), cv2.IMREAD_COLOR).astype(np.float32)
quads = []
texts = []
# lines = [line.rstrip('\n') for line in open(os.path.join(os.path.join(self.root, self.labels_dir), 'gt_' + self.image_prefix[idx] + '.txt'),
# encoding='utf-8-sig')]
p = os.path.join(os.path.join(self.root, self.labels_dir), 'gt_' + self.image_prefix[idx] + '.txt')
with open(p, 'r') as f:
reader = csv.reader(f)
for line in reader:
label = line[-1]
line = [i.strip('\ufeff').strip('\xef\xbb\xbf') for i in line]
numbers = np.array(list(map(float, line[:8])))
quads.append(numbers.reshape((4, 2)))
texts.append('###' != label)
return transform(img, np.stack(quads), texts, self.normalizer, self)
Is it incorrect or I should train for more number of epochs
Looks correct
Hey there might be an error in the way I have created annotations. Suppose I have set of polygons points- [(x1,y1)...] so this is how I create the ICDAR format annotations.
rect = cv2.minAreaRect(np.array(polygon_points,dtype=np.int32))
box = np.int0(cv2.boxPoints(rect)).tolist()
line = [point for points in box for point in points]
The only thing I want to know is - Is this order of selecting points correct. I tried to check this from ICDAR website but only found points are in clockwise order. Can you help please?
This boils down to whether Polygon
from shapely.geometry
can process different order of points. It defensively can't when the order is [0, 2, 1, 3] and it is handled by except shapely.errors.TopologicalError
, but I don't know about counter clockwise order.
So I ran the test.py and saw the visualizations of gt are correctly drawn. So this guarantees that the annotations are correct, right?
It only guarantees that annotations are correct from visualizer's point of view. But since transform()
is a different function you cant say that it treats annotations in the exactly same way.
Ohh...so which is the correct order of points to be followed?
Well, if you say ICDAR is in clockwise order, than clockwise order is correct order because the net works for ICDAR.
Actually I meant which point should come first for eg..upper-left, lower-left, etc
I think it doesn't meter: the points go through minAreaRect()
which returns points in consistent order. Polygon
also shouldn't care.
I am facing this issue -
I tried to debug and found polys.shape[0] is 0 I have uncommented the code for visualization
https://github.com/Wovchena/text-detection-fots.pytorch/blob/04b969c87491630dce38cdb48932aa33115798c6/test.py#L43
Any idea why this is happening?