Closed 113HQ closed 3 years ago
๐ Hello @113HQ, 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 glenn.jocher@ultralytics.com.
Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.7
. To install run:
$ pip install -r requirements.txt
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
If 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.
@113HQ well, what features do you want to visualize exactly? The models typically have hundreds of layers and each layer has hundreds of feature maps.
Example๏ผthe three nodes of the PANet(#17ใ#20ใ#23)
---Original--- From: "Glenn Jocher"<notifications@github.com> Date: Mon, Feb 22, 2021 03:40 AM To: "ultralytics/yolov5"<yolov5@noreply.github.com>; Cc: "113HQ"<948107836@qq.com>;"Mention"<mention@noreply.github.com>; Subject: Re: [ultralytics/yolov5] Dear author, can you provide a visualization scheme for YOLOV5 feature graphs during detect.py? Thank you! (#2259)
@113HQ well, what features do you want to visualize exactly? The models typically have hundreds of layers and each layer has hundreds of feature maps.
โ You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
@113HQ yes but this is what i mean, within each of these 3 stages (17, 20 and 23) there are very many feature maps. If we take yolov5l.yaml for example, layer 17 has 256 feature maps, layer 20 has 512 and layer 23 has 1024 feature maps. So there are almost 1800 feature maps that you can look at in just the YOLOv5l output layers (for a single input image).
https://github.com/ultralytics/yolov5/blob/master/models/yolov5l.yaml
Yes๏ผI know. I just want to know what the feature maps inside look like. Can we just choose layer 17 as an example? (for a single input image)
---Original--- From: "Glenn Jocher"<notifications@github.com> Date: Mon, Feb 22, 2021 12:15 PM To: "ultralytics/yolov5"<yolov5@noreply.github.com>; Cc: "113HQ"<948107836@qq.com>;"Mention"<mention@noreply.github.com>; Subject: Re: [ultralytics/yolov5] Dear author, can you provide a visualization scheme for YOLOV5 feature graphs during detect.py? Thank you! (#2259)
@113HQ yes but this is what i mean, within each of these 3 stages (17, 20 and 23) there are very many feature maps. If we take yolov5l.yaml for example, layer 17 has 256 feature maps, 20 has 512 and 23 has 1024 feature maps. So there are almost 1800 feature maps that you can look at in just the YOLOv5l output layers (for a single input image).
https://github.com/ultralytics/yolov5/blob/master/models/yolov5l.yaml
โ You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
@113HQ well, yes its certainly possible to build a visualizer. You could make maybe a 4x3 matplotlib grid, put the original image in the top left subplot, then in each of the rows put the first 3 feature maps from the output layers. You could do this by updating the model forward method to capture the outputs at the layers you were interested in, then it's just a matter of plotting and displaying them nicely. The place you'd capture the feature maps is here. I don't have a lot of free time to work on this, but if you want to get started and submit a PR that would great! https://github.com/ultralytics/yolov5/blob/095d2c11d89892cd9c0c4d034cd1c768a0dba11c/models/yolo.py#L120-L136
@113HQ BTW, a single feature map may be in my opinion a shallow set of information, as you are looking at a 2d spatial slice but are not aptly observing relationships across the feature space (as the convolutions do).
I guess an analogy is that you would be viewing the R, G, B layers of a color image by themselves, when it helps to view them together to get the complete picture.
Ok๏ผI''ll have a try. Thanks
---Original--- From: "Glenn Jocher"<notifications@github.com> Date: Mon, Feb 22, 2021 13:04 PM To: "ultralytics/yolov5"<yolov5@noreply.github.com>; Cc: "113HQ"<948107836@qq.com>;"Mention"<mention@noreply.github.com>; Subject: Re: [ultralytics/yolov5] Dear author, can you provide a visualization scheme for YOLOV5 feature graphs during detect.py? Thank you! (#2259)
@113HQ BTW, a single feature map may be in my opinion a shallow set of information, as you are looking at a 2d spatial slice but are not aptly observing relationships across the feature space (as the convolutions do).
I guess an analogy is that you would be viewing the R, G, B layers of a color image by themselves, when it helps to view them together to get the complete picture.
โ You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Hi @glenn-jocher,
Do you have any image for the entire architecture of YOLOv5? For example: obtained from this link.
If you do not have a nicely plotted one, a hand sketched version will do as well, I can make it nicely myself. I have looked through all YOLOv5 publications but none of them has one image regarding the architecture. I guess getting one from you is much straightforward, otherwise making one will have misunderstanding issues and draw it wrongly. Hope you have one :D.
Many thanks for the great work on YOLOv5!
Hi @JiaLim98 ,
Maybe you could check #280 and this (yolov5s release 3.1 specially).
Hi @zhiqwang,
Thank you so much! Do you have one for v4.0? because my work uses only v4.0. To my knowledge, there are major changes in the architecture between v3.1 and v4.0 right?
I found one following the blog you attached, here. Is this correct?
Just to double confirm, @glenn-jocher, do you agree with the diagrams plotted? Do those directly reflect what YOLOv5 is doing?
@JiaLim98 yes, there were architectural changes between v3.1 and v4.0: the C3() modules replaced CSPBottleneck() modules, and SiLU() replaced HardSwish(). We actually haven't plotted the model ourselves, we typically just use the model yaml files a first order approximation of the structure, and also use Netron to view the block diagram (sometimes looks better with ONNX exported models than the pytorch ones), and sometimes the interactive TF graph view is useful also (when it works): https://github.com/ultralytics/yolov5/blob/7a6870b81f31db40b06d2e899801febbeed96696/train.py#L324
The linked models are good too, they seem correct.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Ok๏ผI''ll have a try. Thanks โฆ ---Original--- From: "Glenn Jocher"<notifications@github.com> Date: Mon, Feb 22, 2021 13:04 PM To: "ultralytics/yolov5"<yolov5@noreply.github.com>; Cc: "113HQ"<948107836@qq.com>;"Mention"<mention@noreply.github.com>; Subject: Re: [ultralytics/yolov5] Dear author, can you provide a visualization scheme for YOLOV5 feature graphs during detect.py? Thank you! (#2259) @113HQ BTW, a single feature map may be in my opinion a shallow set of information, as you are looking at a 2d spatial slice but are not aptly observing relationships across the feature space (as the convolutions do). I guess an analogy is that you would be viewing the R, G, B layers of a color image by themselves, when it helps to view them together to get the complete picture. โ You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Ok๏ผI''ll have a try. Thanks โฆ ---Original--- From: "Glenn Jocher"<notifications@github.com> Date: Mon, Feb 22, 2021 13:04 PM To: "ultralytics/yolov5"<yolov5@noreply.github.com>; Cc: "113HQ"<948107836@qq.com>;"Mention"<mention@noreply.github.com>; Subject: Re: [ultralytics/yolov5] Dear author, can you provide a visualization scheme for YOLOV5 feature graphs during detect.py? Thank you! (#2259) @113HQ BTW, a single feature map may be in my opinion a shallow set of information, as you are looking at a 2d spatial slice but are not aptly observing relationships across the feature space (as the convolutions do). I guess an analogy is that you would be viewing the R, G, B layers of a color image by themselves, when it helps to view them together to get the complete picture. โ You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Hello, have you realized the visualization of feature map? Thank you
@WANGCHAO1996 @zhiqwang @113HQ @JiaLim98 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 feature_vis=True
in the model forward method and define the layer you want to visualize (default is SPP layer).
To receive this update:
git pull
from within your yolov5/
directory or git clone https://github.com/ultralytics/yolov5
againmodel = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)
sudo docker pull ultralytics/yolov5:latest
to update your image 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 ๐!
๐ Feature
Motivation
Pitch
Alternatives
Additional context