Skip to content

USCDataScience/cmu-fg-bg-similarity

Repository files navigation

USCDataScience: MEMEX: CMU's Foreground and Background Image Similarity Service

This is a Docker and build of an image similarity service compatible with Image Space that provides two functionalities as originally developed by Rohit Girdrar from Carnegie Mellon University (CMU) in these two repos:

ScalableLSH contains CMU's re-implementation of ITQ and LSH. The two algorithms are implemented according to the following papers respectively:

Additionally the segmentation code is based on the work of Xiaolong Wang and the following paper:

Quick Instructions

Build the Docker

  1. docker build -t uscdatascience/cmu-fg-bg-similarity -f Dockerfile .

Run the Docker

  1. docker run -it uscdatascience/cmu-fg-bg-similarity /bin/sh

In a separate window, Outside of the Docker

  1. once built, run it, get a container ID, CID
  2. Copy images to /images on the docker (e.g., from your local), docker cp /some/path/to/imgs/local CID:/images
  3. docker exec -it cmu-img-sim sh

Inside of the Docker

  1. /install/cmu-fg-bg-similarity/entrypoint_cmu-imgsim.sh

Testing a file's similarity with the rest of the corpus

  1. cd /install/cmu-fg-bg-similarity/scripts && ./file_similarity.sh MyPic.png

Which should output something like:

  [
   [
       "http://localhost:8000/MyPic.png",
       1.0
   ],
   [
       "http://localhost:8000/MyPic2.png",
       0.422732
   ],
   [
       "http://localhost:8000/MyPic.jpg",
       0.349333
   ],
 ]

Which is a list of image URLs along with the similarity to the provided image, MyPic.png.

Testing a file's foreground similarity with the rest of the corpus

    1. cd /install/cmu-fg-bg-similarity/scripts && ./file_similarity-fg.sh MyPic.png

You will see similar JSON output akin to the above.

Log file Directory

Log files are written to /install/cmu-fg-bg-similarity/logs.

Questions, comments?

Send them to Chris A. Mattmann.

Contributors

  • Chris A. Mattmann, USC & JPL
  • Tom Barber, JPL
  • Rohit Girdrar, CMU
  • Xiaofan Wang, CMU
  • Karanjeet Singh, USC & JPL

License

Apache License, version 2