Skip to content

How do you get this to work with more than 5 fonts? #1

@Burkino

Description

@Burkino

I am trying to train a model that recognizes many fonts, however it appears to not work with more than 5 fonts.
I have replaced the conv_label function with

font_list = {}
def conv_label(label):
    if label in font_list:
        return font_list[label]
    else:
        font_id = len(font_list)
        font_list[label] = font_id
        return font_id

and this allows me to automatically give each font a unique id. However upon generating training data and then trying to train the model I get the error IndexError: index 6 is out of bounds for axis 1 with size 5.
I then change

trainY = to_categorical(trainY, num_classes=5)
testY = to_categorical(testY, num_classes=5)

to

trainY = to_categorical(trainY, num_classes=len(font_list))
testY = to_categorical(testY, num_classes=len(font_list))

and run it again. However, this time I get the error ValueError: Dimensions must be equal, but are 5 and 6 for '{{node mean_squared_error/SquaredDifference}} = SquaredDifference[T=DT_FLOAT](sequential_2/dense_11/Softmax, IteratorGetNext:1)' with input shapes: [?,5], [?,6].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions