当前位置:网站首页>HOG feature study notes
HOG feature study notes
2022-08-05 01:52:00 【Wsyoneself】
- The foregoing knowledge:
- Feature descriptors simplify image representation by extracting useful information about the image and discarding irrelevant information
- Determine what features are useful according to the task: detect lane lines on the road: edge detection, edge information is useful, color information is useless
- Definition:
- Orientation gradient histogram, which can be used to represent the object characteristics of the image, so that such objects can be detected.
- is a feature descriptor similar to canny edge detector sift (scale invariant and feature transform), used in cv and image processing for object detection
- Essential: Count the gradient directions that occur in local parts of the image.Use the magnitude and angle of the gradient to compute features (generate histogram)
- HOG descriptor concerns the structure or shape of an object
HOG feature descriptor converts a 3-channel color image into a feature vector of a certain length
In the HOG feature descriptor, the distribution of gradient directions, that is, the histogram of gradient directions, is regarded as a feature.
The angle (the derivative of x and y) of the image, the gradients around the edges and corners (regions of sudden intensity) are large and contain more information about the shape of the object.
Using the image gradient, you can only focus on the corner information to outline the appearance of a person
- HOG is often used in conjunction with svm to train high-precision target classifiers.HOG (similar to sift) + SVM workflow:
- Preprocess the input image:
- Cut
- Scale to fixed size
- Grayscale processing (optional, for color images, the gradients are calculated relative to the three-channel color values, and the largest gradient value is taken as the gradient of the pixel)
- Gamma correction (the output image is a power function of the input image, the exponent is γ, the larger the γ, the darker the image): adjust the image contrast (reduce the influence of lighting (uneven lighting, partial shadows) on the image), so thatThe image is closer to what the human eye sees
- Calculate the gradient value of each pixel point (calculated according to the 3X3 area), and get the magnitude matrix and angle matrix:
- For each pixel, compute the horizontal and vertical gradients (the same result can be obtained using the sobel operator with a kernel size of 1)
- Calculate the total gradient strength value and gradient direction (absolute value, so the range is [0-180])
- Form gradient histogram:
- Calculated in an 8X8 cell, there are a total of 8X8X2=128 values (2 includes the gradient strength and gradient direction), and the gradient histogram is formed through statistics, 128 values will become 9 values (here9 is only because it is assumed that 0-180 is divided into 9 bins to count the pixel points m, the histogram of 9 columns, the angle range of each column is 20 degrees), while reducing the amount of calculation, it is also suitable for lighting and other environments.Changes are more robust.
- When the gradient direction tends to 0 degrees and 160 degrees, it indicates that the gradient direction of these points is upward or downward, indicating that there is a relatively obvious lateral edge at this position of the image.
- Normalize blocks
- Each value of the vector is divided by the modulo length of the vector
- Specifically:
- A region of 8X8 is regarded as a cell, and 2X2 cells are used as a group, which is called a block.Since each cell has 9 values (because the 8X8X2 step of building the histogram has become 9 values (bin)), 2X2 cells have 36 values, hog gets the block by sliding the window.
- Normalize the gradient histogram of the block. It can be seen from the above that a block has 4 histograms. The 4 histograms are spliced into a vector of length 36, and then the entire vector is normalized >
- Sliding window, the sliding step is 8 pixels (that is, a cell), and the window size is 2X2. Each time it slides, a feature vector with a length of 36 is obtained.
- Reason: Reduce the impact of lighting (the gradient of the image is sensitive to the overall lighting, but it is hoped that the feature descriptor will not be affected by lighting changes. So the histogram needs to be normalized. Because of the fold change of the original pixel, the normalizationThe result is the same after unification.)
- Calculate HOG feature vector: splicing the feature vector calculated by sliding on the entire image to obtain the feature descriptor of the entire image
- Collect HOG feature (a row of high-dimensional vector) and put it in svm for supervised learning.
- All practice brings out true knowledge and shows the result of practice:


- Preprocess the input image:
边栏推荐
- Introduction to JVM class loading
- 迅睿cms网站搬迁换了服务器后网站不能正常显示
- Knowledge Points for Network Planning Designers' Morning Questions in November 2021 (Part 2)
- torch.autograd.grad finds the second derivative
- 如何看待自己的羞愧感
- (十七)51单片机——AD/DA转换
- 直播预告|30分钟快速入门!来看可信分布式AI链桨的架构设计
- linux(centOs7)部署mysql(8.0.20)数据库
- 【PyQT5 绑定函数的传参】
- Transfer Learning - Joint Geometrical and Statistical Alignment for Visual Domain Adaptation
猜你喜欢
随机推荐
10年测试经验,在35岁的生理年龄面前,一文不值
软件测试技术之最有效的七大性能测试技术
(十七)51单片机——AD/DA转换
torch.autograd.grad finds the second derivative
蓝牙Mesh系统开发四 ble mesh网关节点管理
快速批量修改VOC格式数据集标签的文件名,即快速批量修改.xml文件名
.Net C# 控制台 使用 Win32 API 创建一个窗口
Is DDOS attack really unsolvable?Do not!
程序员失眠时的数羊列表 | 每日趣闻
短域名绕过及xss相关知识
执掌图表
Interview summary: Why do interviewers in large factories always ask about the underlying principles of Framework?
tcp中的三次握手与四次挥手
手把手基于YOLOv5定制实现FacePose之《YOLO结构解读、YOLO数据格式转换、YOLO过程修改》
hypervisor相关的知识点
第十一章 开关级建模
Greenplum数据库故障分析——能对数据库base文件夹进行软连接嘛?
一文看懂推荐系统:召回06:双塔模型——模型结构、训练方法,召回模型是后期融合特征,排序模型是前期融合特征
CMS website construction process
GCC: compile-time library path and runtime library path









