There are three ways to instantiate a DETR model (depending on what you prefer): | |
Option 1: Instantiate DETR with pre-trained weights for entire model | |
from transformers import DetrForObjectDetection | |
model = DetrForObjectDetection.from_pretrained("facebook/detr-resnet-50") | |
Option 2: Instantiate DETR with randomly initialized weights for Transformer, but pre-trained weights for backbone | |
from transformers import DetrConfig, DetrForObjectDetection | |
config = DetrConfig() | |
model = DetrForObjectDetection(config) | |
Option 3: Instantiate DETR with randomly initialized weights for backbone + Transformerpy | |
config = DetrConfig(use_pretrained_backbone=False) | |
model = DetrForObjectDetection(config) | |
As a summary, consider the following table: | |
| Task | Object detection | Instance segmentation | Panoptic segmentation | | |
|------|------------------|-----------------------|-----------------------| | |
| Description | Predicting bounding boxes and class labels around objects in an image | Predicting masks around objects (i.e. |