GithubHelp home page GithubHelp logo

imatge-upc / salgan Goto Github PK

View Code? Open in Web Editor NEW
368.0 20.0 106.0 13.52 MB

SalGAN: Visual Saliency Prediction with Generative Adversarial Networks

Home Page: https://imatge-upc.github.io/salgan

License: MIT License

Python 100.00%
deep-learning deeplearning saliency-map convolutional-neural-networks visual

salgan's Introduction

SalGAN: Visual Saliency Prediction with Adversarial Networks

Junting Pan Cristian Canton Ferrer Kevin McGuinness Noel O'Connor Jordi Torres Elisa Sayrol Xavier Giro-i-Nieto
Junting Pan Cristian Canton Ferrer Kevin McGuinness Noel O'Connor Jordi Torres Elisa Sayrol Xavier Giro-i-Nieto

A joint collaboration between:

logo-insight logo-dcu logo-microsoft logo-facebook logo-bsc logo-upc
Insight Centre for Data Analytics Dublin City University (DCU) Microsoft Facebook Barcelona Supercomputing Center Universitat Politecnica de Catalunya (UPC)

Abstract

We introduce SalGAN, a deep convolutional neural network for visual saliency prediction trained with adversarial examples. The first stage of the network consists of a generator model whose weights are learned by back-propagation computed from a binary cross entropy (BCE) loss over downsampled versions of the saliency maps. The resulting prediction is processed by a discriminator network trained to solve a binary classification task between the saliency maps generated by the generative stage and the ground truth ones. Our experiments show how adversarial training allows reaching state-of-the-art performance across different metrics when combined with a widely-used loss function like BCE.

Slides

<iframe src="//www.slideshare.net/slideshow/embed_code/key/5cXl80Fm2c3ksg" width="595" height="485" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe>

Publication

Find the extended pre-print version of our work on arXiv. The shorter extended abstract presented as spotlight in the CVPR 2017 Scene Understanding Workshop (SUNw) is available here.

Image of the paper

Please cite with the following Bibtex code:

@InProceedings{Pan_2017_SalGAN,
author = {Pan, Junting and Canton, Cristian and McGuinness, Kevin and O'Connor, Noel E. and Torres, Jordi and Sayrol, Elisa and Giro-i-Nieto, Xavier and},
title = {SalGAN: Visual Saliency Prediction with Generative Adversarial Networks},
booktitle = {arXiv},
month = {January},
year = {2017}
}

You may also want to refer to our publication with the more human-friendly Chicago style:

Junting Pan, Cristian Canton, Kevin McGuinness, Noel E. O'Connor, Jordi Torres, Elisa Sayrol and Xavier Giro-i-Nieto. "SalGAN: Visual Saliency Prediction with Generative Adversarial Networks." arXiv. 2017.

Architecture

architecture-fig

Model parameters

The parameters to run SalGAN can be downloaded here:

If you wanted to train the model, you will also need this additional file

Visual Results

Qualitative saliency predictions

Datasets

Training

As explained in our paper, our networks were trained on the training and validation data provided by SALICON.

Test

Two different dataset were used for test:

Software frameworks

Our paper presents two convolutional neural networks, one correspends to the Generator (Saliency Prediction Network) and the another is the Discriminator for the adversarial training. To compute saliency maps only the Generator is needed.

SalGAN on Lasagne

SalGAN is implemented in Lasagne, which at its time is developed over Theano.

pip install -r https://raw.githubusercontent.com/imatge-upc/saliency-salgan-2017/master/requirements.txt

SalGAN on a docker

We have prepared this Docker container with all necessary dependencies for computing saliency maps with SalGAN. You will need to use nvidia-docker.

Using the container is like connecting via ssh to a machine. To start an interactive session run:

    >> sudo nvidia-docker run -it --entrypoint='bash' -w /home/ evamohe/salgan

This will open a terminal within the container located in the '/home' folder.

Yo will find Salgan code in "/home/salgan". So if you want to test the installation, within the container, run:

   >> cd /home/salgan/scripts
   >> THEANO_FLAGS=mode=FAST_RUN,device=gpu0,floatX=float32,lib.cnmem=0.5,optimizer_including=cudnn python 03-predict.py

That will process the sample images located in "/home/salgan/images" and store them in "/home/salgan/saliency". To exit the container, run:

   >> exit

You migh want to process your own data with your own custom scripts. For that, you can mount different local folders in the container. For example:

>> sudo nvidia-docker run -v $PATH_TO_MY_CODE:/home/code -v $PATH_TO_MY_DATA:/home/data -it --entrypoint='bash' -w /home/

will open a new session in the container, with '/home/code' and '/home/data' folders that will be share with your computer. If you edit your code locally, the changes will be updated automatically in the container. Similarly, all the files generated in '/home/data' will be available in your original data folder.

Usage

To train our model from scrath you need to run the following command:

THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32,lib.cnmem=1,optimizer_including=cudnn python 02-train.py

In order to run the test script to predict saliency maps, you can run the following command after specifying the path to you images and the path to the output saliency maps:

THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32,lib.cnmem=1,optimizer_including=cudnn python 03-predict.py

With the provided model weights you should obtain the follwing result:

Image Stimuli Saliency Map

Download the pretrained VGG-16 weights from: vgg16.pkl

External implementation in PyTorch

Bat-Orgil Batsaikhan and Catherine Qi Zhao from the University of Minnesota released a PyTorch implementation in 2018 as part of their poster "Generative Adversarial Network for Videos and Saliency Map".

Acknowledgements

We would like to especially thank Albert Gil Moreno and Josep Pujal from our technical support team at the Image Processing Group at the UPC.

AlbertGil-photo JosepPujal-photo
Albert Gil Josep Pujal
We gratefully acknowledge the support of NVIDIA Corporation with the donation of the GeoForce GTX Titan Z and Titan X used in this work. logo-nvidia
The Image ProcessingGroup at the UPC is a SGR14 Consolidated Research Group recognized and sponsored by the Catalan Government (Generalitat de Catalunya) through its AGAUR office. logo-catalonia
This work has been developed in the framework of the projects BigGraph TEC2013-43935-R and Malegra TEC2016-75976-R, funded by the Spanish Ministerio de Economía y Competitividad and the European Regional Development Fund (ERDF). logo-spain
This publication has emanated from research conducted with the financial support of Science Foundation Ireland (SFI) under grant number SFI/12/RC/2289. logo-ireland

Contact

If you have any general doubt about our work or code which may be of interest for other researchers, please use the public issues section on this github repo. Alternatively, drop us an e-mail at mailto:[email protected].

<script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-7678045-13', 'auto'); ga('send', 'pageview'); </script>

salgan's People

Contributors

cristiancanton avatar junting avatar xavigiro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

salgan's Issues

I'm training a model now, but why this error happened?

Traceback (most recent call last):
File "/media/huiyu/Project/Python/other/saliency-salgan-2017/scripts/my_train.py", line 170, in
train()
File "/media/huiyu/Project/Python/other/saliency-salgan-2017/scripts/my_train.py", line 153, in train
model = ModelSALGAN(INPUT_SIZE[0], INPUT_SIZE[1])
File "/media/huiyu/Project/Python/other/saliency-salgan-2017/scripts/models/model_salgan.py", line 28, in init
self.predictFunction = theano.function([self.input_var], test_prediction)
File "/home/huiyu/miniconda2/lib/python2.7/site-packages/theano/compile/function.py", line 320, in function
output_keys=output_keys)
File "/home/huiyu/miniconda2/lib/python2.7/site-packages/theano/compile/pfunc.py", line 479, in pfunc
output_keys=output_keys)
File "/home/huiyu/miniconda2/lib/python2.7/site-packages/theano/compile/function_module.py", line 1777, in orig_function
defaults)
File "/home/huiyu/miniconda2/lib/python2.7/site-packages/theano/compile/function_module.py", line 1641, in create
input_storage=input_storage_lists, storage_map=storage_map)
File "/home/huiyu/miniconda2/lib/python2.7/site-packages/theano/gof/link.py", line 690, in make_thunk
storage_map=storage_map)[:3]
File "/home/huiyu/miniconda2/lib/python2.7/site-packages/theano/gof/vm.py", line 1003, in make_all
no_recycling))
File "/home/huiyu/miniconda2/lib/python2.7/site-packages/theano/sandbox/cuda/init.py", line 256, in make_thunk
compute_map, no_recycling)
File "/home/huiyu/miniconda2/lib/python2.7/site-packages/theano/gof/op.py", line 970, in make_thunk
no_recycling)
File "/home/huiyu/miniconda2/lib/python2.7/site-packages/theano/gof/op.py", line 879, in make_c_thunk
output_storage=node_output_storage)
File "/home/huiyu/miniconda2/lib/python2.7/site-packages/theano/gof/cc.py", line 1200, in make_thunk
keep_lock=keep_lock)
File "/home/huiyu/miniconda2/lib/python2.7/site-packages/theano/gof/cc.py", line 1143, in compile
keep_lock=keep_lock)
File "/home/huiyu/miniconda2/lib/python2.7/site-packages/theano/gof/cc.py", line 1595, in cthunk_factory
key=key, lnk=self, keep_lock=keep_lock)
File "/home/huiyu/miniconda2/lib/python2.7/site-packages/theano/gof/cmodule.py", line 1142, in module_from_key
module = lnk.compile_cmodule(location)
File "/home/huiyu/miniconda2/lib/python2.7/site-packages/theano/gof/cc.py", line 1506, in compile_cmodule
preargs=preargs)
File "/home/huiyu/miniconda2/lib/python2.7/site-packages/theano/sandbox/cuda/nvcc_compiler.py", line 399, in compile_str
'for cmd', ' '.join(cmd))
Exception: ('The following error happened while compiling the node', GpuDnnConv{algo='small', inplace=True}(GpuContiguous.0, GpuContiguous.0, GpuAllocEmpty.0, GpuDnnConvDesc{border_mode=(1, 1),subsample=(1, 1), conv_mode='cross', precision='float32'}.0, Constant{1.0}, Constant{0.0}), '\n', 'nvcc return status', 2, 'for cmd', 'nvcc -shared -O3 -Xlinker -rpath,/usr/local/cuda-8.0/lib64-arch=sm_61 -m64 -Xcompiler -fno-math-errno,-Wno-unused-label,-Wno-unused-variable,-Wno-write-strings,-DCUDA_NDARRAY_CUH=c72d035fdf91890f3b36710688069b2e,-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,-fPIC,-fvisibility=hidden -Xlinker -rpath,/home/huiyu/.theano/compiledir_Linux-4.4--generic-x86_64-with-debian-stretch-sid-x86_64-2.7.14-64/cuda_ndarray -I/home/huiyu/.theano/compiledir_Linux-4.4--generic-x86_64-with-debian-stretch-sid-x86_64-2.7.14-64/cuda_ndarray -I/usr/local/cuda-8.0/include -I/home/huiyu/miniconda2/lib/python2.7/site-packages/theano/sandbox/cuda -I/home/huiyu/miniconda2/lib/python2.7/site-packages/numpy/core/include -I/home/huiyu/miniconda2/include/python2.7 -I/home/huiyu/miniconda2/lib/python2.7/site-packages/theano/gof -o /home/huiyu/.theano/compiledir_Linux-4.4--generic-x86_64-with-debian-stretch-sid-x86_64-2.7.14-64/tmpxFjabo/b1b28962a86b2752ba91f7d762cc71c7.so mod.cu -L/home/huiyu/.theano/compiledir_Linux-4.4--generic-x86_64-with-debian-stretch-sid-x86_64-2.7.14-64/cuda_ndarray -L/home/huiyu/miniconda2/lib -lcudart -lcublas -lcuda_ndarray -lcudnn -lpython2.7', "[GpuDnnConv{algo='small', inplace=True}(<CudaNdarrayType(float32,4D)>, <CudaNdarrayType(float32, 4D)>, <CudaNdarrayType(float32, 4D)>, <CDataType{cudnnConvolutionDescriptor_t}>, Constant{1.0}, Constant{0.0})]")

The code does not work with huge pickle dataset

Hello,
You load the whole train_data into the RAM at once and then shuffle them for mini-batch selection. Now, my data is so much huge so that it is twice larger than my RAM.
Do you know any alternative in theano/lasagne to handle this problem in your code?

Thanks
Saeed

A problem with using pre-trained Discriminator model "[SalGAN Discriminator (3.4 MB)]"

Hi,

I had tried to use the pre-trained Discriminator model "[SalGAN Discriminator (3.4 MB)]" but it always raises an error:

ValueError: mismatch: parameter has shape (12288L, 100L) but value to set has shape (12288L, 60L)

Does it mean the "fc4" layer needs to be changed from 100-D to 60-D?

But this let the structure become different from proposed in the paper.

I would be very grateful if you can help me to solve this problem.

Best,
Ljovo

Difference between OutputMaps and FixationMaps

I want to train this SalGAN network on my own dataset. I have the original images and the ground-truth images (no fixation maps). What I have presumed is that in Train section of 01-data_preprocessing.py script, pathOutputImages will have path to the original images and pathOutputMaps will have path to ground-truth images. Is my assumption correct?

I am also confused in what I should give as input to pathToFixationMaps in the same script. Is it necessary to give all three parameters (pathOutputImages, pathOutputMaps and pathToFixationMaps) for the training purpose. Can I train this network without fixation maps?

CUDA & cudnn

Hello, thank you for making your code available. I'm having some issues with cudnn (not able to obtain a cudnn handle when running the predict script).

Could you provide some more details about which version of CUDA and cudnn you are using?
Thanks
Fintan
Attention lab, UCL

loading the whole dataset to memory

If I understand salgan code correctly, why does it load the whole dataset into the memory and then picks a batch from the dataset?

it would be better to just load file names into the memory and then load a batch into the memory.

paper code environment configuration and operation requirements

Hello!I am a new student of computer science and technology.When I run the code ,I encountered some problems: the operating environment configuration is not successful (I follow the prompt step by step to install the required software, or not), It makes me really confused.I want to ask about more details of the paper code environment configuration and operation requirements.If anyone can help me,I will be very grateful.Thanks!
Xin Zhu

How to solve the issue about drop of loss of discriminator is too slow ?

Dear authors:
The following screen shot is my training log, I think the decreasing of loss of discriminator is slow, how can I speed it up ? I first training the network using bce loss, then load pretrained model and continue the training with adversal loss. Do I made any mistakes ? Looking forward for your replay. Thanks very much !!!

screenshot from 2017-03-31 22 17 26

NaN loss when training from scratch

Hi,
I tried to train your model on my own dataset consisting of (RGB image, Binary mask) pairs which both are images (and not Mat file). However, after several epochs, I get NaN train loss. what's the problem? I modified your 01-preprocess_data code to use binary images as the ground truth. does it interfere the training?

A question about the loss of training GAN process

Hi,
I met a problem when I train the whole gan network. First I load my weights of G network into the framework, then the train is begining and i print all kinds of loss scores, it confused me that the loss of gan_bce just increase even if the avdersarial loss decreases. Does it normal and i need to wait for more epoches?

Color channels on input images are shuffled

I downloaded your pretrained models and got your code working on my macbook with great results. However, when I did some experimentation I noticed the colors of the image_stimuli in the predict function where wrong. I then found that when the images are being loaded on line 17 in 03-predict.py you seem to shuffle the color channels:

cv2.cvtColor( ... , cv2.COLOR_BGR2RGB)

What is the reason for doing this? Have your pretrained models been trained using shuffled image channels too?

Pre-trained Network Parameters

I am doing some experiments on the SALGAN. I noticed that the results reported in the arXiv say that the training is done using 256x192 size images and saliency maps but the code has default values of 320x240. My question is that in the paper you performed training on 256x192 images, which would change the aspect ratio of the SALICON dataset. Isn't that a problem ??

Could not find a version that satisfies the requirement Lasagne==0.2.dev1

hi,
i have this error on ubuntu 16.04, debian 9 e fedora 27 after execute the command
pip install -r https://raw.githubusercontent.com/imatge-upc/saliency-salgan-2017/master/requirements.txt

Collecting Lasagne==0.2.dev1 (from -r https://raw.githubusercontent.com/imatge-upc/saliency-salgan-2017/master/requirements.txt (line 28))
Could not find a version that satisfies the requirement Lasagne==0.2.dev1 (from -r https://raw.githubusercontent.com/imatge-upc/saliency-salgan-2017/master/requirements.txt (line 28)) (from versions: 0.1)
No matching distribution found for Lasagne==0.2.dev1 (from -r https://raw.githubusercontent.com/imatge-upc/saliency-salgan-2017/master/requirements.txt (line 28))

Thanks

May I ask where should we download the dataset

Dear professor,I am a novice in Python.I got your paper by chance in a class. I was very interested, but I ran into some problems in running the code.Now,I'd like to ask how we can get the dataset,like the Maps.mat and FixationMaps.mat.

producing saliency map for other images

I am naive in python and trying to produce the saliency maps for some other images.
But I am not able to understand the command given for predicting saliency maps.
THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32,lib.cnmem=1,optimizer_including=cudnn python 03-predict.py

Also when I try to run 03predict.py file then I get the following error:
No module name 'generator'.

Please help me in reproducing the results.

Error converting raw image to PKL format data

Dear author:
When I run the code 'python 01-data_preprocessing.py', I always meet this mistake:

File "****/saliency-salgan-2017-master/scripts/eliaLib/dataRepresentation.py", line 49, in load

self.data = (scipy.io.loadmat(self.filePath)['I']).astype(np.uint8)

KeyError: 'I'

 I was miserable. Eager for your help!
 Thank you very much anyway!
 Best!

cPickle

Maybe you could replace:
import cPickle

with...

import _pickle as cPickle

Cannot find the saliency map from SALICON dataset

Hi, I am new and stuck with the 01-data_preprocessing.py
I download the entire SALICON dataset which is provided on their website. However the saliency folder is missing. Since it is required for preprocesing, I guess I missed some steps to get it run.

Any hints about it? I really appreciate it.

May I ask where should we download the dataset

Dear professor,I am a novice in Python.I got your paper by chance in a class. I was very interested, but I ran into some problems in running the code.Now,I'd like to ask how we can get the dataset,like the Maps.mat and FixationMaps.mat.

Access Forbidden in model links

When I try to download the models (generator/discriminator), I receive the following Access Forbidden error:

Access Forbidden
Error Type: 403

Access to the URL that you requested is forbidden.

If you think that this is an error, please send us an email: [email protected]. We will do all we can to fix it as soon as possible.

<< Go back to previous page.

How to draw such a beautiful structure?

    First of all, thank you for sharing the code and your perfect work.
   And I want to know how to draw the structure chart in your paper.Could you give me some recommended tools?Thanks! @ @junting 
    Of course, I will also be very grateful if any of the friends here can give me some advice.

tim 20180419152440

Visualize predicted Scan-paths on input image

Hi,
I'm new to both python as well as deep learning environment. I successfully implemented the code by giving an image as an input and saving the predicted scan-path output as a .mat file. Can someone kindly help me with how to visualize the scan-path over the input image?

Thanks a lot :D

cannot access to vgg.pkl

Hi, I am impressed by this work and I want to use the pre-trained model to produce saliency maps for some other images. However, I have trouble trying to download the vgg.pkl perheps the foreign server is denied by my browser in China. So I wonder if anyone is kind to share the model to me or offer other links to download the vgg.pkl, for which I will be greatly grateful.

lasagne?

/home/public/anaconda3/envs/py27/bin/python2 /home/cbl/PycharmProjects/saliency-salgan-2017-master/scripts/models/discriminator.py
ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: libcublas.so.8.0: cannot open shared object file: No such file or directory
Traceback (most recent call last):
File "/home/cbl/PycharmProjects/saliency-salgan-2017-master/scripts/models/discriminator.py", line 6, in
import nn
File "/home/cbl/PycharmProjects/saliency-salgan-2017-master/scripts/models/nn.py", line 9, in
from lasagne.layers import dnn
File "/home/public/anaconda3/envs/py27/lib/python2.7/site-packages/lasagne/layers/dnn.py", line 42, in
"requires GPU support -- see http://lasagne.readthedocs.org/en/"
ImportError: requires GPU support -- see http://lasagne.readthedocs.org/en/latest/user/installation.html#gpu-support

Process finished with exit code 1

Requirements (Lasagne, optpy)

when installing the requirements it is not possible to find:
Lasagne==0.2.dev1 and others...

Where is this version of Lasagne? the latest release is 0.1
also the same for optpy...

Some question about code of data_preprocessing and enviroment

Hello!I am a student in UESTC,thank you for your share,and I have some question about your code.

Fristly, i have downloaded the dateset of SALICON CHALLENGE(image(jpg),fixation map(png),and fixtion(mat)),but when i ran your code of data_preprocessing,this function:

for currFile in tqdm(listImgFiles): tt = dataRepresentation.Target(os.path.join(pathToImages, currFile + '.jpg'), os.path.join(pathToMaps, currFile + '.mat'), os.path.join(pathToFixationMaps, currFile + '.mat'), dataRepresentation.LoadState.loaded, dataRepresentation.InputType.image, dataRepresentation.LoadState.loaded, dataRepresentation.InputType.saliencyMapMatlab, dataRepresentation.LoadState.unloaded, dataRepresentation.InputType.empty )
why you use two dataset about .mat?(dataset only have one .mat set)

Secondly,the code can only run under the linux and gpu?how about windows on pychram and cpu?I met so many question on enviroment.

Thirdly,question about code of 'dataRepresentation'
data = (scipy.io.loadmat(self.filePath)['I'] * 255).astype(np.uint8)
we kown that the .mat files have three structs(images,gaze,re),and there is not key ,called 'I',when i ran:
self.data = (scipy.io.loadmat(self.filePath)['I'] * 255).astype(np.uint8) KeyError: 'I'

I hope you can reply as soon as possibles.
I would be very grateful if you can give a detailed explanation about how to run your code on windows
Best wishes!
ZHIKUN LIN

RuntimeError: gpudata_alloc: cuMemAlloc: CUDA_ERROR_OUT_OF_MEMORY: out of memory

Hi, when I tried to train my dataset with 02-train.py. I met the problem like this.
The log of that problem is printed as below.

Traceback (most recent call last):
File "02-train.py", line 153, in
train()
File "02-train.py", line 143, in train
salgan_batch_iterator(model, train_data, validation_sample.image.data)
File "02-train.py", line 85, in salgan_batch_iterator
G_obj, D_obj, G_cost = model.G_trainFunction(batch_input, batch_output)
File "/usr/local/lib/python2.7/dist-packages/theano/compile/function_module.py", line 917, in call
storage_map=getattr(self.fn, 'storage_map', None))
File "/usr/local/lib/python2.7/dist-packages/theano/gof/link.py", line 325, in raise_with_op
reraise(exc_type, exc_value, exc_trace)
File "/usr/local/lib/python2.7/dist-packages/theano/compile/function_module.py", line 903, in call
self.fn() if output_subset is None else
RuntimeError: gpudata_alloc: cuMemAlloc: CUDA_ERROR_OUT_OF_MEMORY: out of memory
Apply node that caused the error: GpuDnnReduction{red_op='add', axis=(1,), acc_dtype='float32', dtype='float32', return_indices=False}(GpuContiguous.0)
Toposort index: 1520
Inputs types: [GpuArrayType(float32, 3D)]
Inputs shapes: [(393216, 2, 256)]
Inputs strides: [(2048, 1024, 4)]
Inputs values: ['not shown']
Outputs clients: [[GpuReshape{4}(GpuDnnReduction{red_op='add', axis=(1,), acc_dtype='float32', dtype='float32', return_indices=False}.0, MakeVector{dtype='int64'}.0)]]

Backtrace when the node is created(use Theano flag traceback.limit=N to make it longer):
File "/usr/local/lib/python2.7/dist-packages/theano/gradient.py", line 1326, in access_grad_cache
term = access_term_cache(node)[idx]
File "/usr/local/lib/python2.7/dist-packages/theano/gradient.py", line 1021, in access_term_cache
output_grads = [access_grad_cache(var) for var in node.outputs]
File "/usr/local/lib/python2.7/dist-packages/theano/gradient.py", line 1326, in access_grad_cache
term = access_term_cache(node)[idx]
File "/usr/local/lib/python2.7/dist-packages/theano/gradient.py", line 1021, in access_term_cache
output_grads = [access_grad_cache(var) for var in node.outputs]
File "/usr/local/lib/python2.7/dist-packages/theano/gradient.py", line 1326, in access_grad_cache
term = access_term_cache(node)[idx]
File "/usr/local/lib/python2.7/dist-packages/theano/gradient.py", line 1021, in access_term_cache
output_grads = [access_grad_cache(var) for var in node.outputs]
File "/usr/local/lib/python2.7/dist-packages/theano/gradient.py", line 1326, in access_grad_cache
term = access_term_cache(node)[idx]
File "/usr/local/lib/python2.7/dist-packages/theano/gradient.py", line 1162, in access_term_cache
new_output_grads)

Could anybody help me please? Thanks.

Unable to reproduce the standard saliency map.

Hi @junting,

I'm super interesting in SalGAN, so here I am.

I've tried to run the model with provided VGG-16 weights, and pertained generator and discriminator which are provided in your Github repo, really appreciate your work.

While running (03-predict.py) with the setting above, following is the result I've received:

Use this picture as the input of SalGAN
i112_original

I get the result
i112

which is slightly different from the result I expected according to the website
i1123

​I'm wondering if there's some mistake with my operation, or shall I do some training on the provided weights in order to get the expected results ?
Hope you could give me some assistance.
Nice work for the SalGAN again.

Cheers,

what is the data format for running the Salgan

sorry to interrupt again.
I am still struggle to parse the json file from SALICON dataset into the format required to run salgan. Would you please specify the parsing methods? or please clarify what is saliency map and fixations? My best guess is saliency map equals to annotations and the fixations are coordinates of the dots. If yes, what is the data structure of fixations?

Since the salgan used the 'mat' file, please help to confirm it.

pysaliency==0.1.0 deprecated?

I was trying to install your model, but I did not find the pysaliency version 0.1.0, i menage to install a version > 0.2.x, i'm testing now if it its working properly, but you should give a look into this.

GPU is mandatory?

Is mandatory to run with a NVIDIA GPU?
Or can we run it using only the cpu?

unable to download "gen_modelWeights0090.npz"

I am trying to run the test script. I made necessary changes in "scripts/constants.py" and ran the scripts. But i am getting an IO error which shows this:

......
......
uconv1_2: (64, 192, 256)
uconv1_1: (64, 192, 256)
output: (1, 192, 256)
Traceback (most recent call last):
  File "03-predict.py", line 30, in <module>
    main()
  File "03-predict.py", line 25, in main
    load_weights(model.net['output'], path='gen_', epochtoload=90)
  File "<DIR_PATH>scripts/utils.py", line 22, in load_weights
    with np.load(HOME_DIR + path + "modelWeights{:04d}.npz".format(epochtoload)) as f:
  File "/home/han/.local/lib/python2.7/site-packages/numpy/lib/npyio.py", line 362, in load
    fid = open(file, "rb")
IOError: [Errno 2] No such file or directory: '<DIR_PATH>gen_modelWeights0090.npz'

I tried to download the file "gen_modelWeights0090.npz" but I am getting a standard Apache forbidden error. Can you update the link to download those files?

  • <DIR_PATH> is my local path set with the variable named "HOME_DIR" in scripts/constants.py

Two problems about the discriminator network

Dear friend,
I have two problems about the discriminator network : Firstly, I found that the drop of discriminator network's loss was very slow when I was training salgan. Secondly, I found the model size of discriminator network I trained was different from yours.(5.5MB vs.3.4MB) why? Did you have done some change to your discriminator?
Can you give me some suggestion? I am looking forward to your reply.Thanks.
Sincerely yours

ValueError: mismatch: got 20 values to set 18 parameters

Hi, thanks for the code and trained model. But, I found when load the trained model of discriminator you provided, it shown me the following error. Could you check that model again ? Thanks.

Traceback (most recent call last):
File "wangxiao-02-train.py", line 184, in
train()
File "wangxiao-02-train.py", line 169, in train
load_weights(net=model.discriminator['fc5'], path="test/discrim_", epochtoload=90)
File "/media/wangxiao/724eaeef-e688-4b09-9cc9-dfaca44079b2/saliency-salgan-2017-master-tracking/scripts/utils.py", line 24, in load_weights
lasagne.layers.set_all_param_values(net, param_values)
File "/home/wangxiao/Lasagne/src/lasagne/lasagne/layers/helper.py", line 512, in set_all_param_values
(len(values), len(params)))
ValueError: mismatch: got 20 values to set 18 parameters

Wrong link to requirements.txt

Hi,
It seems like the link to requirements.txt is wrong. Currently, it is https://github.com/imatge-upc/saliency-salgan-2017/blob/junting/requirements.txt, but I think it should be https://raw.githubusercontent.com/imatge-upc/saliency-salgan-2017/master/requirements.txt. (2 issues: junting vs master branch and raw. vs non raw..

Best, Tobias

Pretrained model

Hi

Your SalGAN approach looks super interesting!

Do you provide a pretrained model? Might just be me who can't find the link :)

Best
Casper

vgg16.pkl unaccesible

Since the author of "Lasagne/Recipes" has made vgg16.pkl downloading unpublicly, i'm wondering whether you can provide your existing vgg16.pkl through dropbox or anything else?

looking for modelWeights0080.npz

I'm running the test script to produce the saliency maps as shown in the README (python 03-predict.py)

I cannot find in the instructions where to obtain the model weights. I see https://imatge.upc.edu/web/sites/default/files/resources/1720/saliency/2017-salgan/gen_modelWeights0090.npz and https://imatge.upc.edu/web/sites/default/files/resources/1720/saliency/2017-salgan/discrim_modelWeights0090.npz but the prefix of either gen_ or discrim_ is not present in the call to load_weights in 03-predict nor the epic of 80.

ImportError: requires GPU support Is that anyone could help me ? thanks

Traceback (most recent call last):
File "/home/bl/PycharmProjects/saliency-salgan-2017-master/scripts/02-train.py", line 17, in
from models.model_salgan import ModelSALGAN
File "/home/bl/PycharmProjects/saliency-salgan-2017-master/scripts/models/model_salgan.py", line 8, in
import discriminator
File "/home/bl/PycharmProjects/saliency-salgan-2017-master/scripts/models/discriminator.py", line 6, in
import nn
File "/home/bl/PycharmProjects/saliency-salgan-2017-master/scripts/models/nn.py", line 9, in
from lasagne.layers import dnn
File "/usr/local/lib/python2.7/dist-packages/lasagne/layers/dnn.py", line 42, in
"requires GPU support -- see http://lasagne.readthedocs.org/en/"
ImportError: requires GPU support -- see http://lasagne.readthedocs.org/en/latest/user/installation.html#gpu-support

Is that anyone could help me ? thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.