Exemple #1
0
def predict(pred_func, input_file):
    img = cv2.imread(input_file, cv2.IMREAD_COLOR)
    results = detect_one_image(img, pred_func)
    final = draw_final_outputs(
        img, results)  # image contain boxes,labels and scores
    viz = np.concatenate((img, final), axis=1)
    tpviz.interactive_imshow(viz)
Exemple #2
0
 def _build_coco_predictor(self, idx):
     graph_func = self.trainer.get_predictor(self._in_names,
                                             self._out_names,
                                             device=idx)
     return lambda img: detect_one_image(img, graph_func)
Exemple #3
0
    def detect(self, img, rgb=True):
        # Convert to bgr if necessary
        if rgb:
            img = self.rgb_to_bgr(img)

        return detect_one_image(img, self.pred)
Exemple #4
0
def offline_evaluate(pred_func, output_file):
    df = get_eval_dataflow()
    all_results = eval_coco(df, lambda img: detect_one_image(img, pred_func))
    with open(output_file, 'w') as f:
        json.dump(all_results, f)
    print_evaluation_scores(output_file)