AdaHGNN: Adaptive Hypergraph Neural Networks for Multi-Label Image Classification
-
Description
This repository includes the source code for the paper "AdaHGNN: Adaptive Hypergraph Neural Networks for Multi-Label Image Classification". Basically, the program takes the image as the input to predict multiple labels contained in the image. More details about the underneath model can be found in the submitted paper.
-
Requirements
Ubuntu: 16.04 +
pytorch: 0.4.1
python: 2.7
GPU: V100
-
Code Structure
AdaHGNN
|——backbones
|——resnet.py
|——init.py
|——utils
|——transforms.py
|——metrics.py
|——load_pretrain_model.py
|——init.py
|——datasets
|——cocodataset.py
|——init.py
|——data
|——coco
|——coco_glove_word2vec.npy
|——sampledata
|——MS-COCO-2014
|——train
|——val
|——cate2idx
|——train_label
|——val_label
|——run_coco.sh
|——main.py
|——semantic.py
|——models.py
|——hgnn.py
|——classifier_layer.py
run_coco.sh: paperarameter configuration and run file.
main.py: the main file for training or test.
hgnn.py:hypergraph neural network function file.
semantic.py:semantic decoupling function file.
models.py:model framework file.
classifier_layer.py: the last classification layer of the network.
-
SampleData Description
The sample data is from the ms-coco dataset[1]. You can download it yourself.
[1] Lin T Y, Maire M, Belongie S, et al. Microsoft coco: Common objects in context[C]//European conference on computer vision. Springer, Cham, 2014: 740-755.
-
Train Model
set the relevant experimental configuration in run_coco.sh. FLAG is used to distinguish the parameter names stored in each run.
command;sh run_coco.sh [GPU_ID] [FLAG]
Using GPU3 for example: sh run_coco.sh 3 'adahgnn'
-
Test Model
First, resize the test input image to 640. Second, modify the configuration file "run_coco.sh". Specifically, modify the resume option to the trained model parameters, set the crop_size to 640, and evaluate to true.
command;sh run_coco.sh [GPU_ID] [FLAG]