this is my first machine learning project and actually also my first question here. I am a novice to machine learning with a background in theoretical physics.

I want to use a CNN to detect scratches from manufacturing defects in hi-res images. The images have to be hi-res; downsampling would destroy the very features we want to detect. Also, since we are specifically looking for scratches in certain parts of the product, we cannot simply divide the picture into many tiles and treat each pile - the network will have to "understand" both the small-scale structure (single scratch) as well as the large-scale structure (entire product) of the picture.

I'm concerned about limited model capacity (no of parameters) as well as training time. Also, since the number of training pictures are few, it does not seem to make sense to train a whole network from scratch just using my product pictures.

So, my question is, do you think the following approach would work: * use a pre-trained (on general lo-res pictures) off-the-shelf CNN (possibly the CNN layers of VGG19?), followed by a pretty radical max-pooling (for downsizing the picture without introducing any further parameters), and then adding 1 or 2 fully connected layers with further successively lower resolution, and training ONLY those last layers using my pictures?

PS. btw I am planning to use Keras as a platform.


1 Answer 1


When it comes to questions like this, you should be thinking about this in reverse. By that I mean, you want to actually use this algorithm at some point, don't you? So, the real question is: What do your images look like at prediction time?

Once you establish that, then what is the pre-processing you're going to be doing on these images? My guess is that you're not going to be changing things like the resolution. Sure, you might do some cropping or re-sizing, things like that. But the bottom line is that you should be training your algorithm based on what your prediction items are going to look like.

  • $\begingroup$ Thanks for your reply. The images at prediction time are of course the same, and no cropping or resizing. I agree. $\endgroup$
    – Chris
    Commented Jan 16, 2019 at 13:24
  • $\begingroup$ @Chris OK, well, then there is your answer. The other answer you were given in this thread is clearly wrong because it ignored this fact. Just use the same type of images that you will have at prediction time - simple :-) $\endgroup$ Commented Jan 16, 2019 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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