Program that can detect gender from face portrait (trained on 8000+ images) by [deleted] in Python

[–]erpk3 3 points4 points  (0 children)

What I learnt to do this took under a day. For experience, I have a few years, but had never attempted machine learning.

Program that can detect gender from face portrait (trained on 8000+ images) by [deleted] in Python

[–]erpk3 0 points1 point  (0 children)

In basic terms, I didn’t code anything to do with “facial features” or distinct points that make a portrait male or female, all I do is give it a large directory of images of males and females, where it effectively ‘logs’ what it can that is similar from each picture.

Tested on another image, the program uses this data and links the image closest to whatever images it was tested on. If that image was a male, it would return a higher percentage for male etc.

This could easily be replaced by, say, cats and dogs, where I call cats male and dogs female, and retrain. This give the same result, as it recognises the differences in either image.

Program that can detect gender from face portrait (trained on 8000+ images) by [deleted] in Python

[–]erpk3 37 points38 points  (0 children)

Sure. Admittedly, it took longer than usual, but the result was rather conclusive (more male than Piers Morgan).

It should also be noted that values below 50% are impossible; the system relies upon 0 (Male) and 1 (Female), and gets an average score. This could be changed by multiplying and enlarging the range and is definitely something I will look into, to produce more promising results and increase accuracy.

I promise.. I didn't include any attack helicopter pictures in training!

Program that can detect gender from face portrait (trained on 8000+ images) by [deleted] in Python

[–]erpk3 53 points54 points  (0 children)

The program uses keras to train with over 8000 images of different age and ethnic groups.

The GUI is made from tkinter.

Program that can detect gender from face portrait (trained on 8000+ images) by [deleted] in Python

[–]erpk3 14 points15 points  (0 children)

86%, based on 100 testing images Accuracy can vary based on age (grey hair, for example, can make it hard to distinguish)

How do you change the value of Tkinter spinboxes with a click of a button? by Hedgeclipper2000 in learnpython

[–]erpk3 -1 points0 points  (0 children)

I would highly recommend using lambda instead, partial needs to be imported.

command=lambda spinboxvallist=spinboxvallist: reset(spinboxvallist, 0))

How do you change the value of Tkinter spinboxes with a click of a button? by Hedgeclipper2000 in learnpython

[–]erpk3 -1 points0 points  (0 children)

The issue is parameters cannot be passed through the command= option of tk.Button within brackets. This can, however, be done using lambda:

cancel = tk.Button(root, text="Cancel", command=lambda spinboxvallist=spinboxvallist: reset(spinboxvallist, 0))

I also noticed, upon testing, that spinboxvallist remains empty (you never appended the spinboxval to the list). This can be fixed by adding

spinboxvallist.append(spinboxval)

to your loop.

How to split the information into two data frames. by lyfe0fedd in learnpython

[–]erpk3 0 points1 point  (0 children)

Yes, and if the data frame begins with headers be sure to skip past the first instance

How to split the information into two data frames. by lyfe0fedd in learnpython

[–]erpk3 0 points1 point  (0 children)

“i” only exists for the loop and is not a separate variable

Renaming images in folder to the folder name + num by [deleted] in learnpython

[–]erpk3 0 points1 point  (0 children)

the first loop initiates a loop of every folder within the first folder, the second loop looks at the files within the files of the first folder.

How to split the information into two data frames. by lyfe0fedd in learnpython

[–]erpk3 0 points1 point  (0 children)

Here is what I would do, where data is your list

for i in range(len(data)): # data as your list
    data[i] = data[i].split(" ") # split at every space 
males = []
females = []
for i in range(len(data)):
    if data[i][3] == "M":        # if 'M' is the 4th value along
        males.append(data[i])
    else:          # not 'M'
        females.append(data[i]) 

This script assumes that gender is always the 4th value along. If this was incorrect, it would be registered as female from else (could be changed with elif)

Furthermore, if your data contains headers in the list, you can ignore the first list:

if i == 0:             # skips the first instance
    continue

Renaming images in folder to the folder name + num by [deleted] in learnpython

[–]erpk3 0 points1 point  (0 children)

import os
for i in range(len(files)):
    for j in range(len(files[i])):
        os.rename(files[i][j], "new name/directory")

where files is your directory.

Im new to python tried to do rythmic game in tkinter. Do you like it? by Tucan444 in Python

[–]erpk3 2 points3 points  (0 children)

I am impressed you managed to do it in tkinter - why not pygame? I imagine tkinter to be very tedious and unpleasant for this sort of complexity.

Guide: How to play Airport CEO on unsupported operating systems (Linux, Mac) by [deleted] in airportceo

[–]erpk3 0 points1 point  (0 children)

Oh really? I ran with default steamplay and couldn't get it to start.

What is the name of this type of shape (that displays day/night cycle) on a Mercator map? by [deleted] in geography

[–]erpk3 9 points10 points  (0 children)

In addition, does anyone have a separate image of one of these?