Untitled

 avatar
unknown
python
a year ago
1.2 kB
4
Indexable
imagePath='The IQ-OTHNCCD lung cancer dataset/Bengin cases/Bengin case (1).jpg'
img = cv.imread(imagePath, cv.IMREAD_GRAYSCALE)
img = cv.resize(img, (528, 528))
numOfImg = 1
test = img.copy()
path_save='result'
segment_result = get_segmented_lungs(imagePath, numOfImg, show_on_window=True)
list_filename_img = os.listdir(path_save)

list_filename_img=sorted(list_filename_img, reverse=False)
list_img = [{"filename": os.path.join('..',path_save, filename),"title":filename[:-4].replace("_"," ")} for filename in list_filename_img]

# path_image=os.path.join(path_save, list_filename_img[-1])
path_image="dataset/after_preprocessing/train_test/test/Bengin/Bengin(3).jpg"

filename_model_hybrid = os.path.join('.',"best_model", 'cnn3_svm_bestParam.pkl')
model_hybrid= pickle.load(open(filename_model_hybrid,'rb'))
img = cv.imread(path_image, cv.IMREAD_GRAYSCALE)
img = cv.resize(img, (128, 128))
predict_img = np.expand_dims(img, 0)
predict_img = predict_img.reshape(-1, 128, 128, 1)

extraction_predict_img = cnn3_hybrid.predict(predict_img)
result_predict_img = model_hybrid.predict(extraction_predict_img)
print("🚀 ~ file: myapp.py:150 ~ result_predict_img:", result_predict_img)
Editor is loading...
Leave a Comment