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 I can save the numpy value of output features as .csv format file layer by layer (stage by stage)? #4775

Closed
PariaDarbani opened this issue Sep 13, 2021 · 4 comments
Labels
question Further information is requested

Comments

@PariaDarbani
Copy link

How I can save the numpy value of output features as .csv format file layer by layer (stage by stage)?

I can access the weights of each layer by model.state_dict() but how I can print or save the input/output feature maps from selective layers?

Additional context

@PariaDarbani PariaDarbani added the question Further information is requested label Sep 13, 2021
@glenn-jocher
Copy link
Member

glenn-jocher commented Sep 13, 2021

@PariaDarbani you can use the --visualize flag to output YOLOv5 feature maps:

python detect.py --visualize

See #3920

@PariaDarbani
Copy link
Author

Thank you. it saves the images of outputs. how I can save the numpy values or tensor of each image (numbers)

@glenn-jocher
Copy link
Member

@PariaDarbani there's no method to save the output values directly, but you can customize the code to return values here:

yolov5/models/yolo.py

Lines 158 to 160 in aa18599

if visualize:
feature_visualization(x, m.type, m.i, save_dir=visualize)

@PariaDarbani
Copy link
Author

@PariaDarbani there's no method to save the output values directly, but you can customize the code to return values here:

yolov5/models/yolo.py

Lines 158 to 160 in aa18599

if visualize:
feature_visualization(x, m.type, m.i, save_dir=visualize)

Thank you so much. solved. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants