Recent Question/Assignment

Team Work- Python Scripts
Exercie 1 (Networking, sockets)
You need to write a Python network TCP server/client script. Upon receiving a connection, it should send back to the client its IP address (client IP). Then it should wait for commands from the client. Valid
commands are “TIME”, “IP”, “OS” and “EXIT”. To the TIME command, the server should return the current time. To the IP command, it returns the client’s IP address. To the “OS” command, the server returns information about the operating system. To the “File” command, the server sends a dummy file to the client.
If the client closes the connection or does not respond with a command in a reasonable time (30
seconds), the server should close the current connection and wait for another connection (see Setting a timeout on a socket).
To the EXIT command, your server should close all open sockets and exit.
Exercice 2 (Who am I, Numpy……..)
• The goal is to compute the average image of faces.
• Download Labeled Faces of personalities having names starting with “A” from the attached file
• For each folder representing a person
If a folder contains more or equal to 2 pictures
Read each image with scipy.misc.imread or any other module of your choice and accumulate values into RGB tensor.
Compute an averaged RGB tensor by dividing with the number of images in a
Write the averaged result in an image with scipy.misc.imsave (do not forget to
convert result to a type that saves images in correct form). The images need to
be saved in “./result” folder
• Please keep in mind that you can use multi-threading or multi-processing to speed up the solution