def _gen_input_batch(img_input, box_size, scales): # any input image --> sqrared input image acceptable for the model img_square = utils.img_scale_squareify(img_input, box_size) # generate multi-scale input batch input_batch = [] for scale in scales: img = utils.img_scale_padding(img_square, scale) if scale < 1 else img_square input_batch.append(img) # input image range: [0, 255) --> [-0.4, 0.6) input_batch = np.asarray(input_batch, dtype=np.float32) / 255 - 0.4 return input_batch
def _create_input_batch(self): """ create multi-scale input batch input image range: [0, 255) --> [-0.4, 0.6) """ self.input_batch = [] for scale in self.scales: img = utils.img_scale_padding( self.frame_square, scale) if scale < 1 else self.frame_square self.input_batch.append(img) self.input_batch = np.asarray(self.input_batch, dtype=np.float32) / 255 - 0.4