Using Numpy and SciPy, I would need a python script to calculate the average RGB tensor from image of human faces.
o If a folder contains more than or equal to 2 images, do these step:
▪ Read each image using SciPy and add the values in the RGB tensor (Red, Green, Blue)
▪ Calculate an average RGB tensor by dividing by the number of images in the folder.
▪ Write the average result in an image with [login to view URL] (don't forget to convert the result to a type that saves images in correct form). Images should be saved in a folder called "./result".
• Please keep in mind that the uses of multithreading or multiprocessing to speed up the script.
The script will have to run from the root of the main folder. In the main folder, there is about 400 folders containing images of faces from various celebrities. Each folder represent one celebrity. If a folder contains more than 2 images, the script must calculate each image RGB tensor value using SciPy. If a folder contains only one image, do not calculate the RGB tensor value of this image. The script will then add the value of each RGB tensor values from each image and calculate the average RGB tensor by dividing by the numbers of images in the folder (Average RGB tensor values for 3 images: The sum of all RGB tensor for each images values divided by 3). Finally, the script will write the average result in an image using SciPy in a folder called "./result.