0
$\begingroup$

I have been trying to decode a captcha using CNN.
The number of training samples is 1,82,000.
So far, I could achieve 99% accuracy on training as well as test set.

The issue however is that LOCATION INVARIANCE is not achieved while training. The captcha text if slightly shifted horizontally gives bad prediction.

Below image is one of the samples on which network was trained and gives good prediction accuracy for similar images (Accuracy~99%) .

enter image description here

But if following image is given , it gives some random prediction.

enter image description here

The only difference between above two images is location of captcha text (apart from the actual captcha value.)

As far as I know, the usp of CNN is the fact that location of a pattern doesnt matter. So what could be the possible reasons for this ?

$\endgroup$
  • $\begingroup$ Do you use max-pooling? Max-pooling represents basicaly an apriori assumption about location independent features. $\endgroup$ – Andreas Look Sep 1 '17 at 14:43
  • $\begingroup$ It depends on how good/bad your architecture is $\endgroup$ – enterML Sep 1 '17 at 14:57
  • 2
    $\begingroup$ Am I going blind? Those don't look like translations of each other to me... $\endgroup$ – kbrose Sep 1 '17 at 15:08
  • $\begingroup$ @kbrose, I have edited the question now. There are 2 kinds of captchas..one with text in the center and other with text in left. Above two images just represent these 2 kinds of images. $\endgroup$ – mach Sep 1 '17 at 16:21
  • $\begingroup$ Given your one answer so far suggests something you already know about and are using, I think you need to share more details of your architecture and training pipeline, to prevent suggestions to use dropout, pre-processing etc stages that you already have. $\endgroup$ – Neil Slater Sep 1 '17 at 16:21
3
$\begingroup$

As far as I know, the usp of CNN is the fact that location of a pattern doesnt matter.

This is not true. Some options used in CNN architecture, such as max pooling, or strided convolutions, can add a moderate amount of translation invariance. However this will not cover larger translations - anything that is a significant percentage of the image width/height.

CNNs also support translation equivariance, which is where image textures and motifs that appear repeatedly but in different locations (lines, corners, curves) are learned efficiently and appear in the feature maps. This is probably closer to the USP of CNNs, that they learn the "representation language" of a signal, such as photograph, where it is consistent across the dimensions that are being convolved.

The cause of your problem is therefore very likely that your training set does not include enough images with the more central translation, or enough variations with the separate images.

To cover large translations you could look at one or more of:

  • Image pre-processing. In your supplied examples it looks very feasible to centre the digits.

  • Data augmentation. Generate translated versions of your training data to cover expected range of input translations in test.

  • Network architecture. A RNN or RNN/CNN hybrid could probably consume the images using smaller overlapped tiles of the images in sequence, and be trained to output the captcha string at the end. You might also be able to do this without a RNN, but that would require labelling each tile for the separate digits.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.