Manuscript Offprint

arXiv:2610.12786

Domain Adaptation of SAM 2.1 for Building-Component Segmentation in Image-Based 3D Reconstruction

Ehsan Agha Ebrahimi, Yong-Cheol Lee, Keith G. Mills

Abstract

3D reconstruction of building components using image-based scanning requires appropriate segmentation of the objects in the 2D building images. In order to benefit from consistent grouping of the 2D masks in 3D environments, vision foundation models such as the Segment Anything Model have been utilized by Group Anything with Radiance Fields (GARField) to perform 3D segmentation. This study fine-tuned SAM 2.1 on the HBD dataset, consisting of 2,679 annotated images from 42 buildings, to enhance multi-class segmentation of 2D building images, covering 11 classes (Wall, Window, Ceiling, Door, Column, Beam, Floor, Opening, Curtain Wall, Roof, and Lift). The model was evaluated using per-class IoU, Dice, and mIoU metrics, and the results show an improvement in mIoU from 49.9% to 69.6%, indicating a meaningful improvement in class segmentation and providing a more accurate model for distilling the masks in 3D. SegFormer was then used as a baseline, generating per-class masks for comparison with SAM 2.1, which indicates improvement in some object classes with larger surface area. The masks in the building images were grouped in the neural radiance field, and the pretrained SAM 2.1 was compared with the fine-tuned SAM 2.1 in the newly rendered images. This comparison shows that fine-tuning improves the grouping of building components at a user-selected grouping scale. This advances the application of Group Anything with Radiance Fields (GARField) in 3D, enabling better segmentation of building structures for 3D auto-reconstruction.

1. Introduction

3D scene reconstruction using 2D images is one of the areas that has several downstream applications, such as capturing the reality and creating a digital twin of the real world. In this regard, semantic segmentation of objects in 3D by 2D images has always been a matter of concern in computer vision, and several studies, such as SA3d [2] and

Figure

Figure 1. Patrick F. Taylor Hall reconstructed in 3D from drone images. Top: rendered photo view. Bottom: the same view segmented into building components with our fine-tuned SAM 2.1 and grouped hierarchically in 3D by Group Anything with Radiance Fields (GARField) [7], with each 3D group shown in a distinct color.

OpenNeRF[4], tried to address this issue by either using deep learning models or distilling the 2D masks in 3D. Although methods such as photogrammetry and NeRF can reconstruct geometry, they do not provide reliable semantic labels for building components [12]. One of the recent studies for 3D segmentation of the objects in 3D, benefits from Neural Radiance Field (NeRF), which makes the possibility to create a scale-conditioned 3D affinity field using 3D feature vectors for grouping the mask by different scales in the 3D environment [7].

This study aims to improve object-oriented 3D reconstruction of buildings from 2D images by adapting a promptable vision foundation model to the building domain so that building components are segmented and grouped consistently in 3D. The focus is on identifying the main building components in 2D images, such as walls, windows, doors, and roofs, which are essential for converting image-based 3D models into structured representations. Existing segmentation models are not adapted to the building domain, and they are designed to produce masks for a predefined set of object classes. Models such as YOLOv8 [6], SAM 3 [1] (given an open-vocabulary text prompt), and SegFormer [22] segment a scene into masks for specific object categories. However, to maintain 3D consistency during reconstruction, masks must be generated automatically for the entire scene rather than only for a fixed set of classes. Among current models, the vision foundation model SAM 2.1 [13] can automatically generate masks for every part of a scene, which makes it a suitable source of masks for 3D grouping with Group Anything with Radiance Fields (GARField) [7].

A key property we exploit is the scale of the masks, which GARField uses in a hierarchical manner during training and consolidates inconsistent 2D masks. The building masks exist at different scales: a mask may cover a complete window, while other masks cover parts of windows or doors. Training with this hierarchy of mask scales leads to more consistent building segmentation when the masks are grouped together.

The Segment Anything Model (SAM) is a vision foundation model developed by Meta AI for promptable image segmentation [8]. Subsequently, SAM 2.1 was introduced as a unified model for image and video segmentation that uses point, box, and mask prompts on individual frames to define the spatial extent of an object and segment it spatio-temporally [13]. Its architecture consists of an image encoder (a vision transformer), a prompt encoder, and a mask decoder. SAM 2.1 was trained on the SA-V dataset, which comprises 50.9K videos with 642.6K masklets [13]. Although several methods exist for adapting the model, such as adapter-based fine-tuning [3] that modifies the weights of the upper layers, the fine-tuning approach used in this paper is the one provided by Meta AI to fine-tune SAM 2.1 on a custom dataset [3].

First, we used a custom dataset created by Wong et al. [19], consisting of interior and exterior images of buildings, for building-component segmentation. Although many datasets exist for building image segmentation, this dataset was chosen because it was created specifically for 3D reconstruction of building components. Its annotations cover most of the facade and interior, and it is already split into training, validation, and test sets.

Second, both SAM 2.1 and the baseline, SegFormer, were fine-tuned on this dataset, and their performance was evaluated using segmentation metrics. The results indicate that SAM 2.1 improves segmentation for some discrete object types. However, for large-surface objects such as walls, SegFormer outperforms SAM 2.1 in those classes.

Third, the comparison was carried out by rendering existing and novel views of the building. The experimental results show that the fine-tuned model performs better in the hierarchical grouping of the building facade when different grouping scales are applied. The groups are visible across different views, and the windows, doors, and walls of the building are grouped together as part of the facade when the scale is large enough to merge closely related affinity vectors.

References (22)

  • Sam 3: Segment anything with concepts, 2025
  • Segment anything in 3d with radiance fields
  • Sam2-adapter: Evaluating & adapting segment anything 2 in downstream tasks: Camouflage, shadow, medical image segmentation, and more, 2024
  • Opennerf: Open set 3d neural scene segmentation with pixel-wise features and rendered novel views, 2024
  • Ultralytics yolov8, 2023
  • Garfield: Group anything with radiance fields
  • Segment Anything
  • Deepfacade: A deep learning approach to facade parsing
  • Decoupled weight decay regularization, 2019
  • A deep learning method for building façade parsing utilizing improved solov2 instance segmentation
  • Nerf: Representing scenes as neural radiance fields for view synthesis
  • SAM 2: Segment Anything in Images and Videos
  • 3d modeling of façade elements using multi-view images from mobile scanning systems
  • A convolutional network for semantic facade segmentation and interpretation
  • Structure-from-motion revisited
  • Nerfstudio: A modular framework for neural radiance field development
  • State-of-the-art natural language processing
  • Semantic 3d reconstruction-oriented image dataset for building component segmentation
  • Scan2lod3: Reconstructing semantic 3d building models at lod3 using ray casting and bayesian networks
  • Zaha: Introducing the level of facade generalization and the large-scale point cloud facade semantic segmentation benchmark dataset
  • Segformer: Simple and efficient design for semantic segmentation with transformers
  • Building façade element extraction based on multidimensional virtual semantic feature map ensemble learning and hierarchical clustering