Machine Learning II, GCiED
David Bergés, Roser Cantenys and Alex Carrillo
-November 2019, Universitat Politècnica de Catalunya
Abstract. This paper presents a method for recognizing toy pieces categories based on the global features that describe color and illumination properties, and by using the statistical learning paradigm. This technique works by partitioning the image into increasingly finer sub-regions and computing a weighted histogram intersection in this space. First, we show the mathematical properties of it to be used as a kernel function for Support Vector Machines (SVMs). Second, we describe the implementation and give examples of how these SVMs, equipped with such a kernel, can achieve very promising results on image classification.
- Introduction
- Aim and motivations
- Theoretical aspects
- Kernel learning approaches for image classification
- Spatial pyramid matching
- Pyramid match kernel
- Satisfying Mercer’s condition
- Computational complexity
- Dataset
- Set of images
- Data preprocessing
- Implementation and difficulties
- Data loading and partitioning
- Binning
- Kernel
- Histograms computation
- Building the matrix
- Experimenting and results
- Playing with the dataset
- Conclusions
- Improvements and further development
- References
Here is a brew description of the attached files in the delivery folder:
-
data/df128.csv
,data/df64.csv
: two.csv
files containing the flattened image with reduced resolution 128x128 and 64x64 -
data/results128.csv
,data/results64.csv
: two.csv
files including all the results for our experimentations shown in the paper -
images/hist1.jpg
,images/hist2.jpg
: two random images used for the visualization of histogram intersection inVisualization.ipynb
-
Visualization.ipynb
: IPython notebook used to generate all different plottings in the paper -
html_notebooks/Visualization.html
: rendered version of the latter -
Load_and_Resize.ipynb
: IPython notebook used to read all the raw data and convert it into DataFrames and store it to.csv
files. -
html_notebooks/Load_and_Resize.html
: rendered version of the latterACHTUNG!! Do not execute this notebook! We specifically included the
.csv
of the processesed data to avoid executing the latter. Notice that the raw image data is not included, and the execution of the latter may take over 30 minutes depending on the computer! -
scripts/run.py
: Python script used for creating multiple subprocesses and executing several SVMs in parallel in Google Cloud -
scripts/hist_svm.py
: main script. Automates the process of reading the data and executes the SVM with the specified kernel parameters through the terminal. Typepython3 hist_svm.py --help
to get some useful hints on how the parameters are passed.
It accepts 4 arguments:
--data
: csv file from which to read the data--L
: L value used for partitioning--quantization
: level of quantization desired--train_frac
: fraction of training samples to be taken--test_frac
: fraction of test samples to be taken