# When Fine-tuning a object detection model which parameters do we update?

**URL:** <https://discuss.huggingface.co/t/when-fine-tuning-a-object-detection-model-which-parameters-do-we-update/162494>\
**Category:** 🤗Transformers\
**Created:** [July 10, 2025, 9:47am UTC](https://discuss.huggingface.co/t/when-fine-tuning-a-object-detection-model-which-parameters-do-we-update/162494 "2025-07-10T09:47:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kallinteris-Andreas](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/kallinteris-andreas/32/50408_2.png) [@Kallinteris-Andreas](https://discuss.huggingface.co/u/Kallinteris-Andreas)\
**Post date:** [July 10, 2025, 9:47am UTC](https://discuss.huggingface.co/t/when-fine-tuning-a-object-detection-model-which-parameters-do-we-update/162494/1 "2025-07-10T09:47:37Z")

</div>

When we fine-tune an object detection model, which weights exactly are we updating?

Do we explicitly configure which components of the model we want to update?

For example, in fine-tuning [DETR](https://huggingface.co/docs/transformers/en/model_doc/detr), which components are we updating?

I would assume that the backbone is being frozen, and that encoder/decoder get updated, the prediction heads get reset and trained from scratch

(I am asking specifically about DETR because it is a popular and simple object detection dataset)

[![](https://us1.discourse-cdn.com/hellohellohello/original/3X/3/d/3d4c06f446818af4a1ec3273f80147d789676813.png) ](https://cdn-lfs.hf.co/repos/bf/2a/bf2a50c0acddc20a4963bc4c9bfd57f4a0a887faf272014a120b3c17331f0aa6/2f6a2f211196f88fc3b53b1d14b08eb8d3dcee46b0807f642575a9d8654b3229?response-content-disposition=inline%3B+filename*%3DUTF-8%27%27DETR.png%3B+filename%3D%22DETR.png%22%3B&response-content-type=image%2Fpng&Expires=1752144187&Policy=eyJTdGF0ZW1lbnQiOlt7IkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTc1MjE0NDE4N319LCJSZXNvdXJjZSI6Imh0dHBzOi8vY2RuLWxmcy5oZi5jby9yZXBvcy9iZi8yYS9iZjJhNTBjMGFjZGRjMjBhNDk2M2JjNGM5YmZkNTdmNGEwYTg4N2ZhZjI3MjAxNGExMjBiM2MxNzMzMWYwYWE2LzJmNmEyZjIxMTE5NmY4OGZjM2I1M2IxZDE0YjA4ZWI4ZDNkY2VlNDZiMDgwN2Y2NDI1NzVhOWQ4NjU0YjMyMjk%7EcmVzcG9uc2UtY29udGVudC1kaXNwb3NpdGlvbj0qJnJlc3BvbnNlLWNvbnRlbnQtdHlwZT0qIn1dfQ __&Signature=ihwwOX6n8JNHcIvaCCfiQOy9YF8DbbBTQ0QjoLYqNhE5WDU1Zmtu8rId32Xlo2fQy62i-btneGO2prbCTmJ1CgknbAZkMw1x4XUtM9qtHhCM0ZqR6wPA7cH5KNxKaDWR898Vo%7Ep1-GsXQ0BXcaltYhKBFxvqAtLIHSpAUJt5ike3ivsopfmIuUqojVpbnVgiCkQ%7EnDBCn1Q6Z47O26-hqXpwIRR2n6-bkofrj%7E78vV8efb46ZQmTmJhAwTrvuLphfTzDOcRs2M5nntl4%7ET7JuY9VSiCGVed0snFF29587xpcyHIccdBHe0I5PHfqU-rQDFHcyoHL72hZwLY7Tu-PCw__ &Key-Pair-Id=K3RPWS32NSSJCE)

Thanks!

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [July 10, 2025, 1:25pm UTC](https://discuss.huggingface.co/t/when-fine-tuning-a-object-detection-model-which-parameters-do-we-update/162494/2 "2025-07-10T13:25:00Z")

</div>

In the case of Hugging Face’s Trainer, simply specify `requires_grad=False` for the parts you want to freeze. Therefore, [trainable parameters can be obtained like this](https://github.com/huggingface/transformers/issues/27615).

```py
for name, param in model.named_parameters():
    if "backbone" in name:
        param.requires_grad = False # frozen

```

> **[GitHub - makriot/detr-finetune: Fine-tuning DETR model to detect any object. DETR...](https://github.com/makriot/detr-finetune)**
>
> Fine-tuning DETR model to detect any object. DETR for balloons detection.
