Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Fix invalid mask when running automatic annotation on a task (cvat-ai…
Browse files Browse the repository at this point in the history
  • Loading branch information
yasakova-anastasia authored and mikhail-treskin committed Jul 1, 2023
1 parent bca8c6c commit 29c2a58
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- An invalid project/org handling in webhooks (<https://github.com/opencv/cvat/pull/5707>)
- Warning `key` is undefined on project page (<https://github.com/opencv/cvat/pull/5876>)
- Invalid mask when running automatic annotation on a task (<https://github.com/opencv/cvat/pull/5883>)
- Cloud storage content listing when the manifest name contains special characters
(<https://github.com/opencv/cvat/pull/5873>)

Expand Down
32 changes: 13 additions & 19 deletions cvat/apps/lambda_manager/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,33 @@

import base64
import json
from functools import wraps
from enum import Enum
from copy import deepcopy
import os
import textwrap
from copy import deepcopy
from enum import Enum
from functools import wraps
from typing import Any, Dict, Optional

import datumaro.util.mask_tools as mask_tools
import django_rq
import numpy as np
import requests
import rq
import os

from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from rest_framework import status, viewsets, serializers
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import (OpenApiParameter, OpenApiResponse,
extend_schema, extend_schema_view,
inline_serializer)
from rest_framework import serializers, status, viewsets
from rest_framework.response import Response

import cvat.apps.dataset_manager as dm
from cvat.apps.engine.frame_provider import FrameProvider
from cvat.apps.engine.models import Job, Task
from cvat.apps.engine.models import Job, ShapeType, SourceType, Task, DataChoice
from cvat.apps.engine.serializers import LabeledDataSerializer
from cvat.apps.engine.models import ShapeType, SourceType, DataChoice
from cvat.utils.http import make_requests_session

from drf_spectacular.utils import (extend_schema, extend_schema_view,
OpenApiResponse, OpenApiParameter, inline_serializer)
from drf_spectacular.types import OpenApiTypes

class LambdaType(Enum):
DETECTOR = "detector"
Expand Down Expand Up @@ -559,14 +560,7 @@ def reset(self):
elif anno["type"] == "mask":
[xtl, ytl, xbr, ybr] = shape["points"][-4:]
cut_points = shape["points"][:-4]
rle = [0]
prev = shape["points"][0]
for val in cut_points:
if val == prev:
rle[-1] += 1
else:
rle.append(1)
prev = val
rle = mask_tools.mask_to_rle(np.array(cut_points))["counts"].tolist()
rle.extend([xtl, ytl, xbr, ybr])
shape["points"] = rle

Expand Down

0 comments on commit 29c2a58

Please sign in to comment.