質問編集履歴

1

コード改善

2020/12/11 01:49

投稿

Sukenosuke0221
Sukenosuke0221

スコア10

test CHANGED
File without changes
test CHANGED
@@ -27,3 +27,159 @@
27
27
  return imgs
28
28
 
29
29
  ```
30
+
31
+ #エラーコード
32
+
33
+ ```ここに言語を入力
34
+
35
+ Traceback (most recent call last):
36
+
37
+
38
+
39
+ File "C:\Users\Desktop\resyuu.py", line 149, in <module>
40
+
41
+ main()
42
+
43
+
44
+
45
+ File "C:\Users\Desktop\resyuu.py", line 85, in main
46
+
47
+ imgs1 = create_images_array(load_img1_paths,model,layer_name)
48
+
49
+
50
+
51
+ File "C:\Users\Desktop\resyuu.py", line 28, in create_images_array
52
+
53
+ middle_output = middle_layer_model.predict(target)
54
+
55
+
56
+
57
+ File "C:\anaconda\lib\site-packages\tensorflow\python\keras\engine\training.py", line 130, in _method_wrapper
58
+
59
+ return method(self, *args, **kwargs)
60
+
61
+
62
+
63
+ File "C:\anaconda\lib\site-packages\tensorflow\python\keras\engine\training.py", line 1599, in predict
64
+
65
+ tmp_batch_outputs = predict_function(iterator)
66
+
67
+
68
+
69
+ File "C:\anaconda\lib\site-packages\tensorflow\python\eager\def_function.py", line 780, in __call__
70
+
71
+ result = self._call(*args, **kwds)
72
+
73
+
74
+
75
+ File "C:\anaconda\lib\site-packages\tensorflow\python\eager\def_function.py", line 823, in _call
76
+
77
+ self._initialize(args, kwds, add_initializers_to=initializers)
78
+
79
+
80
+
81
+ File "C:\anaconda\lib\site-packages\tensorflow\python\eager\def_function.py", line 697, in _initialize
82
+
83
+ *args, **kwds))
84
+
85
+
86
+
87
+ File "C:\anaconda\lib\site-packages\tensorflow\python\eager\function.py", line 2855, in _get_concrete_function_internal_garbage_collected
88
+
89
+ graph_function, _, _ = self._maybe_define_function(args, kwargs)
90
+
91
+
92
+
93
+ File "C:\anaconda\lib\site-packages\tensorflow\python\eager\function.py", line 3213, in _maybe_define_function
94
+
95
+ graph_function = self._create_graph_function(args, kwargs)
96
+
97
+
98
+
99
+ File "C:\anaconda\lib\site-packages\tensorflow\python\eager\function.py", line 3075, in _create_graph_function
100
+
101
+ capture_by_value=self._capture_by_value),
102
+
103
+
104
+
105
+ File "C:\anaconda\lib\site-packages\tensorflow\python\framework\func_graph.py", line 986, in func_graph_from_py_func
106
+
107
+ func_outputs = python_func(*func_args, **func_kwargs)
108
+
109
+
110
+
111
+ File "C:\anaconda\lib\site-packages\tensorflow\python\eager\def_function.py", line 600, in wrapped_fn
112
+
113
+ return weak_wrapped_fn().__wrapped__(*args, **kwds)
114
+
115
+
116
+
117
+ File "C:\anaconda\lib\site-packages\tensorflow\python\framework\func_graph.py", line 973, in wrapper
118
+
119
+ raise e.ag_error_metadata.to_exception(e)
120
+
121
+
122
+
123
+ ValueError: in user code:
124
+
125
+
126
+
127
+ C:\anaconda\lib\site-packages\tensorflow\python\keras\engine\training.py:1462 predict_function *
128
+
129
+ return step_function(self, iterator)
130
+
131
+ C:\anaconda\lib\site-packages\tensorflow\python\keras\engine\training.py:1452 step_function **
132
+
133
+ outputs = model.distribute_strategy.run(run_step, args=(data,))
134
+
135
+ C:\anaconda\lib\site-packages\tensorflow\python\distribute\distribute_lib.py:1211 run
136
+
137
+ return self._extended.call_for_each_replica(fn, args=args, kwargs=kwargs)
138
+
139
+ C:\anaconda\lib\site-packages\tensorflow\python\distribute\distribute_lib.py:2585 call_for_each_replica
140
+
141
+ return self._call_for_each_replica(fn, args, kwargs)
142
+
143
+ C:\anaconda\lib\site-packages\tensorflow\python\distribute\distribute_lib.py:2945 _call_for_each_replica
144
+
145
+ return fn(*args, **kwargs)
146
+
147
+ C:\anaconda\lib\site-packages\tensorflow\python\keras\engine\training.py:1445 run_step **
148
+
149
+ outputs = model.predict_step(data)
150
+
151
+ C:\anaconda\lib\site-packages\tensorflow\python\keras\engine\training.py:1418 predict_step
152
+
153
+ return self(x, training=False)
154
+
155
+ C:\anaconda\lib\site-packages\tensorflow\python\keras\engine\base_layer.py:985 __call__
156
+
157
+ outputs = call_fn(inputs, *args, **kwargs)
158
+
159
+ C:\anaconda\lib\site-packages\tensorflow\python\keras\engine\functional.py:386 call
160
+
161
+ inputs, training=training, mask=mask)
162
+
163
+ C:\anaconda\lib\site-packages\tensorflow\python\keras\engine\functional.py:508 _run_internal_graph
164
+
165
+ outputs = node.layer(*args, **kwargs)
166
+
167
+ C:\anaconda\lib\site-packages\tensorflow\python\keras\engine\base_layer.py:976 __call__
168
+
169
+ self.name)
170
+
171
+ C:\anaconda\lib\site-packages\tensorflow\python\keras\engine\input_spec.py:180 assert_input_compatibility
172
+
173
+ str(x.shape.as_list()))
174
+
175
+
176
+
177
+ ValueError: Input 0 of layer conv1_pad is incompatible with the layer: expected ndim=4, found ndim=3. Full shape received: [32, 224, 3]
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+ ```