Closed novialriptide closed 2 years ago
Hey Andrew, thanks for working on this PR. Couple of requests before finishing this mini-project up:
compute_threshold
method in facenet.py
seems to just compute the dot product similarity between two vectors. Instead of defining a new method within the FaceNet
class, it's best to use the existing DistMetric
(from util/distance.py
). Dot product distance is already implemented there in DistMetric.distance
, maybe you could make an auxiliary method similarity
that just returns 1 - self.distance()
.find_threshold
creates a copy of self.data
. Is it possible to rewrite that method without doing so? Not a big deal since it seems to only be called at init.apply_thresholds
- if possible, can it be written without the nested for loop (ie vectorized)? If not, no big deal.find_similar_embedding
- this should definitely be rewritten to avoid looping over self.data
on each call. Better way to do this would be to use the SVM/KNN classifier (self.classifier.predict
) to get the most similar embedding.I resolved Code Organization: 1
and Performance: 3
, I'm now working on the low-priority ones.
This PR adds some new things other than adaptive thresholding:
No face detected
spam.It looks like tests are failing, but in files unrelated to this pull request. I would like to create another pull request fixing these tests. @orangese.
Fix: https://github.com/millburnai/aisecurity/issues/19