machine-perception-robotics-group / ABN_CelebA_Chainer

ABN for facial attributes recognition
8 stars 1 forks source link

Some mistakes in celeba.py and bad visual results #4

Open o0t1ng0o opened 4 years ago

o0t1ng0o commented 4 years ago

Hi, @Hiroshi-Fukui I had trained the model, and I found some mistakes in your code.

  1. First, there might be a sigmoid layer after line 143? https://github.com/machine-perception-robotics-group/ABN_CelebA/blob/4f5e474c0c57f1f2cc812369b601335f92e1ad53/src/CelebA_Multi-task_Recognition_attention-sig_itr3/Ftuning_model.py#L143 It should be replaced by gh = F.sigmoid(self.att_out(gh))
  2. Then, did you miss the adding sh and x ? https://github.com/machine-perception-robotics-group/ABN_CelebA/blob/4f5e474c0c57f1f2cc812369b601335f92e1ad53/src/CelebA_Multi-task_Recognition_attention-sig_itr3/Ftuning_model.py#L105 It should be followed by sh = F.add(sh, x)?

Did you mistakenly upload the previous version of the code?

In addition, after correct the mistakes, only fews facial attribtues have the correct attention maps, i.e. attractive, high checkbones, mouth slightly open, no beard and young. The attention maps can be seen in the following figures.

12345

I am looking forward to your reply~~ : ) Many thanks!!!

Hiroshi-Fukui commented 4 years ago

Thank you for this repo!

When I compared the accuracies of modified ABN (add sigmoid) and ABN (remove sigmoid), removed sigmoid model was better. Additionally, both ABN models can output a clear attention map. Therefore, I used the ABN that is removed the sigmoid function. Maybe, this difference performance of sigmoid function at attention mechanism was caused by older versions of chainer, cuDNN, and python.

Hiroshi-Fukui commented 4 years ago

Why did you use the sh = F.add(sh, x)? Is this mean the residual structure?

o0t1ng0o commented 4 years ago

Yes. I mean residual structure.

I try to use the same environment as you mentioned.

But I met this error after 22821 iterations.

Traceback (most recent call last):
File "train.py", line 140, in
trainer.run()
File "/usr/local/lib/python2.7/dist-packages/chainer/training/trainer.py", line 299, in run
entry.extension(self)
File "/usr/local/lib/python2.7/dist-packages/chainer/training/extensions/evaluator.py", line 137, in call
result = self.evaluate()
File "/usr/local/lib/python2.7/dist-packages/chainer/training/extensions/evaluator.py", line 177, in evaluat e
eval_func(*in_arrays)
File "./CelebA_Multi-task_Recognition_sig_add_256/Ftuning_model.py", line 138, in
call
h = F.max_pooling_2d(F.relu(h), 3, stride=2)
File "/usr/local/lib/python2.7/dist-packages/chainer/functions/activation/relu.py", line 88, in relu
return ReLU()(x)
File "/usr/local/lib/python2.7/dist-packages/chainer/function.py", line 201, in
call__
outputs = self.forward(in_data)
File "/usr/local/lib/python2.7/dist-packages/chainer/function.py", line 329, in forward
return self.forward_gpu(inputs)
File "/usr/local/lib/python2.7/dist-packages/chainer/functions/activation/relu.py", line 42, in forward_gpu y = cuda.cupy.maximum(x[0], 0)
File "/usr/local/lib/python2.7/dist-packages/cupy/core/fusion.py", line 708, in call
return self._cupy_op(*args, **kwargs)
File "cupy/core/elementwise.pxi", line 778, in cupy.core.core.ufunc.call (cupy/core/core.cpp:48816)
File "cupy/util.pyx", line 39, in cupy.util.memoize.decorator.ret (cupy/util.cpp:1481)
File "cupy/core/elementwise.pxi", line 584, in cupy.core.core._get_ufunc_kernel (cupy/core/core.cpp:45286)
File "cupy/core/elementwise.pxi", line 32, in cupy.core.core._get_simple_elementwise_kernel (cupy/core/core. cpp:34963)
File "cupy/core/carray.pxi", line 87, in cupy.core.core.compile_with_cache (cupy/core/core.cpp:34618)
File "/usr/local/lib/python2.7/dist-packages/cupy/cuda/compiler.py", line 159, in compile_with_cache
mod.load(cubin)
File "cupy/cuda/function.pyx", line 162, in cupy.cuda.function.Module.load (cupy/cuda/function.cpp:4988)
File "cupy/cuda/function.pyx", line 163, in cupy.cuda.function.Module.load (cupy/cuda/function.cpp:4936)
File "cupy/cuda/driver.pyx", line 84, in cupy.cuda.driver.moduleLoadData (cupy/cuda/driver.cpp:1796)
File "cupy/cuda/driver.pyx", line 62, in cupy.cuda.driver.check_status (cupy/cuda/driver.cpp:1446)
cupy.cuda.driver.CUDADriverError: CUDA_ERROR_ILLEGAL_ADDRESS: an illegal memory access was encountered

Do you have any idea about this error? Many thanks!