Ubuntu (14 or higher)
Cuda 9
python 2.7
pip install -r requirements.txt
For faster training, we have extracted the saliency maps using [1] and appended them with the RGB images as RGBA PILs.
- RGB
- RGB + Saliency
- Pretrained Models
- One can train both single and double column architectures using this code.
- Testing is optional. One can try only training for different data augmentation and network architectures.
- A web based GUI is provided which can be used to observe the performance for a single image
Training a double column CNN
python -W ignore CNN_Master.py --datapath /root/directory/containing/train/val/subdirectories/ --model DenseNet_Saliency_Direct --save /path/for/saving/models/ --pooling --pretrained --aug_train SAL_ICC --batch_size 8
Training a single column CNN
python -W ignore CNN_Master.py --datapath /root/directory/containing/train/val/subdirectories/ --model DenseNet_161 --save /path/for/saving/models/ --pooling --pretrained --aug_train ICC --batch_size 8
Check CNN_Master.py for the full list of command line options, models, augmentation strategies
For double column
python -W ignore CNN_Master.py --datapath /root/directory/containing/train/val/subdirectories/ --model DenseNet_Saliency_Direct --save /path/for/saving/models/ --pooling --pretrained --aug_train SAL_ICC --batch_size 8 --withTesting --aug_test SAL_ICC --testDataPath /path/to/test/data --testLabels /path/to/test/data/test.multilab --testIds /path/to/test/data/test.jpgl
For single column
python -W ignore CNN_Master.py --datapath /root/directory/containing/train/val/subdirectories/ --model DenseNet_161 --save /path/for/saving/models/ --pooling --pretrained --aug_train ICC --batch_size 8 --withTesting --aug_test ICC --testDataPath /path/to/test/data --testLabels /path/to/test/data/test.multilab --testIds /path/to/test/data/test.jpgl
Make sure you use a SAL_ prefix for augmentation for the double column model. For a single column remove the SAL_ prefix.
This GUI can be used to observe predictions on single image from the web or local directories.
cd GUI
python Master.py /path/to/model/xyz.model ICC
cd GUI
python Master.py /path/to/model/xyz.model SAL_ICC
Open browser and go to 0.0.0.0:3134.
For images from the web just paste the raw link of the image. For example,
https://pbs.twimg.com/profile_images/969919433820041216/lx_WkhmQ_200x200.jpg
For local images, paste the location followed by file://. For example,
file:///home/path/to/image/XYZ.jpg
Press submit. If everything works one should observe something as follows.
Make sure you use a SAL_ prefix for augmentation and use a 4-channel image for the double column model. For a single column remove the SAL_ prefix and use it on a RGB image.
- Cornia, M., Baraldi, L., Serra, G., and Cucchiara, R. (2016). Predicting human eye fixations via an lstm-based saliency attentive model. arXiv preprint arXiv:1611.09571