Samuel Schmidt commited on
Commit
ddfac1f
·
1 Parent(s): 6ee3bc1

Update src/app.py

Browse files
Files changed (1) hide show
  1. src/app.py +6 -4
src/app.py CHANGED
@@ -13,18 +13,20 @@ dataset.cleanup_cache_files()
13
  candidate_subset = dataset["train"].select(range(10)) # This is a small CBIR app! :D
14
 
15
  def index_dataset(dataset):
 
 
 
 
 
16
 
17
  print("Color Embeddings")
18
  cd = ColorDescriptor((8, 12, 3))
19
- dataset_with_embeddings = dataset.map(lambda row: {'color_embeddings': cd.describe(row["image"])})
20
 
21
  print("CLIP Embeddings")
22
  clip_model = CLIPImageEncoder()
23
  dataset_with_embeddings = dataset_with_embeddings.map(clip_model.encode_images, batched=True, batch_size=16)
24
 
25
- print("LBP Embeddings")
26
- lbp_model = LBPImageEncoder(8,2)
27
- dataset_with_embeddings = dataset_with_embeddings.map(lambda row: {'lbp_embeddings': lbp_model.describe(row["image"])})
28
 
29
  # Add index
30
  dataset_with_embeddings.add_faiss_index(column='color_embeddings')
 
13
  candidate_subset = dataset["train"].select(range(10)) # This is a small CBIR app! :D
14
 
15
  def index_dataset(dataset):
16
+ print(dataset)
17
+
18
+ print("LBP Embeddings")
19
+ lbp_model = LBPImageEncoder(8,2)
20
+ dataset_with_embeddings = dataset.map(lambda row: {'lbp_embeddings': lbp_model.describe(row["image"])})
21
 
22
  print("Color Embeddings")
23
  cd = ColorDescriptor((8, 12, 3))
24
+ dataset_with_embeddings = dataset_with_embeddings.map(lambda row: {'color_embeddings': cd.describe(row["image"])})
25
 
26
  print("CLIP Embeddings")
27
  clip_model = CLIPImageEncoder()
28
  dataset_with_embeddings = dataset_with_embeddings.map(clip_model.encode_images, batched=True, batch_size=16)
29
 
 
 
 
30
 
31
  # Add index
32
  dataset_with_embeddings.add_faiss_index(column='color_embeddings')