Code Monkey home page Code Monkey logo

dcnets's Introduction

Decoupled Networks

By Weiyang Liu*, Zhen Liu*, Zhiding Yu, Bo Dai, Rongmei Lin, Yisen Wang, James Rehg, Le Song

(* equal contribution)

License

Decoupled Networks is released under the MIT License (refer to the LICENSE file for details).

Updates

  • Examples for ImageNet-2012
  • Examples for CIFAR-100

Contents

  1. Introduction
  2. Short Video Introduction
  3. Citation
  4. Requirements
  5. Usage

Introduction

Inner product-based convolution has been a central component of convolutional neural networks (CNNs) and the key to learning visual representations. Inspired by the observation that CNN-learned features are naturally decoupled with the norm of features corresponding to the intra-class variation and the angle corresponding to the semantic difference, we propose a generic decoupled learning framework which models the intra-class variation and semantic difference independently.

Specifically, we first reparametrize the inner product to a decoupled form and then generalize it to the decoupled convolution operator which serves as the building block of our decoupled networks. We present several effective instances of the decoupled convolution operator. Each decoupled operator is well motivated and has an intuitive geometric interpretation. Based on these decoupled operators, we further propose to directly learn the operator from data.

The latest version of our paper is available at arXiv and here. Our work is largely inspired and motivated by the observation that the CNN-learned features are naturally decoupled, as shown as follows.

As illustrated as follows, the central idea of decoupled networks is the decoupled convolution, which is used to replace all the original convolution operators.

Short Video Introduction

The following is a short video introduction by Zhen Liu.

DCNet_talk

Citation

If you find our work useful in your research, please consider to cite:

@InProceedings{Liu_2018_CVPR,
    author = {Liu, Weiyang and Liu, Zhen and Yu, Zhiding and Dai, Bo and Lin, Rongmei and Wang, Yisen and Rehg, James M. and Song, Le},
    title = {Decoupled Networks},
    booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
    year = {2018}
}

Requirements

  1. Python 2.7
  2. TensorFlow (Tested on version 1.01)
  3. numpy

Usage

Part 1: Clone the repositary

  • Clone the repositary.

    git clone https://github.com/wy1iu/DCNets.git

Part 2: CIFAR-100

  • Training DCNets with TanhConv + Cosine on CIFAR-100:

    cd $DCNET_ROOT/dcnet_cifar100/tanh_cos
    python train_resnet.py
  • To train other models, change the model name (tanh_cos) in the script above to your desired one.

Part 3: ImageNet-2012

  • Download ImageNet-2012 dataset and process the dataset with TensorFlow-Slim.

  • We provide one example with the modified Resnet-18 for ImageNet-2012. We use TanhConv magnitude function + Cosine angular activation in this implementation. The user can replace magnitude function and angular function with the other choices mentioned in the paper or any other customized functions.

    cd $DCNET_ROOT/dcnet_imagenet
    python train_DCNet.py
  • We provide our result for this implementation, which matches our reported result 88.9% in the paper.

dcnets's People

Contributors

lzzcd001 avatar wy1iu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dcnets's Issues

Which layer is decoupled?

Hi, I am a little confused with the code.
Do you decoupled all the conv layers except for the last one( Fully connection layer) ?
So the vector w is 3D filter and vectorized into columns ?
Thx.

train with deeper layers for imagenet

thank you for your greate jobs. I see you report the result with res-18 for imagenet in your paper. Do you have trained more deep layers for imagenet or some other largescale dataset? for example res101, or res152 ? can you share some experience for that?

when i run the test code, i have got an error!

Traceback (most recent call last):
File "/home/tanglin/data/Code/DCNets/dcnet_cifar100/linear_cos/train_resnet.py", line 161, in
train(args.base_lr, args.batch_size)
File "/home/tanglin/data/Code/DCNets/dcnet_cifar100/linear_cos/train_resnet.py", line 49, in train
vgg.build(images, n_class, is_training)
File "/home/tanglin/data/Code/DCNets/dcnet_cifar100/linear_cos/architecture.py", line 168, in build
name='root', bn=True, pad='SAME', norm=True, reg=False, orth=True)
File "/home/tanglin/data/Code/DCNets/dcnet_cifar100/linear_cos/architecture.py", line 118, in _conv_layer
self._add_orthogonal_constraint(filt, n_filt)
File "/home/tanglin/data/Code/DCNets/dcnet_cifar100/linear_cos/architecture.py", line 99, in _add_orthogonal_constraint
wnorm = self._get_filter_norm(filt)
File "/home/tanglin/data/Code/DCNets/dcnet_cifar100/linear_cos/architecture.py", line 87, in _get_filter_norm
return tf.sqrt(tf.reduce_sum(filt*filt, [0, 1, 2], keep_dims=True)+eps)
File "/home/tanglin/anaconda3/envs/tf1.9/lib/python2.7/site-packages/tensorflow/python/ops/math_ops.py", line 1206, in reduce_sum
name=name)
File "/home/tanglin/anaconda3/envs/tf1.9/lib/python2.7/site-packages/tensorflow/python/ops/gen_math_ops.py", line 2804, in _sum
keep_dims=keep_dims, name=name)
File "/home/tanglin/anaconda3/envs/tf1.9/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 763, in apply_op
op_def=op_def)
File "/home/tanglin/anaconda3/envs/tf1.9/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2329, in create_op
set_shapes_for_outputs(ret)
File "/home/tanglin/anaconda3/envs/tf1.9/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1717, in set_shapes_for_outputs
shapes = shape_func(op)
File "/home/tanglin/anaconda3/envs/tf1.9/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1667, in call_with_requiring
return call_cpp_shape_fn(op, require_shape_fn=True)
File "/home/tanglin/anaconda3/envs/tf1.9/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 610, in call_cpp_shape_fn
debug_python_shape_fn, require_shape_fn)
File "/home/tanglin/anaconda3/envs/tf1.9/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 676, in _call_cpp_shape_fn_impl
raise ValueError(err.message)
ValueError: Invalid reduction dimension 2 for input with 2 dimensions. for 'root/Sum' (op: 'Sum') with input shapes: [27,96], [3].

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.