HITS-AIN / PINK

Parallelized rotation and flipping INvariant Kohonen maps
GNU General Public License v3.0
21 stars 11 forks source link

--train result Pink v0.23 differs from Pink v2.2 #38

Closed RafaelMostert closed 5 years ago

RafaelMostert commented 5 years ago

Starting out with a 2x2 cartesian SOM, all four neurons containing only 1s.

I train with a single image containing only 1s and --dist-func gaussian 1 1. I try the following setups: setup 1: v2.2 default settings, setup 2: v2.2 where --neuron-dimension == --euclidean-distance-dimension setup 3: v0.23

After training, I expect the neurons in setup 1 to be similar to the neurons setup 2, except for at the edges as is to be expected from #15 (as I found out again in #37 ). That behaviour is true.

I also expect that the neurons in setup 2 are fully equal to the neurons in setup 3. That is not true.

The run command for setup 2:

CUDA_VISIBLE_DEVICES=3 Pink --dist-func gaussian 0.1 1 --cuda-off --input-shuffle-off --euclidean-distance-type float --som-width 2 --som-height 2 --neuron-dimension 70 --euclidean-distance-dimension 70  --train /data/test/single_image.bin /data/single_neuron_somv2.bin

and setup 3:

CUDA_VISIBLE_DEVICES=3 Pink --dist-func gaussian 0.1 1 --cuda-off --som-width 2 --som-height 2 --train /data/single_imagev1.bin /data/single_neuron_somv1.bin

The runtime output for setup 2:

  *************************************************************************
  *                                                                       *
  *                    PPPPP    II   NN    NN   KK  KK                    *
  *                    PP  PP   II   NNN   NN   KK KK                     *
  *                    PPPPP    II   NN NN NN   KKKK                      *
  *                    PP       II   NN   NNN   KK KK                     *
  *                    PP       II   NN    NN   KK  KK                    *
  *                                                                       *
  *       Parallelized rotation and flipping INvariant Kohonen maps       *
  *                                                                       *
  *                         Version 2.2                                   *
  *                         Git revision: c55d0d8                         *
  *                                                                       *
  *       Bernd Doser <bernd.doser@h-its.org>                             *
  *       Kai Polsterer <kai.polsterer@h-its.org>                         *
  *                                                                       *
  *       Distributed under the GNU GPLv3 License.                        *
  *       See accompanying file LICENSE or                                *
  *       copy at http://www.gnu.org/licenses/gpl-3.0.html.               *
  *                                                                       *
  *************************************************************************

  Data file = /data/single_image.bin
  Result file = /data/single_neuron_somv2.bin
  Number of data entries = 1
  Data dimension = 100 x 100
  SOM dimension (width x height x depth) = 2x2x1
  SOM size = 4
  Number of iterations = 1
  Neuron dimension = 70x70
  Euclidean distance dimension = 70x70
  Maximal number of progress information prints = 10
  Intermediate storage of SOM = off
  Layout = cartesian
  Initialization type = zero
  Interpolation type = bilinear
  Seed = 1234
  Number of rotations = 360
  Use mirrored image = 1
  Number of CPU threads = 40
  Use CUDA = 0
  Distribution function for SOM update = gaussian
  Sigma = 0.1
  Damping factor = 1
  Maximum distance for SOM update = -1
  Use periodic boundary conditions = 0
  Random shuffle data input = 0

[======================================================================] 100 % 0.101 s

  Write final SOM to /data/single_neuron_somv2.bin ... done.

  Total time (hh:mm:ss): 00:00:00.200     (0 s)

  Successfully finished. Have a nice day.

and for setup 3:

  ************************************************************************
  *   Parallel orientation Invariant Non-parametric Kohonen-map (PINK)   *
  *                                                                      *
  *                             Version 0.23                             *
  *                                                                      *
  *   Kai Polsterer, Bernd Doser, HITS gGmbH                             *
  ************************************************************************

  Image file = /data/single_imagev1.bin
  Result file = /data/test/single_neuron_somv1.bin
  Number of images = 1
  Number of channels = 1
  Image dimension = 100x100
  SOM dimension (width x height x depth) = 2x2x1
  SOM size = 4
  Number of iterations = 1
  Neuron dimension = 70x70
  Progress = 0.1
  Intermediate storage of SOM = off
  Layout = quadratic
  Initialization type = zero
  Interpolation type = bilinear
  Seed = 1234
  Number of rotations = 360
  Use mirrored image = 1
  Number of CPU threads = 40
  Use CUDA = 0
  Use multiple GPUs = 1
  Distribution function for SOM update = gaussian
  Sigma = 0.1
  Damping factor = 1
  Maximum distance for SOM update = -1
  Use periodic boundary conditions = 0

  Starting C version of training.

  Progress:            1 updates, 100 % (0 s)

  Total time (hh:mm:ss): 00:00:00     (= 0s)

  Successfully finished. Have a nice day.

I tried with and without CUDA, with many or just 1 threads, with and without flipping and rotations. Every time the absolute neuron weights from setup 2 differ from those in setup 3.

BerndDoser commented 5 years ago

The issue was in the shuffled input iterator used for the training makes that the first image was taken twice.