Skip to content

Commit 565dcbf

Browse files
authored
Merge pull request #3744 from programminghistorian/Issue-3743-link
Update facial-recognition-ai-python.md
2 parents 879d749 + bd01b04 commit 565dcbf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

en/lessons/facial-recognition-ai-python.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ From police-operated surveillance cameras to facial recognition software at the
3333

3434
## Lesson Overview
3535

36-
This lesson is meant as an introductory exercise in applying computer vision ML to historical photos. The dataset we will explore contains several digitized American college yearbooks from the 20th century, now contained in [Bethel University's Digital Library](https://perma.cc/ZWE4-8MYL). We have selected one yearbook per decade from 1911 to 1961. Certainly, many more yearbooks would yield more complete findings, but a limited dataset is sufficient for this exercise and will be processed much more quickly than a larger dataset. After extracting an individual image of each face, we will use a pre-trained library in Python called [DeepFace](https://github.com/serengil/deepface) to detect the presence of a smile in each photograph.
36+
This lesson is meant as an introductory exercise in applying computer vision ML to historical photos. The dataset we will explore contains several digitized American college yearbooks from the 20th century, now contained in [Bethel University's Digital Library](https://perma.cc/ZWE4-8MYL). We have selected one yearbook per decade from 1911 to 1961. Certainly, many more yearbooks would yield more complete findings, but a limited dataset is sufficient for this exercise and will be processed much more quickly than a larger dataset. After extracting an individual image of each face, we will use a pre-trained library in Python called [DeepFace](https://pypi.org/project/deepface/) to detect the presence of a smile in each photograph.
3737

3838
This test case will allow us to verify something easily spotted by traditional historical analyses: that early photographic portraits in the 20th century typically feature stoical, serious faces, while more recent photographs tend to feature more casual, smiling faces. Historians like Christina Kotchemidova, for example, have argued that early sitters for photos avoided smiling in order to appear more like subjects in painted portraits, and hence more dignified.[^2] The long exposure times of primitive cameras also discouraged posing with a smile. The proliferation of amateur photography in the 20th century led to less formal photography, and hence more smiling. This tutorial will allow us to test these assertions computationally.
3939

@@ -354,7 +354,7 @@ In the decades since the Haar Cascades technique was developed in 2001, huge adv
354354

355355
In AI terminology, each individual pattern in the CNN is called a 'neuron.' Simplistically, one neuron might be dedicated to recognizing the pixel patterns at the corner of a left eye, another to the bottom of an ear lobe, etc. When the computer evaluates a photo looking for a smiling human face, these individual neurons pass their evaluations and predictions to the next series of calculations (typically called the next 'layer' within the CNN), which contain more neurons that take the previous layer's calculations into account and look for yet more patterns, before passing the updated information on to the next layer, and so on. This kind of multi-faceted detection program is an example of deep learning because the algorithm continually refines its evaluation through multiple layers. Through a refinement process commonly known as 'backpropagation,' the CNN compares its predictions with the correct answers, and adjusts the connections between the neurons accordingly, thereby improving the results. Like Haar Cascades, CNNs are capable of detecting objects anywhere in the image as it passes (or 'convolves') the detector over various stages of the image.
356356

357-
The particular deep learning library you'll use here is called [DeepFace](https://github.com/serengil/deepface), which comes with several pre-trained models that can be used to detect and classify various categories in images of human faces, like age, gender, emotion, and race. Given the current ethical state of AI in regards to race and gender, which we discussed above, we'll limit the experiment to DeepFace's emotion classifier. For our purposes, we'll say that a photo designated as 'happy' contains a smile, while a photo with any other dominant emotion, or a photo lacking any dominant emotion, does not. We should note here that even emotion detection algorithms are not inherently objective, as the facial cues for human emotions are not themselves universal.
357+
The particular deep learning library you'll use here is called [DeepFace](https://pypi.org/project/deepface/), which comes with several pre-trained models that can be used to detect and classify various categories in images of human faces, like age, gender, emotion, and race. Given the current ethical state of AI in regards to race and gender, which we discussed above, we'll limit the experiment to DeepFace's emotion classifier. For our purposes, we'll say that a photo designated as 'happy' contains a smile, while a photo with any other dominant emotion, or a photo lacking any dominant emotion, does not. We should note here that even emotion detection algorithms are not inherently objective, as the facial cues for human emotions are not themselves universal.
358358

359359
In the code below, you'll create a series of counts for each year that tallies the number of times the object detector classifies images as containing either smiles or non-smiles. It will then compare these counts against a count of total images, which will allow us to calculate a ratio of smiles to non-smiles for any given yearbook edition:
360360

0 commit comments

Comments
 (0)