Python 如何用图像加载经过训练的模型作业库?

Python 如何用图像加载经过训练的模型作业库?,python,python-3.x,scikit-learn,pre-trained-model,Python,Python 3.x,Scikit Learn,Pre Trained Model,我试图用图像加载保存的glob.pkl训练文件,代码运行正常,但没有任何效果 未发生任何预测,也未从文件夹中拾取任何要测试的图像。但是没有代码错误 import numpy as np import os import glob import joblib import cv2 # function to extract haralick textures from an image def extract_features(image): #loop over the test imag

我试图用图像加载保存的glob.pkl训练文件,代码运行正常,但没有任何效果 未发生任何预测,也未从文件夹中拾取任何要测试的图像。但是没有代码错误

import numpy as np
import os
import glob
import joblib
import cv2

# function to extract haralick textures from an image 
def extract_features(image):

#loop over the test images
test_path = "D:/tata"
for file in glob.glob(test_path + "/*.jpg"):
    # read the input image
    image = cv2.imread(file)


# convert to grayscale
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

# extract haralick texture from the image
features = extract_features(gray)       

# load shit from data
joblib_model = joblib.load("D:/Anothertest/joblib_model.pkl")

# evaluate the model and predict label
prediction = joblib_model.predict(features.reshape(1, -1))[0]
 
 # show the label
cv2.putText(image, prediction, (10,30), cv2.FONT_HERSHEY_SIMPLEX, 1.0, (0,0,255), 3)
print ("Prediction - {}".format(prediction))
print("Accuracy - ", joblib_model.score(train_features, train_labels))

# display the output image
cv2.imshow("Test_Image", image)
cv2.waitKey(0)