I am trying to build a celebrity look-alike program, using VggFace and IMDb celebrity faces database, I calculate the embedding of each face in the database and I stock it in a pandas data frame. However, when I try to load that embedding afterword to use it to calculate a cosine distance I can't make it work, apparently it is stocked as a list inside of a string (ie "[ 1.3 -1 .... ] )etc". So I have to questions:
My code is too long, so I don't know if I should upload the dataframe online so you guys can view it.
Here is a line using df.to_dict():
518 : '[ 3.8515975 0.4580283 1.964929 ... -6.336113 1.31456 4.2759323]'
I am trying to iterate through the dataframe and multiply each line with an embedding representation of the user face using this code :
vect = calculVecteur('imagesUtilisateur/test.jpg',model)
vect = list(map(float, vect))
meta_data_imdb = pd.read_csv("resources/vectorisation/imdb_metadata_v.csv")
meta_data_imdb['distance'] = meta_data_imdb['vecteur'].apply(lambda x: calculerDistance(x,vect))
the calculVecteur()
calculates the embedding of the users image using the Vgg model, then I calculate the cosine distance using the calculerDistance()
method.
Using the debugger here is what I get :
https://imgur.com/a/B95VjdT
Thanks in advance for any help.
question from:
https://stackoverflow.com/questions/65834947/problem-with-converting-a-pandas-dataframe-column-into-a-float 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…