can you please convert python code into matlab code ?
7 次查看(过去 30 天)
显示 更早的评论
# -*- coding: utf-8 -*- """ Created on Tue March 3 18:02:51 2022 @author: MRANAL """ from tensorflow.keras.models import load_model import cv2 import numpy as np best_model = load_model('modelsave.h5') pred_img = cv2.imread('./predicting/lungp_ben2.jpeg') pred_img = cv2.resize(pred_img, (80,80)) pred_img = pred_img/255; pred_img = np.asarray(pred_img).reshape((-1, 80, 80, 3)) ans = best_model.predict(pred_img) lis = ans.tolist() result = lis[0].index(max(lis[0])) if result==0: print("Benign tissue") elif result==1: print("Adenocarcinoma") else: print("Squamous cell carcinoma")
0 个评论
回答(1 个)
Sivylla Paraskevopoulou
2022-5-31
Save the TensorFlow model that you created in the SavedModel format, and then you can import the TensorFlow model into MATLAB by using the importTensorFlowNetworkNetwork function.
For an example on how to compare inference results between the TensorFlow model and the imported MATLAB network, see Inference Comparison Between TensorFlow and Imported Networks for Image Classification.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!