face-search's Issues
Numpy 1.20.0 error invalid __array_struct__
Thanks a lot for your work Dr. Varshita Sher!
To avoid the issue: Invaliid array_struct , you can easely bypass the filtering function with a try and extracting only the embedding array in the embedding function:
to get only the embeddings array with insight face:
emb_res = app.get(rgb_arr)
res = emb_res[0].embedding
Then the function will be :
def generate_embs(img_fpaths: List[str]):
embs_set = list()
embs_label = list()
for img_fpath in img_fpaths:
print('tratamento: ',img_fpath)
# read grayscale img
img = Image.open(os.path.join(YALE_DIR, img_fpath))
img_arr = np.asarray(img)
# convert grayscale to rgb
im = Image.fromarray((img_arr * 255).astype(np.uint8))
rgb_arr = np.asarray(im.convert('RGB'))
# generate Insightface embedding
emb_res = app.get(rgb_arr)
try:
res = emb_res[0].embedding
# append emb to the eval set
embs_set.append(res)
# append label to eval_label set
embs_label.append(img_fpath.split("_")[0])
except:
print('no embedding found for this image')
return embs_set, embs_label
this way no need for filtering the set is updated only if the embedding exist.
Then replace these 2 lines:
evaluation_embs, evaluation_labels = filter_empty_embs(eval_set, eval_labels)
probe_embs, probe_labels = filter_empty_embs(probe_set, probe_labels)
with
evaluation_embs, evaluation_labels = eval_set, eval_labels
probe_embs, probe_labels = probe_set, probe_labels
or rename the variables name
Check my answer on stackoverflow:
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.