can you please convert python code into matlab code ?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
# -*- 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 Commenti
Risposte (1)
Sivylla Paraskevopoulou
il 31 Mag 2022
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 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!