# BATFormer: Towards Boundary-Aware Lightweight Transformer for Efficient Medical Image Segmentation

BATFormer: 효율적인 의료 영상 분할을 위한 경계 인식 경량 트랜스포머를 향하여

Xian Lin, Li Yu, Kwang-Ting Cheng, Zengqiang Yan · arXiv · 2022년 6월 29일

- **연구 문제** 의료 영상 분할에서 트랜스포머는 장거리 관계를 잡지만 계산량이 크고, 고정 윈도우 분할은 경계를 왜곡합니다.
- **연구 방법** BATFormer는 작은 스케일 특징에 교차 스케일 전역 어텐션을 적용하고, 엔트로피로 고른 경계 주변 윈도우에 지역 어텐션을 적용합니다.
- **주요 결과** ACDC 평균 Dice 92.84%와 ISIC 2018 Dice 90.76%를 보고하며, 원문 비교 설정에서 파라미터와 계산량이 가장 낮다고 설명합니다.

## 연구 문제: 트랜스포머의 계산량과 경계 왜곡

의료 영상 분할에서 CNN은 수용 영역이 지역적이어서 넓은 문맥을 잡기 어렵고, 이를 보완하려고 도입된 트랜스포머는 모든 토큰 쌍의 관계를 계산하기 때문에 고해상도 특징 맵에 그대로 적용하면 계산 비용이 크게 늘어납니다. 이 논문은 이 두 문제를 함께 다룹니다. 또 기존 트랜스포머가 쓰는 고정된 격자형 윈도우 분할은 윈도우 경계에서 세부 정보를 잘라내어 장기 관계를 계산하더라도 물체 경계를 흐리게 만듭니다.

저자들은 이 문제를 해결하기 위해 두 가지 요구를 제시합니다. 하나는 계산 비용을 낮게 유지하면서 다중 스케일 장거리 의존성을 만드는 것이고, 다른 하나는 경계 영역을 중심으로 내용에 맞게 윈도우를 배치하는 것입니다. 이 질문에 답하는 모델이 BATFormer이며, 이 설명은 그 구조와 검증 범위를 따라갑니다.

## 경량 U자형 백본과 교차 스케일 전역 트랜스포머

BATFormer는 네 번의 다운샘플링 블록과 네 번의 업샘플링 블록, 다섯 개의 스킵 연결로 구성된 경량 U자형 백본을 사용합니다. 각 다운샘플링 블록은 2×2 최대 풀링과 두 개의 3×3 합성곱으로 이루어지며, 채널 수는 2C, 4C, 8C, 8C로 설정되고 C는 16입니다.

교차 스케일 전역 트랜스포머(CGT)는 고해상도 특징 F1과 F2를 쓰지 않고, 작은 스케일의 F3, F4, F5에만 적용합니다. 논문은 전역 어텐션의 계산량이 입력 시퀀스 길이의 제곱에 비례하기 때문에 큰 스케일의 특징에 적용하기 비싸다고 설명합니다. CGT에서는 F3을 쿼리로 만들고, F4와 F5는 각각 키와 값으로 사용합니다. 이 교차 스케일 어텐션은 K와 V의 시퀀스가 짧아지므로 계산량을 2^2 또는 2^4 배 줄인다고 원문이 설명합니다. 이후 두 어텐션 출력을 연결하고 잔차 연결을 더한 뒤 FFN을 통과시켜 CGT 출력을 얻습니다.

## 엔트로피 기반 경계 윈도우와 경계 인식 지역 트랜스포머

경계 인식 지역 트랜스포머(BLT)는 고정 격자 대신 경계 주변 윈도우를 고릅니다. 먼저 특징 맵 F2 위에 촘촘하게 배치한 초기 윈도우 집합을 만들고, CGT가 출력한 확률 맵 P\_CGT의 각 위치에서 엔트로피를 계산합니다. 이때 엔트로피는 클래스 수 c의 로그 값으로 정규화되며, 각 윈도우의 점수는 윈도우 안에 포함된 위치들의 엔트로피 값을 윈도우 크기로 나눈 평균 형태로 정의됩니다. 원문은 엔트로피가 높은 위치일수록 실제 경계일 가능성이 높다고 설명합니다.

![Figure 7: Visualization of boundary-around windows generation by BLT on the ISIC 2018 dataset. From top to bottom: the raw images, the ground truth, the entrop…](https://refivu.com/papers/40d99b95-2938-4e9a-8075-b56b6146c523/figures/figure-bb0bf38db45ffc087287ec01c55f5048.png?thumb=512)

**Fig. 7** . Visualization of boundary-around windows generation by BLT on the ISIC 2018 dataset. From top to bottom: the raw images, the ground truth, the entropy maps, and the generated boundary-aware w indows. In entropy maps, the darker the color, the higher the entropy .

[원문](https://arxiv.org/abs/2206.14409v3) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Xian Lin, Li Yu, Kwang-Ting Cheng, Zengqiang Yan · BATFormer: Towards Boundary-Aware Lightweight Transformer for Efficient Medical Image Segmentation · 원문 그림 인용 · 원본 PDF 9쪽에서 그림 영역을 추출했습니다.

점수가 계산되면 비최대 억제로 중복 윈도우를 제거하고, RoIAlign으로 선택된 윈도우를 F2에 맞춥니다. 선택된 윈도우의 특징 안에서 멀티헤드 셀프 어텐션과 FFN을 수행하여 BLT 출력을 만듭니다. 논문은 이 과정이 경계 주변 영역에만 지역 어텐션을 적용하므로 계산량을 줄인다고 설명하며, 이 계산량 감소는 저자가 제시한 식으로 평가됩니다.

## 다중 스케일 소프트 감독과 학습 설정

다중 스케일 소프트 감독은 정답 마스크를 여러 스케일로 줄여 CNN, BLT, CGT에 각각 손실을 적용하는 방법입니다. 각 스케일의 정답은 다운샘플링 블록 안의 클래스 빈도로 만들어지며, 손실은 정답과 예측 확률 사이의 절댓값 차이를 합산하는 형태로 정의됩니다. 최종 예측은 교차 엔트로피 손실과 Dice 손실을 함께 받습니다.

전체 손실은 네 항의 가중합이며, 가중치 β1, β2, β3, β4는 실험에서 각각 0.2, 0.1, 0.1, 0.6으로 설정되었습니다. 원문은 이 가중치가 ACDC와 ISIC 2018 실험에서 사용된 값이라고 밝힙니다. 학습은 Adam 옵티마이저와 초기 학습률 0.001, 배치 크기 4로 진행되었고, 마지막 50 라운드에서는 백본의 파라미터를 고정하고 분기 헤드와 합성 헤드만 학습률 10^-4로 갱신했습니다.

## ACDC에서의 검증과 해석

ACDC 실험은 3D 심장 MRI 데이터셋을 대상으로 하며, 원문은 100명의 학습 데이터와 50명의 테스트 데이터로 나뉜 공식 설정을 따른다고 설명합니다. 3D 트랜스포머 기준 모델과 비교했을 때 BATFormer는 평균 Dice 92.84%를 보고했습니다. 같은 표에서 D-Former는 평균 Dice 92.29%로 가장 높은 3D 기준선이며, BATFormer는 이보다 0.54%p 높다고 원문이 보고합니다.

이 결과는 2D 설정의 BATFormer와 3D 기준선을 비교한 것이며, 원문에서 2D 모델의 파라미터는 1.2M, FLOPs는 4.1G로 제시됩니다. 따라서 이 결과를 3D 트랜스포머 전체의 우위로 일반화하지 않고, 원문이 비교한 기준선과 설정 안에서 읽어야 합니다.

## ISIC 2018 무작위 분할에서의 결과

ISIC 2018 실험은 2596장의 피부 병변 영상을 저자들이 무작위로 2076장 학습과 520장 테스트로 나눈 설정에서 수행되었습니다. 저자들은 기존 방법들이 서로 다른 분할을 사용하므로 공정한 비교를 위해 이 분할을 택했고, 비교 모델은 공개 코드로 다시 구현했다고 설명합니다.

이 설정에서 BATFormer는 Dice 90.76%, IoU 84.64%, ACC 96.76%를 보고했습니다. CNN 기반 Ms RED는 Dice 90.25%로 가장 좋은 CNN 기준선이며, 원문은 BATFormer가 Ms RED보다 평균 0.51%p 높은 Dice를 보인다고 설명합니다. 이 비교는 저자의 무작위 분할과 재구현 조건에서 얻은 결과이므로, 공식 분할의 기존 논문 점수와 같은 조건으로 묶어 해석하지 않습니다.

## 구성요소와 설정에 대한 절제 결과

절제 실험에서 백본만 사용한 Dice는 88.41%였고, CGT를 추가하면 89.60%, BLT를 추가하면 89.73%로 올라갔습니다. 원문은 BLT의 이득이 CGT보다 크다고 설명하며, 이는 경계 불확실성이 의료 영상 분할에서 더 흔하고 어렵다는 저자의 해석입니다. 다중 스케일 소프트 감독을 제외한 BATFormer-의 Dice는 90.00%이고, 이를 포함한 BATFormer는 90.76%입니다.

BLT의 윈도우 크기는 8×8부터 20×20까지 비교되었고, 16×16에서 Dice 89.73%로 가장 높았습니다. 원문은 이 선택이 작업 의존적이며 윈도우 크기 변화에 따른 차이는 제한적이라고 설명합니다. 따라서 16×16은 ISIC 2018 설정에서 얻은 선택이며, 다른 데이터셋에 그대로 고정할 수 있다는 근거로 보지 않습니다.

## 계산 효율과 한계

BATFormer는 ACDC와 ISIC 2018 비교 표에서 가장 적은 파라미터와 낮은 FLOPs를 보고합니다. ISIC 2018의 2D 설정에서 BATFormer는 1.2M 파라미터와 4.1G FLOPs입니다. 다만 저자들은 BLT의 윈도우 크기를 작업마다 조정해야 하며, 많은 윈도우를 촘촘하게 만들어 엔트로피를 계산하는 과정이 효율을 떨어뜨릴 수 있다고 밝힙니다. 이 한계 때문에 향후 연구로 희소하고 크기가 다양한 윈도우를 도입하는 방향이 제시됩니다.

또한 3D 확장 실험에서 3D BATFormer는 2D 모델과 비슷한 평균 Dice 92.84%를 보고하지만 파라미터와 계산 자원을 더 많이 요구합니다. 이 결과는 ACDC 3D 설정에 한정되며, 모든 3D 의료 영상 과제에 대한 일반적 결론으로 확장하지 않습니다.

## 논문 정보

- **저자**: Xian Lin, Li Yu, Kwang-Ting Cheng, Zengqiang Yan
- **학회·저널**: arXiv · 프리프린트
- **최초 공개일**: 2022년 6월 29일
- **등록일**: 2026년 11월 6일
- **수정일**: 2023년 4월 19일
- **버전**: v3
- **arXiv**: 2206.14409
- **분류**: cs.CV · cs.AI
- **원문 이용 조건**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **제공 범위**: 논문 정보, 해설, 허용된 원문 그림

[논문 원문 ↗](https://arxiv.org/abs/2206.14409v3) · [원문 PDF ↗](https://arxiv.org/pdf/2206.14409v3)

AI 해설은 논문 원문과 별개의 설명이며 오류가 있을 수 있습니다. 원문과 그림은 각 출처의 이용 조건과 따로 표시된 권리를 따릅니다.

## 초록

Objective: Transformers, born to remedy the inadequate receptive fields of CNNs, have drawn explosive attention recently. However, the daunting computational complexity of global representation learning, together with rigid window partitioning, hinders their deployment in medical image segmentation. This work aims to address the above two issues in transformers for better medical image segmentation. Methods: We propose a boundary-aware lightweight transformer (BATFormer) that can build cross-scale global interaction with lower computational complexity and generate windows flexibly under the guidance of entropy. Specifically, to fully explore the benefits of transformers in long-range dependency establishment, a cross-scale global transformer (CGT) module is introduced to jointly utilize multiple small-scale feature maps for richer global features with lower computational complexity. Given the importance of shape modeling in medical image segmentation, a boundary-aware local transformer (BLT) module is constructed. Different from rigid window partitioning in vanilla transformers which would produce boundary distortion, BLT adopts an adaptive window partitioning scheme under the guidance of entropy for both computational complexity reduction and shape preservation. Results: BATFormer achieves the best performance in Dice of 92.84%, 91.97%, 90.26%, and 96.30% for the average, right ventricle, myocardium, and left ventricle respectively on the ACDC dataset and the best performance in Dice, IoU, and ACC of 90.76%, 84.64%, and 96.76% respectively on the ISIC 2018 dataset. More importantly, BATFormer requires the least amount of model parameters and the lowest computational complexity compared to the state-of-the-art approaches. Conclusion and Significance: Our results demonstrate the necessity of developing customized transformers for efficient and better medical image segmentation.

## 원문 인용

Xian Lin, Li Yu, Kwang-Ting Cheng, Zengqiang Yan (2022). BATFormer: Towards Boundary-Aware Lightweight Transformer for Efficient Medical Image Segmentation. arXiv:2206.14409v3. https://arxiv.org/abs/2206.14409v3

**BibTeX**

```
@misc{lin2022batformer,
  title = {{BATFormer: Towards Boundary-Aware Lightweight Transformer for Efficient Medical Image Segmentation}},
  author = {Xian Lin and Li Yu and Kwang-Ting Cheng and Zengqiang Yan},
  year = {2022},
  eprint = {2206.14409},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2206.14409v3}
}
```

## 이 논문의 용어

- [U-Net](https://refivu.com/terms/f49a93d54ad5-u-net)
- [IoU](https://refivu.com/terms/49f3d09602a9-iou)
- [FLOPs](https://refivu.com/terms/14c405888d5b-flops)
- [Dice](https://refivu.com/terms/806602d5f351-dice)
- [entropy](https://refivu.com/terms/4c6413bc6b11-entropy)
- [RoIAlign](https://refivu.com/terms/63bbc998a4d4-roialign)
- [ISIC 2018](https://refivu.com/terms/335cf4030fcf-isic-2018)
- [TransUNet](https://refivu.com/terms/c85c5f748b8d-transunet)
- [ACC](https://refivu.com/terms/e6cad80f6e60-acc)
- [ACDC](https://refivu.com/terms/fcc4e65cdd2c-acdc)
- [UNETR](https://refivu.com/terms/d46850df6995-unetr)
- [hard samples](https://refivu.com/terms/b40413aa8ce6-hard-samples)

## 다른 논문 해설

- [LO-Det: Lightweight Oriented Object Detection in Remote Sensing Images](https://refivu.com/papers/6d06eea5-9339-45a4-bd9c-33a27cc53148-lo-det-lightweight-oriented-object-detection-in-remote.md)
- [UIF: An Objective Quality Assessment for Underwater Image Enhancement](https://refivu.com/papers/bf6fde4e-63f1-4926-9bd7-be2d7fee5a92-uif-an-objective-quality-assessment-for-underwater-image.md)
- [Continual Learning for Blind Image Quality Assessment](https://refivu.com/papers/3f3f9c43-d0c1-4289-8d6f-3de5349d4d93-continual-learning-for-blind-image-quality-assessment.md)
- [A Generalized Deep Learning Framework for Whole-Slide Image Segmentation and Analysis](https://refivu.com/papers/17229723-709e-4a8a-9857-8cd6f0d14883-a-generalized-deep-learning-framework-for-whole-slide.md)
- [Deep Learning Methods For Synthetic Aperture Radar Image Despeckling: An Overview Of Trends And Perspectives](https://refivu.com/papers/2aafbd8c-2aab-41ee-9e07-8df924985266-deep-learning-methods-for-synthetic-aperture-radar-image.md)
- [Automatic Posture and Movement Tracking of Infants with Wearable Movement Sensors](https://refivu.com/papers/c3125f12-a3a0-4774-98ae-2fc7eb29121a-automatic-posture-and-movement-tracking-of-infants-with.md)
- [Autonomous Platoon Control with Integrated Deep Reinforcement Learning and Dynamic Programming](https://refivu.com/papers/ea9c86e8-a45b-4cfe-b36d-90c4ede94bee-autonomous-platoon-control-with-integrated-deep.md)
- [Comparison of Topic Modelling Approaches in the Banking Context](https://refivu.com/papers/d9e5c3d9-cda9-4560-92a2-1e5de46a4d37-comparison-of-topic-modelling-approaches-in-the-banking.md)
- [World Model for Robot Learning: A Comprehensive Survey](https://refivu.com/papers/5f500406-dd66-4f71-ab4d-73a3fb8604c8-world-model-for-robot-learning-a-comprehensive-survey.md)
- [Quantum reinforcement learning in continuous action space](https://refivu.com/papers/3528919b-77d8-4232-bfb1-6cae6f24105c-quantum-reinforcement-learning-in-continuous-action-space.md)
- [Multi-SimLex: A Large-Scale Evaluation of Multilingual and Cross-Lingual Lexical Semantic Similarity](https://refivu.com/papers/2e03a8c0-9df9-42e1-97d6-82e5f0f5ad03-multi-simlex-a-large-scale-evaluation-of-multilingual.md)
- [Software Reconfiguration in Robotics](https://refivu.com/papers/5a696633-52e6-4503-a8cd-20d2df0f8441-software-reconfiguration-in-robotics.md)

---

AI 해설에는 오류가 있을 수 있습니다. [Refivu](https://refivu.com/papers/40d99b95-2938-4e9a-8075-b56b6146c523-batformer-towards-boundary-aware-lightweight-transformer-for)
