MCPcopy
hub / github.com/PaddlePaddle/PaddleOCR / eval

Method eval

benchmark/PaddleOCR_DBNet/tools/eval.py:48–74  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

46 self.metric_cls = get_metric(config["metric"])
47
48 def eval(self):
49 self.model.eval()
50 raw_metrics = []
51 total_frame = 0.0
52 total_time = 0.0
53 for i, batch in tqdm(
54 enumerate(self.validate_loader),
55 total=len(self.validate_loader),
56 desc="test model",
57 ):
58 with paddle.no_grad():
59 start = time.time()
60 preds = self.model(batch["img"])
61 boxes, scores = self.post_process(
62 batch, preds, is_output_polygon=self.metric_cls.is_output_polygon
63 )
64 total_frame += batch["img"].shape[0]
65 total_time += time.time() - start
66 raw_metric = self.metric_cls.validate_measure(batch, (boxes, scores))
67 raw_metrics.append(raw_metric)
68 metrics = self.metric_cls.gather_measure(raw_metrics)
69 print("FPS:{}".format(total_frame / total_time))
70 return {
71 "recall": metrics["recall"].avg,
72 "precision": metrics["precision"].avg,
73 "fmeasure": metrics["fmeasure"].avg,
74 }
75
76
77def init_args():

Callers 15

generateMethod · 0.80
generate_exportMethod · 0.80
exportFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
__init__Method · 0.80
evalFunction · 0.80
mainFunction · 0.80
__init__Method · 0.80

Calls 4

validate_measureMethod · 0.80
gather_measureMethod · 0.80
formatMethod · 0.80
post_processMethod · 0.45

Tested by 6

test_unimernet_backboneFunction · 0.64
test_unimernet_headFunction · 0.64
test_ppformulanet_s_headFunction · 0.64
test_ppformulanet_l_headFunction · 0.64