97d778705b9f3da5fff5e5d55dbc6cdaf7bddf6e,chainer_/metrics/hpe_metrics.py,CocoHpeOksApMetric,get,#CocoHpeOksApMetric#,41
Before Change
pred.createIndex()
return pred
gt = self.coco
pred = calc_pred(self.coco, self._results)
from pycocotools.cocoeval import COCOeval
coco_eval = COCOeval(gt, pred, "keypoints")
coco_eval.params.useSegm = None
After Change
import copy
from pycocotools.coco import COCO
gt = COCO(self.coco_annotations_file_path)
if self.use_file:
import tempfile
import json
with tempfile.NamedTemporaryFile(mode="w", suffix=".json") as f:
json.dump(self.coco_result, f)
f.flush()
pred = gt.loadRes(f.name)
else:
def calc_pred(coco, anns):
import numpy as np
import copy
pred = COCO()
pred.dataset["images"] = [img for img in coco.dataset["images"]]
annsImgIds = [ann["image_id"] for ann in anns]
assert set(annsImgIds) == (set(annsImgIds) & set(coco.getImgIds()))
pred.dataset["categories"] = copy.deepcopy(coco.dataset["categories"])
for id, ann in enumerate(anns):
s = ann["keypoints"]
x = s[0::3]
y = s[1::3]
x0, x1, y0, y1 = np.min(x), np.max(x), np.min(y), np.max(y)
ann["area"] = (x1 - x0) * (y1 - y0)
ann["id"] = id + 1
ann["bbox"] = [x0, y0, x1 - x0, y1 - y0]
pred.dataset["annotations"] = anns
pred.createIndex()
return pred
pred = calc_pred(gt, copy.deepcopy(self.coco_result))
from pycocotools.cocoeval import COCOeval
coco_eval = COCOeval(gt, pred, "keypoints")
if self.validation_ids is not None:
coco_eval.params.imgIds = self.validation_ids
coco_eval.params.useSegm = None
coco_eval.evaluate()
coco_eval.accumulate()
coco_eval.summarize()
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 31
Instances
Project Name: osmr/imgclsmob
Commit Name: 97d778705b9f3da5fff5e5d55dbc6cdaf7bddf6e
Time: 2020-03-11
Author: osemery@gmail.com
File Name: chainer_/metrics/hpe_metrics.py
Class Name: CocoHpeOksApMetric
Method Name: get
Project Name: osmr/imgclsmob
Commit Name: 97d778705b9f3da5fff5e5d55dbc6cdaf7bddf6e
Time: 2020-03-11
Author: osemery@gmail.com
File Name: chainer_/metrics/hpe_metrics.py
Class Name: CocoHpeOksApMetric
Method Name: get
Project Name: osmr/imgclsmob
Commit Name: 97d778705b9f3da5fff5e5d55dbc6cdaf7bddf6e
Time: 2020-03-11
Author: osemery@gmail.com
File Name: gluon/metrics/hpe_metrics.py
Class Name: CocoHpeOksApMetric
Method Name: get
Project Name: osmr/imgclsmob
Commit Name: 97d778705b9f3da5fff5e5d55dbc6cdaf7bddf6e
Time: 2020-03-11
Author: osemery@gmail.com
File Name: tensorflow2/metrics/hpe_metrics.py
Class Name: CocoHpeOksApMetric
Method Name: get