我正在使用GUI进行肝脏超声诊断的项目。
我将PyQT5(5.12.1)用于GUI,将sklearn(0.21.2)用于统计模型。我从虫草学(2.2.0)获得的主要纹理特征。
当我在PyCharm 2019.1中编译项目时-所有工作都完全正常。
但是当我尝试使用pyinstaller将项目构建为.exe文件时,出现了一些错误。我解决了大多数问题(关于缺少库),但是剩下的一个。
我遇到了错误:
Feature class firstorder is not recognized
Feature class glcm is not recognized
Feature class glrlm is not recognized
Feature class ngtdm is not recognized
Feature class glszm is not recognized
并且我的模型也给出了错误(当我使用已经保存在sklearn的.sav文件中的模型拟合新数据时):
ValueEror: operands could not be broadcast together with shapes (1,3)(96,)(1,3)
1)我尝试更改为:
extractor.enableFeatureClassByName('glcm')
收件人:
extractor.enableFeatureClassByName(str('glcm'))
它没有帮助。
2)另外,我还尝试在不同版本的乙二体组学上建立一个项目:
2.1.1和 2.2.0 给出相同的结果(错误)
import pandas as pd
import numpy as np
import pickle
import sklearn
...
folderName = "tmp"
sl = "/"
image_path_to = os.getcwd() + "/data/nrrd/" + folderName + sl + name_image
label_path_to = os.getcwd() + "/data/nrrd/" + folderName + sl + name_label
# Instantiate the extractor
extractor = featureextractor.RadiomicsFeatureExtractor()
# Switch on only needed feature class
extractor.disableAllFeatures()
extractor.enableFeatureClassByName('firstorder') <<< There is a problem
extractor.enableFeatureClassByName('glcm')
extractor.enableFeatureClassByName('glrlm')
extractor.enableFeatureClassByName('ngtdm')
extractor.enableFeatureClassByName('gldm')
extractor.enableFeatureClassByName('glszm')
# result -> ordered dict
result = extractor.execute(image_path_to, label_path_to)
df = pd.DataFrame(result, index=[0])
...
# Load the model from disk
model_name = 'Multi-layer Perceptron'
poolParam = ["diagnosis_code", "isnorm"]
models = [0,5]
for param in poolParam:
filename = 'data/result/model/' + model_name + ' ' + param + '.sav'
file = open(filename, 'rb')
loaded = pickle.load(file)
print("Model <" + model_name + " " + param + "> was loaded")
# Test the classifier
y_pred = int(loaded.predict(data)) <<< There is a problem