• Stars
    star
    133
  • Rank 272,600 (Top 6 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created almost 7 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Training code for "Pixels to Graphs by Associative Embedding"

Pixels to Graphs by Associative Embedding

Tensorflow training pipeline for:

Pixels to Graphs by Associative Embedding. Alejandro Newell and Jia Deng. Neural Information Processing Systems (NIPS), 2017. arXiv:1706.07365

Update (March 25, 2018): Changed default optimization to deal with diverging models, so code should no longer freeze in the middle of training. Also, finally added pretrained models!

Getting started

Python 3 package requirements:

(code tested on Python 3.5 and 3.6)

  • tensorflow_gpu (1.3.0)
  • numpy
  • h5py
  • scipy
  • scikit-image
  • tqdm
  • easydict
  • graphviz
  • simplejson (for Visual Genome driver)

Make sure to add the parent directory of px2graph to your PYTHONPATH.

Set up munkres-tensorflow:

  • Clone repo from here
  • Follow build instructions (make sure to use g++ 4.X)
  • For newer versions of TensorFlow it was a bit difficult to get this working, here is the command that finally worked for me:
TF_INC=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())')
TF_LIB=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_lib())')

g++-4.9 -std=c++11 -shared hungarian.cc -o hungarian.so -fPIC -I$TF_INC -I$TF_INC/external/nsync/public -L$TF_LIB -ltensorflow_framework -O2 -D_GLIBCXX_USE_CXX11_ABI=0
  • Place 'hungarian.so' in util/

Download data

  • Download images from Visual Genome (parts 1 and 2)
  • Place all images into data/genome/VG_100K/
  • Download VG-SGG.h5 and proposals.h5 from here and place them in data/genome/ (credit to Xu et al. 'Scene Graph Generation by Iterative Message Passing' for preprocessing the Visual Genome annotations)

Using the code

To train a network, call:

python main.py -e [experiment name] --sg_task [PR|CL|SG]

The different task settings are defined as follows:

  • PR: Object boxes and classes provided, predict relationships
  • CL: Object boxes provided, classify objects and their relationships
  • SG: Full task, nothing but image required as input (an additional argument --use_rpn [0|1] determines whether or not to include box proposals from a RPN)

To train with multiple GPUs use a command like:

python main.py --batchsize 32 --gpu_choice '0,1,2,3'

To continue an experiment or branch off to a new directory (to test different hyperparameters for example), call:

python main.py -e test_exp --continue 1 or python main.py --branch test_exp -e test_exp_2 --learning_rate 1e-5

In general, any binary options you wish to change via the command line must be set explicitly with either a 0 or 1. Use --help to get a list of available options to set.

Important: Regarding optimization, some feature of the code can lead to spontaneous divergence in the midst of training

Evaluating a model

The recall logged during training should give a good sense of the performance of the model. After training, to generate a proper set of predictions and evaluate them, call:

python main.py --branch test_exp -e my_results --predict valid
python eval.py my_results/valid_preds

The --predict argument accepts train|valid|test as options, and will generate predictions on the first opt.valid_iters * opt.batchsize samples of the specified subset.

Pretrained models

Task Setting R @ 50 R @ 100
SGGen (SG) (no RPN) 15.5 18.8
SGCls (CL) 35.7 38.4
PredCls (PR) 82.0 86.4

Note, performance is higher than previously reported in our paper. This is not due to any changes in the algorithm, but instead is the result of training for longer and tuning some postprocessing parameters.

Another important detail regarding our evaluation is that our numbers are reported with unconstrained graphs meaning that when proposing the top 50 or 100 predicates, multiple edges may be proposed between any two nodes. This leads to a notable performance difference when comparing to numbers in a constrained setting particularly on the SGCls and PredCls tasks where nodes are provided ahead of time.

To get final test set predictions from the pretrained models, put them in the exp/ directory and call:

python main.py --branch pretrained_sg -e sg_results --predict test

More Repositories

1

infinigen

Infinite Photorealistic Worlds using Procedural Generation
Python
5,286
star
2

RAFT

Python
3,189
star
3

CornerNet

Python
2,355
star
4

CornerNet-Lite

Python
1,780
star
5

DROID-SLAM

Python
1,730
star
6

lietorch

Cuda
670
star
7

RAFT-Stereo

Python
667
star
8

DeepV2D

Python
651
star
9

DPVO

Deep Patch Visual Odometry/SLAM
C++
597
star
10

pose-hg-train

Training and experimentation code used for "Stacked Hourglass Networks for Human Pose Estimation"
Jupyter Notebook
575
star
11

pytorch_stacked_hourglass

Pytorch implementation of the ECCV 2016 paper "Stacked Hourglass Networks for Human Pose Estimation"
Python
469
star
12

CoqGym

A Learning Environment for Theorem Proving with the Coq proof assistant
Coq
380
star
13

pose-ae-train

Training code for "Associative Embedding: End-to-End Learning for Joint Detection and Grouping"
Python
373
star
14

pose-hg-demo

Code to test and use the model from "Stacked Hourglass Networks for Human Pose Estimation"
Lua
316
star
15

SEA-RAFT

[ECCV2024 - Oral, Best Paper Award Candidate] SEA-RAFT: Simple, Efficient, Accurate RAFT for Optical Flow
Python
298
star
16

RAFT-3D

Python
229
star
17

SimpleView

Official Code for ICML 2021 paper "Revisiting Point Cloud Shape Classification with a Simple and Effective Baseline"
Python
154
star
18

relative_depth

Code for the NIPS 2016 paper
Lua
124
star
19

CER-MVS

Python
122
star
20

YouTube3D

Code for the CVPR 2019 paper "Learning Single-Image Depth from Videos using Quality Assessment Networks"
Python
106
star
21

Coupled-Iterative-Refinement

Python
105
star
22

pose-ae-demo

Python
97
star
23

MultiSlam_DiffPose

Jupyter Notebook
94
star
24

SNP

Official code for View Synthesis with Sculpted Neural Points
Python
83
star
25

DecorrelatedBN

Code for Decorrelated Batch Normalization
Lua
80
star
26

SpatialSense

An Adversarially Crowdsourced Benchmark for Spatial Relation Recognition
Python
70
star
27

oasis

Code for the CVPR 2020 paper "OASIS: A Large-Scale Dataset for Single Image 3D in the Wild"
MATLAB
64
star
28

selfstudy

Code for reproducing experiments in "How Useful is Self-Supervised Pretraining for Visual Tasks?"
Python
60
star
29

PackIt

Code for reproducing results in ICML 2020 paper "PackIt: A Virtual Environment for Geometric Planning"
Jupyter Notebook
52
star
30

d3dhelper

Unofficial sample code for Distilled 3D Networks (D3D) in Tensorflow.
Jupyter Notebook
48
star
31

Oriented1D

Official code for ICCV 2023 paper "Convolutional Networks with Oriented 1D Kernels"
Python
44
star
32

SOLID

Python
41
star
33

OGNI-DC

[ECCV24] official code for "OGNI-DC: Robust Depth Completion with Optimization-Guided Neural Iterations"
Python
38
star
34

OcMesher

C++
35
star
35

attach-juxtapose-parser

Code for the paper "Strongly Incremental Constituency Parsing with Graph Neural Networks"
Python
34
star
36

surface_normals

Code for the ICCV 2017 paper "Surface Normals in the Wild"
Lua
33
star
37

MetaGen

Code for the paper "Learning to Prove Theorems by Learning to Generate Theorems"
Objective-C++
30
star
38

FormulaNet

Code for FormulaNet in NIPS 2017
Python
29
star
39

Rel3D

Official code for NeurRIPS 2020 paper "Rel3D: A Minimally Contrastive Benchmark for Grounding Spatial Relations in 3D"
Python
26
star
40

selfstudy-render

Code to generate datasets used in "How Useful is Self-Supervised Pretraining for Visual Tasks?"
Python
22
star
41

think_visually

Code for ACL 2018 paper 'Think Visually: Question Answering through Virtual Imagery'
Python
14
star
42

structured-matching

codes for ECCV 2016
Lua
9
star
43

DPVO_Docker

Shell
8
star
44

uniloss

Python
8
star
45

MetaQNL

Learning Symbolic Rules for Reasoning in Quasi-Natural Language: https://arxiv.org/abs/2111.12038
Julia
6
star
46

PackIt_Extra

Code for generating data in ICML 2020 paper "PackIt: A Virtual Environment for Geometric Planning"
C#
5
star
47

Rel3D_Render

Code for rendering images for NeurRIPS 2020 paper "Rel3D: A Minimally Contrastive Benchmark for Grounding Spatial Relations in 3D"
Python
3
star
48

HYPE-C

Python
1
star