I tried to train new ResNet50 model, and it seemed quite good on the result.
![Uploading Screenshot from 2022-08-24 10-05-51.png…]()
However, when I tried to evaluate using
python3 train_eval.py --eval path-to-model.h5
the evaluation result on 'test' part is bad
Also when I tried to use the model to predict single image class, it also went bad.
Here is my code for single image prediction.(quote some lines from your work)
Where did I do wrong in this thanks!
from keras.models import load_model
from keras.preprocessing.image import load_img
from keras.preprocessing.image import img_to_array
from keras.applications.resnet50 import preprocess_input
from keras.applications.resnet50 import decode_predictions
import cv2
import numpy as np
path_to_model = ....
model= load_model(path_to_model)
image = cv2.imread("027491_007.png")
image = cv2.resize(image,(224,224))
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
image = (image.astype(np.float32) - 116)/128.
x = np.empty([1] + list((224,224)) + [3], dtype=np.float32)
x[0, ...] = image
predict = model.predict(x);
pred_idx = np.argmax(predict)
print(predict,pred_idx)
Hi Jakub,
I tried to train new ResNet50 model, and it seemed quite good on the result. ![Uploading Screenshot from 2022-08-24 10-05-51.png…]() However, when I tried to evaluate using
python3 train_eval.py --eval path-to-model.h5
the evaluation result on 'test' part is badAlso when I tried to use the model to predict single image class, it also went bad. Here is my code for single image prediction.(quote some lines from your work) Where did I do wrong in this thanks!