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

Minor changes to save_word_recognition for Visualization. #50

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ This project hosts the testing code for CharNet, described in our paper:
In: Proceedings of the IEEE International Conference on Computer Vision (ICCV), 2019.


## Updates

1. Added Visualization
2. icdar_2015 Test Dataset


## Installation

```
Expand All @@ -15,6 +21,10 @@ python setup.py build develop
```


## Dataset
Download icdar_2015 Test Dataset [here](https://drive.google.com/file/d/1mPRmedDdC9UPlNQAEohMCMWlnTRoiqfC/view?usp=share_link)


## Run
1. Please run `bash download_weights.sh` to download our trained weights.
2. For ICDAR 2015, please run the following command line. Please replace `images_dir` with the directory containing ICDAR 2015 testing images. The results will be in `results_dir`.
Expand All @@ -23,6 +33,10 @@ python setup.py build develop
python tools/test_net.py configs/icdar2015_hourglass88.yaml <images_dir> <results_dir>
```

## Results
![](https://github.com/hamzakhalil798/research-charnet/blob/master/images/result_1.jpg)
![](https://github.com/hamzakhalil798/research-charnet/blob/master/images/result_2.jpg)


## Citation

Expand Down
Binary file added images/result_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/result_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions tools/test_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ def save_word_recognition(word_instances, image_id, save_root, separator=chr(31)
fw.write(separator)
fw.write(word_ins.text)
fw.write('\n')
for word_ins in word_instances:
if len(word_ins.text) > 0:
bbox = word_ins.word_bbox.astype(np.int32)
cv2.rectangle(im_original, (bbox[0], bbox[1]), (bbox[4], bbox[5]), (0, 255, 0), 2)
cv2.putText(im_original, word_ins.text, (bbox[0], bbox[1]-10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)
cv2.imwrite('{}/{}.jpg'.format(args.results_dir, os.path.splitext(im_name)[0]), im_original)


def resize(im, size):
Expand Down