This repository contains the implementation code for the paper "OSANet: Object Semantic Attention Network for Visual Sentiment Analysis".
- data/ is the top level data directory. Here we assume it consists of different kinds of dataset. Also, each dataset folder is divided into train, validation and test set folder. The data directory is expected to consist as follows.
data
├── FI
│ ├── train
│ ├── val
│ └── test
├── flickr
│ ├── train
│ ├── val
│ └── test
└── instagram
├── train
├── val
└── test
Environment setup
For experimental setup, requirements.txt lists down the requirements for running the code on the repository. Note that a cuda device is required. The requirements can be downloaded using,
pip install -r requirements.txt
-
Clone the repository
git clone https://github.com/sange1104/OSANet.git
-
Download dataset and split into train, val, and test set.
-
Set up the object_detection folder. We used pre-trained object detection model from the Faster R-CNN with model pretrained on Visual Genome. For the object_detection folder, you better follow the guideline of this repository.
-
Train the model with arguments from config/train_config.yaml. You can train the model as follows:
python train.py
-
The checkpoints of the best validation performance will be saved in checkpoints directory. You can further train model or use for inference with this checkpoint.