1. A method for operating an electronic device, the method comprising: detecting a user input on an image displayed in the electronic device; determining, by the electronic device, an object included in the image, based on the detected user input; retrieving at least one image from among a plurality of images stored in the electronic device, by comparing the object to metadata associated with each of the plurality of images; and displaying, by the electronic device, the at least one image, wherein the metadata comprises information regarding at least one object included in each of the plurality of images, and the information regarding the at least one object is determined by applying an unsupervised image segmentation to an output of a supervised image segmentation on each of the plurality of images, and wherein the supervised image segmentation comprises training a random forest with a ground truth associated with the each of the plurality of images for processing pixels in the plurality of images, and the unsupervised image segmentation comprises a graph partitioning algorithm that defines each pixel for further processing the pixels.