<p dir="auto">Seems to be caused at the model merge stage:</p>
<p dir="auto"><a href="https://github.com/keras-team/keras/blob/45c838cc7a0a5830c0a54a2f58f48fc61950eb68/keras/utils/training_utils.py#L172_L177">https://github.com/keras-team/keras/blob/45c838cc7a0a5830c0a54a2f58f48fc61950eb68/keras/utils/training_utils.py#L172_L177</a></p>
<p dir="auto">Reproduction of the issue here along with possible change that would suffix the model names running on the GPUs uniquely by index:<br>
<a href="https://gist.github.com/BAXTER001/5b2bb9e65b587f893298f09102436ca1">https://gist.github.com/BAXTER001/5b2bb9e65b587f893298f09102436ca1</a><br>
<a class="commit-link" href="https://github.com/keras-team/keras/compare/master...BAXTER001:patch-1"><tt>master...BAXTER001:patch-1</tt></a></p>
<p dir="auto">Hi,</p>
<p dir="auto">I am using Keras to segment images to road and background pixels. As you can imagine percentage of road pixels are much lower than that of background pixels. Hence, I want to use class_weight= {0:0.05, 1:0.95} while fitting the model so that cnn won't predict every pixel as background. But, when I do this I got the following error:</p>
<p dir="auto">File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 597, in fit<br>
sample_weight=sample_weight)<br>
File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 1035, in fit<br>
batch_size=batch_size)<br>
File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 973, in _standardize_user_data<br>
in zip(y, sample_weights, class_weights, self.sample_weight_modes)]<br>
File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 387, in standardize_weights<br>
raise Exception('class_weight not supported for '<br>
Exception: class_weight not supported for 3+ dimensional targets.</p>
<p dir="auto">My  training labels are in this form: (number_of_training_samples=10000, number_of_pixels_in_patch=16384, number_of_classes=2). How can I weight the classes in Keras?</p>
<p dir="auto">Thanks in advance.</p>