The test for whether a tile is background is whether it matches the zero/background class:
class_match(ml_type, tile_results[k], 0)
For classification and object detection this works fine; however for segmentation it will return true for every tile that isn't completely non-background