Tensorflow 2 Object Detection API: Can't set batchsize to 1

662 Views Asked by At

If I Change the batchsize to 1 with faster RCNN 640x640 and ResNet 50 as Backbone,

I get the following Error:

The 'global_batch_size' 1 is not divisible by 'num_replicas_in_sync' 4
How can I set the batchsize to 1?
1

There are 1 best solutions below

0
On

As you may imagine, the problem in your case is that you are actually trying to use 4 video cards/devices (num_replicas_in_sync), but your batch_size is 1. Needless to say, you cannot train with 1 batch size to with on 4 devices.

There are two solutions:

  1. Either change num_replicas_in_sync to 1.
  2. Either increase the global_batch_size to a value which is divisible by 4 (4,8,12 etc.)