0

I followed the following blog for Character Recognition using CNN. http://ankivil.com/kaggle-first-steps-with-julia-chars74k-first-place-using-convolutional-neural-networks

The only change I did was dim_ordering="th" latest keras compatibility.

model = Sequential()

    model.add(Convolution2D(128, 3, 3, border_mode='same', init='he_normal', activation = 'relu', input_shape=(1, img_rows, img_cols)))
    print model.output_shape
    model.add(Convolution2D(128, 3, 3, border_mode='same', init='he_normal', activation = 'relu'))
    print model.output_shape

    model.add(MaxPooling2D(pool_size=(2, 2), dim_ordering="th"))
    print model.output_shape

    model.add(Convolution2D(256, 3, 3, border_mode='same', init='he_normal', activation = 'relu'))
    print model.output_shape
    model.add(Convolution2D(256, 3, 3, border_mode='same', init='he_normal', activation = 'relu'))
    print model.output_shape

    model.add(MaxPooling2D(pool_size=(2, 2), dim_ordering="th"))
    print model.output_shape

    model.add(Convolution2D(512, 3, 3, border_mode='same', init='he_normal', activation = 'relu'))
    print model.output_shape
    model.add(Convolution2D(512, 3, 3, border_mode='same', init='he_normal', activation = 'relu'))
    print model.output_shape
    model.add(Convolution2D(512, 3, 3, border_mode='same', init='he_normal', activation = 'relu'))
    print model.output_shape

    model.add(MaxPooling2D(pool_size=(2, 2), dim_ordering="th"))
    print model.output_shape

    model.add(Flatten())
    print model.output_shape
    model.add(Dense(4096, init='he_normal', activation = 'relu'))
    print model.output_shape
    model.add(Dropout(0.5))
    print model.output_shape
    model.add(Dense(4096, init='he_normal', activation = 'relu'))
    print model.output_shape
    model.add(Dropout(0.5))
    print model.output_shape
    model.add(Dense(nb_classes, init='he_normal', activation = 'softmax'))
    print model.output_shape

I am getting a very poor accuracy of 0.07 after 50 - 60 Iterations and it got stuck there.

Can you please suggest some pointers for me ? I am open for other models performing OCR using CNN.

Thanks, Siva

cchamberlain
  • 17,444
  • 7
  • 59
  • 72
siva
  • 1,429
  • 3
  • 26
  • 47
  • 2
    Did you normalize your data ? which optimizer are you using? which learning rate you are using? Without details no one can help. – Avijit Dasgupta Nov 25 '16 at 08:56
  • 3
    Are you sure that you changed your input data accordingly? You change from tf to th so you will also have to reshape your data. Are you sure that the data still looks the same. If not this is the most likely candidate for why it isn't working. – Thomas Pinetz Nov 25 '16 at 10:14
  • @AvijitDasgupta The example I used, use two optimizers, for the first 20 epochs, AdaDelta and later AdaMax. Using the default learning rate. Yes, Input is normalized to 0 to 1.0 – siva Nov 25 '16 at 17:00

0 Answers0