Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?


Failed to load latest commit information.
Latest commit message
Commit time

CornerNet: Training and Evaluation Code

Update (4/18/2019): please check out CornerNet-Lite, more efficient variants of CornerNet

Code for reproducing the results in the following paper:

CornerNet: Detecting Objects as Paired Keypoints
Hei Law, Jia Deng
European Conference on Computer Vision (ECCV), 2018

Getting Started

Please first install Anaconda and create an Anaconda environment using the provided package list.

conda create --name CornerNet --file conda_packagelist.txt

After you create the environment, activate it.

source activate CornerNet

Our current implementation only supports GPU so you need a GPU and need to have CUDA installed on your machine.

Compiling Corner Pooling Layers

You need to compile the C++ implementation of corner pooling layers.

cd <CornerNet dir>/models/py_utils/_cpools/
python install --user

Compiling NMS

You also need to compile the NMS code (originally from Faster R-CNN and Soft-NMS).

cd <CornerNet dir>/external

Installing MS COCO APIs

You also need to install the MS COCO APIs.

cd <CornerNet dir>/data
git clone coco
cd <CornerNet dir>/data/coco/PythonAPI

Downloading MS COCO Data

  • Download the training/validation split we use in our paper from here (originally from Faster R-CNN)
  • Unzip the file and place annotations under <CornerNet dir>/data/coco
  • Download the images (2014 Train, 2014 Val, 2017 Test) from here
  • Create 3 directories, trainval2014, minival2014 and testdev2017, under <CornerNet dir>/data/coco/images/
  • Copy the training/validation/testing images to the corresponding directories according to the annotation files

Training and Evaluation

To train and evaluate a network, you will need to create a configuration file, which defines the hyperparameters, and a model file, which defines the network architecture. The configuration file should be in JSON format and placed in config/. Each configuration file should have a corresponding model file in models/. i.e. If there is a <model>.json in config/, there should be a <model>.py in models/. There is only one exception which we will mention later.

To train a model:

python <model>

We provide the configuration file (CornerNet.json) and the model file ( for CornerNet in this repo.

To train CornerNet:

python CornerNet

We also provide a trained model for CornerNet, which is trained for 500k iterations using 10 Titan X (PASCAL) GPUs. You can download it from here and put it under <CornerNet dir>/cache/nnet/CornerNet (You may need to create this directory by yourself if it does not exist). If you want to train you own CornerNet, please adjust the batch size in CornerNet.json to accommodate the number of GPUs that are available to you.

To use the trained model:

python CornerNet --testiter 500000 --split <split>

If you want to test different hyperparameters in testing and do not want to overwrite the original configuration file, you can do so by creating a configuration file with a suffix (<model>-<suffix>.json). You DO NOT need to create <model>-<suffix>.py in models/.

To use the new configuration file:

python <model> --testiter <iter> --split <split> --suffix <suffix>

We also include a configuration file for multi-scale evaluation, which is CornerNet-multi_scale.json, in this repo.

To use the multi-scale configuration file:

python CornerNet --testiter <iter> --split <split> --suffix multi_scale


No description, website, or topics provided.







No releases published


No packages published