# How to get feature map from pre-trained Resnet50

**URL:** <https://discuss.pytorch.org/t/how-to-get-feature-map-from-pre-trained-resnet50/86150>\
**Category:** Uncategorized\
**Created:** [June 20, 2020, 7:35am UTC](https://discuss.pytorch.org/t/how-to-get-feature-map-from-pre-trained-resnet50/86150 "2020-06-20T07:35:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![asahi](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/a/ac8455/32.png) [@asahi](https://discuss.pytorch.org/u/asahi)\
**Post date:** [June 20, 2020, 7:35am UTC](https://discuss.pytorch.org/t/how-to-get-feature-map-from-pre-trained-resnet50/86150/1 "2020-06-20T07:35:55Z")

</div>

Hi!  
I want to extract feature maps from pre-trained ResNet50 model.  
Actually, I’m trying to make image-captioning model and need to get feature maps from images.  
However, I cannot find good ways to do that.  
Does anyone know the way for that and show me the code to make it possible?

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [June 20, 2020, 8:56am UTC](https://discuss.pytorch.org/t/how-to-get-feature-map-from-pre-trained-resnet50/86150/2 "2020-06-20T08:56:54Z")

</div>

You could use forward hooks to get the activation maps as described in [this example](https://discuss.pytorch.org/t/how-can-l-load-my-best-model-as-a-feature-extractor-evaluator/17254/6).

---

<div class="post-metadata">

**Author:** ![asahi](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/a/ac8455/32.png) [@asahi](https://discuss.pytorch.org/u/asahi)\
**Post date:** [June 20, 2020, 12:45pm UTC](https://discuss.pytorch.org/t/how-to-get-feature-map-from-pre-trained-resnet50/86150/3 "2020-06-20T12:45:04Z")

</div>

thank you for your quick answering.  
I’ll check it out!
