/FeatureExtraction

Feature extraction - Image Processing

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Introdution

The FeatureExtraction project is dedicated to extracting features from images. We have brought together the main last generation pullers.

You can extract resources by using the following approaches:

  1. LBP (Local Binary Part)
  • Extraction : 352 features
  • Default Configuration : radius = 2 | n_points = 12
  • Reference : OJALA, Timo; PIETIKÄINEN, Matti; MÄENPÄÄ, Topi. Gray scale and rotation invariant texture classification with local binary patterns. In: European Conference on Computer Vision. Springer, Berlin, Heidelberg, 2000. p. 404-420.
  1. FOM (First Order Measures)
  • Extraction : 8 features (gray) | 24 features (color)
  • First Order Measures : 1 - Average | 2 - Mode | 3 - Variation | 4 - Standard deviation | 5 - Dispersal | 6 Population sample standard deviation | 7 - Energy | 8 - Entropy
  • Reference : IRONS, James R.; PETERSEN, Gary W. Texture transforms of remote sensing data. Remote Sensing of Environment, v. 11, p. 359-370, 1981.
  1. Surf (Speeded up robust features)
  • Extraction : 70 features
  • Default Configuration : nr_octaves=4 | nr_scales=6 | initial_step_size=1 | threshold=0.1 | max_points=1024 | descriptor_only=False
  • Reference : BAY, Herbert; TUYTELAARS, Tinne; VAN GOOL, Luc. Surf: Speeded up robust features. In: European conference on computer vision. Springer, Berlin, Heidelberg, 2006. p. 404-417.
  1. Zernike
  • Extraction : 72 features
  • Default Configuration : radius = 15 | degree = 8
  • Reference : TEAGUE, Michael Reed. Image analysis via the general theory of moments. JOSA, v. 70, n. 8, p. 920-930, 1980.
  1. Haralick
  • Extraction : 13 features
  • Measures : AngularSecondMoment | Contrast | Correlation | SumofSquares:Variance | InverseDifferenceMoment | SumAverage | SumVariance | SumEntropy | Entropy | DifferenceVariance | DifferenceEntropy | InformationMeasureofCorrelation1 | InformationMeasureofCorrelation2
  • Reference : HARALICK, Robert M.; SHANMUGAM, Karthikeyan; DINSTEIN, Its' Hak. Textural features for image classification. IEEE Transactions on systems, man, and cybernetics, n. 6, p. 610-621, 1973.
  1. GCH (Global Color Histogram)
  • Extraction : 30 features
  • Default Configuration : bins = 10 (bins for chanel)
  • Reference : STRICKER, Markus Andreas; ORENGO, Markus. Similarity of color images. In: Storage and retrieval for image and video databases III. International Society for Optics and Photonics, 1995. p. 381-392.
  1. DEEP Transfer Learning
  • Extraction : Depends on the approach. (512 to 4032 features)
  • Approach : Xception | VGG16 | VGG19 | ResNet50 | ResNet101 | ResNet152 | ResNet50V2 | ResNet101V2 | ResNet152V2 | InceptionV3 | InceptionResNetV2 | MobileNet | MobileNetV2 | DenseNet121 | DenseNet169 | DenseNet201 | NASNetMobile | NASNetLarge

Requirements

  • Tests performed on Ubuntu 18.04.3 LTS with Python (3.6.8)

libraries

  • Keras (2.3.1)
  • TensorFlow (2.0.0)
  • mahotas (1.4.8)
  • numpy (1.17.1)

Use desired code for extraction

  • LBP (Local Binary Part)
    from extractor.lbp import LBP
    lbp = LBP()
    featuresLBP = lbp.extractionFeatures('img.jpg')
    print('LBP --> ', featuresLBP)

  • Surf
    from extractor.surf import Surf
    surf = Surf()
    featuresSurf= surf.extractionFeatures('img.jpg')
    print('Surf --> ', featuresSurf)

  • Zernike
    from extractor.zernike import Zernike
    zernike = Zernike()
    featuresZernike= zernike.extractionFeatures('img.jpg')
    print('Zernike --> ', featuresZernike)

  • Haralick
    from extractor.haralick import Haralick
    haralick = Haralick()
    featuresHaralick = haralick.extractionFeatures('img.jpg')
    print('haralick --> ', featuresHaralick)

  • FOM - First Order Measures (Gray)
    from extractor.fom import FOM
    fom = FOM()
    featuresFOM = fom.extractionFeatures('img.jpg')
    print('FOM (Gray) --> ', featuresFOM)

  • FOM - First Order Measures (Color)
    from extractor.fom import FOM
    fom = FOM()
    featuresFOM = fom.extractionFeaturesColor('img.jpg')
    print('FOM (Color) --> ', featuresFOM)

  • GCH - Global Color Histogram
    from extractor.gch import GCH
    gch = GCH()
    featuresGCH = gch.extractionFeatures('img.jpg')
    print('GCH --> ', featuresGCH)

  • Deep Features
    from extractor.deep import Deep
    deep = Deep('Xception')
    featuresDeep = deep.extractionFeatures('img.jpg')
    print(featuresDeep)

Opition - DEEP:
--- Xception
--- VGG16
--- VGG19
--- ResNet50
--- ResNet101
--- ResNet152
--- ResNet50V2
--- ResNet101V2
--- ResNet152V2
--- InceptionV3
--- InceptionResNetV2
--- MobileNet
--- MobileNetV2
--- DenseNet121
--- DenseNet169
--- DenseNet201
--- NASNetMobile
--- NASNetLarge

Extract from multiple simultaneous images and generate one file (.arff)

  • Orgnization dataset
    -- Dir_dataset
    ------ Dir_class1
    ------------- img01.jpg
    ------------- img02.jpg
    ------------- img03.jpg
    ------ Dir_class2
    ------------- img01.jpg
    ------------- img02.jpg
    ------------- img03.jpg
    ------ Dir_classN
    ------------- img01.jpg
    ------------- img02.jpg
    ------------- img03.jpg

Command Line

-d dataset
-- Directory containing the images
-m Method
-- Extraction Method
-n deepName
-- Name desired method to deep learning

python3 extractorFeatures.py -d dataset -m lbp
python3 extractorFeatures.py -d dataset -m surf
python3 extractorFeatures.py -d dataset -m zernike
python3 extractorFeatures.py -d dataset -m haralick
python3 extractorFeatures.py -d dataset -m fom
python3 extractorFeatures.py -d dataset -m fomc
python3 extractorFeatures.py -d dataset -m gch
python3 extractorFeatures.py -d dataset -m deep -n Xception
python3 extractorFeatures.py -d dataset -m deep -n VGG16
python3 extractorFeatures.py -d dataset -m deep -n VGG19
python3 extractorFeatures.py -d dataset -m deep -n ResNet50
python3 extractorFeatures.py -d dataset -m deep -n ResNet101
python3 extractorFeatures.py -d dataset -m deep -n ResNet152
python3 extractorFeatures.py -d dataset -m deep -n ResNet50V2
python3 extractorFeatures.py -d dataset -m deep -n ResNet101V2
python3 extractorFeatures.py -d dataset -m deep -n ResNet152V2
python3 extractorFeatures.py -d dataset -m deep -n InceptionV3
python3 extractorFeatures.py -d dataset -m deep -n InceptionResNetV2
python3 extractorFeatures.py -d dataset -m deep -n MobileNet
python3 extractorFeatures.py -d dataset -m deep -n MobileNetV2
python3 extractorFeatures.py -d dataset -m deep -n DenseNet121
python3 extractorFeatures.py -d dataset -m deep -n DenseNet169
python3 extractorFeatures.py -d dataset -m deep -n DenseNet201
python3 extractorFeatures.py -d dataset -m deep -n NASNetMobile
python3 extractorFeatures.py -d dataset -m deep -n NASNetLarge