cs231n assignment1 feature
来源:互联网 发布:淘宝卖家需要用的软件 编辑:程序博客网 时间:2024/06/05 10:25
图像特征提取方法 LBP
在做stanford cs231n assignment1时,最后一个作业题用到了图像的特征提取, 作业里给的是HOG和color histogram
这里我简单的在网上找了一下,在图像处理方面一般有三种图像特征提取方法,
1)HOG 2)LBP 3)Haar
因为作业里的feature.py代码写的很好,可以很容易添加不同的extract feature functions,
所以bonus time环节就可以多用一些function了。
然后我是这样做的
在运行环境下安装skimage包,直接pip安装
然后在feature.py中导入包
from skimage import feature as skft
最后附上我的代码。。。完全照抄挺简单的。。。
把下面这个函数直接加在feature.py再调用就可以了,
这里对应的feature.ipynb可能需要重头开始加载,因为我一开始没重头加载一直显示导入不了lbp_feature这个函数
def lbp_feature(im): """Local Binary Patterns (LBP) feature for an image https://github.com/scikit-image/scikit-image/blob/master/skimage/feature/_texture.pyx https://github.com/scikit-image/scikit-image/blob/master/skimage/feature/texture.py Reference: (1, 2) Face recognition with local binary patterns. Timo Ahonen, Abdenour Hadid, Matti Pietikainen, http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.214.6851, 2004. Parameters: im : an input grayscale or rgb image Returns: feat: Local Binary Patterns (LBP) feature """ # convert rgb to grayscale if needed if im.ndim == 3: image = rgb2gray(im) else: image = np.at_least_2d(im) # settings for LBP # Small radius can get fine texture. radius = 1 n_point = radius * 8 #Using LBP to extract texture feature of image. lbp = skft.local_binary_pattern(image, n_point, radius, 'default') #Satistics histogram of image max_bins = int(lbp.max() + 1) train_hist, _ = np.histogram(lbp, normed=True, bins=max_bins, range=(0, max_bins)) # return histogram return train_hist.ravel()
阅读全文
1 0
- cs231n assignment1 feature
- cs231n assignment1
- CS231n-assignment1
- [CS231n@Stanford] Assignment1-Q1
- cs231n assignment1 tips
- cs231n:assignment1:KNN解答
- CS231n Assignment1--Q1
- CS231n Assignment1--Q2
- CS231n Assignment1--Q3
- CS231n Assignment1--Q4
- CS231n Assignment1--Q5
- cs231n assignment1--svm
- cs231n assignment1--Softmax
- cs231n assignment1--two_layer_net
- 【深度学习】cs231n-assignment1
- cs231n assignment1 svm
- CS231n-assignment1-KNN篇
- cs231n assignment1:KNN
- MVC和MVP
- JavaScript中map()函数的用法
- flaot类型数据与单个字节相互转换
- 9*9乘法表
- Android_studio和ecilpse
- cs231n assignment1 feature
- C语言的一些误用和知识总结
- 命令行编译C++(Linux下、Windows下)
- 挂一波Dalao的代码
- 一款小巧的清理软件——Dir
- ConfigReader(二十一)—— ReadGuidePopTipTaskConfig
- BZOJ 1123: [POI2008]BLO 图的连通性
- tensorboard使用记录
- 手机直播链接