Introduction
In software engineering research, large-scale datasets of Unified Modeling Language (UML) diagrams are essential for training tools that generate code from designs or translate natural language into architecture. However, building these datasets is a significant challenge. Repositories like the Lindholmen dataset contain thousands of images, many of which are "noise" (non-UML images) or mislabeled.
Manually sorting through these to identify specific diagram types—such as distinguishing a Class diagram from a Sequence diagram—is incredibly time-consuming. While deep learning has revolutionized image classification, most models are optimized for "natural" images (cats, cars, trees) rather than the structured, schematic nature of software diagrams. This research addresses the challenge of automating this classification process with high precision and low computational cost.
Methodology
The researchers adopted a two-pronged approach to find the optimal classification strategy:
- Transfer Learning Benchmarking: They evaluated five state-of-the-art architectures—MobileNet, DenseNet169, NasNetMobile, ResNet152V2, and InceptionV3—using both "semi-trainable" (training only top layers) and "fully-trainable" (fine-tuning the entire network) strategies.
- Custom Architecture: They proposed a novel CNN architecture specifically designed for UML diagrams. Inspired by MobileNetV3 and ResNet, their model uses "logical blocks" featuring residual shortcuts for better gradient flow, separable convolutions to reduce parameters, and a mix of activation functions (ReLU, LeakyReLU, and HardSwish). The network concludes with Global Average Pooling instead of memory-heavy fully connected layers.
Datasets and Preprocessing
The study utilized a curated dataset of 3,231 images, including 700 Class diagrams, 454 Activity diagrams, 651 Use Case diagrams, 706 Sequence diagrams, and 720 non-UML images as a control group. Data was preprocessed via resizing, normalization, and augmentation (horizontal flips and shifts) to improve model robustness.
Key Results and Insights
The custom architecture emerged as the clear winner across every performance metric. One of the most striking findings was that massive depth is not a requirement for high accuracy in schematic domains; the custom model, with only 2.4 million parameters, outperformed ResNet152V2, which has over 60 million parameters.
Performance Comparison
The custom solution achieved a peak accuracy of 98.65%, surpassing the best off-the-shelf model (DenseNet169) by nearly a full percentage point. Precision, recall, and F1-scores all exceeded 96%.
Efficiency Metrics
- Accuracy: 98.65%
- Inference Speed: 0.0135 seconds per image on a GPU.
- Model Size: 2.4 million parameters, making it roughly 25x smaller than ResNet152V2 and 2x smaller than MobileNet.
Conclusion
This research demonstrates that specialized, lightweight deep learning architectures can outperform general-purpose heavyweights when applied to structured schematic data. By achieving high accuracy with a minimal computational footprint, this model is ideal for real-time processing of massive software engineering repositories. Future work will focus on expanding the classification to all 14 UML diagram types and automatically recovering relationships between diagrams within a single project.
Summary updated