Skip to content

Commit

Permalink
autoformat
Browse files Browse the repository at this point in the history
  • Loading branch information
MiXaiLL76 committed Feb 7, 2024
1 parent 0157c5d commit 20f620b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
11 changes: 7 additions & 4 deletions examples/comparison/faster_coco_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,10 @@ def gt_to_coco_json(
description="Coco json file converted by mmeval CocoMetric.",
)
coco_json = dict(
info=info, images=image_infos, categories=categories, licenses=None,
info=info,
images=image_infos,
categories=categories,
licenses=None,
)
if len(annotations) > 0:
coco_json["annotations"] = annotations
Expand Down Expand Up @@ -360,9 +363,9 @@ def compute_metric(self, results: list) -> dict:
)
eval_results[f'{metric}_{nm["name"]}_precision'] = ap

table_results[
f"{metric}_classwise_result"
] = results_per_category
table_results[f"{metric}_classwise_result"] = (
results_per_category
)
if tmp_dir is not None:
tmp_dir.cleanup()
# if the testing results of the whole dataset is empty,
Expand Down
21 changes: 8 additions & 13 deletions faster_coco_eval/core/cocoeval.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,7 @@ def computeOks(self, imgId, catId):
dy = np.max((z, y0 - yd), axis=0) + np.max(
(z, yd - y1), axis=0
)
e = (
(dx ** 2 + dy ** 2)
/ vars
/ (gt["area"] + np.spacing(1))
/ 2
)
e = (dx**2 + dy**2) / vars / (gt["area"] + np.spacing(1)) / 2
if k1 > 0:
e = e[vg > 0]
ious[i, j] = np.sum(np.exp(-e)) / e.shape[0]
Expand Down Expand Up @@ -505,10 +500,10 @@ def setDetParams(self):
)
self.maxDets = [1, 10, 100]
self.areaRng = [
[0 ** 2, 1e5 ** 2],
[0 ** 2, 32 ** 2],
[32 ** 2, 96 ** 2],
[96 ** 2, 1e5 ** 2],
[0**2, 1e5**2],
[0**2, 32**2],
[32**2, 96**2],
[96**2, 1e5**2],
]
self.areaRngLbl = ["all", "small", "medium", "large"]
self.useCats = 1
Expand All @@ -525,9 +520,9 @@ def setKpParams(self):
)
self.maxDets = [20]
self.areaRng = [
[0 ** 2, 1e5 ** 2],
[32 ** 2, 96 ** 2],
[96 ** 2, 1e5 ** 2],
[0**2, 1e5**2],
[32**2, 96**2],
[96**2, 1e5**2],
]
self.areaRngLbl = ["all", "medium", "large"]
self.useCats = 1
Expand Down
22 changes: 12 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,18 @@ def get_extensions(version_info):
"faster_coco_eval.mask_api_cpp",
sources=sources,
include_dirs=include_dirs,
extra_compile_args=[]
if platform.system() == "Windows"
else [
"-Wno-cpp",
"-Wno-unused-function",
"-std=c99",
"-O3",
"-Wno-maybe-uninitialized",
"-Wno-misleading-indentation",
],
extra_compile_args=(
[]
if platform.system() == "Windows"
else [
"-Wno-cpp",
"-Wno-unused-function",
"-std=c99",
"-O3",
"-Wno-maybe-uninitialized",
"-Wno-misleading-indentation",
]
),
extra_link_args=[],
)
]
Expand Down

0 comments on commit 20f620b

Please sign in to comment.