ValueError: Shapes (None, 775, 770, 1) and (None, 776, 776, 8) are incompatible

I trying to replicate the semantic segmentation example

but train on my own data. There are 8 labels (7 features + background). My images are 775 by 770 pixels.

I changed num_classes to 8, img_size to (775,770) (and changed the input and target directories), otherwise I run the example code exactly. When I fit the model, I get the following error:

ValueError Traceback (most recent call last)
Cell In[32], line 14
12 # Train the model, doing validation at the end of each epoch.
13 epochs = 50
—> 14 model.fit(
15 train_dataset,
16 epochs=epochs,
17 validation_data=valid_dataset,
18 callbacks=callbacks,
19 verbose=2,
20 )
ValueError: in user code: [traceback]
ValueError: Shapes (None, 775, 770, 1) and (None, 784, 784, 8) are incompatible

The model’s final output shape is (None, 784, 784, 8).

Where am I going wrong? What else do I need to change in the model to match the size of my inputs and the number of classes?