Home

Awesome

PiCANet-Implementation

Pytorch Implementation of PiCANet: Learning Pixel-wise Contextual Attention for Saliency Detection

New method on implementing PiCANet

input image target_image

Top 10 Performance Test with F-score (beta-square = 0.3)

batchsize:4

StepValueThresholdMAE
2140000.85200.69800.0504
2590000.85180.65100.0512
2750000.85330.66270.0536
2810000.85400.74510.0515
3070000.85180.80780.0523
3830000.85460.66270.0532
3990000.85610.78820.0523
4000000.85440.78040.0512
4080000.85350.59220.0550
4100000.85180.78820.0507

Execution Guideline

Requirements

Pillow==4.3.0
pytorch==0.4.1
tensorboardX==1.1
torchvision==0.2.1
numpy==1.14.2

My Environment

S/W
Windows 10
CUDA 9.0
cudnn 7.0
python 3.5
H/W
AMD Ryzen 1700
Nvidia gtx 1080ti
32GB RAM

Execution Guide

<pre> usage: train.py [-h] [--load LOAD] --dataset DATASET [--cuda CUDA] [--batch_size BATCH_SIZE] [--epoch EPOCH] [-lr LEARNING_RATE] [--lr_decay LR_DECAY] [--decay_step DECAY_STEP] [--display_freq DISPLAY_FREQ] optional arguments: -h, --help show this help message and exit --load LOAD Directory of pre-trained model, you can download at https://drive.google.com/file/d/109a0hLftRZ5at5hwpteRfO1A6xLzf8Na/view?usp=sharing None --> Do not use pre-trained model. Training will start from random initialized model --dataset DATASET Directory of your Dataset --cuda CUDA 'cuda' for cuda, 'cpu' for cpu, default = cuda --batch_size BATCH_SIZE batchsize, default = 1 --epoch EPOCH # of epochs. default = 20 -lr LEARNING_RATE, --learning_rate LEARNING_RATE learning_rate. default = 0.001 --lr_decay LR_DECAY Learning rate decrease by lr_decay time per decay_step, default = 0.1 --decay_step DECAY_STEP Learning rate decrease by lr_decay time per decay_step, default = 7000 --display_freq DISPLAY_FREQ display_freq to display result image on Tensorboard </pre> <pre> usage: image_test.py [-h] [--model_dir MODEL_DIR] --dataset DATASET [--cuda CUDA] [--batch_size BATCH_SIZE] [--logdir LOGDIR] [--save_dir SAVE_DIR] optional arguments: -h, --help show this help message and exit --model_dir MODEL_DIR Directory of pre-trained model, you can download at https://drive.google.com/drive/folders/1s4M-_SnCPMj_2rsMkSy3pLnLQcgRakAe?usp=sharing --dataset DATASET Directory of your test_image ""folder"" --cuda CUDA cuda for cuda, cpu for cpu, default = cuda --batch_size BATCH_SIZE batchsize, default = 4 --logdir LOGDIR logdir, log on tensorboard --save_dir SAVE_DIR save result images as .jpg file. If None -> Not save </pre> <pre> usage: measure_test.py [-h] --model_dir MODEL_DIR --dataset DATASET [--cuda CUDA] [--batch_size BATCH_SIZE] [--logdir LOGDIR] [--which_iter WHICH_ITER] [--cont CONT] [--step STEP] optional arguments: -h, --help show this help message and exit --model_dir MODEL_DIR Directory of folder which contains pre-trained models, you can download at https://drive.google.com/drive/folders/1s4M-_SnCPMj_2rsMkSy3pLnLQcgRakAe?usp=sharing --dataset DATASET Directory of your test_image ""folder"" --cuda CUDA cuda for cuda, cpu for cpu, default = cuda --batch_size BATCH_SIZE batchsize, default = 4 --logdir LOGDIR logdir, log on tensorboard --which_iter WHICH_ITER Specific Iter to measure --cont CONT Measure scores from this iter --step STEP Measure scores per this iter step </pre>

Detailed Guideline

Pretrained Model

You can download pre-trained models from https://drive.google.com/drive/folders/1s4M-_SnCPMj_2rsMkSy3pLnLQcgRakAe?usp=sharing

Dataset

PairDataset Class

DUTS

You can download dataset from http://saliencydetection.net/duts/#outline-container-orgab269ec.

Directory & Name Format of .ckpt files

<code> "models/state_dict/<datetime(Month,Date,Hour,Minute)>/<#epo_#step>.ckpt" </code>