The output of your model seems to have the shape [-1, 8, 632, 344] based on your model summary.
However, neither the printed target shape not the error message fit this shape, so I’m unsure how the model is supposed to be used.
The script assumes that the model output and target shape match, while the currently posted shapes don’t really match.
Also, your target seems to use 3 channels in a channels-last format.
What does dim3 represent?