cntk

CNTK: Define a custom loss function (Sørensen-Dice coefficient)

╄→гoц情女王★ 提交于 2019-12-06 13:16:49
问题 I'd like to use Wiki: Sørensen–Dice coefficient as a loss function in CNTK/Python. How can I define a custom loss function. 回答1: To answer your more general question "How can I define a custom loss function:" In CNTK, loss functions are not special. Any expression that results in a scalar can be used as a loss function. The learner will compute the minibatch-level loss by summing up the scalar loss values of all samples in the minibatch, and backpropagate through it like through any CNTK

possible std::async implementation bug Windows

六月ゝ 毕业季﹏ 提交于 2019-12-06 11:21:33
It seems like there is a bug in the windows implementation of std::async. Under heavy load (on the order of 1000 threads launched async per second), async tasks are never scheduled and waiting on the returned futures leads to deadlocks. See this piece of code (modified with launch policy deferred instead of async): BundlingChunk(size_t numberOfInputs, Bundler* parent, ChunkIdType chunkId) : m_numberOfInputs(numberOfInputs), m_parent(parent), m_chunkId(chunkId) { const BundlerChunkDescription& chunk = m_parent->m_chunks[m_chunkId]; const ChunkInfo& original = chunk.m_original; auto&

How to verify the usage of the GPU?

不问归期 提交于 2019-12-05 09:31:13
How can I verify that CNTK is using the GPU? I have installed the CNTK-2-0-beta7-0-Windows-64bit-GPU-1bit-SGD binaries on my machine. But, when I try to run this from Python: from cntk.device import set_default_device, gpu set_default_device(gpu(0)) I get: --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-8-eca77b3090be> in <module>() 1 from cntk.device import set_default_device, gpu ----> 2 set_default_device(gpu(0)) C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py34\lib\site-packages\cntk\device.py in

CNTK: Define a custom loss function (Sørensen-Dice coefficient)

核能气质少年 提交于 2019-12-04 18:36:47
I'd like to use Wiki: Sørensen–Dice coefficient as a loss function in CNTK/Python. How can I define a custom loss function. To answer your more general question "How can I define a custom loss function:" In CNTK, loss functions are not special. Any expression that results in a scalar can be used as a loss function. The learner will compute the minibatch-level loss by summing up the scalar loss values of all samples in the minibatch, and backpropagate through it like through any CNTK expression. For example, the following is a way of defining a square-error loss: def my_square_error(x,y): diff

CNTK: how do I create a sequence of tensors from a single tensor?

时光怂恿深爱的人放手 提交于 2019-12-04 18:15:57
I have a working TensorFlow seq2seq model I've been using for image captioning that I'd like to convert over to CNTK, but I'm having trouble getting the input to my LSTM in the right format. Here's what I do in my TensorFlow network: max_seq_length = 40 embedding_size = 512 self.x_img = tf.placeholder(tf.float32, [None, 2048]) self.x_txt = tf.placeholder(tf.int32, [None, max_seq_length]) self.y = tf.placeholder(tf.int32, [None, max_seq_length]) with tf.device("/cpu:0"): image_embed_inputs = tf.layers.dense(inputs=self.x_img, units=embedding_size) image_embed_inputs = tf.reshape(image_embed

c# Wrapper for CNTK steps

≡放荡痞女 提交于 2019-12-04 05:10:42
问题 I'm having some issues at running CNTK on c# wrapper. I see rold2007 had success on doing the same thing. There got to be something simple that I missed. Any advice would be greatly appreciated. The steps I used are as follow: use the source code from C# generate a new dos application and copy the new code to it. building the program, the following error occurred at line using (var model = new IEvaluateModelManagedF()) Wit error message: Severity Code Description Project File Line Suppression

Keras-CNTK saving model-v2 format

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using CNTK as the backend for Keras. I'm trying to use my model which I have trained using Keras in C++. I have trained and saved my model using Keras which is in HDF5. How do I now use CNTK API to save it in their model-v2 format? I tried this: model = load_model('model2.h5') cntk.ops.functions.Function.save(model, 'CNTK_model2.pb') but i got the following error: TypeError: save() missing 1 required positional argument: 'filename' If tensorflow were the backend I would have done this: model = load_model('model2.h5') sess = K.get_session

c# Wrapper for CNTK steps

前提是你 提交于 2019-12-02 07:23:49
I'm having some issues at running CNTK on c# wrapper. I see rold2007 had success on doing the same thing. There got to be something simple that I missed. Any advice would be greatly appreciated. The steps I used are as follow: use the source code from C# generate a new dos application and copy the new code to it. building the program, the following error occurred at line using (var model = new IEvaluateModelManagedF()) Wit error message: Severity Code Description Project File Line Suppression State Error CS0246 The type or namespace name 'IEvaluateModelManagedF' could not be found (are you

use cntk trained model with python

时光怂恿深爱的人放手 提交于 2019-12-01 18:04:12
问题 I have trained a model using CNTK, lets call simple.dnn now for the phase of testing I do not want to install CNTK on windows,but use trained model with python. How can I use trained model (weights,...) for testing using python? 回答1: You can use the load_model function, see https://www.cntk.ai/pythondocs/cntk.html?highlight=load_model#cntk.persist.load_model. The basic flow should look like this: from cntk import load_model loaded_model = load_model("yourModel.model", 'float') output = model

use cntk trained model with python

喜夏-厌秋 提交于 2019-12-01 17:44:23
I have trained a model using CNTK, lets call simple.dnn now for the phase of testing I do not want to install CNTK on windows,but use trained model with python. How can I use trained model (weights,...) for testing using python? You can use the load_model function, see https://www.cntk.ai/pythondocs/cntk.html?highlight=load_model#cntk.persist.load_model . The basic flow should look like this: from cntk import load_model loaded_model = load_model("yourModel.model", 'float') output = model.eval(arguments) 来源: https://stackoverflow.com/questions/40504635/use-cntk-trained-model-with-python