This is the code for the paper:
Visual Sentiment Analysis for Review Images with Item-Oriented and User-Oriented CNN
Quoc-Tuan Truong and Hady W. Lauw
Presented at MM 2017
- CPU Intel(R) Xeon(R) E5-2650 v4 @ 2.20GHz
- DRAM 256 GiB
- GPU NVIDIA Tesla P100
- CUDA 10.0
- CuDNN 7.5
- Python 3.6
- Tensorflow >=1.12, <2.0
- Scikit-learn >= 0.20
- Tqdm >= 4.28
Install dependencies:
pip3 install -r requirements.txt
Note: Tensorflow GPU is installed by default. If you do not have GPU on your machine, please install CPU version instead.
Download data and pre-trained weights:
chmod +x download.sh
./download.sh
- Train and evaluate the base model VS-CNN:
python3 train_base.py --dataset [user,business]
- Train and evaluate the factor models, iVS-CNN (business) and uVS-CNN (user):
python3 train_factor.py --dataset [user,business] --factor_layer [conv1,conv3,conv5,fc7] --num_factors 16
Note: The factor models use trained weights of the base models for initialization. If you have not trained the base models, pre-trained weights are provided and need to be extracted before training.
unzip -qq weights.zip
- Train and evaluate Naive Bayes baseline:
python3 train_nb.py --dataset [user,business]
Questions and discussion are welcome: www.qttruong.info