I am classifying about 9 books from the image of their cover pages. I am using a TensorFlow Keras CNN model for this. But, the model predicts a book even when a picture of a book is not taken, like a wall, sofa, house etc. I want to avoid this. I want the model to first classify whether there is a book in the image and then classify the book in 9 classes. How could I achieve this?
You can introduce another class to your network - "not a book". After that, you will need to add new data to your dataset, random images that do not contain books to classify and train your network on that data. So when your network won't see a book it will output high probability for "not a book" class, if an image with a book will be shown to the network probability of the "not a book" class should be low.