I am trying to train a classifier (let's say to classify an object X or not X). But I don't have too much real images of object X which I want to classify. So I made some synthetic images of my own using some photo editing tools, but the problem is after feeding synthetic data my classifier doesn't recognise the real object. And since I had like 2-3 images of real object so I can't feed it more real data. Is there any solution on how to approach such problem with synthetic data to recognise real ones?
Neural networks require a lot of data for training. This is one of their largest drawbacks, and is very hard to get around this.
Using artificial data is not a solution. We don't really understand what the network is learning and we can't tell if it learned anything that is particular to the synthetic images.
What you can do is to use some sort of data augmentation. Rotate, scale, translate your images many times, and create a larger dataset.
Since it's such a small dataset, and if more data is really not possible to obtain, you should consider other approaches to help the classification. Either manually design some features to help a bit the classifier or do the classification with more traditional methods.
There are several data augmentation techniques available as rightly pointed out by Paul. You could for e.g. see the following https://www.kaggle.com/cdeotte/25-million-images-0-99757-mnist where 25 million images are generated from 42K original images.
The only other approach I would like to add is that if the real image you want to classify can be broken down into smaller features. For e.g. say you want to classify a picture of a man riding a bike with a bag on his arm. You may not have too many images of those, but you have millions of images of bikes and men and bags. You could train on those and re-use some of the lower layers as-is in your model.