Skip to main page content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Access keys NCBI Homepage MyNCBI Homepage Main Content Main Navigation
. 2022 Nov 11;17(11):e0277557.
doi: 10.1371/journal.pone.0277557. eCollection 2022.

A novel hybrid transformer-CNN architecture for environmental microorganism classification

Affiliations

A novel hybrid transformer-CNN architecture for environmental microorganism classification

Ran Shao et al. PLoS One. .

Abstract

The success of vision transformers (ViTs) has given rise to their application in classification tasks of small environmental microorganism (EM) datasets. However, due to the lack of multi-scale feature maps and local feature extraction capabilities, the pure transformer architecture cannot achieve good results on small EM datasets. In this work, a novel hybrid model is proposed by combining the transformer with a convolution neural network (CNN). Compared to traditional ViTs and CNNs, the proposed model achieves state-of-the-art performance when trained on small EM datasets. This is accomplished in two ways. 1) Instead of the original fixed-size feature maps of the transformer-based designs, a hierarchical structure is adopted to obtain multi-scale feature maps. 2) Two new blocks are introduced to the transformer's two core sections, namely the convolutional parameter sharing multi-head attention block and the local feed-forward network block. The ways allow the model to extract more local features compared to traditional transformers. In particular, for classification on the sixth version of the EM dataset (EMDS-6), the proposed model outperforms the baseline Xception by 6.7 percentage points, while being 60 times smaller in parameter size. In addition, the proposed model also generalizes well on the WHOI dataset (accuracy of 99%) and constitutes a fresh approach to the use of transformers for visual classification tasks based on small EM datasets.

PubMed Disclaimer

Conflict of interest statement

The authors have declared that no competing interests exist.

Figures

Fig 1
Fig 1. Overall architecture of HTEM.
First, the inputs are fed to a Convolutional Token Embedding (CTE) to obtain patches. Second, the feature maps are processed using a feature embedding layer and repeated transformer-encoder blocks consisting of CPSA and LFFN blocks in each stage. Finally, a global average pooling block is employed to obtain the class token.
Fig 2
Fig 2
(A) Multi-Head Attention (MHA) block in ViT [30]. (B) Convolutional Parameters Sharing multi-head Attention (CPSA) block in HTEM.
Fig 3
Fig 3. Local Feed-Forward Network (LFFN) in HTEM.
DW Conv denotes depth-wise convolution.
Fig 4
Fig 4. The accuracy and loss curves of the proposed HTEM model.
Fig 5
Fig 5. Confusion matrix of HTEM model on the test set after data augmentation.
In the confusion matrix, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 represent Actinophrys, Arcella, Aspidisca, Codosiga, Colpoda, Epistylis, Euglypha, Paramecium, Rotifera, Vorticella, Noctiluca, Ceratium, Stentor, Siprostomum, K. Quadrala, Euglena, Gymnodinium, Gymlyano, Phacus, Stylongchia, Synchaeta.
Fig 6
Fig 6. Images of Paramecium, Codosiga, and K. Quadrala.
Fig 7
Fig 7. Images of Epistylis, and Vorticella.

References

    1. Madigan MT. Brock Biology of Microorganisms. New Jersey: Pearson/Prentice Hall. 2006.
    1. Kulwa F, Li C, Zhao X, Cai B, Teng Y. A State-of-the-art Survey for Microorganism Image Segmentation Methods and Future Potential. IEEE Access. 2019;PP(99):1–1. 10.1109/ACCESS.2019.2930111 - DOI
    1. Zhang J, Li C, Kulwa F, Zhao X, Sun C, Li Z, et al.. A Multi-scale CNN-CRF Framework for Environmental Microorganism Image Segmentation. BioMed Research International. 2020;2020(1):1–27. doi: 10.1155/2020/4621403 - DOI - PMC - PubMed
    1. Dring DM, Rangaswami G. AGRICULTURAL MICROBIOLOGY. Kew Bulletin. 2014;23(1):180. 10.2307/4117004 - DOI
    1. Newsom SWB. Medical microbiology and infection at a glance. Journal of Hospital Infection. 2012;82(2). 10.1016/j.jhin.2012.07.001 - DOI

Publication types