S Four channels

This page is a supplementary material for those who are interested in exploring more.

Did you wonder, whether it is possible to train a model with all four channels? Well, it is possible! However, we need to make some adaptations to our codes. We will only give you the hints here, since most of the codes stay the same.

  1. It is recommended to change your rootDir, so that you do not overwrite the files with three channels.
  2. There is, of course, no need anymore to subset to three channels.
  3. The mask files stay the same, since the extent is not changed.
  4. In our function spectral_augmentation(), the function tf$image$random_saturation() only accepts three channels. This can be seen in the Python TensorFlow reference. For simplicity, let us just remove random_saturation from our function.
  5. In our function get_unet_128(), change the input_shape to c(128, 128, 4).

That is it! Happy coding :)

If this raised your interest, you may also have a look into this thesis on GitHub, which also started from modifying codes in this course and is able to train images with any number of channels.

Comments?

You can leave comments under this Issue if you have questions or remarks about any of the code chunks that are not included as gist. Please copy the corresponding line into your comment to make it easier to answer the question.

Updated: