SynthText icon indicating copy to clipboard operation
SynthText copied to clipboard

Output text masks, upgrade dependencies, improved code and docs

Open sslavian812 opened this issue 5 years ago • 5 comments

Hi there!

In my research, I needed to use your project to generate some images with texts along with masks, labels and bounding boxes. I added some new features to it, and here is my PR:

  • made this code compatible with mac OS (it was impossible to satisfy dependencies, a lot of problems with pyplot and others)
  • removed deprecated api calls: https://matplotlib.org/api/_as_gen/matplotlib.pyplot.hold.html pyplot.hold(True) - works by default since version 3.0 (and the method is removed), scipy.misc.imsave - replaced with recommended imageio.imwrite)
  • updated requirements.txt
  • improved code formatting (used auto-formatting tool)
  • improved and added more of documentation. Used docstrings style by Google. See this for different formats examples https://stackoverflow.com/a/24385103/2877029
  • implemented a new feature: with --output-masks flag users can obtain text masks used to place text to the image (see "_mask.png" files), and bounding boxes of each word with a label (see "_bb.txt" files). Run with this flag and see the content of "./masks/" folder for more examples
  • moved output visualization (--viz flag) out of renderer - no need to propagate this flag to renderer logic: Following the single responsibility principle: renderer should render, a generator should generate (and, optionally, display result for users)
  • added debug logs and --debug flag, which enables more logs to be printed. Tested combinations "--viz --debug" "--viz --output-masks", "--viz --output-masks --debug" "--output-masks --debug".

Let's work together on merging this contribution to your project.

Btw, I'd very much encourage you to make it python3 by default.

sslavian812 avatar May 05 '19 20:05 sslavian812

@sslavian812 : thank you for the pull request. I will review it in a few days and get back to you!

ankush-me avatar May 06 '19 20:05 ankush-me

Hi, do you have some news about this pr?

sslavian812 avatar Jun 01 '19 10:06 sslavian812

Hi @ankush-me Did you have some time to take a look at this PR?

sslavian812 avatar Jun 30 '19 20:06 sslavian812

Hi @ankush-me Did you have some time to look into this PR?

sslavian812 avatar Jul 15 '19 12:07 sslavian812

@sslavian812 Thanks for this pull request. I tried to test it out but kept running into issues. I've highlighted some of these in the comments above. Will review later with (hopefully) more time at hand.

ankush-me avatar Jul 22 '19 21:07 ankush-me