8000 Error in conversion of Inception Model from Keras to CNTK · Issue #19 · microsoft/MMdnn · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Error in conversion of Inception Model from Keras to CNTK #19
Closed
@coolrishi2005

Description

@coolrishi2005

Hi kitstar,

I have saved Inception Model and its Weights using the below code:

import numpy as np
import tensorflow as tf
import os
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Dropout, Flatten, Dense
from keras import applications

BackEndModel = applications.InceptionV3(include_top=False, weights='imagenet')
model_json = BackEndModel.to_json()
with open("incpetionTopModel.json", "w") as json_file:
json_file.write(model_json)
BackEndModel.save_weights("incpetionTopModel.h5")

Now, I want to convert this model and weight files to cntk. Using the standard procedure as mentioned in mmdnn documentation, I am getting the following error in the last step (After generating the CNTK code snippet, you can convert the code and IR weights file to CNTK original model). Following is the error trace:

(C:\Program Files\Anaconda3\envs\py35) >python -m mmdnn.conversion.examples.cntk.imagenet_test
-n cntkInceptionTopModel.py -w IRIncpetionTopModel.npy --dump cntkInceptionTopMo
del.dnn
Selected CPU as the process wide default device.
C:\Program Files\Anaconda3\envs\py35\lib\site-packages\cntk\core.py:82: RuntimeW
arning: data is not C contiguous; rearrange your data/computation to avoid costl
y data conversions
RuntimeWarning)
Traceback (most recent call last):
File "C:\Program Files\Anaconda3\envs\py35\lib\runpy.py", line 184, in _run_mo
dule_as_main
"main", mod_spec)
File "C:\Program Files\Anaconda3\envs\py35\lib\runpy.py", line 85, in run_cod
e
exec(code, run_globals)
File "C:\Program Files\Anaconda3\envs\py35\lib\site-packages\mmdnn\conversion
examples\cntk\imagenet_test.py", line 57, in
tester = TestCNTK()
File "C:\Program Files\Anaconda3\envs\py35\lib\site-packages\mmdnn\conversion
examples\cntk\imagenet_test.py", line 22, in init
self.model = self.MainModel.KitModel(self.args.w)
File "D:\Rishi\Machine Learning\CNTK\MMdnn-master\mmdnn\conversion\cntk\cntkIn
ceptionTopModel.py", line 27, in KitModel
conv2d_189 = convolution(input_3, strides = (2, 2,), auto_padding = [Fa
lse, False, False], name = 'conv2d_189')
File "D:\Rishi\Machine Learning\CNTK\MMdnn-master\mmdnn\conversion\cntk\cntkIn
ceptionTopModel.py", line 374, in convolution
input = cntk.transpose(input, [dim - 2] + list(range(0, dim - 2)))
File "C:\Program Files\Anaconda3\envs\py35\lib\site-packages\cntk\internal\swi
g_helper.py", line 69, in wrapper
result = f(*args, **kwds)
File "C:\Program Files\Anaconda3\envs\py35\lib\site-packages\cntk\ops_init

.py", line 2056, in transpose
return transpose(x, perm, name)
RuntimeError: invalid vector subscript

Kindly help me out with it.
I have already added -node add as suggested by you while generating IRCode from Keras Model.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0