-
-
Save gabguerin/2259948424837c742722ab5931249668 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _get_sign_predicted(self, batch_size=5, threshold=0.5): | |
# Get the list (of size batch_size) of the most similar reference signs | |
sign_names = self.sign_dictionary.iloc[:batch_size]["name"].values | |
# Count the occurrences of each sign and sort them by ascending order | |
sign_counter = Counter(sign_names).most_common() | |
# Check if the most similar sign's proportion in the batch is greater than the threshold | |
predicted_sign, count = sign_counter[0] | |
if count / batch_size < threshold: | |
return "Signe inconnu" | |
return predicted_sign |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment