| <!--Copyright 2022 The HuggingFace Team. All rights reserved. | |
| Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | |
| the License. You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 | |
| Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | |
| an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | |
| specific language governing permissions and limitations under the License. | |
| โ ๏ธ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be | |
| rendered properly in your Markdown viewer. | |
| --> | |
| # Swin Transformer V2 [[swin-transformer-v2]] | |
| ## ๊ฐ์ [[overview]] | |
| Swin Transformer V2๋ Ze Liu, Han Hu, Yutong Lin, Zhuliang Yao, Zhenda Xie, Yixuan Wei, Jia Ning, Yue Cao, Zheng Zhang, Li Dong, Furu Wei, Baining Guo๊ฐ ์ ์ํ ๋ ผ๋ฌธ [Swin Transformer V2: Scaling Up Capacity and Resolution](https://huggingface.co/papers/2111.09883)์์ ์๊ฐ๋์์ต๋๋ค. | |
| ๋ ผ๋ฌธ์ ์ด๋ก์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค: | |
| *๋๊ท๋ชจ NLP ๋ชจ๋ธ๋ค์ ์ธ์ด ์์ ์์์ ์ฑ๋ฅ์ ํฌ๊ฒ ํฅ์ํ๋ฉฐ, ์ฑ๋ฅ์ด ํฌํํ๋ ์งํ๋ฅผ ๋ณด์ด์ง ์์ต๋๋ค. ๋ํ, ์ฌ๋๊ณผ ์ ์ฌํ few-shot ํ์ต ๋ฅ๋ ฅ์ ๋ณด์ฌ์ค๋๋ค. ์ด ๋ ผ๋ฌธ์ ๋๊ท๋ชจ ๋ชจ๋ธ์ ์ปดํจํฐ ๋น์ ๋ถ์ผ์์ ํ๊ตฌํ๊ณ ์ ํฉ๋๋ค. ๋ํ ๋น์ ๋ชจ๋ธ์ ํ๋ จํ๊ณ ์ ์ฉํ๋ ๋ฐ ์์ด ์ธ ๊ฐ์ง ์ฃผ์ ๋ฌธ์ ๋ฅผ ๋ค๋ฃน๋๋ค: ํ๋ จ ๋ถ์์ ์ฑ, ์ฌ์ ํ์ต๊ณผ ํ์ธํ๋ ๊ฐ์ ํด์๋ ์ฐจ์ด, ๊ทธ๋ฆฌ๊ณ ๋ ์ด๋ธ์ด ๋ฌ๋ฆฐ ๋ฐ์ดํฐ์ ๋ํ ๋์ ์๊ตฌ์ ๋๋ค. ์ธ ๊ฐ์ง ์ฃผ์ ๊ธฐ๋ฒ์ ์ ์ํฉ๋๋ค: 1) ํ๋ จ ์์ ์ฑ์ ๊ฐ์ ํ๊ธฐ ์ํ residual-post-norm ๋ฐฉ๋ฒ๊ณผ cosine attention์ ๊ฒฐํฉ; 2) ์ ํด์๋ ์ด๋ฏธ์ง๋ก ์ฌ์ ํ์ต๋ ๋ชจ๋ธ์ ๊ณ ํด์๋ ์ ๋ ฅ์ผ๋ก ์ ์ดํ ์ ์๋ log-spaced continuous position bias ๋ฐฉ๋ฒ; 3) ๋ ์ด๋ธ์ด ๋ฌ๋ฆฐ ๋ฐฉ๋ํ ์ด๋ฏธ์ง์ ํ์์ฑ์ ์ค์ด๊ธฐ ์ํ self-supervised ์ฌ์ ํ์ต ๋ฐฉ๋ฒ์ธ SimMIM์ ๋๋ค. ์ด๋ฌํ ๊ธฐ๋ฒ๋ค์ ํตํด 30์ต ๊ฐ์ ํ๋ผ๋ฏธํฐ๋ฅผ ๊ฐ์ง Swin Transformer V2 ๋ชจ๋ธ์ ์ฑ๊ณต์ ์ผ๋ก ํ๋ จํ์์ผ๋ฉฐ, ์ด๋ ํ์ฌ๊น์ง ๊ฐ์ฅ ํฌ๊ณ ๊ณ ๋ฐ๋์ ๋น์ ๋ชจ๋ธ๋ก, ์ต๋ 1,536ร1,536 ํด์๋์ ์ด๋ฏธ์ง๋ฅผ ๋ค๋ฃฐ ์ ์์ต๋๋ค. ์ด ๋ชจ๋ธ์ ImageNet-V2 ์ด๋ฏธ์ง ๋ถ๋ฅ, COCO ๊ฐ์ฒด ํ์ง, ADE20K ์๋ฏธ๋ก ์ ๋ถํ , Kinetics-400 ๋น๋์ค ํ๋ ๋ถ๋ฅ ๋ฑ ๋ค ๊ฐ์ง ๋ํ์ ์ธ ๋น์ ์์ ์์ ์๋ก์ด ์ฑ๋ฅ ๊ธฐ๋ก์ ์ธ์ ์ต๋๋ค. ๋ํ, ์ฐ๋ฆฌ์ ํ๋ จ์ Google์ billion-level ๋น์ ๋ชจ๋ธ๊ณผ ๋น๊ตํด 40๋ฐฐ ์ ์ ๋ ์ด๋ธ์ด ๋ฌ๋ฆฐ ๋ฐ์ดํฐ์ 40๋ฐฐ ์ ์ ํ๋ จ ์๊ฐ์ผ๋ก ์ด๋ฃจ์ด์ก๋ค๋ ์ ์์ ํจ์ฌ ๋ ํจ์จ์ ์ ๋๋ค.* | |
| ์ด ๋ชจ๋ธ์ [nandwalritik](https://huggingface.co/nandwalritik)์ด ๊ธฐ์ฌํ์์ต๋๋ค. | |
| ์๋ณธ ์ฝ๋๋ [์ฌ๊ธฐ](https://github.com/microsoft/Swin-Transformer)์์ ํ์ธํ ์ ์์ต๋๋ค. | |
| ## ๋ฆฌ์์ค [[resources]] | |
| Swin Transformer v2์ ์ฌ์ฉ์ ๋์ธ ์ ์๋ Hugging Face ๋ฐ ์ปค๋ฎค๋ํฐ(๐๋ก ํ์)์ ๊ณต์ ์๋ฃ ๋ชฉ๋ก์ ๋๋ค. | |
| <PipelineTag pipeline="image-classification"/> | |
| - [`Swinv2ForImageClassification`]์ ์ด [์์ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification)์ [๋ ธํธ๋ถ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb)์ ํตํด ์ง์๋ฉ๋๋ค. | |
| - ๊ด๋ จ ์๋ฃ: [์ด๋ฏธ์ง ๋ถ๋ฅ ์์ ๊ฐ์ด๋](../tasks/image_classification) | |
| ๋ํ: | |
| - [`Swinv2ForMaskedImageModeling`]๋ ์ด [์์ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining)๋ฅผ ํตํด ์ง์๋ฉ๋๋ค. | |
| ์๋ก์ด ์๋ฃ๋ฅผ ์ถ๊ฐํ๊ณ ์ถ์ผ์๋ค๋ฉด, ์ธ์ ๋ ์ง Pull Request๋ฅผ ์ด์ด์ฃผ์ธ์! ์ ํฌ๊ฐ ๊ฒํ ํด ๋๋ฆด๊ฒ์. ์ด๋, ์ถ๊ฐํ๋ ์๋ฃ๋ ๊ธฐ์กด ์๋ฃ์ ์ค๋ณต๋์ง ์๊ณ ์๋ก์ด ๋ด์ฉ์ ๋ณด์ฌ์ฃผ๋ ์๋ฃ์ฌ์ผ ํฉ๋๋ค. | |
| ## Swinv2Config [[transformers.Swinv2Config]] | |
| [[autodoc]] Swinv2Config | |
| ## Swinv2Model [[transformers.Swinv2Model]] | |
| [[autodoc]] Swinv2Model | |
| - forward | |
| ## Swinv2ForMaskedImageModeling [[transformers.Swinv2ForMaskedImageModeling]] | |
| [[autodoc]] Swinv2ForMaskedImageModeling | |
| - forward | |
| ## Swinv2ForImageClassification [[transformers.Swinv2ForImageClassification]] | |
| [[autodoc]] transformers.Swinv2ForImageClassification | |
| - forward | |