Exemple #1
0
    def log_rpn(self,step=None, scope_name=''):

        top_image = self.top_image
        subdir = self.log_subdir
        top_inds = self.batch_top_inds
        top_labels = self.batch_top_labels
        top_pos_inds = self.batch_top_pos_inds
        top_targets = self.batch_top_targets
        proposals = self.batch_proposals
        proposal_scores = self.batch_proposal_scores
        gt_top_boxes = self.batch_gt_top_boxes
        gt_labels = self.batch_gt_labels

        if gt_top_boxes is not None:
            img_gt = draw_rpn_gt(top_image, gt_top_boxes, gt_labels)
            # nud.imsave('img_rpn_gt', img_gt, subdir)
            self.summary_image(img_gt, scope_name + '/img_rpn_gt', step=step)

        if top_inds is not None:
            img_label = draw_rpn_labels(top_image, self.top_view_anchors, top_inds, top_labels)
            # nud.imsave('img_rpn_label', img_label, subdir)
            self.summary_image(img_label, scope_name+ '/img_rpn_label', step=step)

        if top_pos_inds is not None:
            img_target = draw_rpn_targets(top_image, self.top_view_anchors, top_pos_inds, top_targets)
            # nud.imsave('img_rpn_target', img_target, subdir)
            self.summary_image(img_target, scope_name+ '/img_rpn_target', step=step)

        if proposals is not None:
            rpn_proposal = draw_rpn_proposal(top_image, proposals, proposal_scores, draw_num=20)
            # nud.imsave('img_rpn_proposal', rpn_proposal, subdir)
            self.summary_image(rpn_proposal, scope_name + '/img_rpn_proposal',step=step)
Exemple #2
0
    def log_rpn(self,step=None, scope_name=''):

        top_image = self.top_image
        subdir = self.log_subdir
        top_inds = self.batch_top_inds
        top_labels = self.batch_top_labels
        top_pos_inds = self.batch_top_pos_inds
        top_targets = self.batch_top_targets
        proposals = self.batch_proposals
        proposal_scores = self.batch_proposal_scores
        gt_top_boxes = self.batch_gt_top_boxes
        gt_labels = self.batch_gt_labels

        if gt_top_boxes is not None:
            img_gt = draw_rpn_gt(top_image, gt_top_boxes, gt_labels)
            # nud.imsave('img_rpn_gt', img_gt, subdir)
            self.summary_image(img_gt, scope_name + '/img_rpn_gt', step=step)

        if top_inds is not None:
            img_label = draw_rpn_labels(top_image, self.top_view_anchors, top_inds, top_labels)
            # nud.imsave('img_rpn_label', img_label, subdir)
            self.summary_image(img_label, scope_name+ '/img_rpn_label', step=step)

        if top_pos_inds is not None:
            img_target = draw_rpn_targets(top_image, self.top_view_anchors, top_pos_inds, top_targets)
            # nud.imsave('img_rpn_target', img_target, subdir)
            self.summary_image(img_target, scope_name+ '/img_rpn_target', step=step)

        if proposals is not None:
            rpn_proposal = draw_rpn_proposal(top_image, proposals, proposal_scores, draw_num=20)
            # nud.imsave('img_rpn_proposal', rpn_proposal, subdir)
            self.summary_image(rpn_proposal, scope_name + '/img_rpn_proposal',step=step)
Exemple #3
0
    def log_rpn(self,
                step=None,
                scope_name='',
                loss=None,
                tensor_board=True,
                draw_rpn_target=False):

        top_image = self.top_image
        subdir = self.log_subdir
        top_inds = self.batch_top_inds
        top_labels = self.batch_top_labels
        top_pos_inds = self.batch_top_pos_inds
        top_targets = self.batch_top_targets
        proposals = self.batch_proposals
        proposal_scores = self.batch_proposal_scores
        gt_top_boxes = self.batch_gt_top_boxes
        gt_labels = self.batch_gt_labels

        total_img = None
        if gt_top_boxes is not None:
            total_img = draw_rpn_gt(top_image, gt_top_boxes, gt_labels)
        # nud.imsave('img_rpn_gt', img_gt, subdir)

        if draw_rpn_target:
            img_label = draw_rpn_labels(top_image, self.top_view_anchors,
                                        top_inds, top_labels)
            # nud.imsave('img_rpn_label', img_label, subdir)
            total_img = np.concatenate(
                (total_img,
                 img_label), 1) if total_img is not None else img_label
            img_target = draw_rpn_targets(top_image, self.top_view_anchors,
                                          top_pos_inds, top_targets)
            # nud.imsave('img_rpn_target', img_target, subdir)
            total_img = np.concatenate((total_img, img_target), 1)

        if proposals is not None:
            rpn_proposal = draw_rpn_proposal(top_image, proposals,
                                             proposal_scores)
            if loss != None:
                text = 'loss c: %6f r: %6f' % loss
                font = cv2.FONT_HERSHEY_SIMPLEX
                text_pos = (0, 25)
                cv2.putText(rpn_proposal, text, text_pos, font, 0.5,
                            (5, 255, 100), 0, cv2.LINE_AA)
            if total_img is not None:
                total_img = np.concatenate((total_img, rpn_proposal), 1)
            else:
                total_img = rpn_proposal
            # print('\nproposal_scores= {}\n'.format(proposal_scores))
            # nud.imsave('img_rpn_proposal', rpn_proposal, subdir)
            if tensor_board:
                self.summary_image(total_img,
                                   scope_name + '/top_view',
                                   step=step)
        return total_img
Exemple #4
0
    def log_rpn(self, step=None, scope_name='', loss=None, tensor_board=True, draw_rpn_target=False):

        top_image = self.top_image
        subdir = self.log_subdir
        top_inds = self.batch_top_inds
        top_labels = self.batch_top_labels
        top_pos_inds = self.batch_top_pos_inds
        top_targets = self.batch_top_targets
        proposals = self.batch_proposals
        proposal_scores = self.batch_proposal_scores
        gt_top_boxes = self.batch_gt_top_boxes
        gt_labels = self.batch_gt_labels
        
        total_img = None
        if gt_top_boxes is not None:
            total_img = draw_rpn_gt(top_image, gt_top_boxes, gt_labels)
        # nud.imsave('img_rpn_gt', img_gt, subdir)

        if draw_rpn_target:
            img_label = draw_rpn_labels(top_image, self.top_view_anchors, top_inds, top_labels)
            # nud.imsave('img_rpn_label', img_label, subdir)
            total_img = np.concatenate((total_img, img_label), 1) if total_img is not None else img_label
            img_target = draw_rpn_targets(top_image, self.top_view_anchors, top_pos_inds, top_targets)
            # nud.imsave('img_rpn_target', img_target, subdir)
            total_img = np.concatenate((total_img, img_target), 1)

        if proposals is not None:
            rpn_proposal = draw_rpn_proposal(top_image, proposals, proposal_scores)
            if loss != None:
                text = 'loss c: %6f r: %6f' % loss
                font = cv2.FONT_HERSHEY_SIMPLEX
                text_pos = (0, 25)
                cv2.putText(rpn_proposal, text, text_pos, font, 0.5, (5, 255, 100), 0, cv2.LINE_AA)
            if total_img is not None:
                total_img = np.concatenate((total_img, rpn_proposal), 1)
            else:
                total_img = rpn_proposal
            # print('\nproposal_scores= {}\n'.format(proposal_scores))
            # nud.imsave('img_rpn_proposal', rpn_proposal, subdir)
            if tensor_board: self.summary_image(total_img, scope_name + '/top_view', step=step)
        return total_img