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

Save *.npy features on detect.py --visualize #5701

Merged
merged 6 commits into from
Nov 21, 2021

Conversation

Zengyf-CVer
Copy link
Contributor

@Zengyf-CVer Zengyf-CVer commented Nov 18, 2021

Add feature map to save npy files,export npy files with 32 feature maps per layer.
ksnip_20211117-215723

ksnip_20211117-215757

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Enhancements in feature visualization and data saving within YOLOv5.

📊 Key Changes

  • 📁 Modified the path handling for saving feature visualization images, ensuring they are stored in the correct directory.
  • 🖼️ Feature visualization now includes saving the features as .npy files for easier post-processing or analysis.

🎯 Purpose & Impact

  • 🚀 The updated path handling prevents potential issues with saving files in unintended locations, improving the reliability of the feature visualization functionality.
  • 🔍 Saving features as .npy files provides users with more flexibility, allowing them to more easily use the visualized data for further research or analysis.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 Hello @Zengyf-CVer, thank you for submitting a 🚀 PR! To allow your work to be integrated as seamlessly as possible, we advise you to:

  • ✅ Verify your PR is up-to-date with upstream/master. If your PR is behind upstream/master an automatic GitHub actions rebase may be attempted by including the /rebase command in a comment body, or by running the following code, replacing 'feature' with the name of your local branch:
git remote add upstream https://github.com/ultralytics/yolov5.git
git fetch upstream
git checkout feature  # <----- replace 'feature' with local branch name
git merge upstream/master
git push -u origin -f
  • ✅ Verify all Continuous Integration (CI) checks are passing.
  • ✅ Reduce changes to the absolute minimum required for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." -Bruce Lee

@glenn-jocher
Copy link
Member

@Zengyf-CVer if you want to add numpy outputs, it probably makes sense to export a single multi-dimensional array npy file per image rather than many npy files. i.e. instead of exporting 30 10x10 arrays you could export a single 30x10x10 array, and then no new directories are needed.

@Zengyf-CVer
Copy link
Contributor Author

@glenn-jocher
Thank you very much for your suggestion, I will look into it again. thanks.

@Zengyf-CVer
Copy link
Contributor Author

@glenn-jocher
I merged the 32 feature maps of each layer into one npy file and removed the folder.
ksnip_20211120-125556

@glenn-jocher
Copy link
Member

@Zengyf-CVer hey great!

@glenn-jocher
Copy link
Member

/rebase

Zengyf-CVer and others added 4 commits November 21, 2021 18:28
Add feature map to save npy files,export npy files with 32 feature maps per layer.
@glenn-jocher glenn-jocher changed the title Add feature map to save npy files Save *.npy features on detect.py --visualize Nov 21, 2021
@glenn-jocher
Copy link
Member

@Zengyf-CVer I've cleaned this up so the PR only adds +1 lines of code to the repo.

@glenn-jocher glenn-jocher merged commit f17c86b into ultralytics:master Nov 21, 2021
@glenn-jocher
Copy link
Member

@Zengyf-CVer PR is merged. Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐

BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
* Add feature map to save npy files

Add feature map to save npy files,export npy files with 32 feature maps per layer.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update plots.py

* Update plots.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update plots.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Glenn Jocher <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants