def evaluate(self, test=True): """ Evaluate network on the validation set. """ if test is True: key = 'TEST' data_directory = flags['data_directory'] + 'Test/' else: # valid key = 'VALID' data_directory = flags['data_directory'] + 'Valid/' print('Detecting images in %s set' % key) data_info = (self.num_images[key], flags['num_classes'], flags['classes']) tf_inputs = (self.x['EVAL'], self.im_dims['EVAL']) tf_outputs = (self.roi_proposal_net['EVAL'].get_rois(), self.fast_rcnn_net['EVAL'].get_cls_prob(), self.fast_rcnn_net['EVAL'].get_bbox_refinement()) class_metrics = test_net(self.sess, data_directory, data_info, tf_inputs, tf_outputs, vis=self.flags['vis']) self.record_eval_metrics(class_metrics, key)
def test(self): """ Evaluate network on the test set. """ data_info = (self.num_images['TEST'], flags['num_classes'], flags['classes']) tf_inputs = (self.x['TEST'], self.im_dims['TEST']) tf_outputs = (self.roi_proposal_net['TEST'].get_rois(), self.fast_rcnn_net['TEST'].get_cls_prob(), self.fast_rcnn_net['TEST'].get_bbox_refinement()) class_metrics = test_net(self.sess, flags['data_directory'], data_info, tf_inputs, tf_outputs) print(class_metrics)
def evaluate(self, test=True): """ Evaluate network on the validation set. """ key = 'TEST' if test is True else 'VALID' print('Detecting images in %s set' % key) tf_inputs = (self.x['EVAL'], self.im_dims['EVAL']) tf_outputs = (self.roi_proposal_net['EVAL'].get_rois(), self.fast_rcnn_net['EVAL'].get_cls_prob(), self.fast_rcnn_net['EVAL'].get_bbox_refinement()) class_metrics = test_net(flags['data_directory'], self.names[key], self.sess, tf_inputs, tf_outputs, key=key, thresh=0.5, vis=self.flags['vis']) self.record_eval_metrics(class_metrics, key)
def evaluate(self, sess, img, raw_output_up, preds_summary, test=True): """ Evaluate network on the validation set. """ key = 'TEST' if test is True else 'VALID' tf_inputs = (img) tf_outputs = (self.roi_proposal_net['EVAL'].get_rois(), self.fast_rcnn_net['EVAL'].get_bbox_refinement(), raw_output_up, preds_summary) class_metrics = test_net(self.flags['data_directory'], self.names, sess, tf_inputs, tf_outputs, key=key, thresh=0.5, vis=True)