Feature Extraction and Image Classification using Genetic Programming combined with Histograms of Oriented Gradients
The project requires Python2 or Python3 interpreter as well as appropriate version of following libraries:
In order to run the application properly there has to be a modification made in the source of the DEAP
library. The generate
function located in the gp.py
module of the DAEP
package has to replaced with the contents of the gp_generate_modification.py
file.
In the config
directory there are located two .ini
files. These are configuration files one concerning the analised dataset and the other containing the genetic algorithm parameters. User can specify their own profiles, taking pattern from the existing ones, and set the four variables in the binary_classifier_evaluator.py
file:
DATASET_CONFIG_FILE = 'config/dataset_config.ini'
PARAMETERS_CONFIG_FILE = 'config/parameters_config.ini'
DATASET_PROFILE = ["<DATASET_NAME_1", "DATASET_NAME_2"]
PARAMETERS_PROFILE = ["DATASET_NAME_1_PARAMETERS", "DATASET_NAME_2_PARAMETERS"]
It is required to configure data sets in the dataset-config
file.
[<DATASET_NAME>]
min_width = <IMAGES_WIDTH>
min_height = <IMAGES_HEIGHT>
base_directory = <DATASET_DIR>/
training_directory = <TRAINING_SUBDIR>/
testing_directory = <TESTING_SUBDIR>/
classes = <NUMBER_OF_CLASSES>
The data set with 10 classes should have the following form. It is also required that the collection consists of png images.
├── testing
│ ├── 0
│ │ ├── 0001.png
│ │ ├── 0002.png
│ │ ├── ....
│ ├── 1
│ │ ├── 0001.png
│ │ ├── 0002.png
│ │ ├── ...
│ ├── 9
│ │ ├── 0001.png
│ │ ├── 0002.png
│ │ ├── ...
├── training
│ ├── 0
│ │ ├── 0001.png
│ │ ├── 0002.png
│ │ ├── ....
│ ├── 1
│ │ ├── 0001.png
│ │ ├── 0002.png
│ │ ├── ...
│ ├── ...
│ ├── 9
│ │ ├── 0001.png
│ │ ├── 0002.png
│ │ ├── ...
To perform the process of creating binary classifiers user needs to execute following command from the main directory:
python -m binary.binary_classifier_evaluator
There should be created two log files. One of them - the info.log
will contain binary classifiers.
Apart from the images required for the binary classification there has to be created a file containing binary classifiers for each pair of classes. It should contain one classifier in each line. Optionally, after the classifier there can be comma-separated priority of the classifier (e.g. learn-rate). If the priority is not provided then all classifiers are of equal importance with the priority set to one. Additionally the classifiers have to be sorted with respect to their classes.
In the appropriate file in the multiclass
directory there have to be set following variables:
CLASSES = <NUMBER_OF_CLASSES>
CLASSIFIERS_FILE = <FILE_WITH_BINARY_CLASSIFIERS>
BASE_DIRECTORY = <DATASET_DIR>
Depending on which method of multiclass classification the user wants to use, they need to execute following commands from the main directory:
- One versus one
python -m multiclass.one_versus_one_classfier
- All pairs filter tree
python -m multiclass.all_pairs_filter_tree_classifier