I am new to using detectron2, just learning it.This might be a noob question, but I really need the answer. I find nothing related to number of epochs in the repository.
We know , epoch means single passing of all data through the model, and a batch means a certain subset of the whole dataset, that has the ability to impact the loss through gradient descent. In this model, (Detectron2) we have something called iteration. What does this iteration mean? Does it mean passing of one batch through the mode, or an epoch(that shouldn't be the case considering time per iteration)
My question is , how do I know the minimum number of iterations that will pass all my images to the model, at least once.
In detectron2, epoch
is MAX_ITER * BATCH_SIZE / TOTAL_NUM_IMAGES
I don't think the currently accepted answer is correct
single_iteration = cfg.SOLVER.NUM_GPUS * cfg.SOLVER.IMS_PER_BATCH
therefore, if you want to now how many iterations you need for an epoch (all images seen once), that number would be
iterations_for_one_epoch = TOTAL_NUM_IMAGES / single_iteration
So if you want to train for 20 epochs, you would set MAX_ITER as follows:
cfg.SOLVER.MAX_ITER = iterations_for_one_epoch * 20
Sources:
Detectron2 Docs (one iteration is one run_step-call, and that pulls one "datapoint" from the loader data = next(self._data_loader_iter))
MaskRCNN-benchmark Github issue explains it in a similar way
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With