From 3798ffe30ee6151259827ac7edf660dfe0846e28 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 13 Feb 2025 00:43:13 +0200 Subject: [PATCH] fix --- utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/utils.py b/utils.py index f5a08dd..9ba854a 100644 --- a/utils.py +++ b/utils.py @@ -1,16 +1,16 @@ import numpy as np -def EuclideanDistance(detected_colors, target_colors): - return np.linalg.norm(detected_colors - target_colors, axis=1) +def EuclideanDistance(detected_color, target_colors): + return np.linalg.norm(detected_color - target_colors, axis=1) -def ManhattanDistance(detected_colors, target_colors): - return np.sum(np.abs(detected_colors - target_colors), axis=1) +def ManhattanDistance(detected_color, target_colors): + return np.sum(np.abs(detected_color - target_colors), axis=1) -def CosineSimilarity(detected_colors, target_colors): - return np.dot(detected_colors, target_colors) / (np.linalg.norm(detected_colors) * np.linalg.norm(target_colors)) +def CosineSimilarity(detected_color, target_colors): + return -np.dot(target_colors, detected_color) / (np.linalg.norm(detected_color) * np.linalg.norm(target_colors, axis=1)) '''def HSV_Color_Similarity(detected_colors, target_colors):