質問するログイン新規登録

質問編集履歴

11

追記

2020/10/28 06:19

投稿

HY_0208
HY_0208

スコア0

title CHANGED
File without changes
body CHANGED
@@ -17,9 +17,9 @@
17
17
  (ENV_NAME) C:\Users\user>mmconvert --srcFramework caffe --inputWeight C:/~/caffemodel/snapshot_iter_750.caffemodel --inputNetwork C:/~/caffemodel/train_val.prototxt --dstFamework keras --outputModel SGD30.h5 --inputShape 30,3,256,256
18
18
  ```
19
19
  ### 追記
20
- caffeをちゃんと入れていなかったので以下を参考に入れましたhttps://mugichoko.hatenablog.com/entry/2017/10/31/044806
20
+ caffeをちゃんと入れていなかったようだったので以下を参考に入れましたhttps://mugichoko.hatenablog.com/entry/2017/10/31/044806
21
21
 
22
- また、この後いろんなサイトを参考にしながらinputShapeを3 227 227に変更し回してみたところ、エラーが以下のように変わりました。
22
+ また、この後いろんなサイトを参考にしながらinputShapeを3 227 227に変更しかつ変換したいモデルのある場所で回してみたところ、エラーが以下のように変わりました。
23
23
  ```
24
24
  (ENV_NAME) C:\Users\user\Desktop\keras-grad-cam-master\caffemodel>mmconvert --srcFramework caffe --inputWeight SgdAlex30.caffemodel --inputNetwork train_val.prototxt --dstFramework keras --outputModel SgdAlex30.h5 --inputShape 3 227 227
25
25
  ```
@@ -29,9 +29,14 @@
29
29
  (中略)
30
30
  RuntimeError: Could not open file C:\Users\user\AppData\Local\Temp\tmpj05vocvw.prototxt
31
31
  ```
32
- 該当のファイルがそもそも見つからず、、、caffeの問題なのでしょうか。
32
+ ~~該当のファイルがそもそも見つからず、、、caffeの問題なのでしょうか。
33
- また、「開けない」と言われたファイルのディレクトリを絶対パスに通すと良いというのを見つけたのでやってみましたが特に変わりはありませんでした。
33
+ また、「開けない」と言われたファイルのディレクトリを絶対パスに通すと良いというのを見つけたのでやってみましたが特に変わりはありませんでした。~~
34
-
34
+ inputNetworkのファイルをtrain_val.prototxtからdeploy.prototxtファイルにしたところ、
35
+ ```
36
+ Check failed: count_ == proto.data_size() (34848 vs. 0)
37
+ ```
38
+ といったエラーに変わりました。しらべたところ、訓練に用いたcaffeのバージョン(GPU,0.17.0)と今回の変換用のバージョン(CPU,1.0?)が違うとこのように表示されるようでした。
39
+ ですので、GPU版のものを入れようと思うのですが、そのまま入れてしまって大丈夫なのでしょうか。
35
40
  ### (補足情報)
36
41
 
37
42
  python3.5(Anaconda3)上のコマンドプロンプトを使用しています

10

修正

2020/10/28 06:19

投稿

HY_0208
HY_0208

スコア0

title CHANGED
File without changes
body CHANGED
@@ -24,7 +24,10 @@
24
24
  (ENV_NAME) C:\Users\user\Desktop\keras-grad-cam-master\caffemodel>mmconvert --srcFramework caffe --inputWeight SgdAlex30.caffemodel --inputNetwork train_val.prototxt --dstFramework keras --outputModel SgdAlex30.h5 --inputShape 3 227 227
25
25
  ```
26
26
  ```
27
+ WARNING: Logging before InitGoogleLogging() is written to STDERR
28
+ I1027 13:37:01.994166 12988 upgrade_proto.cpp:67] Attempting to upgrade input file specified using deprecated input fields: C:\Users\user\AppData\Local\Temp\tmpj05vocvw.prototxt
29
+ (中略)
27
- RuntimeError: Could not open file C:\Users\user\AppData\Local\Temp\tmp_47xrshz.prototxt
30
+ RuntimeError: Could not open file C:\Users\user\AppData\Local\Temp\tmpj05vocvw.prototxt
28
31
  ```
29
32
  該当のファイルがそもそも見つからず、、、caffeの問題なのでしょうか。
30
33
  また、「開けない」と言われたファイルのディレクトリを絶対パスに通すと良いというのを見つけたのでやってみましたが特に変わりはありませんでした。

9

追記

2020/10/27 05:26

投稿

HY_0208
HY_0208

スコア0

title CHANGED
File without changes
body CHANGED
@@ -19,388 +19,16 @@
19
19
  ### 追記
20
20
  caffeをちゃんと入れていなかったので以下を参考に入れましたhttps://mugichoko.hatenablog.com/entry/2017/10/31/044806
21
21
 
22
- また、該当ファイルある場所で変換を行、また、outputModel.hdf5にしたりしたところ以下のエラーに変わりました。
22
+ また、ろんなサイト参考にしながらinputShapeを3 227 227に変更回してみたところエラーが以下のように変わりました。
23
23
  ```
24
- (ENV_NAME) C:\Users\user\Desktop\caffe-gradCAM-master\caffemodel>mmconvert --srcFramework caffe --inputWeight SgdAlex30.caffemodel --inputNetwork train_val.prototxt --dstFramework keras --outputModel SGD_Alex30.hdf5 --inputShape 1,3,227,227
24
+ (ENV_NAME) C:\Users\user\Desktop\keras-grad-cam-master\caffemodel>mmconvert --srcFramework caffe --inputWeight SgdAlex30.caffemodel --inputNetwork train_val.prototxt --dstFramework keras --outputModel SgdAlex30.h5 --inputShape 3 227 227
25
25
  ```
26
-
27
26
  ```
28
- mmconvert: error: argument --inputShape: invalid int value: '1,3,227,227'
27
+ RuntimeError: Could not open file C:\Users\user\AppData\Local\Temp\tmp_47xrshz.prototxt
29
28
  ```
30
- ※inputShape値はdeploy.prototxtinput_shapeと同じ値
29
+ 該当ファイルがそもそも見つからず、、、caffe問題なのしょうか
30
+ また、「開けない」と言われたファイルのディレクトリを絶対パスに通すと良いというのを見つけたのでやってみましたが特に変わりはありませんでした。
31
31
 
32
- また、この後入力の方法を「1,3,227,227」から「1 3 227 227」に変更してみたところ、以下のようになりました。
33
- ```
34
- WARNING: Logging before InitGoogleLogging() is written to STDERR
35
- I1023 11:42:05.834072 12172 upgrade_proto.cpp:67] Attempting to upgrade input file specified using deprecated input fields: C:\Users\7117115\AppData\Local\Temp\tmp_tb7gdlv.prototxt
36
- I1023 11:42:05.850147 12172 upgrade_proto.cpp:70] Successfully upgraded file specified using deprecated input fields.
37
- W1023 11:42:05.850147 12172 upgrade_proto.cpp:72] Note that future Caffe releases will only support input layers and not input fields.
38
- I1023 11:42:05.893544 12172 net.cpp:51] Initializing net from parameters:
39
- state {
40
- phase: TEST
41
- level: 0
42
- }
43
- layer {
44
- name: "input"
45
- type: "Input"
46
- top: "data"
47
- input_param {
48
- shape {
49
- dim: 1
50
- dim: 1
51
- dim: 3
52
- dim: 227
53
- }
54
- }
55
- }
56
- layer {
57
- name: "conv1"
58
- type: "Convolution"
59
- bottom: "data"
60
- top: "conv1"
61
- param {
62
- lr_mult: 1
63
- decay_mult: 1
64
- }
65
- param {
66
- lr_mult: 2
67
- decay_mult: 0
68
- }
69
- convolution_param {
70
- num_output: 96
71
- kernel_size: 11
72
- stride: 4
73
- weight_filler {
74
- type: "gaussian"
75
- std: 0.01
76
- }
77
- bias_filler {
78
- type: "constant"
79
- value: 0
80
- }
81
- }
82
- }
83
- layer {
84
- name: "relu1"
85
- type: "ReLU"
86
- bottom: "conv1"
87
- top: "conv1"
88
- }
89
- layer {
90
- name: "norm1"
91
- type: "LRN"
92
- bottom: "conv1"
93
- top: "norm1"
94
- lrn_param {
95
- local_size: 5
96
- alpha: 0.0001
97
- beta: 0.75
98
- }
99
- }
100
- layer {
101
- name: "pool1"
102
- type: "Pooling"
103
- bottom: "norm1"
104
- top: "pool1"
105
- pooling_param {
106
- pool: MAX
107
- kernel_size: 3
108
- stride: 2
109
- }
110
- }
111
- layer {
112
- name: "conv2"
113
- type: "Convolution"
114
- bottom: "pool1"
115
- top: "conv2"
116
- param {
117
- lr_mult: 1
118
- decay_mult: 1
119
- }
120
- param {
121
- lr_mult: 2
122
- decay_mult: 0
123
- }
124
- convolution_param {
125
- num_output: 256
126
- pad: 2
127
- kernel_size: 5
128
- group: 2
129
- weight_filler {
130
- type: "gaussian"
131
- std: 0.01
132
- }
133
- bias_filler {
134
- type: "constant"
135
- value: 0.1
136
- }
137
- }
138
- }
139
- layer {
140
- name: "relu2"
141
- type: "ReLU"
142
- bottom: "conv2"
143
- top: "conv2"
144
- }
145
- layer {
146
- name: "norm2"
147
- type: "LRN"
148
- bottom: "conv2"
149
- top: "norm2"
150
- lrn_param {
151
- local_size: 5
152
- alpha: 0.0001
153
- beta: 0.75
154
- }
155
- }
156
- layer {
157
- name: "pool2"
158
- type: "Pooling"
159
- bottom: "norm2"
160
- top: "pool2"
161
- pooling_param {
162
- pool: MAX
163
- kernel_size: 3
164
- stride: 2
165
- }
166
- }
167
- layer {
168
- name: "conv3"
169
- type: "Convolution"
170
- bottom: "pool2"
171
- top: "conv3"
172
- param {
173
- lr_mult: 1
174
- decay_mult: 1
175
- }
176
- param {
177
- lr_mult: 2
178
- decay_mult: 0
179
- }
180
- convolution_param {
181
- num_output: 384
182
- pad: 1
183
- kernel_size: 3
184
- weight_filler {
185
- type: "gaussian"
186
- std: 0.01
187
- }
188
- bias_filler {
189
- type: "constant"
190
- value: 0
191
- }
192
- }
193
- }
194
- layer {
195
- name: "relu3"
196
- type: "ReLU"
197
- bottom: "conv3"
198
- top: "conv3"
199
- }
200
- layer {
201
- name: "conv4"
202
- type: "Convolution"
203
- bottom: "conv3"
204
- top: "conv4"
205
- param {
206
- lr_mult: 1
207
- decay_mult: 1
208
- }
209
- param {
210
- lr_mult: 2
211
- decay_mult: 0
212
- }
213
- convolution_param {
214
- num_output: 384
215
- pad: 1
216
- kernel_size: 3
217
- group: 2
218
- weight_filler {
219
- type: "gaussian"
220
- std: 0.01
221
- }
222
- bias_filler {
223
- type: "constant"
224
- value: 0.1
225
- }
226
- }
227
- }
228
- layer {
229
- name: "relu4"
230
- type: "ReLU"
231
- bottom: "conv4"
232
- top: "conv4"
233
- }
234
- layer {
235
- name: "conv5"
236
- type: "Convolution"
237
- bottom: "conv4"
238
- top: "conv5"
239
- param {
240
- lr_mult: 1
241
- decay_mult: 1
242
- }
243
- param {
244
- lr_mult: 2
245
- decay_mult: 0
246
- }
247
- convolution_param {
248
- num_output: 256
249
- pad: 1
250
- kernel_size: 3
251
- group: 2
252
- weight_filler {
253
- type: "gaussian"
254
- std: 0.01
255
- }
256
- bias_filler {
257
- type: "constant"
258
- value: 0.1
259
- }
260
- }
261
- }
262
- layer {
263
- name: "relu5"
264
- type: "ReLU"
265
- bottom: "conv5"
266
- top: "conv5"
267
- }
268
- layer {
269
- name: "pool5"
270
- type: "Pooling"
271
- bottom: "conv5"
272
- top: "pool5"
273
- pooling_param {
274
- pool: MAX
275
- kernel_size: 3
276
- stride: 2
277
- }
278
- }
279
- layer {
280
- name: "fc6"
281
- type: "InnerProduct"
282
- bottom: "pool5"
283
- top: "fc6"
284
- param {
285
- lr_mult: 1
286
- decay_mult: 1
287
- }
288
- param {
289
- lr_mult: 2
290
- decay_mult: 0
291
- }
292
- inner_product_param {
293
- num_output: 4096
294
- weight_filler {
295
- type: "gaussian"
296
- std: 0.005
297
- }
298
- bias_filler {
299
- type: "constant"
300
- value: 0.1
301
- }
302
- }
303
- }
304
- layer {
305
- name: "relu6"
306
- type: "ReLU"
307
- bottom: "fc6"
308
- top: "fc6"
309
- }
310
- layer {
311
- name: "drop6"
312
- type: "Dropout"
313
- bottom: "fc6"
314
- top: "fc6"
315
- dropout_param {
316
- dropout_ratio: 0.5
317
- }
318
- }
319
- layer {
320
- name: "fc7"
321
- type: "InnerProduct"
322
- bottom: "fc6"
323
- top: "fc7"
324
- param {
325
- lr_mult: 1
326
- decay_mult: 1
327
- }
328
- param {
329
- lr_mult: 2
330
- decay_mult: 0
331
- }
332
- inner_product_param {
333
- num_output: 4096
334
- weight_filler {
335
- type: "gaussian"
336
- std: 0.005
337
- }
338
- bias_filler {
339
- type: "constant"
340
- value: 0.1
341
- }
342
- }
343
- }
344
- layer {
345
- name: "relu7"
346
- type: "ReLU"
347
- bottom: "fc7"
348
- top: "fc7"
349
- }
350
- layer {
351
- name: "drop7"
352
- type: "Dropout"
353
- bottom: "fc7"
354
- top: "fc7"
355
- dropout_param {
356
- dropout_ratio: 0.5
357
- }
358
- }
359
- layer {
360
- name: "fc8"
361
- type: "InnerProduct"
362
- bottom: "fc7"
363
- top: "fc8"
364
- param {
365
- lr_mult: 1
366
- decay_mult: 1
367
- }
368
- param {
369
- lr_mult: 2
370
- decay_mult: 0
371
- }
372
- inner_product_param {
373
- num_output: 2
374
- weight_filler {
375
- type: "gaussian"
376
- std: 0.01
377
- }
378
- bias_filler {
379
- type: "constant"
380
- value: 0
381
- }
382
- }
383
- }
384
- layer {
385
- name: "prob"
386
- type: "Softmax"
387
- bottom: "fc8"
388
- top: "prob"
389
- }
390
- I1023 11:42:05.895570 12172 layer_factory.cpp:58] Creating layer input
391
- I1023 11:42:05.971525 12172 net.cpp:84] Creating Layer input
392
- I1023 11:42:05.971525 12172 net.cpp:380] input -> data
393
- I1023 11:42:05.981457 12172 net.cpp:122] Setting up input
394
- I1023 11:42:05.990782 12172 net.cpp:129] Top shape: 1 1 3 227 (681)
395
- I1023 11:42:05.990782 12172 net.cpp:137] Memory required for data: 2724
396
- I1023 11:42:05.991809 12172 layer_factory.cpp:58] Creating layer conv1
397
- I1023 11:42:05.992776 12172 net.cpp:84] Creating Layer conv1
398
- I1023 11:42:05.994771 12172 net.cpp:406] conv1 <- data
399
- I1023 11:42:05.994771 12172 net.cpp:380] conv1 -> conv1
400
- I1023 11:42:05.997732 12172 common.cpp:36] System entropy source not available, using fallback algorithm to generate seed instead.
401
- F1023 11:42:05.997732 12172 blob.cpp:32] Check failed: shape[i] >= 0 (-1 vs. 0)
402
- *** Check failure stack trace: ***
403
- ```
404
32
  ### (補足情報)
405
33
 
406
34
  python3.5(Anaconda3)上のコマンドプロンプトを使用しています

8

追記

2020/10/27 03:14

投稿

HY_0208
HY_0208

スコア0

title CHANGED
File without changes
body CHANGED
@@ -23,37 +23,383 @@
23
23
  ```
24
24
  (ENV_NAME) C:\Users\user\Desktop\caffe-gradCAM-master\caffemodel>mmconvert --srcFramework caffe --inputWeight SgdAlex30.caffemodel --inputNetwork train_val.prototxt --dstFramework keras --outputModel SGD_Alex30.hdf5 --inputShape 1,3,227,227
25
25
  ```
26
+
26
27
  ```
27
28
  mmconvert: error: argument --inputShape: invalid int value: '1,3,227,227'
28
29
  ```
29
30
  ※inputShapeの値はdeploy.prototxtのinput_shapeと同じ値です。
30
31
 
31
- また、この後入力の方法を「1,3,227,227」から「13227227」に変更してみたところ、以下のようにエラーが変わりました。最後の箇所を読むとheightとwidthを入力する必要があるようです
32
+ また、この後入力の方法を「1,3,227,227」から「1 3 227 227」に変更してみたところ、以下のようにりました。
32
33
  ```
33
- ------------------------------------------------------------
34
- WARNING: PyCaffe not found!
35
- Falling back to a pure protocol buffer implementation.
36
- * Conversions will be drastically slower.
37
- * This backend is UNTESTED!
38
- ------------------------------------------------------------
39
-
40
- Traceback (most recent call last):
41
- File "c:\users\user\anaconda3\envs\env_name\lib\runpy.py", line 193, in _run_module_as_main
42
- "__main__", mod_spec)
43
- File "c:\users\user\anaconda3\envs\env_name\lib\runpy.py", line 85, in _run_code
44
- exec(code, run_globals)
45
- File "C:\Users\user\anaconda3\envs\ENV_NAME\Scripts\mmconvert.exe\__main__.py", line 7, in <module>
46
- File "c:\users\user\anaconda3\envs\env_name\lib\site-packages\mmdnn\conversion\_script\convert.py", line 89, in _main
47
- ret = convertToIR._convert(ir_args)
48
- File "c:\users\user\anaconda3\envs\env_name\lib\site-packages\mmdnn\conversion\_script\convertToIR.py", line 9, in _convert
49
- transformer = CaffeTransformer(args.network, args.weights, "tensorflow", args.inputShape, phase = args.caffePhase)
50
- File "c:\users\user\anaconda3\envs\env_name\lib\site-packages\mmdnn\conversion\caffe\transformer.py", line 316, in __init__
51
- graph = GraphBuilder(def_path, self.input_shape, self.is_train_proto, phase).build()
52
- File "c:\users\user\anaconda3\envs\env_name\lib\site-packages\mmdnn\conversion\caffe\graph.py", line 447, in build
53
- graph.compute_output_shapes(self.model)
54
- File "c:\users\user\anaconda3\envs\env_name\lib\site-packages\mmdnn\conversion\caffe\graph.py", line 271, in compute_output_shapes
55
- node.output_shape = TensorShape(*NodeKind.compute_output_shape(node))
56
- TypeError: __new__() missing 2 required positional arguments: 'height' and 'width'
34
+ WARNING: Logging before InitGoogleLogging() is written to STDERR
35
+ I1023 11:42:05.834072 12172 upgrade_proto.cpp:67] Attempting to upgrade input file specified using deprecated input fields: C:\Users\7117115\AppData\Local\Temp\tmp_tb7gdlv.prototxt
36
+ I1023 11:42:05.850147 12172 upgrade_proto.cpp:70] Successfully upgraded file specified using deprecated input fields.
37
+ W1023 11:42:05.850147 12172 upgrade_proto.cpp:72] Note that future Caffe releases will only support input layers and not input fields.
38
+ I1023 11:42:05.893544 12172 net.cpp:51] Initializing net from parameters:
39
+ state {
40
+ phase: TEST
41
+ level: 0
42
+ }
43
+ layer {
44
+ name: "input"
45
+ type: "Input"
46
+ top: "data"
47
+ input_param {
48
+ shape {
49
+ dim: 1
50
+ dim: 1
51
+ dim: 3
52
+ dim: 227
53
+ }
54
+ }
55
+ }
56
+ layer {
57
+ name: "conv1"
58
+ type: "Convolution"
59
+ bottom: "data"
60
+ top: "conv1"
61
+ param {
62
+ lr_mult: 1
63
+ decay_mult: 1
64
+ }
65
+ param {
66
+ lr_mult: 2
67
+ decay_mult: 0
68
+ }
69
+ convolution_param {
70
+ num_output: 96
71
+ kernel_size: 11
72
+ stride: 4
73
+ weight_filler {
74
+ type: "gaussian"
75
+ std: 0.01
76
+ }
77
+ bias_filler {
78
+ type: "constant"
79
+ value: 0
80
+ }
81
+ }
82
+ }
83
+ layer {
84
+ name: "relu1"
85
+ type: "ReLU"
86
+ bottom: "conv1"
87
+ top: "conv1"
88
+ }
89
+ layer {
90
+ name: "norm1"
91
+ type: "LRN"
92
+ bottom: "conv1"
93
+ top: "norm1"
94
+ lrn_param {
95
+ local_size: 5
96
+ alpha: 0.0001
97
+ beta: 0.75
98
+ }
99
+ }
100
+ layer {
101
+ name: "pool1"
102
+ type: "Pooling"
103
+ bottom: "norm1"
104
+ top: "pool1"
105
+ pooling_param {
106
+ pool: MAX
107
+ kernel_size: 3
108
+ stride: 2
109
+ }
110
+ }
111
+ layer {
112
+ name: "conv2"
113
+ type: "Convolution"
114
+ bottom: "pool1"
115
+ top: "conv2"
116
+ param {
117
+ lr_mult: 1
118
+ decay_mult: 1
119
+ }
120
+ param {
121
+ lr_mult: 2
122
+ decay_mult: 0
123
+ }
124
+ convolution_param {
125
+ num_output: 256
126
+ pad: 2
127
+ kernel_size: 5
128
+ group: 2
129
+ weight_filler {
130
+ type: "gaussian"
131
+ std: 0.01
132
+ }
133
+ bias_filler {
134
+ type: "constant"
135
+ value: 0.1
136
+ }
137
+ }
138
+ }
139
+ layer {
140
+ name: "relu2"
141
+ type: "ReLU"
142
+ bottom: "conv2"
143
+ top: "conv2"
144
+ }
145
+ layer {
146
+ name: "norm2"
147
+ type: "LRN"
148
+ bottom: "conv2"
149
+ top: "norm2"
150
+ lrn_param {
151
+ local_size: 5
152
+ alpha: 0.0001
153
+ beta: 0.75
154
+ }
155
+ }
156
+ layer {
157
+ name: "pool2"
158
+ type: "Pooling"
159
+ bottom: "norm2"
160
+ top: "pool2"
161
+ pooling_param {
162
+ pool: MAX
163
+ kernel_size: 3
164
+ stride: 2
165
+ }
166
+ }
167
+ layer {
168
+ name: "conv3"
169
+ type: "Convolution"
170
+ bottom: "pool2"
171
+ top: "conv3"
172
+ param {
173
+ lr_mult: 1
174
+ decay_mult: 1
175
+ }
176
+ param {
177
+ lr_mult: 2
178
+ decay_mult: 0
179
+ }
180
+ convolution_param {
181
+ num_output: 384
182
+ pad: 1
183
+ kernel_size: 3
184
+ weight_filler {
185
+ type: "gaussian"
186
+ std: 0.01
187
+ }
188
+ bias_filler {
189
+ type: "constant"
190
+ value: 0
191
+ }
192
+ }
193
+ }
194
+ layer {
195
+ name: "relu3"
196
+ type: "ReLU"
197
+ bottom: "conv3"
198
+ top: "conv3"
199
+ }
200
+ layer {
201
+ name: "conv4"
202
+ type: "Convolution"
203
+ bottom: "conv3"
204
+ top: "conv4"
205
+ param {
206
+ lr_mult: 1
207
+ decay_mult: 1
208
+ }
209
+ param {
210
+ lr_mult: 2
211
+ decay_mult: 0
212
+ }
213
+ convolution_param {
214
+ num_output: 384
215
+ pad: 1
216
+ kernel_size: 3
217
+ group: 2
218
+ weight_filler {
219
+ type: "gaussian"
220
+ std: 0.01
221
+ }
222
+ bias_filler {
223
+ type: "constant"
224
+ value: 0.1
225
+ }
226
+ }
227
+ }
228
+ layer {
229
+ name: "relu4"
230
+ type: "ReLU"
231
+ bottom: "conv4"
232
+ top: "conv4"
233
+ }
234
+ layer {
235
+ name: "conv5"
236
+ type: "Convolution"
237
+ bottom: "conv4"
238
+ top: "conv5"
239
+ param {
240
+ lr_mult: 1
241
+ decay_mult: 1
242
+ }
243
+ param {
244
+ lr_mult: 2
245
+ decay_mult: 0
246
+ }
247
+ convolution_param {
248
+ num_output: 256
249
+ pad: 1
250
+ kernel_size: 3
251
+ group: 2
252
+ weight_filler {
253
+ type: "gaussian"
254
+ std: 0.01
255
+ }
256
+ bias_filler {
257
+ type: "constant"
258
+ value: 0.1
259
+ }
260
+ }
261
+ }
262
+ layer {
263
+ name: "relu5"
264
+ type: "ReLU"
265
+ bottom: "conv5"
266
+ top: "conv5"
267
+ }
268
+ layer {
269
+ name: "pool5"
270
+ type: "Pooling"
271
+ bottom: "conv5"
272
+ top: "pool5"
273
+ pooling_param {
274
+ pool: MAX
275
+ kernel_size: 3
276
+ stride: 2
277
+ }
278
+ }
279
+ layer {
280
+ name: "fc6"
281
+ type: "InnerProduct"
282
+ bottom: "pool5"
283
+ top: "fc6"
284
+ param {
285
+ lr_mult: 1
286
+ decay_mult: 1
287
+ }
288
+ param {
289
+ lr_mult: 2
290
+ decay_mult: 0
291
+ }
292
+ inner_product_param {
293
+ num_output: 4096
294
+ weight_filler {
295
+ type: "gaussian"
296
+ std: 0.005
297
+ }
298
+ bias_filler {
299
+ type: "constant"
300
+ value: 0.1
301
+ }
302
+ }
303
+ }
304
+ layer {
305
+ name: "relu6"
306
+ type: "ReLU"
307
+ bottom: "fc6"
308
+ top: "fc6"
309
+ }
310
+ layer {
311
+ name: "drop6"
312
+ type: "Dropout"
313
+ bottom: "fc6"
314
+ top: "fc6"
315
+ dropout_param {
316
+ dropout_ratio: 0.5
317
+ }
318
+ }
319
+ layer {
320
+ name: "fc7"
321
+ type: "InnerProduct"
322
+ bottom: "fc6"
323
+ top: "fc7"
324
+ param {
325
+ lr_mult: 1
326
+ decay_mult: 1
327
+ }
328
+ param {
329
+ lr_mult: 2
330
+ decay_mult: 0
331
+ }
332
+ inner_product_param {
333
+ num_output: 4096
334
+ weight_filler {
335
+ type: "gaussian"
336
+ std: 0.005
337
+ }
338
+ bias_filler {
339
+ type: "constant"
340
+ value: 0.1
341
+ }
342
+ }
343
+ }
344
+ layer {
345
+ name: "relu7"
346
+ type: "ReLU"
347
+ bottom: "fc7"
348
+ top: "fc7"
349
+ }
350
+ layer {
351
+ name: "drop7"
352
+ type: "Dropout"
353
+ bottom: "fc7"
354
+ top: "fc7"
355
+ dropout_param {
356
+ dropout_ratio: 0.5
357
+ }
358
+ }
359
+ layer {
360
+ name: "fc8"
361
+ type: "InnerProduct"
362
+ bottom: "fc7"
363
+ top: "fc8"
364
+ param {
365
+ lr_mult: 1
366
+ decay_mult: 1
367
+ }
368
+ param {
369
+ lr_mult: 2
370
+ decay_mult: 0
371
+ }
372
+ inner_product_param {
373
+ num_output: 2
374
+ weight_filler {
375
+ type: "gaussian"
376
+ std: 0.01
377
+ }
378
+ bias_filler {
379
+ type: "constant"
380
+ value: 0
381
+ }
382
+ }
383
+ }
384
+ layer {
385
+ name: "prob"
386
+ type: "Softmax"
387
+ bottom: "fc8"
388
+ top: "prob"
389
+ }
390
+ I1023 11:42:05.895570 12172 layer_factory.cpp:58] Creating layer input
391
+ I1023 11:42:05.971525 12172 net.cpp:84] Creating Layer input
392
+ I1023 11:42:05.971525 12172 net.cpp:380] input -> data
393
+ I1023 11:42:05.981457 12172 net.cpp:122] Setting up input
394
+ I1023 11:42:05.990782 12172 net.cpp:129] Top shape: 1 1 3 227 (681)
395
+ I1023 11:42:05.990782 12172 net.cpp:137] Memory required for data: 2724
396
+ I1023 11:42:05.991809 12172 layer_factory.cpp:58] Creating layer conv1
397
+ I1023 11:42:05.992776 12172 net.cpp:84] Creating Layer conv1
398
+ I1023 11:42:05.994771 12172 net.cpp:406] conv1 <- data
399
+ I1023 11:42:05.994771 12172 net.cpp:380] conv1 -> conv1
400
+ I1023 11:42:05.997732 12172 common.cpp:36] System entropy source not available, using fallback algorithm to generate seed instead.
401
+ F1023 11:42:05.997732 12172 blob.cpp:32] Check failed: shape[i] >= 0 (-1 vs. 0)
402
+ *** Check failure stack trace: ***
57
403
  ```
58
404
  ### (補足情報)
59
405
 

7

修正

2020/10/23 02:50

投稿

HY_0208
HY_0208

スコア0

title CHANGED
File without changes
body CHANGED
@@ -28,7 +28,7 @@
28
28
  ```
29
29
  ※inputShapeの値はdeploy.prototxtのinput_shapeと同じ値です。
30
30
 
31
- また、この後入力の方法を「1,3,227,227」から「13227227」に変更した見たところ、以下のようにエラーが変わりました
31
+ また、この後入力の方法を「1,3,227,227」から「13227227」に変更してみたところ、以下のようにエラーが変わりました。最後の箇所を読むとheightとwidthを入力する必要があるようです
32
32
  ```
33
33
  ------------------------------------------------------------
34
34
  WARNING: PyCaffe not found!

6

追記

2020/10/22 08:02

投稿

HY_0208
HY_0208

スコア0

title CHANGED
File without changes
body CHANGED
@@ -26,7 +26,35 @@
26
26
  ```
27
27
  mmconvert: error: argument --inputShape: invalid int value: '1,3,227,227'
28
28
  ```
29
- おそらくinputShapeの値(deploy.prototxtのinput_shapeと同じ値)が違うのしょうが、よくわかりません…
29
+ inputShapeの値deploy.prototxtのinput_shapeと同じ値です。
30
- ### 補足情報)
31
30
 
31
+ また、この後入力の方法を「1,3,227,227」から「13227227」に変更した見たところ、以下のようにエラーが変わりました
32
+ ```
33
+ ------------------------------------------------------------
34
+ WARNING: PyCaffe not found!
35
+ Falling back to a pure protocol buffer implementation.
36
+ * Conversions will be drastically slower.
37
+ * This backend is UNTESTED!
38
+ ------------------------------------------------------------
39
+
40
+ Traceback (most recent call last):
41
+ File "c:\users\user\anaconda3\envs\env_name\lib\runpy.py", line 193, in _run_module_as_main
42
+ "__main__", mod_spec)
43
+ File "c:\users\user\anaconda3\envs\env_name\lib\runpy.py", line 85, in _run_code
44
+ exec(code, run_globals)
45
+ File "C:\Users\user\anaconda3\envs\ENV_NAME\Scripts\mmconvert.exe\__main__.py", line 7, in <module>
46
+ File "c:\users\user\anaconda3\envs\env_name\lib\site-packages\mmdnn\conversion\_script\convert.py", line 89, in _main
47
+ ret = convertToIR._convert(ir_args)
48
+ File "c:\users\user\anaconda3\envs\env_name\lib\site-packages\mmdnn\conversion\_script\convertToIR.py", line 9, in _convert
49
+ transformer = CaffeTransformer(args.network, args.weights, "tensorflow", args.inputShape, phase = args.caffePhase)
50
+ File "c:\users\user\anaconda3\envs\env_name\lib\site-packages\mmdnn\conversion\caffe\transformer.py", line 316, in __init__
51
+ graph = GraphBuilder(def_path, self.input_shape, self.is_train_proto, phase).build()
52
+ File "c:\users\user\anaconda3\envs\env_name\lib\site-packages\mmdnn\conversion\caffe\graph.py", line 447, in build
53
+ graph.compute_output_shapes(self.model)
54
+ File "c:\users\user\anaconda3\envs\env_name\lib\site-packages\mmdnn\conversion\caffe\graph.py", line 271, in compute_output_shapes
55
+ node.output_shape = TensorShape(*NodeKind.compute_output_shape(node))
56
+ TypeError: __new__() missing 2 required positional arguments: 'height' and 'width'
57
+ ```
58
+ ### (補足情報)
59
+
32
60
  python3.5(Anaconda3)上のコマンドプロンプトを使用しています

5

修正

2020/10/22 07:56

投稿

HY_0208
HY_0208

スコア0

title CHANGED
File without changes
body CHANGED
@@ -26,7 +26,7 @@
26
26
  ```
27
27
  mmconvert: error: argument --inputShape: invalid int value: '1,3,227,227'
28
28
  ```
29
- おそらくinputShapeの値(ファイルに入力されていたinput_shapeからってきています)が違うのでしょうがよくわかりません…
29
+ おそらくinputShapeの値(deploy.prototxtのinput_shapeと同じ値)が違うのでしょうがよくわかりません…
30
30
  ### 補足情報)
31
31
 
32
32
  python3.5(Anaconda3)上のコマンドプロンプトを使用しています

4

修正・修正

2020/10/22 07:46

投稿

HY_0208
HY_0208

スコア0

title CHANGED
File without changes
body CHANGED
@@ -3,7 +3,7 @@
3
3
  題の通りです。
4
4
  http://blog.abars.biz/archives/52453748.html
5
5
  https://catdance124.hatenablog.jp/entry/2019/07/30/174908
6
- こちらを参考にしつつcaffeモデルをkerasモデルに変換しようと試みているのですが、うまくいきません。また、エラーメッセージについても検索にかけましたがよくわかりませんでした
6
+ こちらを参考にしつつ、DIGITS6.1.1で作成したcaffeモデルをkerasモデルに変換しようと試みているのですが、うまくいきません。また、エラーメッセージについても検索にかけましたがよくわかりませんでした
7
7
 
8
8
  ### 発生している問題・エラーメッセージ
9
9
 
@@ -14,13 +14,19 @@
14
14
  ### 該当のソースコード
15
15
 
16
16
  ```
17
-
18
17
  (ENV_NAME) C:\Users\user>mmconvert --srcFramework caffe --inputWeight C:/~/caffemodel/snapshot_iter_750.caffemodel --inputNetwork C:/~/caffemodel/train_val.prototxt --dstFamework keras --outputModel SGD30.h5 --inputShape 30,3,256,256
19
18
  ```
20
- ### 追加で試してみたこと
19
+ ### 追
21
- caffeをちゃんと入れていなかったのでhttps://mugichoko.hatenablog.com/entry/2017/10/31/044806
20
+ caffeをちゃんと入れていなかったので以下を参考に入れましたhttps://mugichoko.hatenablog.com/entry/2017/10/31/044806
22
- を参考に入れました
23
21
 
22
+ また、該当ファイルのある場所で変換を行い、また、outputModelを.hdf5にしたりなどしたところ以下のエラーに変わりました。
23
+ ```
24
+ (ENV_NAME) C:\Users\user\Desktop\caffe-gradCAM-master\caffemodel>mmconvert --srcFramework caffe --inputWeight SgdAlex30.caffemodel --inputNetwork train_val.prototxt --dstFramework keras --outputModel SGD_Alex30.hdf5 --inputShape 1,3,227,227
25
+ ```
26
+ ```
27
+ mmconvert: error: argument --inputShape: invalid int value: '1,3,227,227'
28
+ ```
29
+ おそらくinputShapeの値(別のファイルに入力されていたinput_shapeからとってきています)が違うのでしょうがよくわかりません…
24
30
  ### 補足情報)
25
31
 
26
32
  python3.5(Anaconda3)上のコマンドプロンプトを使用しています

3

修正

2020/10/22 06:55

投稿

HY_0208
HY_0208

スコア0

title CHANGED
File without changes
body CHANGED
@@ -15,13 +15,12 @@
15
15
 
16
16
  ```
17
17
 
18
- (ENV_NAME) C:\Users\user>mmconvert --srcFramework caffe --inputWeight C:/~/caffemodel/snapshot_iter_750.caffemodel --inputNetwork C:/~/caffemodel/train_val.prototxt --dstFamework keras --outputModel SGD30.h5 --inputShape 1,3,224,224
18
+ (ENV_NAME) C:\Users\user>mmconvert --srcFramework caffe --inputWeight C:/~/caffemodel/snapshot_iter_750.caffemodel --inputNetwork C:/~/caffemodel/train_val.prototxt --dstFamework keras --outputModel SGD30.h5 --inputShape 30,3,256,256
19
19
  ```
20
+ ### 追加で試してみたこと
21
+ caffeをちゃんと入れていなかったのでhttps://mugichoko.hatenablog.com/entry/2017/10/31/044806
22
+ を参考に入れました
20
23
 
21
24
  ### 補足情報)
22
25
 
23
- python3.5(Anaconda3)上のコマンドプロンプトを使用しています
26
+ python3.5(Anaconda3)上のコマンドプロンプトを使用しています
24
-
25
- ### 追加で試してみたこと
26
- caffeをちゃんと入れていなかったのでhttps://mugichoko.hatenablog.com/entry/2017/10/31/044806
27
- を参考に入れました

2

追記

2020/10/22 06:29

投稿

HY_0208
HY_0208

スコア0

title CHANGED
File without changes
body CHANGED
@@ -20,4 +20,8 @@
20
20
 
21
21
  ### 補足情報)
22
22
 
23
- python3.5(Anaconda3)上のコマンドプロンプトを使用しています
23
+ python3.5(Anaconda3)上のコマンドプロンプトを使用しています
24
+
25
+ ### 追加で試してみたこと
26
+ caffeをちゃんと入れていなかったのでhttps://mugichoko.hatenablog.com/entry/2017/10/31/044806
27
+ を参考に入れました

1

追記

2020/10/22 06:27

投稿

HY_0208
HY_0208

スコア0

title CHANGED
File without changes
body CHANGED
@@ -3,7 +3,7 @@
3
3
  題の通りです。
4
4
  http://blog.abars.biz/archives/52453748.html
5
5
  https://catdance124.hatenablog.jp/entry/2019/07/30/174908
6
- こちらを参考にしつつcaffeモデルをkerasモデルに変換しようと試みているのですが、うまくいきません。
6
+ こちらを参考にしつつcaffeモデルをkerasモデルに変換しようと試みているのですが、うまくいきません。また、エラーメッセージについても検索にかけましたがよくわかりませんでした
7
7
 
8
8
  ### 発生している問題・エラーメッセージ
9
9