Skip to content

Commit

Permalink
Improve Backbone API docs (#28666)
Browse files Browse the repository at this point in the history
Update backbones.md
  • Loading branch information
merveenoyan authored Jan 25, 2024
1 parent 7fa4b36 commit 2000095
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docs/source/en/main_classes/backbones.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ We can get the feature maps of first and second stages like below.

## Initializing Backbone Configuration

In computer vision, models consist of backbone, neck, and a head. Backbone extracts the features, neck transforms the output of the backbone and head is used for the main task (e.g. object detection). You can initialize neck and head with model backbones by passing a model configuration to `backbone_config`. For example, below you can see how to initialize the [MaskFormer](../model_doc/maskformer) model with instance segmentation head with [ResNet](../model_doc/resnet) backbone.
In computer vision, models consist of backbone, neck, and a head. Backbone extracts the features, neck enhances the extracted features and head is used for the main task (e.g. object detection).

<div style="text-align: center">
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/Backbone.png">
</div>

You can initialize such multiple-stage model with Backbone API. Initialize the config of the backbone of your choice first. Initialize the neck config by passing the backbone config in. Then, initialize the head with the neck's config. To illustrate this, below you can see how to initialize the [MaskFormer](../model_doc/maskformer) model with instance segmentation head with [ResNet](../model_doc/resnet) backbone.

```py
from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, ResNetConfig
Expand Down

0 comments on commit 2000095

Please sign in to comment.