-
-
Notifications
You must be signed in to change notification settings - Fork 16.4k
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
Features map #2613
Comments
👋 Hello @GiuliaCiaramella, thank you for your interest in 🚀 YOLOv5! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution. If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you. If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available. For business inquiries or professional support requests please visit https://www.ultralytics.com or email Glenn Jocher at [email protected]. RequirementsPython 3.8 or later with all requirements.txt dependencies installed, including $ pip install -r requirements.txt EnvironmentsYOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit. |
As I concered, the true length of vector is (number of class + 5). The size of input influences the the number of vector , for example, 20^2 + 40^2 + 80^2. You can compare them with the given position , layers and anchors. |
@zonguu hey, thanks for the answer. What I am sure by now, is that the smallest feature map before the detect layer has size= [1,3,8,13,9] for an image size of 416*256. 1 and 3 are always there (I think they represent 1=batch, 3 like channels of colors, but not sure), and 9 =4classes in my model+5. |
@GiuliaCiaramella you can always use a nn.AdaptiveAvgPool2d() layer to average the spatial dimensions away, no matter what size they are. Most classification models like VGG do this, which is why their output vector is unaffected by image size. We have a Classify() module that does this as well here that you can use an example of how to get started (i.e. and if you want you can also apply it to each of the 3 Detect() layer inputs to get equal-size feature vectors.) Lines 305 to 315 in 005d7a8
|
@glenn-jocher Amazing! Thank you, I will focus on it :) |
@GiuliaCiaramella |
@GiuliaCiaramella good news 😃! Feature map visualization was added ✅ in PR #3804 by @Zigars today. This allows for visualizing feature maps from any part of the model from any function (i.e. detect.py, train.py, test.py). Feature maps are saved as *.png files in runs/features/exp directory. To turn on feature visualization set Lines 158 to 160 in 20d45aa
To receive this update:
Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀! |
❔Question
is there a feature map in yolov5 whose output is independent on image size?
Additional context
Hello :)
I am interested in extracting the feature map from last layer in the head of the network, in particular, one of the three that goes to feed the Detect() layer. I want this feature map to produce a feature vector representing the input image. The problem I am facing, is that this vector depends on the input image size, and since my goal si to compare images starting from their feature vectors, I can't accomplish my goal if the two images have different sizes.
For now, in order to make things work, I am using VGG16() neural network to process the images and take the feature vector in the last layer before classification, which has always a lenght of 4096, since it depends on the network layer and not on the input image size.
However, since I am already using yolov5 for detection, that would be much more efficient extract the feature vector from yolov5 instead of reprocessing the image in another NN.
So my question is: is there a feature map in yolov5 whose output is independent on image size?
I hope that this is clear.
The text was updated successfully, but these errors were encountered: