The problem I am trying to solve is, given two images, determining whether they contain the same object or not. Here is an example:

enter image description here enter image description here enter image description here

The first two images contain the same object, while the third image contains a similar, but different object. My goal is for the first two images to be seen as a match, but the first and third (and second and third) being seen as not matching. I want the matching to work in general with any object. It should be able to tell if any two pictures of any two objects are identical objects (not just similar) even if they are taken at different angles, cameras, and lighting conditions.

To accomplish this goal I have moved towards using transfer learning to train a siamese neural network (on a pretrained imagenet model) with the triplet loss function. The problem is that I do not have a dataset that is suitable for this. I cannot find any datasets that have pairs of identical objects from different angles, lighting, cameras, ... This is what I believe I would need for training to be successful.

2 Answers 2


I would suggest first training using a class of objects for which Wikimedia Commons has thousands of free pictures: cruise ships.

First get a list of cruise ships:

SELECT ?item ?itemLabel ?image ?commonsCategory
  ?item wdt:P31 wd:Q39804. # Must be of a cruise ship
  ?item wdt:P18 ?image.
  ?item wdt:P373 ?commonsCategory.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

enter image description here

Then download all pictures in the Commons category of each. Example:

enter image description here

Advantages of this approach:

  • Each cruise ship has been photographed by many different photographers under very different lighting conditions, angles, etc.
  • Cruise ships rarely change their shape or painting.
  • Very few data errors. To filter out pictures that show the inside of the ship, just run a classifier and keep only pictures that are found to represent a ship.

Check out SIFT, which is e.g. used by panorama softwares to detect matching features in images.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.