Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Error: Caffe -> IR -> CNTK #48
I want to convert a SqueezeNet model to CNTK. For instance, https://github.com/DeepScale/SqueezeNet/tree/master/SqueezeNet_v1.1
When I try to generate the CNTK model using the generated python script as well as the .npy file, which I retrieved using the following steps, I am receiving the error posted below.
With caffe I get with both networks the following output:
Like recently, this is the call I make:
(not changed at all within this issue and the last issue -> without coffe this step works)
I use the 3.5 CPU Release Version from here: https://github.com/BVLC/caffe/tree/windows
With Caffe even v1.1 of the SqueezeNet model stopped working (also the same error)
Hi @aWeinzierl , tested with ubuntu 16.04, python3.5.2, caffe 1.0.0, cntk 2.3. No error with Squeezenet 1.1.
$ python3 -m mmdnn.conversion.examples.caffe.extract_model -n squeezenet -i mmdnn/conversion/examples/data/seagull.jpg . . . [(21, 0.5285601), (128, 0.071685813), (144, 0.064104252), (416, 0.050044473), (22, 0.049522042)]
$ mv deploy.txt squeezenet_v1.1.prototxt
$ python3 -m mmdnn.conversion._script.convertToIR -f caffe -d kit_imagenet -n squeezenet_v1.1.prototxt -w squeezenet_v1.1.caffemodel . . . IR network structure is saved as [kit_imagenet.json]. IR network structure is saved as [kit_imagenet.pb]. IR weights are saved as [kit_imagenet.npy].
$ python3 -m mmdnn.conversion._script.IRToCode -f cntk -in kit_imagenet.pb -iw kit_imagenet.npy -d kit_imagenet.py Parse file [kit_imagenet.pb] with binary format successfully. Target network code snippet is saved as [kit_imagenet.py].
$ python3 -m mmdnn.conversion.examples.cntk.imagenet_test -p squeezenet -s caffe -n kit_imagenet.py -w kit_imagenet.npy [(21, 0.52856004), (128, 0.071685657), (144, 0.064104237), (416, 0.050044276), (22, 0.049522318)] Test model [squeezenet] from [caffe] passed.
The inference result is almost equal.
$ python3 -m mmdnn.conversion.examples.cntk.imagenet_test -n kit_imagenet.py -w kit_imagenet.npy --dump caffe_squeezenet.dnn CNTK model file is saved as [caffe_squeezenet.dnn], generated by [kit_imagenet.py] and [kit_imagenet.npy].
Thank you for the step by step guidance. It works with my configuration, too.
The problem was that caffe does not accept training proto files. Although it works without any problems with a training proto while I do not use caffe.
But, I ran into the same problem like before (when I did not use caffe). This also happens with the official SqueezeNet1.0 model and proto from here. This should exclude a wrong conversion.
(reference to the first code insertion in post 3 in this issue)