Home

Awesome

GKGNet

PWC PWC

Introduction

This repo contains the official PyTorch implementation of our ECCV'2024 paper GKGNet: Group K-Nearest Neighbor based Graph Convolutional Network for Multi-Label Image Recognition.

<div align="center"><img src="assets/arch.png" width="800"></div>

Quick Start Guide

1. Clone the Repository

To get started, clone the repository using the following commands:

git clone https://github.com/jin-s13/GKGNet.git
cd GKGNet

2. Environment Setup

Set up the required environment with the following commands:

conda create -n mmlab python=3.8 pytorch==1.10.1 torchvision==0.11.2 cudatoolkit=11.3 -c pytorch -y
conda activate mmlab
pip install openmim
mim install mmcv-full==1.5.0
pip install -e .

3. Data Preparation

Prepare the required data by downloading the MS-COCO 2014 dataset. The file structure should look like this:

-0data
    -coco
        -train.data
        -val_test.data
        -annotations
            -instances_train2014.json
            -instances_val2014.json
        -train2014
            -COCO_train2014_000000000009.jpg
            -COCO_train2014_000000000025.jpg
            ...
        -val2014
            -COCO_val2014_000000000042.jpg
            -COCO_val2014_000000000073.jpg
            ...
-GKGNet
    -configs
    -checkpoint
      -pvig_s_82.1.pth.tar
    -tools
    ...

You can obtain train.data and val_test.data from the coco_multi_label_annos directory. The pretrained backbones on ImageNet can be downloaded from Vig:

mkdir checkpoint
wget https://github.com/huawei-noah/Efficient-AI-Backbones/releases/download/pyramid-vig/pvig_s_82.1.pth.tar
mv pvig_s_82.1.pth.tar checkpoint/

4. Training

To train the model, use one of the following commands:

Single Process

python tools/train.py configs/gkgnet/gkgnet_coco_576.py

Multi Process

bash tools/dist_train.sh configs/gkgnet/gkgnet_coco_576.py 8

5. Pretrained Models

5.1 Download Pretrained Models

You can download the pretrained models from the following link:

Model NamemAPLink (Google Drive)
GKGNet-57687.65Download Link

5.2 Test Pretrained Models

To test the pretrained models, run the following command:

python tools/test.py configs/gkgnet/gkgnet_coco_576.py *.pth --metrics mAP
or
bash tools/dist_test.sh configs/gkgnet/gkgnet_coco_576.py *.pth 8 --metrics mAP

Acknowledgement

This repo is developed based on MMPreTrain.

License

GKGNet is freely available for free non-commercial use, and may be redistributed under these conditions. For commercial queries, please contact Mr. Sheng Jin (jinsheng13[at]foxmail[dot]com). We will send the detail agreement to you.