我正在开发一个预测Capstone项目医学影像的模型。我是CNTK的新手(曾经使用TF和Keras一段时间),但遇到以下错误:
Reader from file train_data.ctf
Reader from file test_data.ctf
Traceback (most recent call last):
File "<ipython-input-9-01a27186472a>", line 6, in <module>
exe_train_test(model, all_data = False)
File "<ipython-input-8-65daea35bdc7>", line 8, in do_train_test
train_test(read_train, read_test, model)
File "<ipython-input-7-e044cc5a63e1>", line 32, in train_test
data=train_reader.next_minibatch(mbatch_size, input_map = input_map)
File "C:\Users\devg2\Anaconda3\lib\site-packages\cntk\internal\swig_helper.py", line 69, in wrapper
result = f(*args, **kwds)
File "C:\Users\devg2\Anaconda3\lib\site-packages\cntk\io\__init__.py", line 329, in next_minibatch
partition_index, device)
File "C:\Users\devg2\Anaconda3\lib\site-packages\cntk\cntk_py.py", line 3143, in get_next_minibatch
return _cntk_py.MinibatchSource_get_next_minibatch(self, *args)
RuntimeError: Reached the maximum number of allowed errors while reading the input file (train_data.ctf).
[CALL STACK]
> Microsoft::MSR::CNTK::IDataReader:: SupportsDistributedMBRead
- Microsoft::MSR::CNTK::IDataReader:: SupportsDistributedMBRead (x6)
- CreateCompositeDataReader (x5)
- CNTK::TrainingParameterSchedule<unsigned __int64>:: GetMinibatchSize (x4)
有关我是否在数据输入中遗漏某些内容的任何指导。数据是.png
格式的图像。
答案 0 :(得分:0)
CNTK Nube在这里-但是:
让我们说您的输入流配置如下:
0 |S0 178:1 |# BOS |S1 14:1 |# flight |S2 128:1 |# O
0 |S0 479:1 |# i |S2 128:1 |# O
0 |S0 902:1 |# want |S2 128:1 |# O
0 |S0 851:1 |# to |S2 128:1 |# O
0 |S0 431:1 |# fly |S2 128:1 |# O
0 |S0 444:1 |# from |S2 128:1 |# O
0 |S0 266:1 |# boston |S2 48:1 |# B-fromloc.city_name
0 |S0 240:1 |# at |S2 128:1 |# O
0 |S0 168:1 |# 838 |S2 35:1 |# B-depart_time.time
0 |S0 210:1 |# am |S2 100:1 |# I-depart_time.time
0 |S0 215:1 |# and |S2 128:1 |# O
0 |S0 236:1 |# arrive |S2 128:1 |# O
0 |S0 482:1 |# in |S2 128:1 |# O
0 |S0 351:1 |# denver |S2 78:1 |# B-toloc.city_name
0 |S0 240:1 |# at |S2 128:1 |# O
0 |S0 27:1 |# 1110 |S2 14:1 |# B-arrive_time.time
0 |S0 482:1 |# in |S2 128:1 |# O
0 |S0 827:1 |# the |S2 128:1 |# O
0 |S0 606:1 |# morning |S2 12:1 |# B-arrive_time.period_of_day
0 |S0 179:1 |# EOS |S2 128:1 |# O
因为我在ATIS数据集中提供的输入问题中看不到输入样本。
每个输入和输出流信息必须配置正确的尺寸和轴。必须将其配置如下:
cntk.io.MinibatchSource(cntk.io.CTFDeserializer(path, cntk.io.StreamDefs(
query = cntk.io.StreamDef(field='S0', shape=vocab_size, is_sparse=True),
intent_labels = cntk.io.StreamDef(field='S1', shape=num_intents, is_sparse=True), # (used for intent classification variant)
slot_labels = cntk.io.StreamDef(field='S2', shape=num_labels, is_sparse=True)
)), randomize=is_training, max_sweeps = cntk.io.INFINITELY_REPEAT if is_training else 1)
流S0,S1和S2必须在正确的轴上配置正确的尺寸。
模型看起来像这样:
Sequential([
Label('input'),
Embedding(emb_dim, name='embed'),
Label('embedded_input'),
Stabilizer(),
Recurrence(LSTM(hidden_dim)),
Stabilizer(),
Label('hidden_representation'),
Dense(num_labels, name='out_projection')
])
尽管此示例没有为您的.png示例提供直接答案,但它为您提供了一个查找的地方,可以与CNTK抱怨的尺寸相匹配。我相信通过对您问题的描述,如果满足上述条件,就可以解决您的问题。
此示例来自Microsoft示例:https://github.com/Microsoft/CNTK/tree/master/Examples/LanguageUnderstanding/ATIS