質問編集履歴

1

ためしたことを追記した

2021/02/20 10:49

投稿

nyanryou
nyanryou

スコア20

test CHANGED
File without changes
test CHANGED
@@ -34,6 +34,52 @@
34
34
 
35
35
 
36
36
 
37
+ ```試したコード
38
+
39
+ from tensorflow import keras
40
+
41
+ from PIL import Image
42
+
43
+ import numpy as np
44
+
45
+
46
+
47
+ model = tf.keras.models.load_model('person.h5')
48
+
49
+ model.summary()
50
+
51
+ image = Image.open('C:/GraduationResearch/annotation/3000/train/me/img_0_9309.jpg')
52
+
53
+ img_resize = image.resize((150,150))
54
+
55
+
56
+
57
+ im = np.array(img_resize)
58
+
59
+
60
+
61
+ im = im/255
62
+
63
+
64
+
65
+ predictions = model.predict([im])
66
+
67
+ print(predictions)
68
+
69
+ ```
70
+
71
+
72
+
73
+ ```エラー
74
+
75
+ ValueError: Input 0 of layer sequential is incompatible with the layer: : expected min_ndim=4, found ndim=3. Full shape
76
+
77
+ received: (None, 150, 3)
78
+
79
+ ```
80
+
81
+
82
+
37
83
  ### ソースコード
38
84
 
39
85
  ```Classifier