Hi, a simple alternative would be to preprocess your groundtruth before training,
you can discard the invalid samples in your groundtruth.
several things to notice:
1 xmax, ymax > xmin ymin
2 xmax ymax and xmin ymin are always inside your image.