I am using MaskR-CNN to do object segmentation in 2d-pictures. I use previously written code from someone else. My problem is, that I got problems with many false positives. Now I'd like to check the validation results after each epoch and check for false positives to optimize on that. Maybe not just on that but mixed with F1 score.
The code I use just calls the maskrcnn train method like that:
model.train(dataset_train, dataset_val,
learning_rate=config.LEARNING_RATE,
epochs=epochs,
layers='heads')
My Config looks like this:
class MaskConfig(Config):
NAME = "myName"
IMAGES_PER_GPU = 1
NUM_CLASSES = len(current_labels) + 1
STEPS_PER_EPOCH = 100
IMAGE_RESIZE_MODE = "square"
IMAGE_MIN_DIM = 480
IMAGE_MAX_DIM = 640
DETECTION_MIN_CONFIDENCE = 0.8
BACKBONE = "resnet101"
LEARNING_RATE = learnrate
LOSS_WEIGHTS = {
"rpn_class_loss": 1.,
"rpn_bbox_loss": 10.,
"mrcnn_class_loss": 1.,
"mrcnn_bbox_loss": 10.,
"mrcnn_mask_loss": 10.
}
config = MaskConfig()
I don't know where I can interfere with what is done after every epoch. I checked the 'train'-Method of the maskrcnn but couldn't really figure out how to do that. Is there any example somewhere on how to be able to manipulate on how the model is optimized and how to do early stopping?
Thank you so much for your help.