Feature/iss 262 (#266)

* fix issue#262

* fix #262: modified totaltext_converter and added totaltext for datasets.md

* fix issue#262: modified datasets.md

* fix issue#262: removed download json

* Update totaltext_converter.py

Co-authored-by: Hongbin Sun <hongbin306@gmail.com>
pull/269/head
quincylin1 2021-06-08 21:13:22 +08:00 committed by GitHub
parent 71208cb8e7
commit 271129f812
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 7 deletions

View File

@ -33,6 +33,10 @@ The structure of the text detection dataset directory is organized as follows.
├── synthtext
│   ├── imgs
│   └── instances_training.lmdb
├── totaltext
│   ├── imgs
│   ├── instances_test.json
│   └── instances_training.json
```
| Dataset | Images | | | Annotation Files | |
@ -42,6 +46,7 @@ The structure of the text detection dataset directory is organized as follows.
| ICDAR2015 | [homepage](https://rrc.cvc.uab.es/?ch=4&com=downloads) | | [instances_training.json](https://download.openmmlab.com/mmocr/data/icdar2015/instances_training.json) | - | [instances_test.json](https://download.openmmlab.com/mmocr/data/icdar2015/instances_test.json) |
| ICDAR2017 | [homepage](https://rrc.cvc.uab.es/?ch=8&com=downloads) | [renamed_imgs](https://download.openmmlab.com/mmocr/data/icdar2017/renamed_imgs.tar) | [instances_training.json](https://download.openmmlab.com/mmocr/data/icdar2017/instances_training.json) | [instances_val.json](https://download.openmmlab.com/mmocr/data/icdar2017/instances_val.json) | - | | |
| Synthtext | [homepage](https://www.robots.ox.ac.uk/~vgg/data/scenetext/) | | [instances_training.lmdb](https://download.openmmlab.com/mmocr/data/synthtext/instances_training.lmdb) | - |
| Totaltext | [homepage](https://github.com/cs-chan/Total-Text-Dataset) | | - | - | -
- For `icdar2015`:
- Step1: Download `ch4_training_images.zip`, `ch4_test_images.zip`, `ch4_training_localization_transcription_gt.zip`, `Challenge4_Test_Task1_GT.zip` from [homepage](https://rrc.cvc.uab.es/?ch=4&com=downloads)
@ -90,7 +95,29 @@ The structure of the text detection dataset directory is organized as follows.
```bash
python tools/data/textdet/ctw1500_converter.py /path/to/ctw1500 -o /path/to/ctw1500 --split-list training test
```
- For `Totaltext`:
- Step1: Download `totaltext.zip` from [github dataset](https://github.com/cs-chan/Total-Text-Dataset/tree/master/Dataset) and `groundtruth_text.zip` from [github Groundtruth](https://github.com/cs-chan/Total-Text-Dataset/tree/master/Groundtruth/Text) (We recommend downloading the text groundtruth with .mat format since our totaltext_converter.py supports groundtruth with .mat format only).
```bash
mkdir totaltext && cd totaltext
mkdir imgs && mkdir annotations
# For images
# in ./totaltext
unzip totaltext.zip
mv Images/Train imgs/training
mv Images/Test imgs/test
# For annotations
unzip groundtruth_text.zip
cd Groundtruth
mv Polygon/Train ../annotations/training
mv Polygon/Test ../annotations/test
```
- Step2: Generate `instances_training.json` and `instances_test.json` with following command:
```bash
python tools/data/textdet/totaltext_converter.py /path/to/totaltext -o /path/to/totaltext --split-list training test
```
## Text Recognition
**The structure of the text recognition dataset directory is organized as follows.**

View File

@ -44,17 +44,17 @@ def collect_files(img_dir, gt_dir, split):
files = []
if split == 'training':
for img_file in imgs_list:
gt_file = gt_dir + '/gt_' + osp.splitext(
osp.basename(img_file))[0] + '.mat'
# gt_file = gt_dir + '/' + osp.splitext(
# osp.basename(img_file))[0] + '.png'
gt_file = osp.join(
gt_dir,
'poly_gt_' + osp.splitext(osp.basename(img_file))[0] + '.mat')
files.append((img_file, gt_file))
assert len(files), f'No images found in {img_dir}'
print(f'Loaded {len(files)} images from {img_dir}')
elif split == 'test':
for img_file in imgs_list:
gt_file = gt_dir + '/poly_gt_' + osp.splitext(
osp.basename(img_file))[0] + '.mat'
gt_file = osp.join(
gt_dir,
'poly_gt_' + osp.splitext(osp.basename(img_file))[0] + '.mat')
files.append((img_file, gt_file))
assert len(files), f'No images found in {img_dir}'
print(f'Loaded {len(files)} images from {img_dir}')
@ -107,7 +107,7 @@ def get_contours(gt_path, split):
words = []
data = scio.loadmat(gt_path)
if split == 'training':
data_polygt = data['gt']
data_polygt = data['polygt']
elif split == 'test':
data_polygt = data['polygt']