Segmenter une image pixel à pixel

Links: notebook, html ., PDF, python, slides ., presentation ., GitHub

Il est aujourd’hui assez facile de construire une boîte englobante autour d’un visage dans une image. Le deep learning permet d’extraire précisément les pixels du visage.

run previous cell, wait for 2 seconds

Chargement du modèle

[DLImageSegmentation] download model 'FCN8s'
[DLImageSegmentation] [C:Usersxavie/data/models/chainer/fcn8s_from_caffe.npz] Checking md5 (256c2a8235c1c65e62e48d3284fbd384)
[DLImageSegmentation] load_npz 'C:Usersxavie/data/models/chainer/fcn8s_from_caffe.npz'
[DLImageSegmentation] class_name '['background' 'aeroplane' 'bicycle' 'bird' 'boat' 'bottle' 'bus' 'car'
 'cat' 'chair' 'cow' 'diningtable' 'dog' 'horse' 'motorbike' 'person'
 'potted plant' 'sheep' 'sofa' 'train' 'tv/monitor']'
[DLImageSegmentation] cpu

Sur une petite image

(295, 220)
c:Python363_x64libsite-packagesskimagetransform_warps.py:84: UserWarning: The default mode, 'constant', will be changed to 'reflect' in skimage 0.15.
  warn("The default mode, 'constant', will be changed to 'reflect' in "
<matplotlib.image.AxesImage at 0x18000a1a8d0>
../_images/image_segmentation_9_1.png

Sur une image dont on change la taille

(147, 110, 3)
(147, 110)
c:Python363_x64libsite-packagesskimagetransform_warps.py:84: UserWarning: The default mode, 'constant', will be changed to 'reflect' in skimage 0.15.
  warn("The default mode, 'constant', will be changed to 'reflect' in "
<matplotlib.image.AxesImage at 0x18001a8bd68>
../_images/image_segmentation_17_1.png

Sur une grande image

(456, 684, 3)
<matplotlib.image.AxesImage at 0x1800210b9e8>
../_images/image_segmentation_23_1.png
(456, 684)
c:Python363_x64libsite-packagesskimagetransform_warps.py:84: UserWarning: The default mode, 'constant', will be changed to 'reflect' in skimage 0.15.
  warn("The default mode, 'constant', will be changed to 'reflect' in "
<matplotlib.image.AxesImage at 0x1800216b9e8>
../_images/image_segmentation_26_1.png