Skip to content


Folders and files

Last commit message
Last commit date

Latest commit



16 Commits

Repository files navigation


For Text Classification


Densely Connected CNN with Multi-scale Feature Attention for Text Classification is initially described in an IJCAI-ECAI 2018 paper. It provides a new CNN architecture to produce variable n-gram features. It is worth nothing that:

  • It uses dense connections to build short-cut paths between upstream and downstream convolutional blocks, which enable the model to compose features of larger scale from those of smaller scale, and thus produce variable n-gram features.
  • A multi-scale feature attention is developed to adaptively select multi-scale features for classification.
  • It obtains competitive performance against state-of-the-art baselines on six benchmark datasets.


If you find these models useful in your research, please consider citing:

    title={Densely Connected CNN with Multi-scale Feature Attention for Text Classification},
    author={Wang, Shiyao and Huang, Minlie and Deng, Zhidong},
    conference={IJCAI-ECAI 2018, Stockholm, Sweden},

Preparation for Training & Testing

  1. Please clone the Densely-Connected-CNN-with-Multiscale-Feature-Attention repository, and we call the directory that you cloned as ${DenseAttention_ROOT}.

  2. please clone the Caffe from caffe_for_text and build it. It is a modified version of the offical repository.

  3. Please download text classification datasets from benchmark datasets which are releasd by Zhang et al., 2015. AGNews in $(DenseAttention_ROOT)/data/ag_news_csv is an example dataset in this repo.

  4. Please download pretrained word vectors from Glove.


  1. Prepare training & testing data by using original datasets, pretrained word vectors and tools in $(DenseAttention_ROOT)/data/ An example is in $(DenseAttention_ROOT)/data/agnews.

  2. Generate the training & testing prototxt by using tools in $(DenseAttention_ROOT)/script/

  3. To perform experiments, run the script with the corresponding config file as input. For example, to train and test, use the following command

    cd $(DenseAttention_ROOT)/experiment

    This example uses 4 NVIDIA Titan X Pascal GPUs and the trained model as well as logs are saved in $(DenseAttention_ROOT)/experiment.

  4. Please find more details in config files and in our code.

Main Results



Densely Connected CNN with Multi-scale Feature Attention for Text Classification







No releases published


No packages published