summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdata/face-detection-accuracy.py31
1 files changed, 22 insertions, 9 deletions
diff --git a/data/face-detection-accuracy.py b/data/face-detection-accuracy.py
index ad43a2f..161f932 100755
--- a/data/face-detection-accuracy.py
+++ b/data/face-detection-accuracy.py
@@ -4,13 +4,26 @@ import matplotlib.mlab as ml
import numpy as np
import sys
-face_filename = sys.argv[1]
-data = ml.load(face_filename,delimiter=",",usecols=[3,4])
-distance_detected = [float(distance) for (distance,detected) in data if int(detected)>0]
-distance = [float(distance) for (distance,detected) in data]
-range = (min(distance),max(distance))
-hist_detected,bins = np.histogram(distance_detected,bins=30,range=range)
-hist,bins = np.histogram(distance, bins=30, range=range)
-result = hist_detected*1./hist
-plt.bar(bins[1:],result,width=np.diff(bins)[1])
+numbins_distance = 15
+numbins_brightness = 30
+face_detection_filename = sys.argv[1]
+brightness_filename = sys.argv[2]
+distance,detected = ml.load(face_detection_filename,delimiter=",",usecols=[3,4],unpack=True)
+brightness = ml.load(brightness_filename,delimiter=",",usecols=[3],unpack=True)
+distance_detected = distance[detected>0]
+brightness_detected = brightness[detected>0]
+range_distance = (min(distance),max(distance))
+range_brightness = (min(brightness),max(brightness))
+hist_detected,bins = np.histogram(distance_detected,bins=numbins_distance,range=range_distance)
+hist,bins = np.histogram(distance, bins=numbins_distance, range=range_distance)
+brightness_hist_detected,bins_brightness = np.histogram(brightness_detected,bins=numbins_brightness, range=range_brightness)
+brightness_hist,bins_brightness = np.histogram(brightness,bins=numbins_brightness, range=range_brightness)
+
+result1 = hist_detected*1./hist
+result2 = brightness_hist_detected*1./brightness_hist
+plt.subplot(211)
+plt.bar(bins[:-1],result1,width=np.diff(bins))
+plt.subplot(212)
+plt.bar(bins_brightness[:-1],result2,width=np.diff(bins_brightness))
plt.show()
+