“The balance’: Number and Emotion

Wenya Liu
Measuring the Great Indoors
5 min readDec 10, 2019

The tyranny of minority and the tyranny of majority

The tyranny of Majority:

In most of the voting systems that attempts to seek for fairness, the number of people are the only thing that can ultimately adjudicate the result. That is, on a pragmatic level, we deal with the ambiguity of Mill’s principle by passing laws or taking actions in a public environment which reflect most people’s idea.

All this assumes that what we should care about is the number of people who want something, not how much they want it. That assumption has long been a bedrock assumption of our democracies, but we could run our affairs a different way. Various historical societies have relied on voting procedures that take account of the intensity of people’s feelings as well as their number. In the assemblies of some Celtic tribes, for example, warriors would vote by banging their weapons together, with victory going to the side that produced the most noise. In ancient Sparta, some officials were chosen by having people shout for the candidate they liked the most. Obviously, this made it possible for the side that was smaller in terms of number, but more passionate about their cause, to win the day.

The tyranny of Minority

However, that would also potentially create an unhealthy dynamic in which voters were incentivized to become ever more zealous about their own viewpoints. It might also mean that moderate, unexciting groups would lose out to options.

The Difficulties:

1. It is hard reach out to every audience member and ask them all. If action’s taken only because a tiny minority of the audience felt strongly, the problem will directly slide to the other side of the tyranny of the minority, which encourages extremism and ignores the average audience members’ desires.

“In our democratic societies, politics and culture should be shaped by what all of us want, not by the whims of a few particularly riled-up activists. The tyranny of the minority has made too many inroads already.”

2. People might not willing to present their true feelings when they know their choices will be public recognized.

The way to defeat it is not roll back to the ‘tyranny of the majority’, it is, instead to use the technology we now have at our disposal to make sure that it is the people’s want that become reality. What we need, in other words, is not less democracy, but more, under the new balance allowed by the modern technology. It’s important to get these things right, which suggest the necessity to design procedures that can give us a quick but accurate picture of what people’s actual views are in these types of cases. The most important approach to achieving this goal is to weight the two equivalent ‘Emotion’ and ‘Number’ effectively under a new balancing system.

New procedure’s key word:

‘Comfort’ ‘Immediacy’ ‘Equity’

a. co-working/ office/ studio senario

b. Party scenario

Code

import numpy as np
import cv2
from keras.preprocessing import image
import webbrowser
#-----------------------------
#opencv initialization
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')cap = cv2.VideoCapture(0)
#-----------------------------
#face expression recognizer initialization
from keras.models import model_from_json
model = model_from_json(open("facial_expression_model_structure.json", "r").read())
model.load_weights('facial_expression_model_weights.h5') #load weights
#-----------------------------emotions = ('angry', 'disgust', 'fear', 'happy', 'sad', 'surprise', 'neutral')
a=0
b=0
c=0
d=0
while(True):
ret, img = cap.read()

#img = cv2.imread('C:/Users/IS96273/Desktop/hababam.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)faces = face_cascade.detectMultiScale(gray, 1.3, 5)#print(faces) #locations of detected facesfor (x,y,w,h) in faces:
cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2) #draw rectangle to main image

detected_face = img[int(y):int(y+h), int(x):int(x+w)] #crop detected face
detected_face = cv2.cvtColor(detected_face, cv2.COLOR_BGR2GRAY) #transform to gray scale
detected_face = cv2.resize(detected_face, (48, 48)) #resize to 48x48

img_pixels = image.img_to_array(detected_face)
img_pixels = np.expand_dims(img_pixels, axis = 0)

img_pixels /= 255 #pixels are in scale of [0, 255]. normalize all pixels in scale of [0, 1]

predictions = model.predict(img_pixels) #store probabilities of 7 expressions

#find max indexed array 0: angry, 1:disgust, 2:fear, 3:happy, 4:sad, 5:surprise, 6:neutral
max_index = np.argmax(predictions[0])

emotion = emotions[max_index]
a= emotions[max_index]

#write emotion text above rectangle
cv2.putText(img, emotion, (int(x), int(y)), cv2.FONT_HERSHEY_SIMPLEX, 1, (255,255,255), 2)

#process on detected face end
#-------------------------
print(a)if a == "happy":
b = b+1
print(b)
if b == 200:
webbrowser.open ("https://maker.ifttt.com/trigger/angry/with/key/bFujc_ImSXY2NRm5eha9GA")
b = 0
if a == "angry":
c = c+1
print(c)
if c == 70:
webbrowser.open ("https://maker.ifttt.com/trigger/happy/with/key/bFujc_ImSXY2NRm5eha9GA")
c = 0
if a == "neutral":
d = d+1
print(d)
if d == 200:
webbrowser.open ("https://maker.ifttt.com/trigger/angry/with/key/bFujc_ImSXY2NRm5eha9GA")
d = 0
cv2.imshow('img',img)if cv2.waitKey(1) & 0xFF == ord('q'): #press q to quit
break

#kill open cv things
cap.release()
cv2.destroyAllWindows()

--

--