-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfinal.py
More file actions
26 lines (20 loc) · 704 Bytes
/
final.py
File metadata and controls
26 lines (20 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from utils import load_data
import tensorflow as tf
import numpy as np
import cv2
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
(feature, labels) = load_data()
x_train, x_test, y_train, y_test = train_test_split(
feature, labels, test_size=0.1)
cat = ['daisy', 'dandelion', 'rose', 'sunflower', 'tulip']
model = tf.keras.models.load_model('mod.h5')
pred = model.predict(x_test)
print(pred.shape)
for i in range(20, 30):
img = cv2.cvtColor(x_test[i], cv2.COLOR_BGR2RGB)
plt.imshow(img)
plt.xlabel('Actual:'+cat[y_test[i]]+'\n'+'Prediction: '
+ cat[np.argmax(pred[i])])
plt.xticks([])
plt.show()