Skip to content

Commit

Permalink
Use shorter name
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiltsov-max committed Nov 1, 2024
1 parent 303375c commit ccd3f8c
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 43 deletions.
14 changes: 7 additions & 7 deletions cvat-core/src/quality-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default class QualitySettings {
#task: number;
#iouThreshold: number;
#oksSigma: number;
#useImageSpaceForPointGroupComparisons: boolean;
#useBboxSizeForPoints: boolean;
#lineThickness: number;
#lowOverlapThreshold: number;
#orientedLines: boolean;
Expand All @@ -43,7 +43,7 @@ export default class QualitySettings {
this.#maxValidationsPerJob = initialData.max_validations_per_job;
this.#iouThreshold = initialData.iou_threshold;
this.#oksSigma = initialData.oks_sigma;
this.#useImageSpaceForPointGroupComparisons = initialData.use_image_space_for_point_group_comparisons;
this.#useBboxSizeForPoints = initialData.use_bbox_size_for_points;
this.#lineThickness = initialData.line_thickness;
this.#lowOverlapThreshold = initialData.low_overlap_threshold;
this.#orientedLines = initialData.compare_line_orientation;
Expand Down Expand Up @@ -81,12 +81,12 @@ export default class QualitySettings {
this.#oksSigma = newVal;
}

get useImageSpaceForPointGroupComparisons(): boolean {
return this.#useImageSpaceForPointGroupComparisons;
get useBboxSizeForPoints(): boolean {
return this.#useBboxSizeForPoints;
}

set useImageSpaceForPointGroupComparisons(newVal: boolean) {
this.#useImageSpaceForPointGroupComparisons = newVal;
set useBboxSizeForPoints(newVal: boolean) {
this.#useBboxSizeForPoints = newVal;
}

get lineThickness(): number {
Expand Down Expand Up @@ -207,7 +207,7 @@ export default class QualitySettings {
const result: SerializedQualitySettingsData = {
iou_threshold: this.#iouThreshold,
oks_sigma: this.#oksSigma,
use_image_space_for_point_group_comparisons: this.#useImageSpaceForPointGroupComparisons,
use_bbox_size_for_points: this.#useBboxSizeForPoints,
line_thickness: this.#lineThickness,
low_overlap_threshold: this.#lowOverlapThreshold,
compare_line_orientation: this.#orientedLines,
Expand Down
2 changes: 1 addition & 1 deletion cvat-core/src/server-response-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export interface SerializedQualitySettingsData {
max_validations_per_job?: number;
iou_threshold?: number;
oks_sigma?: number;
use_image_space_for_point_group_comparisons?: boolean;
use_bbox_size_for_points?: boolean;
line_thickness?: number;
low_overlap_threshold?: number;
compare_line_orientation?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ function QualityControlPage(): JSX.Element {
settings.compareAttributes = values.compareAttributes;

settings.oksSigma = values.oksSigma / 100;
settings.useImageSpaceForPointGroupComparisons = values.useImageSpaceForPointGroupComparisons;
settings.useBboxSizeForPoints = values.useBboxSizeForPoints;

settings.lineThickness = values.lineThickness / 100;
settings.lineOrientationThreshold = values.lineOrientationThreshold / 100;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function QualitySettingsForm(props: Readonly<Props>): JSX.Element
compareAttributes: settings.compareAttributes,

oksSigma: settings.oksSigma * 100,
useImageSpaceForPointGroupComparisons: settings.useImageSpaceForPointGroupComparisons,
useBboxSizeForPoints: settings.useBboxSizeForPoints,

lineThickness: settings.lineThickness * 100,
lineOrientationThreshold: settings.lineOrientationThreshold * 100,
Expand Down Expand Up @@ -91,7 +91,7 @@ export default function QualitySettingsForm(props: Readonly<Props>): JSX.Element
);

const pointTooltip = makeTooltip(
makeTooltipFragment('Use image space', settings.descriptions.useImageSpaceForPointGroupComparisons),
makeTooltipFragment('Use image space', settings.descriptions.useBboxSizeForPoints),
);

const linesTooltip = makeTooltip(
Expand Down Expand Up @@ -267,12 +267,12 @@ export default function QualitySettingsForm(props: Readonly<Props>): JSX.Element
<Row>
<Col span={12}>
<Form.Item
name='useImageSpaceForPointGroupComparisons'
name='useBboxSizeForPoints'
valuePropName='checked'
rules={[{ required: true }]}
>
<Checkbox>
<Text className='cvat-text-color'>Use image space</Text>
<Text className='cvat-text-color'>Use bbox size</Text>
</Checkbox>
</Form.Item>
</Col>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.15 on 2024-11-01 11:59
# Generated by Django 4.2.15 on 2024-11-01 15:40

from django.db import migrations, models

Expand All @@ -12,7 +12,8 @@ class Migration(migrations.Migration):
operations = [
migrations.AddField(
model_name="qualitysettings",
name="use_image_space_for_point_group_comparisons",
field=models.BooleanField(default=False),
name="use_bbox_size_for_points",
field=models.BooleanField(default=True),
preserve_default=False,
),
]
2 changes: 1 addition & 1 deletion cvat/apps/quality_control/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class QualitySettings(models.Model):

low_overlap_threshold = models.FloatField()

use_image_space_for_point_group_comparisons = models.BooleanField(default=False)
use_bbox_size_for_points = models.BooleanField()

compare_line_orientation = models.BooleanField()
line_orientation_threshold = models.FloatField()
Expand Down
18 changes: 7 additions & 11 deletions cvat/apps/quality_control/quality_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ class ComparisonParameters(_Serializable):
oks_sigma: float = 0.09
"Like IoU threshold, but for points, % of the bbox area to match a pair of points"

use_image_space_for_point_group_comparisons: bool = False
"Compare points in the image space, instead of using the point group bbox"
use_bbox_size_for_points: bool = True
"Compare point groups using the group bbox size instead of the image size"

line_thickness: float = 0.01
"Thickness of polylines, relatively to the (image area) ^ 0.5"
Expand Down Expand Up @@ -958,7 +958,7 @@ def __init__(
# https://cocodataset.org/#keypoints-eval
# https://github.com/cocodataset/cocoapi/blob/8c9bcc3cf640524c4c20a9c40e89cb6a2f2fa0e9/PythonAPI/pycocotools/cocoeval.py#L523
oks_sigma: float = 0.09,
use_image_space_for_point_group_comparisons: bool = False,
use_bbox_size_for_points: bool = True,
compare_line_orientation: bool = False,
line_torso_radius: float = 0.01,
panoptic_comparison: bool = False,
Expand All @@ -972,10 +972,8 @@ def __init__(
self.oks_sigma = oks_sigma
"% of the shape area"

self.use_image_space_for_point_group_comparisons = (
use_image_space_for_point_group_comparisons
)
"Do not infer bbox for point group comparison, use the image space"
self.use_bbox_size_for_points = use_bbox_size_for_points
"Compare point groups using the group bbox size instead of the image size"

self.compare_line_orientation = compare_line_orientation
"Whether lines are oriented or not"
Expand Down Expand Up @@ -1303,7 +1301,7 @@ def _distance(a: dm.Points, b: dm.Points) -> float:
# Complex case: multiple points, grouped points, points with a bbox
# Try to align points and then return the metric

if self.use_image_space_for_point_group_comparisons:
if not self.use_bbox_size_for_points:
scale = img_h * img_w
else:
# match points in their bbox space
Expand Down Expand Up @@ -1539,9 +1537,7 @@ def __init__(self, categories: dm.CategoriesInfo, *, settings: ComparisonParamet
panoptic_comparison=settings.panoptic_comparison,
iou_threshold=settings.iou_threshold,
oks_sigma=settings.oks_sigma,
use_image_space_for_point_group_comparisons=(
settings.use_image_space_for_point_group_comparisons
),
use_bbox_size_for_points=settings.use_bbox_size_for_points,
line_torso_radius=settings.line_thickness,
compare_line_orientation=False, # should not be taken from outside, handled differently
)
Expand Down
13 changes: 6 additions & 7 deletions cvat/apps/quality_control/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Meta:
"max_validations_per_job",
"iou_threshold",
"oks_sigma",
"use_image_space_for_point_group_comparisons",
"use_bbox_size_for_points",
"line_thickness",
"low_overlap_threshold",
"compare_line_orientation",
Expand All @@ -99,9 +99,6 @@ class Meta:
)

extra_kwargs = {k: {"required": False} for k in fields}
extra_kwargs.setdefault("use_image_space_for_point_group_comparisons", {}).setdefault(
"default", False
)

for field_name, help_text in {
"target_metric": "The primary metric used for quality estimation",
Expand All @@ -123,9 +120,11 @@ class Meta:
where the checked point is expected to be.
Read more: https://cocodataset.org/#keypoints-eval
""",
"use_image_space_for_point_group_comparisons": """
Compare point groups in the image space, instead of using the point group bbox.
Useful if point groups may not represent a single object or grouped boxes
"use_bbox_size_for_points": """
When comparing point groups, OKS sigma defines the matching area for a GT point.
If enabled, the area size is based on the point group bbox size.
If disabled, the image size is used.
Useful if point groups do not represent a single object or boxes attached to points
do not represent object boundaries.
""",
"line_thickness": """
Expand Down
18 changes: 10 additions & 8 deletions cvat/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9661,12 +9661,13 @@ components:
The percent of the bbox area, used as the radius of the circle around the GT point,
where the checked point is expected to be.
Read more: https://cocodataset.org/#keypoints-eval
use_image_space_for_point_group_comparisons:
use_bbox_size_for_points:
type: boolean
default: false
description: |
Compare point groups in the image space, instead of using the point group bbox.
Useful if point groups may not represent a single object or grouped boxes
When comparing point groups, OKS sigma defines the matching area for a GT point.
If enabled, the area size is based on the point group bbox size.
If disabled, the image size is used.
Useful if point groups do not represent a single object or boxes attached to points
do not represent object boundaries.
line_thickness:
type: number
Expand Down Expand Up @@ -10148,12 +10149,13 @@ components:
The percent of the bbox area, used as the radius of the circle around the GT point,
where the checked point is expected to be.
Read more: https://cocodataset.org/#keypoints-eval
use_image_space_for_point_group_comparisons:
use_bbox_size_for_points:
type: boolean
default: false
description: |
Compare point groups in the image space, instead of using the point group bbox.
Useful if point groups may not represent a single object or grouped boxes
When comparing point groups, OKS sigma defines the matching area for a GT point.
If enabled, the area size is based on the point group bbox size.
If disabled, the image size is used.
Useful if point groups do not represent a single object or boxes attached to points
do not represent object boundaries.
line_thickness:
type: number
Expand Down

0 comments on commit ccd3f8c

Please sign in to comment.