Open foralliance opened 6 years ago
@YuwenXiong @Oh233
Can you simply explain the content of the snapshot section
def snapshot(self): """Take a snapshot of the network after unnormalizing the learned bounding-box regression weights. This enables easy use at test-time. """ net = self.solver.net scale_bbox_params_faster_rcnn = (cfg.TRAIN.BBOX_REG and cfg.TRAIN.BBOX_NORMALIZE_TARGETS and net.params.has_key('bbox_pred')) scale_bbox_params_rfcn = (cfg.TRAIN.BBOX_REG and cfg.TRAIN.BBOX_NORMALIZE_TARGETS and net.params.has_key('rfcn_bbox')) scale_bbox_params_rpn = (cfg.TRAIN.RPN_NORMALIZE_TARGETS and net.params.has_key('rpn_bbox_pred')) if scale_bbox_params_faster_rcnn: # save original values orig_0 = net.params['bbox_pred'][0].data.copy() orig_1 = net.params['bbox_pred'][1].data.copy() # scale and shift with bbox reg unnormalization; then save snapshot net.params['bbox_pred'][0].data[...] = \ (net.params['bbox_pred'][0].data * self.bbox_stds[:, np.newaxis]) net.params['bbox_pred'][1].data[...] = \ (net.params['bbox_pred'][1].data * self.bbox_stds + self.bbox_means) if scale_bbox_params_rpn: rpn_orig_0 = net.params['rpn_bbox_pred'][0].data.copy() rpn_orig_1 = net.params['rpn_bbox_pred'][1].data.copy() num_anchor = rpn_orig_0.shape[0] / 4 # scale and shift with bbox reg unnormalization; then save snapshot self.rpn_means = np.tile(np.asarray(cfg.TRAIN.RPN_NORMALIZE_MEANS), num_anchor) self.rpn_stds = np.tile(np.asarray(cfg.TRAIN.RPN_NORMALIZE_STDS), num_anchor) net.params['rpn_bbox_pred'][0].data[...] = \ (net.params['rpn_bbox_pred'][0].data * self.rpn_stds[:, np.newaxis, np.newaxis, np.newaxis]) net.params['rpn_bbox_pred'][1].data[...] = \ (net.params['rpn_bbox_pred'][1].data * self.rpn_stds + self.rpn_means) ..................
many many thanks !!
@YuwenXiong @Oh233
Can you simply explain the content of the snapshot section
many many thanks !!