500 official portraits coded for gender and checked against the record: 97.4% right, and every error a woman taken for a man.
Official portraits are as good as photos of faces get: one person, lit, sharp and facing the camera. They are also a test with the answers attached, since the gender of every member of Congress is on record. So this is two things at once: a small study of who is in the portraits, and a check of how far a tool that codes gender from faces can be trusted.
The 119th Congress has official portraits in the public domain for 523 of its 539 members and delegates. We took all 98 available for the Senate and 402 of the House, uploaded them as two groups and coded them with Age and gender of faces. A face was found and coded in every portrait. The faces are 228 pixels across (median). The record is the gender given in the public list of legislators.
| Senate (n = 98) | House (n = 402) | |
|---|---|---|
| Woman | 25 (25.5%) | 107 (26.6%) |
| Man | 73 (74.5%) | 295 (73.4%) |
χ²(1, N = 500) = 0.05, Cramér's V = .01, p = .904, permutation test.
On these figures women are about a quarter of both chambers, and the chambers do not differ.
| Coded as woman | Coded as man | |
|---|---|---|
| Woman | 132 | 13 |
| Man | 0 | 355 |
Agreement 97.4%.
The tool is right about 97.4% of the faces, and every one of its 13 errors is a woman coded as a man. It finds 91% of the women and all of the men. The share of women therefore comes out at 26.4% when it is 29.0%, and the gap is not the same in the two chambers: 25.5% instead of 26.5% in the Senate, 26.6% instead of 29.6% in the House. A difference of three points between the chambers shrinks to one.
An accuracy of 97% sounds like a licence to forget about errors. It is not, as long as they all point the same way. Two things follow for anyone who counts women and men in photos. Report the confusion matrix and not only the accuracy. And correct the share with a sample coded by hand: 2,000 random samples of 100 of these portraits gave corrected shares of women that averaged 29.0%, with 95% of them between 26.4% and 32.0%. How to do it is in How many images to check by hand.
Age is another matter. The tool put 82 of the 500 members under 30 and 12 under 20, although nobody can sit in the House before 25. Portraits can be years old, but not that old. Age groups from a tool like this one can be compared between sets of photos coded the same way. They should not be read as ages.
The whole report, with the data file, is under the form of the tool. The portraits come from the public-domain collection of the unitedstates project, and the record from its list of legislators.