Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to show the feature vectors while inference image? #195

Closed
ryan994 opened this issue Apr 1, 2021 · 2 comments
Closed

How to show the feature vectors while inference image? #195

ryan994 opened this issue Apr 1, 2021 · 2 comments

Comments

@ryan994
Copy link

ryan994 commented Apr 1, 2021

Hello,
Due to some researches and curious, I tried to print out some feature vectors during inferencing image.
I only find this command when model inferences image:
scores = model(return_loss=False, **data),
which returns a list :
[array([1.2522009e-02, 9.9847050e-08, 9.8747790e-01], dtype=float32)].
what if I want to see the feature vectors of fc layer whild model inferences an image ,how should I do? Not weights in pretrain model file .pth.

Thanks

@mzr1996
Copy link
Member

mzr1996 commented May 18, 2021

I think you need to use breakpoint or add log output where you want to output feature vector.
For example, if you use LinearClsHead, you need to add it before final fc layer.
https://github.com/open-mmlab/mmclassification/blob/ace09510f700d3f8583e19c993113491cfd10ce4/mmcls/models/heads/linear_head.py#L37-L39

@mzr1996
Copy link
Member

mzr1996 commented Jan 22, 2022

Closed by #593

@mzr1996 mzr1996 closed this as completed Jan 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants