Skip to main content

TexIm: A Novel Text-to-Image Encoding Technique Using BERT

  • Conference paper
  • First Online:
Computer Vision and Machine Intelligence

Abstract

Often when we read some text, it leaves an impression in our mind. This perception imbibes the knowledge conveyed, the context, and the lexical information. Although there has been abundant research on the representation of text, research on devising techniques for visualization of embedded text is absent. Thus, we propose a novel “text-to-image” (TexIm) encoding enabling visualization of textual features. The proposed TexIm extracts the contextualized semantic and syntactic information present in the text through BERT and generates informed pictorial representations through a series of transformations. This unique representation is potent enough to assimilate the information conveyed, and the linguistic intricacies present in the text. Additionally, TexIm generates concise input representation that reduces the memory footprint by 37%. The proposed methodology has been evaluated on a hand-crafted dataset of Cricketer Biographies for the task of pair-wise comparison of texts. The conformity between the similarity of texts and the corresponding generated representations ascertain its fruitfulness.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    https://www.worldwidewebsize.com/.

  2. 2.

    https://twitter.com.

  3. 3.

    https://www.facebook.com.

  4. 4.

    https://www.google.com.

  5. 5.

    https://blog.microfocus.com/how-much-data-is-created-on-the-internet-each-day/.

  6. 6.

    https://www.t-sciences.com/news/humans-process-visual-data-better.

  7. 7.

    https://www.wikipedia.org.

  8. 8.

    https://colab.research.google.com.

  9. 9.

    http://www.norvig.com/mayzner.html.

  10. 10.

    https://www.lexico.com/explore/how-many-words-are-there-in-the-english-language.

  11. 11.

    https://en.wikipedia.org/wiki/List_of_dictionaries_by_number_of_words #cite_note-11.

References

  1. Chowdhary, K.R.: Natural language processing. In: Fundamentals of Artificial Intelligence, pp. 603–649. Springer, New Delhi (2020)

    Google Scholar 

  2. Ainon, R.N.: Storing text using integer codes. In: Coling 1986 Volume 1: The 11th International Conference on Computational Linguistics (1986)

    Google Scholar 

  3. Harris, Z.S.: Distributional structure. Word 10(2–3), 146–162 (1954)

    Article  Google Scholar 

  4. Mikolov, T., Chen, K., Corrado, G., Dean, J.: Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781 (2013)

  5. Mikolov, T., Sutskever, I., Chen, K., Corrado, G.S., Dean, J.: Distributed representations of words and phrases and their compositionality. In: Advances in Neural Information Processing Systems, pp. 3111–3119 (2013)

    Google Scholar 

  6. Pennington, J., Socher, R., Manning, C.: Glove: global vectors for word representation. In: Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 1532–1543 (2014)

    Google Scholar 

  7. Melamud, O., Goldberger, J., Dagan, I.: Context2vec: learning generic context embedding with bidirectional LSTM. In: Proceedings of the 20th SIGNLL Conference on Computational Natural Language Learning, pp. 51–61 (2016)

    Google Scholar 

  8. Peters, M.E., Neumann, M., Iyyer, M., Gardner, M., Clark, C., Lee, K., Zettlemoyer, L.: Deep contextualized word representations. arXiv preprint arXiv:1802.05365 (2018)

  9. Devlin, J., Chang, M.-W., Lee, K., Toutanova, K.: Bert: pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805 (2018)

  10. Huffman, D.A.: A method for the construction of minimum-redundancy codes. Proc. IRE 40(9), 1098–1101 (1952)

    Article  MATH  Google Scholar 

  11. Alakuijala, J., Vandevenne, L.: Data Compression Using Zopfli. Tech. Rep, Google (2013)

    Google Scholar 

  12. Habib, A., Jahirul Islam, M., Rahman, M.S.: A dictionary-based text compression technique using quaternary code. Iran J. Comput. Sci. 3(3), 127–136 (2020)

    Google Scholar 

  13. Ziv, J., Lempel, A.: A universal algorithm for sequential data compression. IEEE Trans. Inf. Theory 23(3), 337–343 (1977)

    Article  MathSciNet  MATH  Google Scholar 

  14. Ziv, J., Lempel, A.: Compression of individual sequences via variable-rate coding. IEEE Trans. Inf. Theory 24(5), 530–536 (1978)

    Article  MathSciNet  MATH  Google Scholar 

  15. Hahn, B.: A new technique for compression and storage of data. Commun. ACM 17(8), 434–436 (1974)

    Article  MATH  Google Scholar 

  16. Zakraoui, J., Saleh, M., Ja’am, A.: Text-to-picture tools, systems, and approaches: a survey. Multimedia Tools Appl. 78(16), 22833–22859 (2019)

    Article  Google Scholar 

  17. Nataraj, L., Karthikeyan, S., Jacob, G., Manjunath, B.S.: Malware images: visualization and automatic classification. In: Proceedings of the 8th International Symposium on Visualization for Cyber Security, pp. 1–7 (2011)

    Google Scholar 

  18. He, K., Kim, D.-S.: Malware detection with malware images using deep learning techniques. In: 2019 18th IEEE International Conference on Trust, Security and Privacy in Computing and Communications/13th IEEE International Conference on Big Data Science and Engineering (TrustCom/BigDataSE) (2019). https://doi.org/10.1109/TrustCom/BigDataSE.2019.00022

  19. Petrie, S.M., Julius, T.D.: Representing text as abstract images enables image classifiers to also simultaneously classify text. arXiv preprint arXiv:1908.07846 (2019)

  20. Zhu, L., Li, W., Shi, Y., Guo, K.: SentiVec: learning sentiment-context vector via kernel optimization function for sentiment analysis. IEEE Trans. Neural Networks Learn. Syst. 32(6), 2561–2572 (2020)

    Article  Google Scholar 

  21. Strubell, E., Ganesh, A., McCallum, A.: Energy and policy considerations for deep learning in NLP. arXiv preprint arXiv:1906.02243 (2019)

  22. Hu, W., Tan, Y.: Black-box attacks against RNN based malware detection algorithms. In: Workshops at the Thirty-Second AAAI Conference on Artificial Intelligence (2018)

    Google Scholar 

  23. Krizhevsky, A., Sutskever, I., Hinton, G.E.: Imagenet classification with deep convolutional neural networks. In: Advances in Neural Information Processing Systems, vol. 25 (2012)

    Google Scholar 

  24. Plisson, J., Lavrac, N., Mladenic, D.: A rule based approach to word lemmatization. Proc. IS 3, 83–86 (2004)

    Google Scholar 

  25. Wu, Y., Schuster, M., Chen, Z., Le, Q.V., Norouzi, M., Macherey, W., Krikun, M., et al.: Google’s neural machine translation system: bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144 (2016)

  26. Clark, N.R., Ma’ayan, A.: Introduction to statistical methods to analyze large data sets: principal components analysis. Sci. Signal. 4(190) (2011)

    Google Scholar 

  27. Patro, S., Sahu, K.K.: Normalization: a preprocessing stage. arXiv preprint arXiv:1503.06462 (2015)

  28. Hore, A., Ziou, D.: Image quality metrics: PSNR versus SSIM. In: 2010 20th International Conference on Pattern Recognition, pp. 2366–2369. IEEE (2010)

    Google Scholar 

  29. Wang, Z., Bovik, A.C., Sheikh, H.R., Simoncelli, E.P.: Image quality assessment: from error visibility to structural similarity. IEEE Trans. Image Process. 13(4), 600–612 (2004)

    Article  Google Scholar 

  30. Kusner, M., Sun, Y., Kolkin, N., Weinberger, K.: From word embeddings to document distances. In: International Conference on Machine Learning, pp. 957–966. PMLR (2015)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Wazib Ansar .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd.

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Ansar, W., Goswami, S., Chakrabarti, A., Chakraborty, B. (2023). TexIm: A Novel Text-to-Image Encoding Technique Using BERT. In: Tistarelli, M., Dubey, S.R., Singh, S.K., Jiang, X. (eds) Computer Vision and Machine Intelligence. Lecture Notes in Networks and Systems, vol 586. Springer, Singapore. https://doi.org/10.1007/978-981-19-7867-8_11

Download citation

Publish with us

Policies and ethics