{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/CNTK/issues/1050","repository_url":"https://api.github.com/repos/Microsoft/CNTK","labels_url":"https://api.github.com/repos/Microsoft/CNTK/issues/1050/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/CNTK/issues/1050/comments","events_url":"https://api.github.com/repos/Microsoft/CNTK/issues/1050/events","html_url":"https://github.com/Microsoft/CNTK/issues/1050","id":189841544,"number":1050,"title":"Evaluating models created using python bindings in C# ","user":{"login":"Troelsj","id":3653067,"avatar_url":"https://avatars.githubusercontent.com/u/3653067?v=3","gravatar_id":"","url":"https://api.github.com/users/Troelsj","html_url":"https://github.com/Troelsj","followers_url":"https://api.github.com/users/Troelsj/followers","following_url":"https://api.github.com/users/Troelsj/following{/other_user}","gists_url":"https://api.github.com/users/Troelsj/gists{/gist_id}","starred_url":"https://api.github.com/users/Troelsj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Troelsj/subscriptions","organizations_url":"https://api.github.com/users/Troelsj/orgs","repos_url":"https://api.github.com/users/Troelsj/repos","events_url":"https://api.github.com/users/Troelsj/events{/privacy}","received_events_url":"https://api.github.com/users/Troelsj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-16T20:54:26Z","updated_at":"2016-11-23T13:08:38Z","closed_at":null,"body":"Hi,\r\n\r\nI have a problem with evaluating models, created using the python bindings, through the C# evaluation interface.\r\n\r\nIf I follow the examples on saving a model it would look like:\r\n``python \r\n        persist.save_model(z, os.path.join(model_path, network_name + \"_{}.dnn\".format(epoch)))\r\n``\r\n\r\nIf I then load that model into a C# program in order to classify an image, it returns the error:\r\n\r\n> No Output nodes found: Cannot determine Input node dimensions due to lack of Output nodes.\r\n(are 'outputNodeNames' and/or 'OutputNodes' properly defined in the configuration file?)\r\n\r\n(Both with my own models and the models from the examples)\r\nWhich seems like a simple error, but I can't find any explanation on how this should be defined in python, it works fine if I load a brainscript model into the program.\r\n\r\nUsing the python evaluation function works with the python model, something like:\r\n\r\n``python\r\nmodel = load_model(\"model.bin\")\r\ninput_arg = model.arguments\r\ntest_image  = np.array(Image.open(\"image.png\"), dtype = np.float32).T\r\nresults = np.squeeze(model.eval({ input_arg:test_image }))\r\n``\r\n\r\nBut that doesn't work with a brainscript model, even if I change it to fit the extra inputs.\r\n\r\nSo are the models really not created equally, why is the resnet20 model created in python not the same as the one created in brainscript? \r\nIs there an easy way of defining outputnodes using the python bindings, such that it works with a C# evaluation program?\r\n\r\nI am running cntk v2.0 beta3, built from source for GPU usage."},"comment":{"url":"https://api.github.com/repos/Microsoft/CNTK/issues/comments/262508347","html_url":"https://github.com/Microsoft/CNTK/issues/1050#issuecomment-262508347","issue_url":"https://api.github.com/repos/Microsoft/CNTK/issues/1050","id":262508347,"user":{"login":"Troelsj","id":3653067,"avatar_url":"https://avatars.githubusercontent.com/u/3653067?v=3","gravatar_id":"","url":"https://api.github.com/users/Troelsj","html_url":"https://github.com/Troelsj","followers_url":"https://api.github.com/users/Troelsj/followers","following_url":"https://api.github.com/users/Troelsj/following{/other_user}","gists_url":"https://api.github.com/users/Troelsj/gists{/gist_id}","starred_url":"https://api.github.com/users/Troelsj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Troelsj/subscriptions","organizations_url":"https://api.github.com/users/Troelsj/orgs","repos_url":"https://api.github.com/users/Troelsj/repos","events_url":"https://api.github.com/users/Troelsj/events{/privacy}","received_events_url":"https://api.github.com/users/Troelsj/received_events","type":"User","site_admin":false},"created_at":"2016-11-23T13:08:38Z","updated_at":"2016-11-23T13:08:38Z","body":"@zhouwangzw Sorry for the late reply, but that indeed makes it possible to create the network, unfortunately I am still not able to actually evaluate with a model created in python.\r\n\r\nThe output lines from brainscript looks like:\r\n\r\n>Validating --> out = Plus (out.PlusArgs[0], model.arrayOfFunctions[8].b) : [2 x *], [2] -> [2 x *]\r\n>Validating --> ce = CrossEntropyWithSoftmax (labels, out) : [2 x *], [2 x *] -> [1]\r\n>Validating --> errs = ClassificationError (labels, out) : [2 x *], [2 x *] -> [1]\r\n>Validating --> inputs.inputs[2] = LearnableParameter() :  -> [1 x 1]\r\n>Validating --> top5Errs = ClassificationError (labels, out, inputs.inputs[2]) : [2 x *], [2 x *], [1 x 1] -> [1]\r\n\r\n>Validating network. 77 nodes to process in pass 2.\r\n\r\nThe same from python:\r\n\r\n>Validating --> __v2libuid__Parameter2010__v2libname__b = LearnableParameter() :  -> [2]\r\n>Validating --> __v2libuid__Plus2023__v2libname__Plus2014 = Plus >(__v2libuid__Times2021__v2libname__Times2012, __v2libuid__Parameter201\r\n>0__v2libname__b) : [2 x *2], [2] -> [2 x *2]\r\n\r\n>Validating network. 73 nodes to process in pass 2.\r\n\r\nSo in python the roots are missing, not that big of a deal, but still weird.\r\n\r\nThe input and output from GetNodeDimensions seems to be the same, besides the key: \r\n>Brainscript:    input dimensions: Key: features, value = count: 3072\r\n>Brainscript:    output dimensions = Key: \"z\", Value = 2 \r\n\r\n>python:         input dimensions: Key = \"__v2libuid__Input2__v2libname__\", Value = 3072\r\n>python:         output dimensions = Key: \"__v2libuid__Plus2023__v2libname__Plus2014\", value = 2\r\n\r\nThis is just a test with resnet used on a binary problem.\r\n\r\nIf I let it run it gets to the evaluate function and at the evalwrapper call:\r\n\r\n``\r\ntry \r\n{\r\n        m_eval->Evaluate(stdInputs, stdOutputs)\r\n}\r\n``\r\n\r\nWhich first throws the error:\r\n![evalerror](https://cloud.githubusercontent.com/assets/3653067/20562161/85510fc6-b182-11e6-9580-c5a2466469e0.png)\r\n\r\nIf i press continue it throws the exception:\r\n> Error: The output matrix being saved has more data than the numRecords (0) requested to be saved\r\n\r\nAgain, it works completely fine using a brainscript model and I can't really see any differences in any variables until it throws that error,  so what could be the cause of this?\r\n\r\nThis was the case with beta 3 and I have update to beta 4 and rebuild the models and the issue is still the same.\r\nThanks for your help."}}
{"actor":{"display_login":"Troelsj"}}