Project package

AutoEncoder module

AutoEncoder.cut_list(list, length)[source]

This function allows to cut a list into parts of a certain length. It returns a new list which takes less memory and contains for each index a part of the initial list.

Args :

list : list of the images path of the whole database

length (int): the length of the parts

Returns :

list containing the images path cut by parts of <length>

AutoEncoder.show_face_data(nparray, n=10, title='')[source]

This function allows to show the faces from a numpy array.

Args :

nparray : array containing the images

n (int): the number of images we want to plot (default=10)

title : the title of the plotted faces

Returns :

None

evolutionary module

evolutionary.cross_over(pop, parent, lamb)[source]

This function allows to cross-over the selected parent with random other images with the same characteristics (sex, age and hair/beard wise). It returns a new population of mutated vectors while keeping the parent.

Args :

pop : encoded images vector of the whole database

parent: the array selected by the user

lamb (int): the size of the total population (children + parent)

Returns :

array containing lamb vectors from encoded pictures

Example :
>>> len(cross_over(population, population[0], 4))
4
>>> population[0] in cross-over(population,population[0], 4)
True
evolutionary.get_children_from_parent(pop, parent, lamb)[source]

This function allows to cross-over the parent pictures with other pictures and mutate the children to add diversity. It returns a new population of mutated vectors.

Args :

pop : encoded images vector of the whole database

parent: the array selected by the user

lamb (int): the size of the total population (children + parent)

Returns :

array containing lamb vectors from encoded pictures

evolutionary.mutation(pop)[source]

This function allows to mutate the picture’s attributes using Gaussian distribution. It returns a new population of mutated vectors.

Args :

pop : encoded images vector to mute

Returns :

nparray containing modified vectors from encoded pictures

filter_data module

filter_data.filter(path)[source]

This function creates 8 files containing different pictures sorted according specific attributes.

Args :

path : path to the database

Returns :

None

filter_data.split_encoded_images(encoder, csv_file)[source]

This function creates a file containing encoded vectors of images with the same characteristics.

Args :

encoder : encoder loaded from file “encodeur.h5”

csv_file : path to the csv file containing the listed pictures with the same characteristics

Returns :

None

interface module

interface.bevent(event)[source]

This function is for choosing the characteristic for man which is ‘beard’ not ‘no beard’.

interface.break_time(pop, parent, nb_children)[source]

This function offers the user a break time with a peaceful picture wtih cute Koala. The user can have the break time whenever he/she wants it.

Args:

pop : encoded images vector

parent : the array selected by the user

nb_children(int) : the number of children generated from the parent

Returns:

None

interface.choice_database(char)[source]

This function is for returning the images according to the user’s selection.

Args :

char : dictionary of characteristics for the aggressor.

Returns :

returns the vector of encoded images according to the user’s selection.

interface.chooseimage(pop, parent, nb_children)[source]

This function generates a new interface for asking the user whether he/she recognizes the suspects.

Args :

pop : encoded images vector

parent : the array selected by the user

nb_children(int) : the number of children generated from the parent

Returns :

None

interface.end_or_continue(photo, pop, parent, nb_children)[source]

This function generates a new interface for asking the user whether he/she found the suspect. It also asks the user if he/she wants other pictures of suspects.

Args :

photo : photo of the selected parent

pop : encoded images vector

parent : the array selected by the user

nb_children(int) : the number of children generated from the parent

Returns :

None

interface.fevent(event)[source]

This function is for choosing the gender which is ‘woman’ not ‘man’.

interface.found_agressor(photo)[source]

This function allows to generate the final interface showing the robot portrait of the agressor.

Args :

photo : the photo of the agressor

Returns :

None

interface.hevent(event)[source]

This function is for choosing the gender which is ‘man’ not ‘woman’.

interface.inital_population(event)[source]

This function is for showing the initial 10 pictures of the suspects according to the user’s choice.

interface.initialize()[source]

This function allows to put all the agressor’s characteristics to ‘False’.

interface.nbevent(event)[source]

This function is for choosing the characteristic for man which is ‘no beard’ not ‘beard’.

interface.nsevent(event)[source]

This function is for choosing the characteristic for woman which is ‘wavy hair’ not ‘straight hair’.

interface.oevent(event)[source]

This function is for choosing the age group which is ‘old’ not ‘young’.

interface.onClick(event)[source]

This function allows to generate a new interface to ask and store the characteristics of the agressor.

interface.reselect(event)[source]

This function is about asking the user for selecting the characteristic again because he/she did not click on a button so the data is missing.

interface.sevent(event)[source]

This function is for choosing the characteristic for woman which is ‘straight hair’ not ‘wavy hair’.

interface.sex_characteristics(event)[source]

This function is for asking the characteristic regarding to the gender. ‘beard’ or ‘no beard’ for man and ‘straight hair’ or ‘wavy hair’ for woman.

interface.yevent(event)[source]

This function is for choosing the age group which is ‘young’ not ‘old’.