我正在开发一种预测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
格式的图像。
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