Click here to Skip to main content
15,886,664 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I am very new to GAN and machine learning overall, anyway this line is not working and I don't know why:
Python
Xd = numpy.concatenate((image_batch, generated_images))


image_batch looks like this:
[[[[-1.         -1.         -0.99215686 ... -1.         -1.
    -1.        ]
   [-1.         -1.         -0.99215686 ... -0.99215686 -1.
    -1.        ]
   [-1.         -1.         -0.99215686 ... -0.9843137  -0.99215686
    -1.        ]
   ...
   [-1.         -1.         -1.         ... -0.84313726 -0.8509804
    -0.85882354]
   [-1.         -1.         -1.         ... -0.9372549  -0.9529412
    -0.9529412 ]
   [-1.         -1.         -1.         ... -0.99215686 -1.
    -1.        ]]

  [[-0.9843137  -0.9764706  -0.96862745 ... -1.         -0.99215686
    -0.9843137 ]
   [-0.9843137  -0.9764706  -0.96862745 ... -0.9843137  -0.99215686
    -0.9843137 ]
   [-0.9764706  -0.9764706  -0.96862745 ... -0.96862745 -0.9843137
    -0.99215686]
   ...
   [-1.         -1.         -1.         ... -0.75686276 -0.77254903
    -0.78039217]
   [-1.         -1.         -1.         ... -0.8666667  -0.90588236
    -0.92941177]
   [-1.         -1.         -1.         ... -0.92156863 -0.9764706
    -1.        ]]

  [[-0.8980392  -0.8901961  -0.88235295 ... -0.99215686 -0.9843137
    -0.9764706 ]
   [-0.8980392  -0.8901961  -0.88235295 ... -0.9764706  -0.9843137
    -0.9764706 ]
   [-0.8901961  -0.8901961  -0.88235295 ... -0.9607843  -0.9764706
    -0.9843137 ]
   ...
   [-1.         -1.         -1.         ... -0.654902   -0.67058825
    -0.6784314 ]
   [-1.         -1.         -1.         ... -0.7647059  -0.8117647
    -0.8352941 ]
   [-1.         -1.         -1.         ... -0.81960785 -0.88235295
    -0.9137255 ]]]]

and generated_images like this:
[[[[ 4.23198326e-05  3.00442276e-04 -1.81058873e-04]
   [ 1.45811282e-04  3.19001469e-04 -5.63107751e-05]
   [ 2.64693721e-04  1.66193859e-04 -1.39604657e-04]
   ...
   [-6.86520070e-04  5.22632385e-04  5.16742817e-04]
   [-1.71413078e-04  3.02032888e-04  4.35194233e-04]
   [-5.06673474e-04  6.82787504e-04  1.78376344e-04]]

  [[ 6.45761684e-05  8.61766166e-05 -6.29937422e-05]
   [ 2.98403582e-04  6.86934000e-05  4.29495230e-05]
   [ 4.09575558e-04 -4.51698754e-04  4.19436947e-05]
   ...
   [-9.55444353e-04  5.43228874e-04  1.13315729e-03]
   [-4.64068027e-04  4.53829765e-04  6.01236941e-04]
   [-8.01370596e-04  6.68600784e-04  2.78927822e-04]]

  [[ 1.68935439e-04  1.33932399e-05  1.74131943e-04]
   [ 1.84323857e-04  4.10580367e-04  3.57588753e-04]
   [ 2.85821239e-04 -1.35206705e-04  3.16827151e-04]
   ...
   [-7.73848209e-04  2.02491228e-03 -4.51121850e-05]
   [-4.27678955e-04  1.60137843e-03 -2.11666484e-04]
   [-6.78208133e-04  1.14948954e-03 -9.94570655e-05]]

  ...

  [[-4.19918069e-04 -1.32954505e-03  2.47726566e-03]
   [ 1.10020614e-04 -7.01685902e-04  2.04097223e-03]
   [ 4.61560732e-04 -1.73690103e-04  1.79996120e-03]
   ...
   [ 1.10731961e-03 -1.98406796e-03  3.62820574e-04]
   [ 9.58909630e-04 -1.13258348e-03  2.37658562e-04]
   [ 9.03887034e-04 -6.93049049e-04 -3.79532954e-04]]

  [[ 2.94119072e-05 -1.02064828e-03  2.08724616e-03]
   [ 4.25078993e-04 -1.15254743e-03  2.18772772e-03]
   [ 4.50835330e-04 -1.38088432e-03  1.82284403e-03]
   ...
   [ 1.06123753e-03 -1.31258322e-03  1.31079473e-03]
   [ 9.41374048e-04 -9.39883583e-04  5.85307193e-04]
   [ 6.50550472e-04 -7.27863458e-04 -2.13365493e-04]]

  [[ 3.37545469e-04 -1.10758666e-03  1.32661499e-03]
   [ 6.59163459e-04 -9.21792001e-04  1.55565923e-03]
   [ 5.12639701e-04 -6.35552977e-04  9.16730613e-04]
   ...
   [ 1.27078302e-03 -6.56231248e-04  1.26750499e-03]
   [ 8.59004795e-04 -8.31177284e-04  5.39227622e-04]
   [ 5.79519896e-04 -1.06042309e-03  1.16935298e-04]]]]


What I have tried:

I tried changing the code slightly to this:
Python
Xd = np.concatenate((image_batch, generated_images), axis=1)

this gave me the following error:
ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 3 and the array at index 1 has size 16384
Posted
Updated 15-Apr-21 8:59am
v2
Comments
Richard MacCutchan 16-Apr-21 5:47am    
The message is quite clear, you have unbalanced axes.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900