Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICDAR2003 dataset integration #653

Merged
merged 26 commits into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e7122a5
start synth
felixdittrich92 Nov 13, 2021
4fa0aff
cleanup
felixdittrich92 Nov 15, 2021
3ffdcc5
Merge branch 'mindee:main' into main
felixdittrich92 Nov 15, 2021
b74f06a
start synth
felixdittrich92 Nov 15, 2021
1a661e0
add synthtext
felixdittrich92 Nov 15, 2021
6270c93
add docu and tests
felixdittrich92 Nov 15, 2021
d74f148
apply code factor suggestions
felixdittrich92 Nov 15, 2021
9099e95
apply changes
felixdittrich92 Nov 15, 2021
23eca0d
Merge branch 'mindee:main' into main
felixdittrich92 Nov 15, 2021
7ba31e1
clean
felixdittrich92 Nov 15, 2021
02a8104
Merge branch 'mindee:main' into main
felixdittrich92 Nov 15, 2021
6955110
Merge branch 'mindee:main' into main
felixdittrich92 Nov 16, 2021
8fbeb30
Merge branch 'mindee:main' into main
felixdittrich92 Nov 16, 2021
7408935
Merge branch 'mindee:main' into main
felixdittrich92 Nov 17, 2021
a2b0fbc
Merge branch 'mindee:main' into main
felixdittrich92 Nov 19, 2021
a9cbd14
Merge branch 'mindee:main' into main
felixdittrich92 Nov 20, 2021
b245443
Merge branch 'mindee:main' into main
felixdittrich92 Nov 23, 2021
0cb2f7b
Merge branch 'mindee:main' into main
felixdittrich92 Nov 23, 2021
743c54a
Merge branch 'mindee:main' into main
felixdittrich92 Nov 25, 2021
1c1cbcb
Merge branch 'mindee:main' into main
felixdittrich92 Nov 25, 2021
cfbd898
Merge branch 'mindee:main' into main
felixdittrich92 Nov 30, 2021
2c764c2
start icdar2003
felixdittrich92 Nov 26, 2021
8ffe184
to relative
felixdittrich92 Nov 26, 2021
67128f9
up
felixdittrich92 Nov 26, 2021
2cee810
skip empty and to relative coords
felixdittrich92 Nov 29, 2021
247ef92
apply changes
felixdittrich92 Nov 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
apply changes
  • Loading branch information
felixdittrich92 committed Nov 30, 2021
commit 247ef9215f734f3e6b80588d02c8d70adf90fc08
2 changes: 1 addition & 1 deletion docs/source/datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Here are all datasets that are available through docTR:
.. autoclass:: IIIT5K
.. autoclass:: SVT
.. autoclass:: SynthText
.. autoclass:: ICDAR2003
.. autoclass:: IC03


Data Loading
Expand Down
2 changes: 1 addition & 1 deletion doctr/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .detection import *
from .doc_artefacts import *
from .funsd import *
from .icdar2003 import *
from .ic03 import *
from .iiit5k import *
from .ocr import *
from .recognition import *
Expand Down
12 changes: 6 additions & 6 deletions doctr/datasets/icdar2003.py → doctr/datasets/ic03.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@

from .datasets import VisionDataset

__all__ = ['ICDAR2003']
__all__ = ['IC03']


class ICDAR2003(VisionDataset):
"""ICDAR2003 dataset from `"ICDAR 2003 Robust Reading Competitions: Entries, Results and Future Directions"
class IC03(VisionDataset):
"""IC03 dataset from `"ICDAR 2003 Robust Reading Competitions: Entries, Results and Future Directions"
<http://www.iapr-tc11.org/mediawiki/index.php?title=ICDAR_2003_Robust_Reading_Competitions>`_.

Example::
>>> from doctr.datasets import ICDAR2003
>>> train_set = ICDAR2003(train=True, download=True)
>>> from doctr.datasets import IC03
>>> train_set = IC03(train=True, download=True)
>>> img, target = train_set[0]

Args:
Expand Down Expand Up @@ -82,7 +82,7 @@ def __init__(
]

# filter images without boxes
if _boxes:
if len(_boxes) > 0:
# Convert them to relative
w, h = int(resolution.attrib['x']), int(resolution.attrib['y'])
boxes = np.asarray(_boxes, dtype=np_dtype)
Expand Down
4 changes: 3 additions & 1 deletion doctr/datasets/svt.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ def __init__(
raise FileNotFoundError(f"unable to locate {os.path.join(tmp_root, name.text)}")

if rotated_bbox:
# x_center, y_center, width, height, 0
_boxes = [
[float(rect.attrib['x']) + float(rect.attrib['width']) / 2,
float(rect.attrib['y']) + float(rect.attrib['height']) / 2,
float(rect.attrib['width']), float(rect.attrib['height'])]
float(rect.attrib['width']), float(rect.attrib['height']), 0.0]
for rect in rectangles
]
else:
# x_min, y_min, x_max, y_max
_boxes = [
[float(rect.attrib['x']), float(rect.attrib['y']),
float(rect.attrib['x']) + float(rect.attrib['width']),
Expand Down
4 changes: 2 additions & 2 deletions tests/pytorch/test_datasets_pt.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def test_visiondataset():
['SVT', False, [512, 512], 249, False],
['SynthText', True, [512, 512], 27, True], # Actual set has 772875 samples
['SynthText', False, [512, 512], 3, False], # Actual set has 85875 samples
['ICDAR2003', True, [512, 512], 246, True],
['ICDAR2003', False, [512, 512], 249, False],
['IC03', True, [512, 512], 246, True],
['IC03', False, [512, 512], 249, False],
],
)
def test_dataset(dataset_name, train, input_size, size, rotate):
Expand Down
4 changes: 2 additions & 2 deletions tests/tensorflow/test_datasets_tf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
['SVT', False, [512, 512], 249, False],
['SynthText', True, [512, 512], 27, True], # Actual set has 772875 samples
['SynthText', False, [512, 512], 3, False], # Actual set has 85875 samples
['ICDAR2003', True, [512, 512], 246, True],
['ICDAR2003', False, [512, 512], 249, False],
['IC03', True, [512, 512], 246, True],
['IC03', False, [512, 512], 249, False],
],
)
def test_dataset(dataset_name, train, input_size, size, rotate):
Expand Down