HITS-AIN / PINK

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

--numrot 1 fails if neuron dimension equals Euclidean distance dimension #36

Closed RafaelMostert closed 5 years ago

RafaelMostert commented 5 years ago

In pink Version 2.2 Git revision: 1113763, if Neuron dimension equals Euclidean distance dimension, running with --numrot 1 flag fails with error message: PINK exception: euclidean distance dimension must be equal or smaller than neuron dimension.

BerndDoser commented 5 years ago

When I use Pink -n 1 --train images.bin som.bin the neuron dimension is equal to the euclidean distance dimension by default (here 64x64). And this works for me:

  *************************************************************************
  *                                                                       *
  *                    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: 1113763                         *
  *                                                                       *
  *       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 = images.bin
  Result file = som_cart10x10.bin
  Number of data entries = 4000
  Data dimension = 64 x 64
  SOM dimension (width x height x depth) = 10x10x1
  SOM size = 100
  Number of iterations = 1
  Neuron dimension = 64x64
  Euclidean distance dimension = 64x64
  Number of progress information prints = 10
  Intermediate storage of SOM = off
  Layout = cartesian
  Initialization type = zero
  Interpolation type = bilinear
  Seed = 1234
  Number of rotations = 1
  Use mirrored image = 1
  Number of CPU threads = 12
  Use CUDA = 1
  Distribution function for SOM update = gaussian
  Sigma = 1.1
  Damping factor = 0.2
  Maximum distance for SOM update = -1
  Use periodic boundary conditions = 0
  Random shuffle data input = 1

  CUDA Device Query...
  There are 1 CUDA devices.

  CUDA Device #0
  Major revision number:         7
  Minor revision number:         5
  Name:                          GeForce RTX 2080
  Total global memory:           8337227776
  Total shared memory per block: 49152
  Total registers per block:     65536
  Warp size:                     32
  Maximum memory pitch:          2147483647
  Maximum threads per block:     1024
  Maximum dimension 0 of block:  1024
  Maximum dimension 1 of block:  1024
  Maximum dimension 2 of block:  64
  Maximum dimension 0 of grid:   2147483647
  Maximum dimension 1 of grid:   65535
  Maximum dimension 2 of grid:   65535
  Clock rate:                    1800000
  Total constant memory:         65536
  Texture alignment:             512
  Concurrent copy and execution: Yes
  Number of multiprocessors:     46
  Kernel execution timeout:      Yes

[=======>                                                              ] 10 % 0.061 s
[==============>                                                       ] 20 % 0.117 s
[=====================>                                                ] 30 % 0.176 s
[============================>                                         ] 40 % 0.231 s
[===================================>                                  ] 50 % 0.282 s
[==========================================>                           ] 60 % 0.333 s
[=================================================>                    ] 70 % 0.384 s
[========================================================>             ] 80 % 0.437 s
[===============================================================>      ] 90 % 0.49 s
[======================================================================] 100 % 0.54 s

  Write final SOM to som_cart10x10.bin ... done.

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

  Successfully finished. Have a nice day.

Do you have some other additional settings?

RafaelMostert commented 5 years ago

Running:

CUDA_VISIBLE_DEVICES=1 Pink  -p 1 --euclidean-distance-type float --som-width 2 --som-height 2 --neuron-dimension 70  --map /data/single_image.bin /data/map_single_image_to_single_neuronv2.bin /data/single_neuron_somv2.bin

I get:


  *************************************************************************
  *                                                                       *
  *                    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: 1113763                         *
  *                                                                       *
  *       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/map_single_image_to_single_neuronv2.bin
  SOM file = /data/single_neuron_somv2.bin
  Number of data entries = 4
  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
  Number of progress information prints = 1
  Intermediate storage of SOM = off
  Layout = cartesian
  Initialization type = file_init
  SOM initialization file = /data/single_neuron_somv2.bin
  Interpolation type = bilinear
  Seed = 1234
  Number of rotations = 360
  Use mirrored image = 1
  Number of CPU threads = 40
  Use CUDA = 1
  Store best rotation and flipping parameters = 0

[======================================================================] 100 % 0.032 s

  Total time (hh:mm:ss): 00:00:01.333     (1 s)

  Successfully finished. Have a nice day.

Adding the -n 1 flag I get:

CUDA_VISIBLE_DEVICES=1 Pink  -p 1 --euclidean-distance-type float --som-width 2 --som-height 2 --neuron-dimension 70  --map /data/single_image.bin /data/map_single_image_to_single_neuronv2.bin /data/single_neuron_somv2.bin -n 1
PINK exception: euclidean distance dimension must be equal or smaller than neuron dimension.
Program was aborted.

removing the euclidean-distance-type flag and the -p 1 flag does not change the error.

RafaelMostert commented 5 years ago

Maybe the difference here is that I use the --map mode instead of the --train mode?

BerndDoser commented 5 years ago

The problem is that you set neuron-dimension without setting a suitable euclidean-distance-dimension. The default neuron-dimension and euclidean-distance-dimension using no rotations are equal to the image-dimension. In your case 100x100. When you set neuron-dimension to 70x70, the euclidean-distance-dimension with 100x100 is to large. The error message is correct. With rotations the default value is set euclidean-distance-dimension via #15 (70x70), which is ok.

The best advice is, if you don't use the default values for neuron-dimension or euclidean-distance-dimension, you have to set both with euclidean-distance-dimension <= neuron-dimension.

RafaelMostert commented 5 years ago

Ok, good to know.