We introduce a new code clone detection technique based on image similarity, and a tool called Vincent. The technique captures visual perception of code seen by humans in an IDE by applying syntax highlighting and images conversion on raw source code text.
We compared two similarity measures, Jaccard and earth mover’s distance (EMD) for our image-based code clone detection technique. Jaccard similarity offered better detection perfor- mance than EMD. The F1 score of our technique on detecting Java clones with pervasive code modifications is comparable to five well-known code clone detectors: CCFinderX, Deckard, iClones, NiCad, and Simian. A Gaussian blur filter is chosen as a normalisation technique for type-2 and type-3 clones. We found that blurring code images before similarity computation resulted in higher precision and recall. The detection performance after including the blur filter increased by 1 to 6 percent.
The manual investigation of clone pairs in three software systems revealed that our technique, while it missed some of the true clones, could also detect additional true clone pairs missed by NiCad.
Vincent is an open-source tool and can be downloaded here:
We used two data sets in this study:
We processed the clones so that they are divided into three different sets: 1) common (clone pairs found by both Vincent and NiCad), 2) disjoin-v (clone pairs found only by Vincent), 3) disjoint-n (clone pairs found only by NiCad). The first author looked at 100-randomly sampled clone pairs in each projects and validated them.
The clone pairs reported by Vincent and NiCad and the manual clone validation results can be downloaded below:
Having trouble with Vincent or the data? Please contact: