The FeatureExtraction project is dedicated to extracting features from images.
You can extract features using the following approaches:
- BIC (Border/Interior Pixel Classification)
- Extraction : 128 features
- Default Configuration : bins = 64 ((HI 64 + HC 64 = 128))
- Reference : STEHLING, Renato O.; NASCIMENTO, Mario A.; FALCAO, Alexandre X. A compact and efficient image retrieval approach based on border/interior pixel classification. In: Proceedings of the eleventh international conference on Information and knowledge management. 2002. p. 102-109.
- TAS (Threshold Adjacency Statistics)
- Extraction : 162 features
- Reference : COELHO, Luís Pedro et al. Structured literature image finder: extracting information from text and images in biomedical literature. In: Linking Literature, Information, and Knowledge for Biology. Springer, Berlin, Heidelberg, 2010. p. 23-32.
- 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.
- 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.
- 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.
- 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.
- 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.
- DEEP Transfer Learning
- Extraction : Depends on the approach. (512 to 4032 features)
- Approach : Xception | VGG16 | VGG19 | ResNet50 | ResNet50V2 | ResNet101 | ResNet101V2 | ResNet152 | ResNet152V2 | InceptionV3 | InceptionResNetV2 | MobileNet | MobileNetV2 | DenseNet121 | DenseNet169 | DenseNet201 | NASNetMobile | NASNetLarge | EfficientNetB0 | EfficientNetB1 | EfficientNetB2 | EfficientNetB3 | EfficientNetB4 | EfficientNetB5 | EfficientNetB6 | EfficientNetB7 | EfficientNetV2B0 | EfficientNetV2B1 | EfficientNetV2B2 | EfficientNetV2B3 | EfficientNetV2S | EfficientNetV2M | EfficientNetV2L
- Tests performed on Ubuntu 20.04.4 LTS with Python (3.8.10)
- see the file (requirements.txt)
- Install all dependencies (pip3 install -r requirements.txt)
- TAS (Threshold Adjacency Statistics)
from extraction.tas import TAS
tas = TAS()
featuresTAS = tas.extractionFeatures('img.jpg')
print('TAS --> ', featuresTAS)
- BIC (Border/Interior pixel Classification)
from extraction.bic import BIC
bic = BIC()
featuresBIC = bic.extractionFeatures('img.jpg')
print('BIC --> ', featuresBIC)
- LBP (Local Binary Part)
from extraction.lbp import LBP
lbp = LBP()
featuresLBP = lbp.extractionFeatures('img.jpg')
print('LBP --> ', featuresLBP)
- Zernike
from extraction.zernike import Zernike
zernike = Zernike()
featuresZernike= zernike.extractionFeatures('img.jpg')
print('Zernike --> ', featuresZernike)
- Haralick
from extraction.haralick import Haralick
haralick = Haralick()
featuresHaralick = haralick.extractionFeatures('img.jpg')
print('haralick --> ', featuresHaralick)
- FOM - First Order Measures (Gray)
from extraction.fom import FOM
fom = FOM()
featuresFOM = fom.extractionFeatures('img.jpg')
print('FOM (Gray) --> ', featuresFOM)
- FOM - First Order Measures (Color)
from extraction.fom import FOM
fom = FOM()
featuresFOM = fom.extractionFeaturesColor('img.jpg')
print('FOM (Color) --> ', featuresFOM)
- GCH - Global Color Histogram
from extraction.gch import GCH
gch = GCH()
featuresGCH = gch.extractionFeatures('img.jpg')
print('GCH --> ', featuresGCH)
- Deep Features
from extraction.deep import Deep
deep = Deep('Xception')
featuresDeep = deep.extractionFeatures('img.jpg')
print(featuresDeep)
Opition - DEEP:
--- Xception
--- VGG16
--- VGG19
--- ResNet50
--- ResNet50V2
--- ResNet101
--- ResNet101V2
--- ResNet152
--- ResNet152V2
--- InceptionV3
--- InceptionResNetV2
--- MobileNet
--- MobileNetV2
--- DenseNet121
--- DenseNet169
--- DenseNet201
--- NASNetMobile
--- NASNetLarge
--- EfficientNetB0
--- EfficientNetB1
--- EfficientNetB2
--- EfficientNetB3
--- EfficientNetB4
--- EfficientNetB5
--- EfficientNetB6
--- EfficientNetB7
--- EfficientNetV2B0
--- EfficientNetV2B1
--- EfficientNetV2B2
--- EfficientNetV2B3
--- EfficientNetV2S
--- EfficientNetV2M
--- EfficientNetV2L
- Organize the image set
- 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
- Run the command for extraction using a specific technique
-d dataset
-- Directory containing the images
-m Method
-- Extraction Method
-n deepName
-- Name desired method to deep learning
python3 extractorFeatures.py -d dataset -m tas
python3 extractorFeatures.py -d dataset -m bic
python3 extractorFeatures.py -d dataset -m lbp
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 ResNet50V2
python3 extractorFeatures.py -d dataset -m deep -n ResNet101
python3 extractorFeatures.py -d dataset -m deep -n ResNet101V2
python3 extractorFeatures.py -d dataset -m deep -n ResNet152
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
python3 extractorFeatures.py -d dataset -m deep -n EfficientNetB0
python3 extractorFeatures.py -d dataset -m deep -n EfficientNetB1
python3 extractorFeatures.py -d dataset -m deep -n EfficientNetB2
python3 extractorFeatures.py -d dataset -m deep -n EfficientNetB3
python3 extractorFeatures.py -d dataset -m deep -n EfficientNetB4
python3 extractorFeatures.py -d dataset -m deep -n EfficientNetB5
python3 extractorFeatures.py -d dataset -m deep -n EfficientNetB6
python3 extractorFeatures.py -d dataset -m deep -n EfficientNetB7
python3 extractorFeatures.py -d dataset -m deep -n EfficientNetV2B0
python3 extractorFeatures.py -d dataset -m deep -n EfficientNetV2B1
python3 extractorFeatures.py -d dataset -m deep -n EfficientNetV2B2
python3 extractorFeatures.py -d dataset -m deep -n EfficientNetV2B3
python3 extractorFeatures.py -d dataset -m deep -n EfficientNetV2S
python3 extractorFeatures.py -d dataset -m deep -n EfficientNetV2M
python3 extractorFeatures.py -d dataset -m deep -n EfficientNetV2L
- Run command for extraction considering all approaches
$ ./autoExtract.sh
- Generated files (.arff)
The generated files will be available in the (output_files) directory after the execution
- Observation. If desired, you can transform (.arff) to standard (csv) using the file (arff_to_csv.py)
python3 arff_to_csv.py -d output_files/bic.arff
- Example of reading the generated files
- Reading from (csv) file
import pandas as pd
df = pd.read_csv('output_files/bic.csv')
print(df.head())
...
- Reading from (arff) file
from scipy.io.arff import loadarff
import pandas as pd
dataset, mdataset = loadarff("output_files/bic.arff")
df = pd.DataFrame(dataset)
print(df.head())
Bressan, R. S., Alves, D. H., Valerio, L. M., Bugatti, P. H., & Saito, P. T. (2018, June). DOCToR: the role of deep features in content-based mammographic image retrieval. In 2018 IEEE 31st International Symposium on Computer-Based Medical Systems (CBMS) (pp. 158-163). IEEE.