Affichage des articles dont le libellé est CODE. Afficher tous les articles
Affichage des articles dont le libellé est CODE. Afficher tous les articles

mardi, juillet 21, 2020

Running MTCNN on my own photos

Purpose

The aim of this post is to share my own experience of running a MTCNN (Multi-task Cascaded Convolutional Neural Network) on my own images.

I ran MTCCN on some of my photographs in order to extract faces out of photos.


Dolls

The first example is a photo of dolls in my garden:

After running the code, the extracted faces are:
Here we can observe that only the two dolls and the "Pierrot" are extracted. It's logic as their faces are much like humans and with some 3D aspect that is not the case for the other characters (flat faces)

Amsterdam marathon

The second example I ran was the photos taken during the Amsterdam marathon, first photo during the race:
And the extracted faces are:

Here we can observe that the algorithm is correctly extracting faces in the first plan, and is even good for extracting the faces in the back, of course with less accuracy.

The second photo at the finish:

An the extracted faces are:
Here we can observe that there is an outlier on the right handside: MTCNN has identified the arm as a face :=(

La Famille Belier

The last example is taken out of a photos of celebrities, a photo from the poster of the film "La Famille Bélier":

An the extracted faces are:

The code

Conclusion

  • The code is pretty simple if you simply use the Keras libraries. From the different examples, I observe the MTCNN is pretty efficient at distinguishing human faces out of non human faces.
  • The time for execution is also fast.
  • The next steps I might explore is how to attach the names of the celebrities given their photos, and give a legend to some photos. I will explore this with LTSM (Long Short Term Memory) neural network.
  • A big thanks to Jason Brownlee.




dimanche, juin 28, 2020

CIFAR10: 10 classes of images of 32x32 pixels

This blog post:


  • shows the results of running a deep learning network on a set of images provided by CIFAR10 (10 classes of 6000 images of 32x32 pixels).
  • demonstrates the duration of running a deep learning network on my own computer.
  • demonstrates the impact on accuracy when running the model with dropout, data augmentation and batch normalisation.
The example is provided from the book of Jason Brownlee “Deep Learning for Computer Vision”.

Scope

I ran on the CIFAR10 dataset basically two different models of the CNN (Convolutional Neural Network):
  • The baseline model
  • The baseline augmented model with dropout, data augmentation and batch normalisation.  Data augmentation involves making copies of the example in the training dataset with small random modifications.

Results

You have an overview of the results in the screenshot below with code in Python:

Cross entropy and accuracy loss:

The above result shows the cross entropy and classification accuracy for the baseline model

The above diagram shows the cross entropy and classification accuracy for the augmented model

CPU load:
You can observe that GPU load is 0%, which is a bad usage in Neural Network computation.

A CFIFAR 10 example written in JavaScript has been created here and is very much visualising the ConvNetJS deep learning network.

Epilogue

This test clearly indicates the necessity to use an other mean of training deep neural network other than my own computer: either Amazon Web Services, Google Colab or a personal computer with big GPU capacity.

vendredi, avril 03, 2020

Tension artérielle et fréquence cardiaque - Cours de bourse

Avec le langage R et l'outil R Studio on peut assez rapidement obtenir des statistiques. Il est aussi possible grace à cet outil de créer des résultats graphiques.

Ainsi sur une base de 42 échantillons de ma tension artérielle relevés entre le dernier trimestre 2019 et le premier trimestre 2020, on obtient les résultats ci-dessous :

> round(mean(tar$Systolic))
[1] 127
> round(mean(tar$Diastolic))
[1] 87
> round(mean(tar$FC))
[1] 69

et le graphique dit "à moustaches" ci-dessous :

J'ai aussi effectué une analyse des données de course de 2014 à 2020. Après un export de Garmin Connect en fichier.csv, j'ai pu extraire les principaux éléments. Les échantillons sont mensuels.


Donc en moyenne sur les 6 dernières années, j'ai parcouru 169 km en moyenne par mois, 15h30 par mois, en fréquence cardiaque moyenne de 146 et en fréquence maximale de 180.
On le savait déjà, mais on remarque que l'analyse de corrélation (Analyse en Composante Principale) permet de confirmer que la VO2MAX est corrélée à la distance parcourue, elle même fortement corrélée au temps d'activité :



Il est aussi possible d'utiliser la librairie quantmod qui permet de récupérer les cours de bourse et d'afficher des graphiques avec les chandeliers japonais :

J'ai pu acquérir cette compétence sur le langage R, ainsi que les bases de la statistique grace au cours en ligne de type MOOC FUN.

Le code pour la tension artérielle: