How can I classify relevant and irrelevant images from the Database?
The classification of images as relevant or irrelevant can be done using LSTM, the design of which is perhaps best explained without the mathematical detail of the original paper by Eugene Kang's Long Short-Term Memory: Concept text and diagrams.

That the data is unstructured is not an issue if the images can be extracted and placed into raw pixel matrices with appropriate indices into  the database so the results of classification can be inserted into the database in a way where the image and the classification are associated.

The labels from a training point of view are not the indices into the database but the single bit indication of relevance.

The LSTM network must be trained on a sufficient sample of labeled example data before it will be usable to classify the images.  That requirement may further require a significant amount of manual classification unless some form of delegation, hints from associated features in the database, or crowd sourcing can be used to generate labels.