import cv2
import numpy as np
import xlrd
def LoadPredictDataFromExcel():
#文件位置
ExcelFile=xlrd.open_workbook(r'..\0221_To_Teves训练数据.xlsx')
#获取目标EXCEL文件sheet名
print (ExcelFile.sheet_names())
sheet = ExcelFile.sheet_by_name('Sheet1')
#打印sheet的名称,行数,列数
print (sheet.name,sheet.nrows,sheet.ncols)
#获取整行或者整列的值
BackgroundDist = sheet.col_values(5)
ForegroundDist = sheet.col_values(1)
ForegroundArea = sheet.col_values(2)
offset = sheet.col_values(3)
BackgroundDist.pop(0)
ForegroundDist.pop(0)
ForegroundArea.pop(0)
offset.pop(0)
data = np.vstack((BackgroundDist, ForegroundDist, ForegroundArea))
data = data.transpose()
data = np.array(data,dtype='float32')
return data, offset
if __name__ == '__main__':
data, offset
用excel中的数据进行svr预测
最新推荐文章于 2023-03-14 13:24:58 发布
本文介绍了一种从Excel文件中读取预测数据的方法,并利用OpenCV库中的支持向量回归(SVR)模型进行预测。通过Python代码实现了数据的加载、预处理及模型预测过程。

最低0.47元/天 解锁文章
275

被折叠的 条评论
为什么被折叠?



