Git Product home page Git Product logo

hierarchical-classification's Introduction

Hierarchical-Classification

Overview

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.

Implemented Models

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
  • HResNet​50: based on ResNet50, but with hierarchical classification as in HVGG16
  • Branch Selection ResNet​50: based on ResNet50, but with branch selection mechanism based on the coarse prediction
  • CondHResNet50: based on HResNet50, but with conditionally parameterized convolutions

Evaluation

Here we can see the validation accuracy over training time (50 epochs) of the ResNet50-based models: Validation

Setup

Install the conda environment using the environment.yml file:

conda env create -f environment.yml

Dataset

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

Training

To train the model, run the run.py file:

python run.py

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.