Skip to content

Commit

Permalink
Merge pull request #2762 from wellcomecollection/Features-vector-changes
Browse files Browse the repository at this point in the history
Switch to using full 4096 dimensional feature vector #5823
  • Loading branch information
StepanBrychta authored Nov 25, 2024
2 parents 47ecb52 + 22d5c4f commit cb3dd19
Show file tree
Hide file tree
Showing 77 changed files with 255,004 additions and 310,719 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,15 @@ object ImageFsm {
}

case class InferredData(
// We split the feature vector so that it can fit into
// ES's dense vector type (max length 2048)
features1: List[Float],
features2: List[Float],
reducedFeatures: List[Float],
features: List[Float],
paletteEmbedding: List[Float],
averageColorHex: Option[String],
aspectRatio: Option[Float]
)

object InferredData {
def empty: InferredData = InferredData(
features1 = Nil,
features2 = Nil,
reducedFeatures = Nil,
features = Nil,
paletteEmbedding = Nil,
averageColorHex = None,
aspectRatio = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait ImagesIndexFixtures extends IndexFixturesBase {
def withLocalImagesIndex[R]: Fixture[Index, R] = {
withLocalElasticSearchIndex[R](config =
getConfig(
mappings = "mappings.images_indexed.2024-11-06.json",
mappings = "mappings.images_indexed.2024-11-14.json",
analysis = "analysis.works_indexed.2024-11-06.json"
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,9 @@ trait ImageGenerators

def createInferredData: InferredData = {
val features = randomUnitLengthVector(4096)
val (features1, features2) = features.splitAt(features.size / 2)
val reducedFeatures = randomUnitLengthVector(1024)
val paletteEmbedding = randomUnitLengthVector(1000)
InferredData(
features1 = features1.toList,
features2 = features2.toList,
reducedFeatures = reducedFeatures.toList,
features = features.toList,
paletteEmbedding = paletteEmbedding.toList,
averageColorHex = Some(randomHexString),
aspectRatio = inferredDataAspectRatio
Expand Down
Loading

0 comments on commit cb3dd19

Please sign in to comment.