Code Monkey home page Code Monkey logo

interleavedgroupconvolutions's Introduction

Interleaved Group Convolutions

This project contains the code implementation used for the experiments in the paper:

Interleaved Group Convolutions. Ting Zhang, Guo-Jun Qi, Bin Xiao, and Jingdong Wang. In International Conference on Computer Vision (ICCV), 2017. arXiv preprint arXIV:1707.02725 (2017)

Introduction

In this work, we present a simple and modularized neural network architecture, named interleaved group convolutional neural networks (IGCNets). The main point lies in a novel building block, a pair of two successive interleaved group convolutions: primary group convolution and secondary group convolution. The two group convolutions are complementary.

IGC

Illustrating the interleaved group convolution, with L = 2 primary partitions and M = 3 secondary partitions. The convolution for each primary partition in primary group convolution is spatial. The convolution for each secondary partition in secondary group convolution is point-wise (1 × 1).

Our motivation comes from the four branch presentation of regular convolution illustrated in the following picture.

RC

(a) Regular convolution. (b) Four-branch representation of the regular convolution. The shaded part in (b), we call crosssummation, is equivalent to a three-step transformation: permutation, secondary group convolution, and permutation back.

Results

#Params (M) FLOPs (10^9) training error test error
top-1 top-5 top-1 top-5
ResNet(C=64) 11.151 1.8 22.41 6.53 31.06 11.38
ResNet(C=69) 11.333 2.1 21.43 5.96 30.58 10.77
IGC-L4M32+Ident. 11.205 1.9 21.71 6.21 30.77 10.99
IGC-L16M16+Ident. 11.329 2.2 19.97 5.44 29.40 10.32
IGC-L100M2+Ident. 8.61 1.3 13.93 2.75 26.95 8.92

Imagenet classification results of a ResNet of depth 18 and our approach. Both ResNets and our networks contain four stages, and when down-sampling is performed, the channel number is doubled. For ResNets, C is the channel number at the first stage. For our networks except IGC-L100M2+Ident., we double the channel number by doubling M and keeping L unchanged. For IGCL100M2+Ident., we double the channel number by doubling L and keeping M unchanged.

More results can be found in the paper.

Requirements

  • Install MXNet on a machine (Windows, Linux, and Mac OS) with CUDA GPU and optional cuDNN.

  • Add the code in src/ to MXNet src/operator/

  • Build MXNet

  • If you fail to apply the above steps, you can simply use my MXNet repository

How to Train

Current code supports training IGCNets on Cifar-10, Cifar-100 and SVHN, such as plain, resnet, plain_igc,resnet_igc. All the networks are contained in the network folder.

For example, running the following command can train the plain_igc network on Cifar-10.

python train_model.py --network=plain_igc --depth=38 --gpus=0,1 --primary-partition=24 --secondary-partition=2 --batch-size=64 --data-dir=<dataset location> --dataset=cifar10

For example, running the following command can train the resnet_igc_imgnet_d18 network on ImageNet.

python train_imagenet.py --network=resnet_igc_imgnet_d18 --depth=18 --gpus=0,1,2,3,4,5,6,7 --primary-partition=100 --batch-size=256 --data-dir=<dataset location>

Citation

Please cite our papers in your publications if it helps your research:

@article{WangWZZ16,
  author    = {Jingdong Wang and
               Zhen Wei and
               Ting Zhang and
               Wenjun Zeng},
  title     = {Deeply-Fused Nets},
  journal   = {CoRR},
  volume    = {abs/1605.07716},
  year      = {2016},
  url       = {http://arxiv.org/abs/1605.07716}
}
@article{ZhaoWLTZ16,
  author    = {Liming Zhao and
               Jingdong Wang and
               Xi Li and
               Zhuowen Tu and
               Wenjun Zeng},
  title     = {On the Connection of Deep Fusion to Ensembling},
  journal   = {CoRR},
  volume    = {abs/1611.07718},
  year      = {2016},
  url       = {http://arxiv.org/abs/1611.07718}
}
@article{DBLP:journals/corr/ZhangQ0W17,
  author    = {Ting Zhang and
               Guo{-}Jun Qi and
               Bin Xiao and
               Jingdong Wang},
  title     = {Interleaved Group Convolutions for Deep Neural Networks},
  journal   = {CoRR},
  volume    = {abs/1707.02725},
  year      = {2017},
  url       = {http://arxiv.org/abs/1707.02725}
}

interleavedgroupconvolutions's People

Contributors

hellozting 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  avatar  avatar

interleavedgroupconvolutions's Issues

May I know the details of generating rec files of Cifar100 and Imagenet?

Hi! I am now running ur code and generating rec files of the dataset myself. In order to keep the same rec file with yours, may I know the following details:

  1. When generating Cifar100 rec file, what quality(0-100, default quality is 95) did you set with im2rec.py?
  2. When generating Imagenet rec file, what quality did you set with im2rec.py and did you do resize step (such as resize to 256) with im2rec?

about mxnet version

@hellozting 你好,我在运行IGC时碰到了下面问题,应该时mxnet版本的原因,我mxnet是
1.2.0 方便告诉我你的mxnet版本吗? 谢谢!

zcx@zcx-system:~/code/InterleavedGroupConvolutions-master$ python train_model.py --network=plain_igc --depth=38 --gpus=0,1 --primary-partition=24 --secondary-partition=2 --batch-size=64 --data-dir='/home/zcx/data/data/cifar/' --dataset=cifar10
2018-05-15 18:37:47,304 ./snapshot/cifar10/plain_igc/plain_igc_d38L24M2_exp1.txt
2018-05-15 18:37:47,305 start with arguments Namespace(aug_type=1, batch_size=64, checkpoint_epochs=50.0, data_dir='/home/zcx/data/data/cifar/', data_shape=32, dataset='cifar10', depth=38, exp_name=None, gpus='0,1', kv_store='device', load_epoch=None, log_dir='./snapshot/cifar10/', log_iters=50, lr=0.1, lr_factor=0.1, lr_steps=None, mean_rgb=[125.307, 122.95, 113.865], model_args={}, model_prefix='./snapshot/cifar10/plain_igc/weights/plain_igc_d38L24M2_exp1/plain_igc_d38L24M2_exp1', network='plain_igc', num_classes=10, num_epochs=400, num_examples=50000, primary_partition=24, rand_seed=1526380667, secondary_partition=2, std_rgb=[62.993, 62.089, 66.705], test_batch_size=400, train_dataset='train.rec', val_dataset='test.rec')
2018-05-15 18:37:47,404 Using gpus 0,1 from:
GPU 0: GeForce GTX TITAN Black (UUID: GPU-09f14dff-7cdd-4884-42b2-1b56ed6f5131)

2018-05-15 18:37:47,405 training strategy: lr=0.100000, step=[200.0, 300.0, 350.0]
2018-05-15 18:37:47,452 network parameters: 0.3172M
[18:37:47] src/io/iter_image_recordio_2.cc:170: ImageRecordIOParser2: /home/zcx/data/data/cifar/train.rec, use 1 threads for decoding..
[18:37:48] src/io/iter_image_recordio_2.cc:170: ImageRecordIOParser2: /home/zcx/data/data/cifar/test.rec, use 1 threads for decoding..
train_model.py:115: DeprecationWarning: mxnet.model.FeedForward has been deprecated. Please use mxnet.mod.Module instead.
**args.model_args #for retrain
/home/zcx/incubator-mxnet/python/mxnet/initializer.py:370: DeprecationWarning: Calling initializer with init(str, NDArray) has been deprecated.please use init(mx.init.InitDesc(...), NDArray) instead.
init(name, arr)
Traceback (most recent call last):
File "train_model.py", line 131, in
main(sys.argv[1:])
File "train_model.py", line 128, in main
train(args)
File "train_model.py", line 123, in train
epoch_end_callback=mx.callback.do_checkpoint(args.model_prefix,args.checkpoint_epochs),
File "/home/zcx/incubator-mxnet/python/mxnet/model.py", line 856, in fit
**(self.kwargs))
File "/home/zcx/incubator-mxnet/python/mxnet/optimizer.py", line 169, in create_optimizer
return Optimizer.opt_registryname.lower()
File "/home/zcx/incubator-mxnet/python/mxnet/optimizer.py", line 915, in init
super(NAG, self).init(**kwargs)
File "/home/zcx/incubator-mxnet/python/mxnet/optimizer.py", line 107, in init
self.set_wd_mult({})
File "/home/zcx/code/InterleavedGroupConvolutions-master/utility.py", line 52, in set_wd_mult
if self.sym is not None:
AttributeError: 'Nesterov' object has no attribute 'sym'

general framework

Hey, can I use your method in keras? Dose it support this framework?
Thank U

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.