I'm doing two class classification. I have a special dataset with most negative cases (absence of an object I want to classify) and a few positive cases (presence of an object). Since I have only less than 100 positive cases for training and validation, I downloaded some images(around 450) from Flickr and used them for training. I separate my real dataset into two halves, one for training and one for validation.

The models(Alexnet and VGG) I tried could only reach around 70% accuracy (probably due to the background cluster and occlusion). I have two obsevations. First, The object I try to classify only occupies a small portion of the image size. Second, since the images I used are of the size 2688*1512, I resized the images to 224*224 and 227*227 for VGG16 and Alexnet, respectively. Thus, I suspect that the resizing process filters some useful information out before training.

In order to retain more information for training, I tried to reuse only the structure and the weights of VGG16’s convoultional layers and rebuilt the fully connected layers on top of it. So I could feed pixel size 1024*1024 to changed model. The performance, as shown here, is unconvergent.

The second try is to crop the images first and then resize to 224*224 or 227*227. I'm thinking to feed more object information into models by cropping background out before resizing. So hopefully models could see more useful object information. Note I only manually crop my training dataset, not those downloaded from flickr. Unexpected, while feeding cropped images into models, the models simply couldn't learn anything. The accuracy after 100 epochs is still around 50%, random guess. I don't quite understand why the models fail when feeding cropped images.

I'm thinking there are two potentials. One is that the blur (Because the captured object is moving) in the cropped images prevents the model learning. After cropping the background, more blurred pixels are fed into the models. So the models stop learning?

The other one is that the inconsistency of the object size between training and validation. Because of cropping, the object size in the training is much bigger than that in the validation. I could try to adjust augmentation parameters.

Any thoughts and suggestions? Thanks a lot.


To avoid the image resizing/cropping and information retention, there is a very interesting CNN variant called Spacial Pyramid Pooling. Maybe you should give it a try.

The gist is, Convolution layers don't have a restriction on image size. The restriction is because of the final Fully Connected layer. The author of the mentioned paper proposes a solution where this restriction is no longer valid. This is done using the concept of bins. One can use pre-trained model's convolution layers in SPP, in place of training model from scratch.

This post gives a good description and visualization of how this binning works.

  • 2
    $\begingroup$ can you please add full references in addition to the links? Links can die $\endgroup$ – Antoine Dec 6 '17 at 15:09

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.