I trained a convolutional network to classify images of a mechanical component as good or defective. Though the test accuracy was high, I realized that the model performed poorly on images which had slightly different lighting.
The features that I'm trying to detect are subtle, and lighting seems to trip the model into calling a lot of false negatives. Most, if not all, of the training and test data came from images which were shot under diffused lighting. The new images that I tried the model on were shot with focused lights.
Hoping that histogram equalization(CLAHE) would help, I did equalization on images before feeding it to the model, did this for training as well as test data. The problem then was that accuracy was high, but the model seemed to have learnt some other correlation between the images and labels. After equalization, everything in the image stands out, the defects become even more subtle and hard to detect even for human eye.
The model prediction changed even when the same component was shot with the same lighting but with the light at different orientations. So my question is, what can I do, either at the data end or with the model, so that it becomes robust to changes in lighting(or same kind of lighting but changes to orientation of lighting)?