can you please convert python code into matlab code ?
조회 수: 1 (최근 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!