Skip to content

Commit

Permalink
manual
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda committed Oct 11, 2024
1 parent 248c470 commit 20523d7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
10 changes: 5 additions & 5 deletions faster_coco_eval/core/cocoeval.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,13 @@ def computeOks(self, imgId: int, catId: int) -> np.ndarray:
return ious

def evaluateImg(self, imgId, catId, aRng, maxDet):
raise DeprecationWarning("COCOeval.evaluateImg deprecated! Use COCOeval_faster.evaluateImg" " instead.")
raise DeprecationWarning("COCOeval.evaluateImg deprecated! Use COCOeval_faster.evaluateImg instead.")

def accumulate(self, p=None):
raise DeprecationWarning("COCOeval.accumulate deprecated! Use COCOeval_faster.accumulate" " instead.")
raise DeprecationWarning("COCOeval.accumulate deprecated! Use COCOeval_faster.accumulate instead.")

def evaluate(self):
raise DeprecationWarning("COCOeval.evaluate deprecated! Use COCOeval_faster.evaluate" " instead.")
raise DeprecationWarning("COCOeval.evaluate deprecated! Use COCOeval_faster.evaluate instead.")

def _summarize(
self,
Expand All @@ -353,7 +353,7 @@ def _summarize(
catIds=None,
):
p = self.params
iStr = " {:<18} {} @[ IoU={:<9} | area={:>6s} | maxDets={:>3d} {}] =" " {:0.3f}"
iStr = " {:<18} {} @[ IoU={:<9} | area={:>6s} | maxDets={:>3d} {}] = {:0.3f}"

freq_str = "catIds={:>3s}".format("all") if self.lvis_style else ""

Expand Down Expand Up @@ -492,7 +492,7 @@ def _summarizeKps():
elif iouType == "keypoints":
summarize = _summarizeKps
else:
ValueError("iouType must be bbox, segm, boundary or keypoints. Get" f" {iouType}")
ValueError(f"iouType must be bbox, segm, boundary or keypoints. Get {iouType}")

self.all_stats = summarize()
self.stats = self.all_stats[:12]
Expand Down
2 changes: 1 addition & 1 deletion faster_coco_eval/core/faster_eval_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def evaluate(self):
elif p.iouType == "keypoints":
computeIoU = self.computeOks
else:
raise ValueError("p.iouType must be segm, bbox, boundary or keypoints. Get" f" {p.iouType}")
raise ValueError(f"p.iouType must be segm, bbox, boundary or keypoints. Get {p.iouType}")

self.ious = {
(imgId, catId): computeIoU(imgId, catId) for (imgId, catId) in itertools.product(p.imgIds, catIds)
Expand Down
2 changes: 1 addition & 1 deletion faster_coco_eval/core/mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def rleToBoundary(
return _mask.toBoundary([rle], dilation_ratio)[0]
else:
if not opencv_available:
raise ImportError("OpenCV is not available. Please install OpenCV to use this" " function.")
raise ImportError("OpenCV is not available. Please install OpenCV to use this function.")
return rleToBoundaryCV(rle, dilation_ratio)


Expand Down
4 changes: 1 addition & 3 deletions faster_coco_eval/extra/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ def compute_confusion_matrix(self):
assert self.eval is not None, "Run first self.evaluate()"

if self.useCats:
logger.warning(
"The calculation may not be accurate. No intersection of" f" classes. useCats={self.useCats}"
)
logger.warning(f"The calculation may not be accurate. No intersection of classes. useCats={self.useCats}")

y_true = []
y_pred = []
Expand Down
2 changes: 1 addition & 1 deletion faster_coco_eval/extra/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def convert_ann_rle_to_poly(ann: dict):
"""
if type(ann["segmentation"]) is dict:
if not opencv_available:
raise Exception("Your dataset needs to be converted to polygons. Install" " **opencv-python** for this.")
raise Exception("Your dataset needs to be converted to polygons. Install **opencv-python** for this.")

ann["counts"] = ann["segmentation"]
ann["segmentation"] = convert_rle_to_poly(ann["segmentation"], ann["bbox"])
Expand Down

0 comments on commit 20523d7

Please sign in to comment.