This project consists of the implementation of several hierarchical classification models. The goal is to classify images into a hierarchical structure, where each class has a parent class. The dataset used is the ImageNet dataset, which consists of 1000 classes. The hierarchical structure has been extracted from WordNet.
We implemented the following models:
- VGG16: based on the original paper
- HVGG16 and HVGG11: based on the original paper
- ResNet50: based on the original paper
- CondResNet50: based on the original paper
- HResNet50: based on ResNet50, but with hierarchical classification as in HVGG16
- Branch Selection ResNet50: based on ResNet50, but with branch selection mechanism based on the coarse prediction
- CondHResNet50: based on HResNet50, but with conditionally parameterized convolutions
Here we can see the validation accuracy over training time (50 epochs) of the ResNet50-based models:
Install the conda environment using the environment.yml file:
conda env create -f environment.yml
Download the data from here and extract it to the dataset/
folder.
Now you can run the val2train_mapping.py
to correctly organize the validation data:
python -m moduels.utils.val2train_mapping.py
Now you should have the following folder structure:
dataset/
train/
n01440764/ # e.g. synset
n01440764_10026.JPEG # e.g. image
...
val/
n01440765/ # e.g. synset
n01440765_10026.JPEG # e.g. image
...
test/
n01440766/ # e.g. synset
n01440766_10026.JPEG # e.g. image
...
hierarchy.csv
val_mapping.csv
To train the model, run the run.py
file:
python run.py