资源简介
使用Opencv进行图像分类的应用程序,对图像的区分程度不错。
代码片段和文件信息
import cv2
import pandas as pd
import numpy as np
from numpy.linalg import norm
import glob
import pickle
# local modules
#RandomForestClassifier
def RandomForest_learn(xyX_testY_test):
from sklearn.ensemble import RandomForestClassifier
classifier = RandomForestClassifier(n_estimators=3 criterion=‘entropy‘ random_state=0)
classifier.fit(x y)
y_pred = classifier.predict(X_test)
pickle.dump(classifier open(‘RandomForestClassifier.sav‘ ‘wb‘))
n = 0
p = 0
i = 0
while i < len(y_pred):
if y_pred[i] == Y_test[i]:
p = p + 1
else:
n = n + 1
i = i + 1
print(n)
print(p)
accuracy = (p / len(y_pred)) * 100
print(accuracy ‘% RandomForestClassifier‘)
#DecisionTreeClassifier
def DecisionTree_learn(xyX_testY_test):
from sklearn.tree import DecisionTreeClassifier
classifier = DecisionTreeClassifier(criterion=‘entropy‘ random_state=0)
classifier.fit(x y)
y_pred = classifier.predict(X_test)
pickle.dump(classifier open(‘DecisionTreeClassifier.sav‘ ‘wb‘))
n = 0
p = 0
i = 0
while i < len(y_pred):
if y_pred[i] == Y_test[i]:
p = p + 1
else:
n = n + 1
i = i + 1
print(n)
print(p)
accuracy = (p / len(y_pred)) * 100
print(accuracy ‘% DecisionTreeClassifier‘)
#Kernel SVM classification
def KernelSVM_learn(xyX_testY_test):
# Fitting SVM to the Training set
from sklearn.svm import SVC
classifier = SVC(kernel=‘rbf‘ gamma=5.383 C=2.67)
classifier.fit(x y)
y_pred = classifier.predict(X_test)
pickle.dump(classifier open(‘KernelSVMClassifier.sav‘ ‘wb‘))
n = 0
p = 0
i = 0
while i < len(y_pred):
if y_pred[i] == Y_test[i]:
p = p + 1
else:
n = n + 1
i = i + 1
print(n)
print(p)
accuracy = (p / len(y_pred)) * 100
print(accuracy ‘% KernelSVM‘)
#Linear SVM classification
def LinearSVM_learn(xyX_testY_test):
# Fitting SVM to the Training set
from sklearn.svm import SVC
classifier = SVC(kernel=‘linear‘ random_state=0)
classifier.fit(x y)
y_pred = classifier.predict(X_test)
pickle.dump(classifier open(‘LinearSVMClassifier.sav‘ ‘wb‘))
n = 0
p = 0
i = 0
while i < len(y_pred):
if y_pred[i] == Y_test[i]:
p = p + 1
else:
n = n + 1
i = i + 1
print(n)
print(p)
accuracy = (p / len(y_pred)) * 100
print(accuracy ‘% linearSVM‘)
#logit classification
def Logit_learn(xyX_testY_test):
# Fitting Logit to the Training set
from sklearn.linear_model import LogisticRegression
classifier = LogisticRegression(random_state = 0)
classifier.fit(x y)
y_pred = classifier.predict(X_test)
pickle.dump(classifier open(‘LogisticClassifier.sav‘
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-10-19 10:42 Take_photo_By_Finger-master\
文件 1203 2018-10-19 10:42 Take_photo_By_Finger-master\.gitignore
文件 3768 2018-10-19 10:42 Take_photo_By_Finger-master\DecisionTreeClassifier.sav
文件 658183 2018-10-19 10:42 Take_photo_By_Finger-master\KNeighborsClassifier.sav
文件 59353 2018-10-19 10:42 Take_photo_By_Finger-master\KernelSVMClassifier.sav
文件 35149 2018-10-19 10:42 Take_photo_By_Finger-master\LICENSE
文件 81703 2018-10-19 10:42 Take_photo_By_Finger-master\LinearSVMClassifier.sav
文件 1332 2018-10-19 10:42 Take_photo_By_Finger-master\LogisticClassifier.sav
文件 206 2018-10-19 10:42 Take_photo_By_Finger-master\README.md
文件 12326 2018-10-19 10:42 Take_photo_By_Finger-master\RandomForestClassifier.sav
目录 0 2018-10-19 10:42 Take_photo_By_Finger-master\gr\
文件 169 2018-10-19 10:42 Take_photo_By_Finger-master\gr\1539937946.541338.png
文件 157 2018-10-19 10:42 Take_photo_By_Finger-master\gr\1539937946.5563493.png
文件 186 2018-10-19 10:42 Take_photo_By_Finger-master\gr\1539937946.5593388.png
文件 131729 2018-10-19 10:42 Take_photo_By_Finger-master\gr\1539937946.5633383.png
文件 979 2018-10-19 10:42 Take_photo_By_Finger-master\gr\1539937946.587339.png
文件 1174 2018-10-19 10:42 Take_photo_By_Finger-master\gr\1539937946.590338.png
文件 643 2018-10-19 10:42 Take_photo_By_Finger-master\gr\1539937946.605342.png
文件 10461 2018-10-19 10:42 Take_photo_By_Finger-master\gr\1539937946.608341.png
文件 11567 2018-10-19 10:42 Take_photo_By_Finger-master\gr\1539937946.6213424.png
文件 79 2018-10-19 10:42 Take_photo_By_Finger-master\gr\1539937946.6253388.png
文件 2229 2018-10-19 10:42 Take_photo_By_Finger-master\gr\1539937946.6283371.png
文件 314 2018-10-19 10:42 Take_photo_By_Finger-master\gr\1539937948.9613378.png
文件 500 2018-10-19 10:42 Take_photo_By_Finger-master\gr\1539937948.9953377.png
文件 978 2018-10-19 10:42 Take_photo_By_Finger-master\gr\1539937949.278338.png
文件 962 2018-10-19 10:42 Take_photo_By_Finger-master\gr\1539937949.4093368.png
文件 1020 2018-10-19 10:42 Take_photo_By_Finger-master\gr\1539937949.4453394.png
文件 1335 2018-10-19 10:42 Take_photo_By_Finger-master\gr\1539937949.47834.png
文件 1461 2018-10-19 10:42 Take_photo_By_Finger-master\gr\1539937949.5053358.png
文件 67 2018-10-19 10:42 Take_photo_By_Finger-master\gr\1539937949.5693386.png
文件 336 2018-10-19 10:42 Take_photo_By_Finger-master\gr\1539937949.57334.png
............此处省略264个文件信息
相关资源
- 基于opencv的车道线检测代码
- OPENCv 在图片上写字,各种格式
- QT+OpenCV实现图像识别
- 程序包.rar基于pyqt+OpenCV设计的用户密
- OpenCV双目标定双目校正
- 用OpenCV作的一个车牌识别程序,可以
- 邮政编码识别 OPENCV
- opencv 神经网络分类
- opencv中文chm参考api文档
- opencv识别单行数字
- 颜色增强算法Opencv
- 一个基于 OpenCV 的人脸识别系统
- opencv检测人眼并精准定位瞳孔
- Opencv实现物体识别和追踪
- 基于粗糙集的图像分类方法
- 基于OpenCV多目标的模板匹配算法
- Opencv中文手册资料
- opencv js单独文件
- opencv车辆检测model
- 编译opencv缺失的boostdesc_bgm.i等文件
- 基于OpenCV进行图像拼接原理解析和编
- boostdesc_bgm.i等.tar.gz
- 色彩恢复的多尺度Retinex算法MSRCR-VS2
- opencv3.3 自编译需要的xfeatures2d
- OpenCVdemo6by浅墨.rar
- 视频前景提取基于opencv的运动物体检
- 光流法运动跟踪
- KCF视频目标跟踪OPENCV+VS+WIN
- VGG16图像分类源代码、测试图片
- cv100.dll、cxcore100.dll、cxts001.dll、high
评论
共有 条评论