mlsanityData to 7 Oct 2026

CV4Code: Sourcecode Understanding via Visual Code Representations

arXiv 2205.08585 ↗First posted 11 May 2022cs.SE cs.AI cs.CVcited by 0

Not on the map. Why?

Abstract (arXiv)

We present CV4Code, a compact and effective computer vision method for sourcecode understanding. Our method leverages the contextual and the structural information available from the code snippet by treating each snippet as a two-dimensional image, which naturally encodes the context and retains the underlying structural information through an explicit spatial representation. To codify snippets as images, we propose an ASCII codepoint-based image representation that facilitates fast generation of sourcecode images and eliminates redundancy in the encoding that would arise from an RGB pixel representation. Furthermore, as sourcecode is treated as images, neither lexical analysis (tokenisation) nor syntax tree parsing is required, which makes the proposed method agnostic to any particular programming language and lightweight from the application pipeline point of view. CV4Code can even featurise syntactically incorrect code which is not possible from methods that depend on the Abstract Syntax Tree (AST). We demonstrate the effectiveness of CV4Code by learning Convolutional and Transformer networks to predict the functional task, i.e. the problem it solves, of the source code directly from its two-dimensional representation, and using an embedding from its latent space to derive a similarity score of two code snippets in a retrieval setup. Experimental results show that our approach achieves state-of-the-art performance in comparison to other methods with the same task and data configurations. For the first time we show the benefits of treating sourcecode understanding as a form of image processing task.

Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 18 of its 29 references that are in the map. First posted on arXiv 11 May 2022.

Builds on

18 of 29 references.

References · 18

  1. 2015Deep Residual Learning for Image Recognitioncited by 51,809
  2. 2014Very Deep Convolutional Networks for Large-Scale Image Recognitioncited by 15,267
  3. 2021Masked Autoencoders Are Scalable Vision Learnerscited by 7,339
  4. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
  5. 2020A Metric Learning Reality Checkcited by 317
  6. 2021Escaping the Big Data Paradigm with Compact Transformerscited by 261
  7. 2018code2vec: Learning Distributed Representations of Codecited by 249
  8. 2017A Survey of Machine Learning for Big Code and Naturalnesscited by 220
  9. 2018code2seq: Generating Sequences from Structured Representations of Codecited by 177
  10. 2018SequenceR: Sequence-to-Sequence Learning for End-to-End Program Repaircited by 144
  11. 2021Vision Transformer for Small-Size Datasetscited by 122
  12. 2018Automated Vulnerability Detection in Source Code Using Deep Representation Learningcited by 114
6 more
  1. 2018DeepBugs: A Learning Approach to Name-based Bug Detectioncited by 65
  2. 2021Language-Agnostic Representation Learning of Source Code from Structure and Contextcited by 63
  3. 2020Fast and Memory-Efficient Neural Code Completioncited by 38
  4. 2018Aroma: Code Recommendation via Structural Code Searchcited by 29
  5. 2021A Survey on Machine Learning Techniques for Source Code Analysiscited by 23
  6. 2021Code2Image: Intelligent Code Analysis by Computer Vision Techniques and Application to Vulnerability Predictioncited by 2

Built on by

Not cited yet.