Skip to content

Commit

Permalink
Rename FunctionCallRequestSerializer.convMaskToPoly to fit the nami…
Browse files Browse the repository at this point in the history
…ng convention (#8743)

Keep the old name as a compatibility alias for the time being.
  • Loading branch information
SpecLad authored Nov 26, 2024
1 parent 7d0205b commit edef764
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
11 changes: 11 additions & 0 deletions changelog.d/20241126_140417_roman_rename_conv_mask_to_poly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### Added

- The `POST /api/lambda/requests` endpoint now has a `conv_mask_to_poly`
parameter with the same semantics as the old `convMaskToPoly` parameter
(<https://github.com/cvat-ai/cvat/pull/8743>)

### Deprecated

- The `convMaskToPoly` parameter of the `POST /api/lambda/requests` endpoint
is deprecated; use `conv_mask_to_poly` instead
(<https://github.com/cvat-ai/cvat/pull/8743>)
Original file line number Diff line number Diff line change
Expand Up @@ -1254,8 +1254,8 @@ export class ToolsControlComponent extends React.PureComponent<Props, State> {
try {
this.setState({ mode: 'detection', fetching: true });

// The function call endpoint doesn't support the cleanup and convMaskToPoly parameters.
const { cleanup, convMaskToPoly, ...restOfBody } = body;
// The function call endpoint doesn't support the cleanup and conv_mask_to_poly parameters.
const { cleanup, conv_mask_to_poly: convMaskToPoly, ...restOfBody } = body;

const result = await core.lambda.call(jobInstance.taskId, model, {
...restOfBody, frame, job: jobInstance.id,
Expand Down
4 changes: 2 additions & 2 deletions cvat-ui/src/components/model-runner-modal/detector-runner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type ServerMapping = Record<string, {
export interface DetectorRequestBody {
mapping: ServerMapping;
cleanup: boolean;
convMaskToPoly: boolean;
conv_mask_to_poly: boolean;
}

function convertMappingToServer(mapping: FullMapping): ServerMapping {
Expand Down Expand Up @@ -235,7 +235,7 @@ function DetectorRunner(props: Props): JSX.Element {
runInference(model, {
mapping: serverMapping,
cleanup,
convMaskToPoly: convertMasksToPolygons,
conv_mask_to_poly: convertMasksToPolygons,
});
} else if (model.kind === ModelKind.REID) {
runInference(model, { threshold, max_distance: distance });
Expand Down
3 changes: 2 additions & 1 deletion cvat/apps/lambda_manager/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class FunctionCallRequestSerializer(serializers.Serializer):
max_distance = serializers.IntegerField(required=False)
threshold = serializers.FloatField(required=False)
cleanup = serializers.BooleanField(help_text="Whether existing annotations should be removed", default=False)
convMaskToPoly = serializers.BooleanField(default=False) # TODO: use lowercase naming
convMaskToPoly = serializers.BooleanField(required=False, source="conv_mask_to_poly", write_only=True, help_text="Deprecated; use conv_mask_to_poly instead")
conv_mask_to_poly = serializers.BooleanField(required=False, help_text="Convert mask shapes to polygons")
mapping = serializers.DictField(child=LabelMappingEntrySerializer(), required=False,
help_text="Label mapping from the model to the task labels"
)
Expand Down
2 changes: 1 addition & 1 deletion cvat/apps/lambda_manager/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ def create(self, request):
task = request_data['task']
job = request_data.get('job', None)
cleanup = request_data.get('cleanup', False)
conv_mask_to_poly = request_data.get('convMaskToPoly', False)
conv_mask_to_poly = request_data.get('conv_mask_to_poly', False)
mapping = request_data.get('mapping')
max_distance = request_data.get('max_distance')
except KeyError as err:
Expand Down
6 changes: 5 additions & 1 deletion cvat/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8060,7 +8060,11 @@ components:
description: Whether existing annotations should be removed
convMaskToPoly:
type: boolean
default: false
writeOnly: true
description: Deprecated; use conv_mask_to_poly instead
conv_mask_to_poly:
type: boolean
description: Convert mask shapes to polygons
mapping:
type: object
additionalProperties:
Expand Down

0 comments on commit edef764

Please sign in to comment.