-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add threshold image similarity scores #526
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3ed9acb
add a minScore to the query, with appropriate values for each metric
harrisonpim e591b2c
set minScore=0 in tests
harrisonpim 4f6fb10
remove matched images from test documents
harrisonpim fa72318
Apply auto-formatting rules
weco-bot 0d71a0d
Merge branch 'main' into similarity-threshold
harrisonpim da68a42
add a comment which links to the threshold analysis
harrisonpim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
312 changes: 37 additions & 275 deletions
312
search/src/test/resources/expected_responses/visually-similar-features-and-palettes.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,284 +1,46 @@ | ||
{ | ||
"id" : "a5lj9duc", | ||
"locations" : [ | ||
"id": "a5lj9duc", | ||
"locations": [ | ||
{ | ||
"accessConditions" : [ | ||
], | ||
"license" : { | ||
"id" : "cc-by", | ||
"label" : "Attribution 4.0 International (CC BY 4.0)", | ||
"type" : "License", | ||
"url" : "http://creativecommons.org/licenses/by/4.0/" | ||
}, | ||
"linkText" : "Link text: 4N3l8IuPN0", | ||
"locationType" : { | ||
"id" : "iiif-image", | ||
"label" : "IIIF Image API", | ||
"type" : "LocationType" | ||
}, | ||
"type" : "DigitalLocation", | ||
"url" : "https://iiif.wellcomecollection.org/image/RlZ.jpg/info.json" | ||
"accessConditions": [], | ||
"license": { | ||
"id": "cc-by", | ||
"label": "Attribution 4.0 International (CC BY 4.0)", | ||
"type": "License", | ||
"url": "http://creativecommons.org/licenses/by/4.0/" | ||
}, | ||
"linkText": "Link text: 4N3l8IuPN0", | ||
"locationType": { | ||
"id": "iiif-image", | ||
"label": "IIIF Image API", | ||
"type": "LocationType" | ||
}, | ||
"type": "DigitalLocation", | ||
"url": "https://iiif.wellcomecollection.org/image/RlZ.jpg/info.json" | ||
} | ||
], | ||
"source" : { | ||
"id" : "anys7vbv", | ||
"title" : "title-vpbsaVsvTg", | ||
"type" : "Work" | ||
"source": { | ||
"id": "anys7vbv", | ||
"title": "title-vpbsaVsvTg", | ||
"type": "Work" | ||
}, | ||
"thumbnail" : { | ||
"accessConditions" : [ | ||
], | ||
"license" : { | ||
"id" : "cc-by", | ||
"label" : "Attribution 4.0 International (CC BY 4.0)", | ||
"type" : "License", | ||
"url" : "http://creativecommons.org/licenses/by/4.0/" | ||
"thumbnail": { | ||
"accessConditions": [], | ||
"license": { | ||
"id": "cc-by", | ||
"label": "Attribution 4.0 International (CC BY 4.0)", | ||
"type": "License", | ||
"url": "http://creativecommons.org/licenses/by/4.0/" | ||
}, | ||
"linkText" : "Link text: 4N3l8IuPN0", | ||
"locationType" : { | ||
"id" : "iiif-image", | ||
"label" : "IIIF Image API", | ||
"type" : "LocationType" | ||
"linkText": "Link text: 4N3l8IuPN0", | ||
"locationType": { | ||
"id": "iiif-image", | ||
"label": "IIIF Image API", | ||
"type": "LocationType" | ||
}, | ||
"type" : "DigitalLocation", | ||
"url" : "https://iiif.wellcomecollection.org/image/RlZ.jpg/info.json" | ||
"type": "DigitalLocation", | ||
"url": "https://iiif.wellcomecollection.org/image/RlZ.jpg/info.json" | ||
}, | ||
"type" : "Image", | ||
"visuallySimilar" : [ | ||
{ | ||
"id" : "dqlalauc", | ||
"locations" : [ | ||
{ | ||
"accessConditions" : [ | ||
], | ||
"license" : { | ||
"id" : "cc-by", | ||
"label" : "Attribution 4.0 International (CC BY 4.0)", | ||
"type" : "License", | ||
"url" : "http://creativecommons.org/licenses/by/4.0/" | ||
}, | ||
"locationType" : { | ||
"id" : "iiif-image", | ||
"label" : "IIIF Image API", | ||
"type" : "LocationType" | ||
}, | ||
"type" : "DigitalLocation", | ||
"url" : "https://iiif.wellcomecollection.org/image/I2D.jpg/info.json" | ||
} | ||
], | ||
"source" : { | ||
"id" : "j4l3wsjt", | ||
"title" : "title-Q8uNY7ZOEu", | ||
"type" : "Work" | ||
}, | ||
"thumbnail" : { | ||
"accessConditions" : [ | ||
], | ||
"license" : { | ||
"id" : "cc-by", | ||
"label" : "Attribution 4.0 International (CC BY 4.0)", | ||
"type" : "License", | ||
"url" : "http://creativecommons.org/licenses/by/4.0/" | ||
}, | ||
"locationType" : { | ||
"id" : "iiif-image", | ||
"label" : "IIIF Image API", | ||
"type" : "LocationType" | ||
}, | ||
"type" : "DigitalLocation", | ||
"url" : "https://iiif.wellcomecollection.org/image/I2D.jpg/info.json" | ||
}, | ||
"type" : "Image" | ||
}, | ||
{ | ||
"id" : "fp9x20si", | ||
"locations" : [ | ||
{ | ||
"accessConditions" : [ | ||
], | ||
"credit" : "Credit line: 7SWk3TTSq0", | ||
"license" : { | ||
"id" : "cc-by", | ||
"label" : "Attribution 4.0 International (CC BY 4.0)", | ||
"type" : "License", | ||
"url" : "http://creativecommons.org/licenses/by/4.0/" | ||
}, | ||
"locationType" : { | ||
"id" : "iiif-image", | ||
"label" : "IIIF Image API", | ||
"type" : "LocationType" | ||
}, | ||
"type" : "DigitalLocation", | ||
"url" : "https://iiif.wellcomecollection.org/image/WIk.jpg/info.json" | ||
} | ||
], | ||
"source" : { | ||
"id" : "othidyxy", | ||
"title" : "title-pEAVa4Rz7i", | ||
"type" : "Work" | ||
}, | ||
"thumbnail" : { | ||
"accessConditions" : [ | ||
], | ||
"credit" : "Credit line: 7SWk3TTSq0", | ||
"license" : { | ||
"id" : "cc-by", | ||
"label" : "Attribution 4.0 International (CC BY 4.0)", | ||
"type" : "License", | ||
"url" : "http://creativecommons.org/licenses/by/4.0/" | ||
}, | ||
"locationType" : { | ||
"id" : "iiif-image", | ||
"label" : "IIIF Image API", | ||
"type" : "LocationType" | ||
}, | ||
"type" : "DigitalLocation", | ||
"url" : "https://iiif.wellcomecollection.org/image/WIk.jpg/info.json" | ||
}, | ||
"type" : "Image" | ||
}, | ||
{ | ||
"id" : "fsq3gsq0", | ||
"locations" : [ | ||
{ | ||
"accessConditions" : [ | ||
], | ||
"credit" : "Credit line: u1A2IYFqOO", | ||
"license" : { | ||
"id" : "cc-by", | ||
"label" : "Attribution 4.0 International (CC BY 4.0)", | ||
"type" : "License", | ||
"url" : "http://creativecommons.org/licenses/by/4.0/" | ||
}, | ||
"locationType" : { | ||
"id" : "iiif-image", | ||
"label" : "IIIF Image API", | ||
"type" : "LocationType" | ||
}, | ||
"type" : "DigitalLocation", | ||
"url" : "https://iiif.wellcomecollection.org/image/T69.jpg/info.json" | ||
} | ||
], | ||
"source" : { | ||
"id" : "80trgzaf", | ||
"title" : "title-AOCEgK2yRE", | ||
"type" : "Work" | ||
}, | ||
"thumbnail" : { | ||
"accessConditions" : [ | ||
], | ||
"credit" : "Credit line: u1A2IYFqOO", | ||
"license" : { | ||
"id" : "cc-by", | ||
"label" : "Attribution 4.0 International (CC BY 4.0)", | ||
"type" : "License", | ||
"url" : "http://creativecommons.org/licenses/by/4.0/" | ||
}, | ||
"locationType" : { | ||
"id" : "iiif-image", | ||
"label" : "IIIF Image API", | ||
"type" : "LocationType" | ||
}, | ||
"type" : "DigitalLocation", | ||
"url" : "https://iiif.wellcomecollection.org/image/T69.jpg/info.json" | ||
}, | ||
"type" : "Image" | ||
}, | ||
{ | ||
"id" : "vcflqowx", | ||
"locations" : [ | ||
{ | ||
"accessConditions" : [ | ||
], | ||
"credit" : "Credit line: iMzNq5f99", | ||
"license" : { | ||
"id" : "cc-by", | ||
"label" : "Attribution 4.0 International (CC BY 4.0)", | ||
"type" : "License", | ||
"url" : "http://creativecommons.org/licenses/by/4.0/" | ||
}, | ||
"linkText" : "Link text: Z6HmsHmLL", | ||
"locationType" : { | ||
"id" : "iiif-image", | ||
"label" : "IIIF Image API", | ||
"type" : "LocationType" | ||
}, | ||
"type" : "DigitalLocation", | ||
"url" : "https://iiif.wellcomecollection.org/image/yw2.jpg/info.json" | ||
} | ||
], | ||
"source" : { | ||
"id" : "ov8cs7dy", | ||
"title" : "title-U90KOXEeRV", | ||
"type" : "Work" | ||
}, | ||
"thumbnail" : { | ||
"accessConditions" : [ | ||
], | ||
"credit" : "Credit line: iMzNq5f99", | ||
"license" : { | ||
"id" : "cc-by", | ||
"label" : "Attribution 4.0 International (CC BY 4.0)", | ||
"type" : "License", | ||
"url" : "http://creativecommons.org/licenses/by/4.0/" | ||
}, | ||
"linkText" : "Link text: Z6HmsHmLL", | ||
"locationType" : { | ||
"id" : "iiif-image", | ||
"label" : "IIIF Image API", | ||
"type" : "LocationType" | ||
}, | ||
"type" : "DigitalLocation", | ||
"url" : "https://iiif.wellcomecollection.org/image/yw2.jpg/info.json" | ||
}, | ||
"type" : "Image" | ||
}, | ||
{ | ||
"id" : "wfdcghky", | ||
"locations" : [ | ||
{ | ||
"accessConditions" : [ | ||
], | ||
"credit" : "Credit line: daywHchuw", | ||
"license" : { | ||
"id" : "cc-by", | ||
"label" : "Attribution 4.0 International (CC BY 4.0)", | ||
"type" : "License", | ||
"url" : "http://creativecommons.org/licenses/by/4.0/" | ||
}, | ||
"locationType" : { | ||
"id" : "iiif-image", | ||
"label" : "IIIF Image API", | ||
"type" : "LocationType" | ||
}, | ||
"type" : "DigitalLocation", | ||
"url" : "https://iiif.wellcomecollection.org/image/lHZ.jpg/info.json" | ||
} | ||
], | ||
"source" : { | ||
"id" : "hs3nzqux", | ||
"title" : "title-lPUpm8UfHO", | ||
"type" : "Work" | ||
}, | ||
"thumbnail" : { | ||
"accessConditions" : [ | ||
], | ||
"credit" : "Credit line: daywHchuw", | ||
"license" : { | ||
"id" : "cc-by", | ||
"label" : "Attribution 4.0 International (CC BY 4.0)", | ||
"type" : "License", | ||
"url" : "http://creativecommons.org/licenses/by/4.0/" | ||
}, | ||
"locationType" : { | ||
"id" : "iiif-image", | ||
"label" : "IIIF Image API", | ||
"type" : "LocationType" | ||
}, | ||
"type" : "DigitalLocation", | ||
"url" : "https://iiif.wellcomecollection.org/image/lHZ.jpg/info.json" | ||
}, | ||
"type" : "Image" | ||
} | ||
] | ||
"type": "Image", | ||
"visuallySimilar": [] | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain how you came up with these default scores? Why is
Colors
so much lower?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. There's a notebook in the data science repo which produced the results in wellcomecollection/platform#5581. Based on that analysis, we decided that ~300 seemed like an appropriate threshold for the blended similarity metric.
I re-ran that analysis with the
state.inferredData.lshEncodedFeatures
andstate.inferredData.palette
fields individually, and produced these corresponding graphs:lshEncodedFeatures:
palette:
If my mental maths is right, the scores for colours are generally lower because the
state.inferredData.palette
field contains fewer, more commonly occurring terms.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, super. Maybe just include a comment pointing to that ticket, so we can find this again in future?