Warlord-K commited on
Commit
6ad2059
1 Parent(s): 3680d88

Update helpers.py

Browse files
Files changed (1) hide show
  1. helpers.py +7 -4
helpers.py CHANGED
@@ -84,8 +84,11 @@ def findCosineDistance(source_representation, test_representation):
84
 
85
  def get_embeddings(model, imgs):
86
  embeddings = []
87
- for img in imgs:
88
- img = np.expand_dims(np.array(img.resize((152,152))), axis = 0)
89
- embedding = model.predict(img, verbose=0)[0]
90
- embeddings.append(embedding)
 
 
 
91
  return embeddings
 
84
 
85
  def get_embeddings(model, imgs):
86
  embeddings = []
87
+ for i, img in enumerate(imgs):
88
+ try:
89
+ img = np.expand_dims(np.array(img.resize((152,152))), axis = 0)
90
+ embedding = model.predict(img, verbose=0)[0]
91
+ embeddings.append(embedding)
92
+ except:
93
+ print(f"Error at {i}, skipping")
94
  return embeddings