Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-39057

Add distance expressions for image feature comparison

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Backlog
    • Component/s: None
    • Labels:

      Description

      This ticket tracks the work contained in Pull Request #1291.

      We added these expressions:

      '$cossim', '$chi2', '$euclidean', '$squared_euclidean', '$manhattan'

      Which allow us to compare long vectors (image features) stored as arrays or BSON.
      It is useful to find the most similar images in a dataset. The usage is the following:

      db.test_speed.aggregate([
          {   
              '$project':
              {
                  'id': '$id',
                  "other_id": '$other_id',
                  'distance': {'$cossim': [vector, '$vector']},
              },
          },
          {"$sort": {"distance": -1}},
          {"$limit": 20}
      ])
      

      In addition implementations using avx2 and avx512 are included in this pull request.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-query-optimization Backlog - Query Optimization
              Reporter:
              kelsey.schubert Kelsey T Schubert
              Participants:
              Votes:
              1 Vote for this issue
              Watchers:
              18 Start watching this issue

                Dates

                Created:
                Updated: