mltu
mltu copied to clipboard
Failed to find data adapter that can handle input
Hi @pythonlessons, I'm trying to use the image to word Tutorial.
I changed the train.py a bit in order to read my images and labels better. The only change was in def read_annotation_file:
Old Code:
def read_annotation_file(annotation_path):
dataset, vocab, max_len = [], set(), 0
with open(annotation_path, "r") as f:
for line in tqdm(f.readlines()):
line = line.split()
image_path = data_path + line[0][1:]
label = line[0].split("_")[1]
dataset.append([image_path, label])
vocab.update(list(label))
max_len = max(max_len, len(label))
return dataset, sorted(vocab), max_len
New Code:
def read_annotation_file(annotation_path):
dataset, vocab, max_len = [], set(), 0
with open(annotation_path, "r") as f:
for line in tqdm(f.readlines()):
line = line.split(' ')
image_path = data_path + line[0]
label = line[1]
dataset.append([image_path, label])
vocab.update(list(label))
max_len = max(max_len, len(label))
return dataset, sorted(vocab), max_len
I also changed something in line 91 due to an error:
Old Code:
metrics=[CWERMetric()],
New Code:
metrics=[CWERMetric('accuracy')],
This is my error:
Traceback (most recent call last):
File "/path/to/mltu/Tutorials/01_image_to_word/train.py", line 111, in
How do I need to change train_data_provider or train_dataset or is it a version problem ?