diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bc812fe12e9..d2201909a237 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - Review rating, reviewer field from the job instance (use assignee field together with stage field instead) () +- Training django app () ### Fixed - Fixed Interaction handler keyboard handlers () diff --git a/cvat/apps/engine/backup.py b/cvat/apps/engine/backup.py index 4850fc44c0ab..3c82d713252e 100644 --- a/cvat/apps/engine/backup.py +++ b/cvat/apps/engine/backup.py @@ -566,7 +566,7 @@ def _write_tasks(self, zip_object): def _write_manifest(self, zip_object): def serialize_project(): project_serializer = ProjectSerializer(self._db_project) - for field in ('assignee', 'owner', 'tasks', 'training_project', 'url'): + for field in ('assignee', 'owner', 'tasks', 'url'): project_serializer.fields.pop(field) project = self._prepare_project_meta(project_serializer.data) diff --git a/cvat/apps/engine/migrations/0050_auto_20220211_1425.py b/cvat/apps/engine/migrations/0050_auto_20220211_1425.py new file mode 100644 index 000000000000..67322fca1254 --- /dev/null +++ b/cvat/apps/engine/migrations/0050_auto_20220211_1425.py @@ -0,0 +1,34 @@ +# Generated by Django 3.2.12 on 2022-02-11 14:25 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('engine', '0049_auto_20220202_0710'), + ] + + operations = [ + migrations.RemoveField( + model_name='trainingprojectimage', + name='task', + ), + migrations.RemoveField( + model_name='trainingprojectlabel', + name='cvat_label', + ), + migrations.RemoveField( + model_name='project', + name='training_project', + ), + migrations.DeleteModel( + name='TrainingProject', + ), + migrations.DeleteModel( + name='TrainingProjectImage', + ), + migrations.DeleteModel( + name='TrainingProjectLabel', + ), + ] diff --git a/cvat/apps/engine/models.py b/cvat/apps/engine/models.py index 9ef032460d39..bbf6656a084c 100644 --- a/cvat/apps/engine/models.py +++ b/cvat/apps/engine/models.py @@ -12,7 +12,6 @@ from django.core.files.storage import FileSystemStorage from django.db import models from django.db.models.fields import FloatField -from django.utils.translation import gettext_lazy as _ from cvat.apps.engine.utils import parse_specific_attributes from cvat.apps.organizations.models import Organization @@ -223,19 +222,6 @@ class Image(models.Model): class Meta: default_permissions = () - -class TrainingProject(models.Model): - class ProjectClass(models.TextChoices): - DETECTION = 'OD', _('Object Detection') - - host = models.CharField(max_length=256) - username = models.CharField(max_length=256) - password = models.CharField(max_length=256) - training_id = models.CharField(max_length=64) - enabled = models.BooleanField(null=True) - project_class = models.CharField(max_length=2, choices=ProjectClass.choices, null=True, blank=True) - - class Project(models.Model): name = SafeCharField(max_length=256) @@ -250,7 +236,6 @@ class Project(models.Model): default=StatusChoice.ANNOTATION) organization = models.ForeignKey(Organization, null=True, default=None, blank=True, on_delete=models.SET_NULL, related_name="projects") - training_project = models.ForeignKey(TrainingProject, null=True, blank=True, on_delete=models.SET_NULL) def get_project_dirname(self): return os.path.join(settings.PROJECTS_ROOT, str(self.id)) @@ -318,13 +303,6 @@ def get_task_artifacts_dirname(self): def __str__(self): return self.name - -class TrainingProjectImage(models.Model): - task = models.ForeignKey(Task, on_delete=models.CASCADE) - idx = models.PositiveIntegerField() - training_image_id = models.CharField(max_length=64) - - # Redefined a couple of operation for FileSystemStorage to avoid renaming # or other side effects. class MyFileSystemStorage(FileSystemStorage): @@ -429,12 +407,6 @@ class Meta: default_permissions = () unique_together = ('task', 'name') - -class TrainingProjectLabel(models.Model): - cvat_label = models.ForeignKey(Label, on_delete=models.CASCADE, related_name='training_project_label') - training_label_id = models.CharField(max_length=64) - - class AttributeType(str, Enum): CHECKBOX = 'checkbox' RADIO = 'radio' diff --git a/cvat/apps/engine/serializers.py b/cvat/apps/engine/serializers.py index 97e1226a42f4..687d4d64e0e5 100644 --- a/cvat/apps/engine/serializers.py +++ b/cvat/apps/engine/serializers.py @@ -559,14 +559,6 @@ class Meta: fields = ('id', 'name') read_only_fields = ('name',) - -class TrainingProjectSerializer(serializers.ModelSerializer): - class Meta: - model = models.TrainingProject - fields = ('host', 'username', 'password', 'enabled', 'project_class') - write_once_fields = ('host', 'username', 'password', 'project_class') - - class ProjectSerializer(serializers.ModelSerializer): labels = LabelSerializer(many=True, source='label_set', partial=True, default=[]) owner = BasicUserSerializer(required=False, read_only=True) @@ -574,15 +566,13 @@ class ProjectSerializer(serializers.ModelSerializer): assignee = BasicUserSerializer(allow_null=True, required=False) assignee_id = serializers.IntegerField(write_only=True, allow_null=True, required=False) task_subsets = serializers.ListField(child=serializers.CharField(), required=False) - training_project = TrainingProjectSerializer(required=False, allow_null=True) dimension = serializers.CharField(max_length=16, required=False) class Meta: model = models.Project fields = ('url', 'id', 'name', 'labels', 'tasks', 'owner', 'assignee', 'owner_id', 'assignee_id', 'bug_tracker', 'task_subsets', - 'created_date', 'updated_date', 'status', 'training_project', - 'dimension', 'organization') + 'created_date', 'updated_date', 'status', 'dimension', 'organization') read_only_fields = ('created_date', 'updated_date', 'status', 'owner', 'assignee', 'task_subsets', 'dimension', 'organization', 'tasks') @@ -597,17 +587,7 @@ def to_representation(self, instance): # pylint: disable=no-self-use def create(self, validated_data): labels = validated_data.pop('label_set') - training_data = validated_data.pop('training_project', {}) - if training_data.get('enabled'): - host = training_data.pop('host').strip('/') - username = training_data.pop('username').strip() - password = training_data.pop('password').strip() - tr_p = models.TrainingProject.objects.create(**training_data, - host=host, username=username, password=password) - db_project = models.Project.objects.create(**validated_data, - training_project=tr_p) - else: - db_project = models.Project.objects.create(**validated_data) + db_project = models.Project.objects.create(**validated_data) label_colors = list() for label in labels: if label.get('id', None): diff --git a/cvat/apps/engine/tests/test_rest_api.py b/cvat/apps/engine/tests/test_rest_api.py index c08158f1a9c2..8349cd8f2ec0 100644 --- a/cvat/apps/engine/tests/test_rest_api.py +++ b/cvat/apps/engine/tests/test_rest_api.py @@ -1552,7 +1552,6 @@ def _run_api_v2_projects_id_export_import(self, user): "assignee", "created_date", "updated_date", - "training_project", "project_id", "tasks", ), diff --git a/cvat/apps/engine/urls.py b/cvat/apps/engine/urls.py index 57b6c3f600f2..c2918777fef0 100644 --- a/cvat/apps/engine/urls.py +++ b/cvat/apps/engine/urls.py @@ -13,7 +13,6 @@ from django.conf import settings from cvat.apps.restrictions.views import RestrictionsViewSet from cvat.apps.iam.decorators import login_required -from cvat.apps.training.views import PredictView schema_view = get_schema_view( openapi.Info( @@ -53,7 +52,6 @@ def _map_format_to_schema(request, scheme=None): router.register('issues', views.IssueViewSet) router.register('comments', views.CommentViewSet) router.register('restrictions', RestrictionsViewSet, basename='restrictions') -router.register('predict', PredictView, basename='predict') router.register('cloudstorages', views.CloudStorageViewSet) urlpatterns = [ diff --git a/cvat/apps/engine/views.py b/cvat/apps/engine/views.py index e55336500582..93efd5c1a33c 100644 --- a/cvat/apps/engine/views.py +++ b/cvat/apps/engine/views.py @@ -198,14 +198,10 @@ def annotation_formats(request): def plugins(request): response = { 'GIT_INTEGRATION': apps.is_installed('cvat.apps.dataset_repo'), - 'ANALYTICS': False, - 'MODELS': False, - 'PREDICT': apps.is_installed('cvat.apps.training') + 'ANALYTICS': strtobool(os.environ.get("CVAT_ANALYTICS", '0')), + 'MODELS': strtobool(os.environ.get("CVAT_SERVERLESS", '0')), + 'PREDICT':False # FIXME: it is unused anymore (for UI only) } - if strtobool(os.environ.get("CVAT_ANALYTICS", '0')): - response['ANALYTICS'] = True - if strtobool(os.environ.get("CVAT_SERVERLESS", '0')): - response['MODELS'] = True return Response(response) diff --git a/cvat/apps/training/__init__.py b/cvat/apps/training/__init__.py deleted file mode 100644 index 813d16ca0ecd..000000000000 --- a/cvat/apps/training/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (C) 2021 Intel Corporation -# -# SPDX-License-Identifier: MIT - diff --git a/cvat/apps/training/apis.py b/cvat/apps/training/apis.py deleted file mode 100644 index 6946633cdd60..000000000000 --- a/cvat/apps/training/apis.py +++ /dev/null @@ -1,351 +0,0 @@ -import uuid -from abc import ABC, abstractmethod -from collections import OrderedDict -from functools import wraps -from typing import Callable, List, Union -from contextlib import suppress - -import requests - -from cvat.apps.engine.models import TrainingProject, ShapeType - - -class TrainingServerAPIAbs(ABC): - - def __init__(self, host, username, password): - self.host = host - self.username = username - self.password = password - - @abstractmethod - def get_server_status(self): - pass - - @abstractmethod - def create_project(self, name: str, description: str = '', project_class: TrainingProject.ProjectClass = None, - labels: List[dict] = None): - pass - - @abstractmethod - def upload_annotations(self, project_id: str, frames_data: List[dict]): - pass - - @abstractmethod - def get_project_status(self, project_id: str) -> dict: - pass - - @abstractmethod - def get_annotation(self, project_id: str, image_id: str, width: int, height: int, frame: int, - labels_mapping: dict) -> dict: - pass - - -def retry(amount: int = 2) -> Callable: - def dec(func: Callable) -> Callable: - @wraps(func) - def wrapper(*args, **kwargs): - __amount = amount - while __amount > 0: - __amount -= 1 - with suppress(Exception): - result = func(*args, **kwargs) - return result - - return wrapper - - return dec - - -class TrainingServerAPI(TrainingServerAPIAbs): - TRAINING_CLASS = { - TrainingProject.ProjectClass.DETECTION: "DETECTION" - } - - @staticmethod - def __convert_annotation_from_cvat(shapes): - data = [] - for shape in shapes: - x0, y0, x1, y1 = shape['points'] - x = x0 / shape['width'] - y = y0 / shape['height'] - width = (x1 - x0) / shape['width'] - height = (y1 - y0) / shape['height'] - data.append({ - "id": str(uuid.uuid4()), - "shapes": [ - { - "type": "rect", - "geometry": { - "x": x, - "y": y, - "width": width, - "height": height, - "points": None, - } - } - ], - "editor": None, - "labels": [ - { - "id": shape['third_party_label_id'], - "probability": 1.0, - }, - ], - }) - return data - - @staticmethod - def __convert_annotation_to_cvat(annotation: dict, image_width: int, image_height: int, frame: int, - labels_mapping: dict) -> List[OrderedDict]: - shapes = [] - for i, annotation in enumerate(annotation.get('data', [])): - label_id = annotation['labels'][0]['id'] - if not labels_mapping.get(label_id): - continue - shape = annotation['shapes'][0] - if shape['type'] != 'rect': - continue - x = shape['geometry']['x'] - y = shape['geometry']['y'] - w = shape['geometry']['width'] - h = shape['geometry']['height'] - x0 = x * image_width - y0 = y * image_height - x1 = image_width * w + x0 - y1 = image_height * h + y0 - shapes.append(OrderedDict([ - ('type', ShapeType.RECTANGLE), - ('occluded', False), - ('z_order', 0), - ('points', [x0, y0, x1, y1]), - ('id', i), - ('frame', int(frame)), - ('label', labels_mapping.get(label_id)), - ('group', 0), - ('source', 'auto'), - ('attributes', {}) - ])) - return shapes - - @retry() - def __create_project(self, name: str, description: str = None, - labels: List[dict] = None, tasks: List[dict] = None) -> dict: - url = f'{self.host}/v2/projects' - headers = { - 'Context-Type': 'application/json', - 'Authorization': f'bearer_token {self.token}', - } - tasks[1]['properties'] = [ - { - "id": "labels", - "user_value": labels - } - ] - data = { - 'name': name, - 'description': description, - "dimensions": [], - "group_type": "normal", - 'pipeline': { - 'connections': [{ - 'from': { - **tasks[0]['output_ports'][0], - 'task_id': tasks[0]['temp_id'], - }, - 'to': { - **tasks[1]['input_ports'][0], - 'task_id': tasks[1]['temp_id'], - } - }], - 'tasks': tasks, - }, - "pipeline_representation": 'Detection', - "type": "project", - } - response = self.request(method='POST', url=url, json=data, headers=headers) - return response - - @retry() - def __get_annotation(self, project_id: str, image_id: str) -> dict: - url = f'{self.host}/v2/projects/{project_id}/media/images/{image_id}/results/online' - headers = { - 'Authorization': f'bearer_token {self.token}', - } - response = self.request(method='GET', url=url, headers=headers) - return response - - @retry() - def __get_job_status(self, project_id: str) -> dict: - url = f'{self.host}/v2/projects/{project_id}/jobs' - headers = { - 'Authorization': f'bearer_token {self.token}', - } - response = self.request(method='GET', url=url, headers=headers) - return response - - @retry() - def __get_project_summary(self, project_id: str) -> dict: - url = f'{self.host}/v2/projects/{project_id}/statistics/summary' - headers = { - 'Authorization': f'bearer_token {self.token}', - } - response = self.request(method='GET', url=url, headers=headers) - return response - - @retry() - def __get_project(self, project_id: str) -> dict: - url = f'{self.host}/v2/projects/{project_id}' - headers = { - 'Authorization': f'bearer_token {self.token}', - } - response = self.request(method='GET', url=url, headers=headers) - return response - - @retry() - def __get_server_status(self) -> dict: - url = f'{self.host}/v2/status' - headers = { - 'Authorization': f'bearer_token {self.token}', - } - response = self.request(method='GET', url=url, headers=headers) - return response - - @retry() - def __get_tasks(self) -> List[dict]: - url = f'{self.host}/v2/tasks' - headers = { - 'Authorization': f'bearer_token {self.token}', - } - response = self.request(method='GET', url=url, headers=headers) - return response - - @retry() - def __upload_annotation(self, project_id: str, image_id: str, annotation: List[dict]): - url = f'{self.host}/v2/projects/{project_id}/media/images/{image_id}/annotations' - headers = { - 'Authorization': f'bearer_token {self.token}', - 'Content-Type': 'application/json' - } - data = { - 'image_id': image_id, - 'data': annotation - } - response = self.request(method='POST', url=url, headers=headers, json=data) - return response - - @retry() - def __upload_image(self, project_id: str, buffer) -> dict: - url = f'{self.host}/v2/projects/{project_id}/media/images' - files = {'file': buffer} - headers = { - 'Authorization': f'bearer_token {self.token}', - } - response = self.request(method='POST', url=url, headers=headers, files=files) - return response - - @property - def project_id_key(self): - return f'{self.host}_{self.username}_project_id' - - @property - def token(self) -> str: - def get_token(host: str, username: str, password: str) -> dict: - url = f'{host}/v2/authentication' - data = { - 'username': (None, username), - 'password': (None, password), - } - r = requests.post(url=url, files=data, verify=False) # nosec - return r.json() - - response = get_token(self.host, self.username, self.password) - token = response.get('secure_token', '') - - return token - - @property - def token_key(self): - return f'{self.host}_{self.username}_token' - - def request(self, method: str, url: str, **kwargs) -> Union[list, dict, str]: - response = requests.request(method=method, url=url, verify=False, **kwargs) - if response.status_code == 401: - raise Exception("401") - result = response.json() - return result - - def create_project(self, name: str, description: str = '', project_class: TrainingProject.ProjectClass = None, - labels: List[dict] = None) -> dict: - all_tasks = self.__get_tasks() - task_type = self.TRAINING_CLASS.get(project_class) - task_algo = 'Retinanet - TF2' - tasks = [ - next(({'temp_id': '_1_', **task} - for task in all_tasks - if task['task_type'] == 'DATASET'), {}), - next(({'temp_id': '_2_', **task} - for task in all_tasks - if task['task_type'] == task_type and - task['algorithm_name'] == task_algo), {}), - ] - labels = [{ - 'name': label['name'], - 'temp_id': label['name'] - } for label in labels] - r = self.__create_project(name=name, description=description, tasks=tasks, labels=labels) - return r - - def get_server_status(self) -> dict: - return self.__get_server_status() - - def upload_annotations(self, project_id: str, frames_data: List[dict]): - for frame in frames_data: - annotation = self.__convert_annotation_from_cvat(frame['shapes']) - self.__upload_annotation(project_id=project_id, image_id=frame['third_party_id'], annotation=annotation) - - def upload_image(self, training_id: str, buffer): - response = self.__upload_image(project_id=training_id, buffer=buffer) - return response.get('id') - - def get_project_status(self, project_id) -> dict: - summary = self.__get_project_summary(project_id=project_id) - if not summary or not isinstance(summary, list): - return {'message': 'Not available'} - jobs = self.__get_job_status(project_id=project_id) - media_amount = next(item.get('value', 0) for item in summary if item.get('key') == 'Media') - annotation_amount = next(item.get('value', 0) for item in summary if item.get('key') == 'Annotation') - score = next(item.get('value', 0) for item in summary if item.get('key') == 'Score') - job_items = jobs.get('items', 0) - if len(job_items) == 0 and score == 0: - message = 'Not started' - elif len(job_items) == 0 and score > 0: - message = '' - else: - message = 'In progress' - progress = 0 if len(job_items) == 0 else job_items[0]["status"]["progress"] - time_remaining = 0 if len(job_items) == 0 else job_items[0]["status"]['time_remaining'] - result = { - 'media_amount': media_amount if media_amount else 0, - 'annotation_amount': annotation_amount, - 'score': score, - 'message': message, - 'progress': progress, - 'time_remaining': time_remaining, - } - return result - - def get_annotation(self, project_id: str, image_id: str, width: int, height: int, frame: int, - labels_mapping: dict) -> List[OrderedDict]: - annotation = self.__get_annotation(project_id=project_id, image_id=image_id) - cvat_annotation = self.__convert_annotation_to_cvat(annotation=annotation, image_width=width, - image_height=height, frame=frame, - labels_mapping=labels_mapping) - return cvat_annotation - - def get_labels(self, project_id: str) -> List[dict]: - project = self.__get_project(project_id=project_id) - labels = [{ - 'id': label['id'], - 'name': label['name'] - } for label in project.get('labels')] - return labels diff --git a/cvat/apps/training/apps.py b/cvat/apps/training/apps.py deleted file mode 100644 index a9ea6f3336e9..000000000000 --- a/cvat/apps/training/apps.py +++ /dev/null @@ -1,11 +0,0 @@ -from django.apps import AppConfig - - -class TrainingConfig(AppConfig): - name = 'cvat.apps.training' - - def ready(self): - # Required to define signals in application - import cvat.apps.training.signals - # Required in order to silent "unused-import" in pyflake - assert cvat.apps.training.signals diff --git a/cvat/apps/training/jobs.py b/cvat/apps/training/jobs.py deleted file mode 100644 index 85b87485cb21..000000000000 --- a/cvat/apps/training/jobs.py +++ /dev/null @@ -1,183 +0,0 @@ -from collections import OrderedDict -from typing import List - -from django_rq import job - -from cvat.apps import dataset_manager as dm -from cvat.apps.engine.frame_provider import FrameProvider -from cvat.apps.engine.models import ( - Project, - Task, - TrainingProjectImage, - Label, - Image, - TrainingProjectLabel, - Data, - Job, - ShapeType, -) -from cvat.apps.training.apis import TrainingServerAPI - - -@job -def save_prediction_server_status_to_cache_job(cache_key, - cvat_project_id, - timeout=60): - cvat_project = Project.objects.get(pk=cvat_project_id) - api = TrainingServerAPI(host=cvat_project.training_project.host, username=cvat_project.training_project.username, - password=cvat_project.training_project.password) - status = api.get_project_status(project_id=cvat_project.training_project.training_id) - - resp = { - **status, - 'status': 'done' - } - - return resp # dummy code, need to delete training app in a separate PR - - -@job -def save_frame_prediction_to_cache_job(cache_key: str, - task_id: int, - frame: int, - timeout: int = 60): - task = Task.objects.get(pk=task_id) - training_project_image = TrainingProjectImage.objects.filter(idx=frame, task=task).first() - if not training_project_image: - return - - cvat_labels = Label.objects.filter(project__id=task.project_id).all() - training_project = Project.objects.get(pk=task.project_id).training_project - api = TrainingServerAPI(host=training_project.host, - username=training_project.username, - password=training_project.password) - image = Image.objects.get(frame=frame, data=task.data) - labels_mapping = { - TrainingProjectLabel.objects.get(cvat_label=cvat_label).training_label_id: cvat_label.id - for cvat_label in cvat_labels - } - annotation = api.get_annotation(project_id=training_project.training_id, - image_id=training_project_image.training_image_id, - width=image.width, - height=image.height, - labels_mapping=labels_mapping, - frame=frame) - resp = { - 'annotation': annotation, - 'status': 'done' - } - - return resp # dummy code, need to delete training app in a separate PR - - -@job -def upload_images_job(task_id: int): - if TrainingProjectImage.objects.filter(task_id=task_id).count() is 0: - task = Task.objects.get(pk=task_id) - frame_provider = FrameProvider(task.data) - frames = frame_provider.get_frames() - api = TrainingServerAPI( - host=task.project.training_project.host, - username=task.project.training_project.username, - password=task.project.training_project.password, - ) - - for i, (buffer, _) in enumerate(frames): - training_image_id = api.upload_image(training_id=task.project.training_project.training_id, buffer=buffer) - if training_image_id: - TrainingProjectImage.objects.create(task=task, idx=i, - training_image_id=training_image_id) - -def __add_fields_to_shape(shape: dict, frame: int, data: Data, labels_mapping: dict) -> dict: - image = Image.objects.get(frame=frame, data=data) - return { - **shape, - 'height': image.height, - 'width': image.width, - 'third_party_label_id': labels_mapping[shape['label_id']], - } - - -@job -def upload_annotation_to_training_project_job(job_id: int): - cvat_job = Job.objects.get(pk=job_id) - cvat_project = cvat_job.segment.task.project - training_project = cvat_project.training_project - start = cvat_job.segment.start_frame - stop = cvat_job.segment.stop_frame - data = dm.task.get_job_data(job_id) - shapes: List[OrderedDict] = data.get('shapes', []) - frames_data = [] - api = TrainingServerAPI( - host=cvat_project.training_project.host, - username=cvat_project.training_project.username, - password=cvat_project.training_project.password, - ) - cvat_labels = Label.objects.filter(project=cvat_project).all() - labels_mapping = { - cvat_label.id: TrainingProjectLabel.objects.get(cvat_label=cvat_label).training_label_id - for cvat_label in cvat_labels - } - - for frame in range(start, stop + 1): - frame_shapes = list( - map( - lambda x: __add_fields_to_shape(x, frame, cvat_job.segment.task.data, labels_mapping), - filter( - lambda x: x['frame'] == frame and x['type'] == ShapeType.RECTANGLE, - shapes, - ) - ) - ) - - if frame_shapes: - training_project_image = TrainingProjectImage.objects.get(task=cvat_job.segment.task, idx=frame) - frames_data.append({ - 'third_party_id': training_project_image.training_image_id, - 'shapes': frame_shapes - }) - - api.upload_annotations(project_id=training_project.training_id, frames_data=frames_data) - - -@job -def create_training_project_job(project_id: int): - cvat_project = Project.objects.get(pk=project_id) - training_project = cvat_project.training_project - api = TrainingServerAPI( - host=cvat_project.training_project.host, - username=cvat_project.training_project.username, - password=cvat_project.training_project.password, - ) - create_training_project(cvat_project=cvat_project, training_project=training_project, api=api) - - -def create_training_project(cvat_project, training_project, api): - labels = cvat_project.label_set.all() - training_project_resp = api.create_project( - name=f'{cvat_project.name}_cvat', - project_class=training_project.project_class, - labels=[{'name': label.name} for label in labels] - ) - if training_project_resp.get('id'): - training_project.training_id = training_project_resp['id'] - training_project.save() - - for cvat_label in labels: - training_label = list(filter(lambda x: x['name'] == cvat_label.name, training_project_resp.get('labels', []))) - if training_label: - TrainingProjectLabel.objects.create(cvat_label=cvat_label, training_label_id=training_label[0]['id']) - - -async def upload_images(cvat_project_id, training_id, api): - project = Project.objects.get(pk=cvat_project_id) - tasks: List[Task] = project.tasks.all() - for task in tasks: - frame_provider = FrameProvider(task) - frames = frame_provider.get_frames() - for i, (buffer, _) in enumerate(frames): - training_image_id = api.upload_image(training_id=training_id, buffer=buffer) - if training_image_id: - TrainingProjectImage.objects.create(project=project, task=task, idx=i, - training_image_id=training_image_id) - diff --git a/cvat/apps/training/signals.py b/cvat/apps/training/signals.py deleted file mode 100644 index 20ba82420377..000000000000 --- a/cvat/apps/training/signals.py +++ /dev/null @@ -1,30 +0,0 @@ -from django.db.models.signals import post_save -from django.dispatch import receiver - -from cvat.apps.engine.models import Job, StatusChoice, Project, Task -from cvat.apps.training.jobs import ( - create_training_project_job, - upload_images_job, - upload_annotation_to_training_project_job, -) - - -@receiver(post_save, sender=Project, dispatch_uid="create_training_project") -def create_training_project(instance: Project, **kwargs): - if instance.training_project: - create_training_project_job.delay(instance.id) - - -@receiver(post_save, sender=Task, dispatch_uid='upload_images_to_training_project') -def upload_images_to_training_project(instance: Task, **kwargs): - if (instance.status == StatusChoice.ANNOTATION and - instance.data and instance.data.size != 0 and \ - instance.project_id and instance.project.training_project): - - upload_images_job.delay(instance.id) - - -@receiver(post_save, sender=Job, dispatch_uid="upload_annotation_to_training_project") -def upload_annotation_to_training_project(instance: Job, **kwargs): - if instance.status == StatusChoice.COMPLETED: - upload_annotation_to_training_project_job.delay(instance.id) diff --git a/cvat/apps/training/urls.py b/cvat/apps/training/urls.py deleted file mode 100644 index 47ce86bfb0ef..000000000000 --- a/cvat/apps/training/urls.py +++ /dev/null @@ -1,11 +0,0 @@ -from django.urls import path, include -from rest_framework import routers - -from cvat.apps.training.views import PredictView - -router = routers.DefaultRouter(trailing_slash=False) -router.register('', PredictView, basename='predict') - -urlpatterns = [ - path('', include((router.urls, 'predict'), namespace='predict')) -] diff --git a/cvat/apps/training/views.py b/cvat/apps/training/views.py deleted file mode 100644 index e3ec5fd0d6e1..000000000000 --- a/cvat/apps/training/views.py +++ /dev/null @@ -1,52 +0,0 @@ -from drf_yasg.utils import swagger_auto_schema -from rest_framework import viewsets, status -from rest_framework.decorators import action -from rest_framework.permissions import IsAuthenticated -from rest_framework.response import Response - -from cvat.apps.engine.models import Project -from cvat.apps.training.jobs import save_frame_prediction_to_cache_job, save_prediction_server_status_to_cache_job - - -class PredictView(viewsets.ViewSet): - def get_permissions(self): - permissions = [IsAuthenticated] - - return [perm() for perm in permissions] - - @swagger_auto_schema(method='get', operation_summary='Returns prediction for image') - @action(detail=False, methods=['GET'], url_path='frame') - def predict_image(self, request): - frame = self.request.query_params.get('frame') - task_id = self.request.query_params.get('task') - if not task_id: - return Response(data='query param "task" empty or not provided', status=status.HTTP_400_BAD_REQUEST) - if not frame: - return Response(data='query param "frame" empty or not provided', status=status.HTTP_400_BAD_REQUEST) - cache_key = f'predict_image_{task_id}_{frame}' - save_frame_prediction_to_cache_job.delay(cache_key, task_id=task_id, - frame=frame) - resp = { - 'status': 'queued', - } - - return Response(resp) - - @swagger_auto_schema(method='get', - operation_summary='Returns information of the tasks of the project with the selected id') - @action(detail=False, methods=['GET'], url_path='status') - def predict_status(self, request): - project_id = self.request.query_params.get('project') - if not project_id: - return Response(data='query param "project" empty or not provided', status=status.HTTP_400_BAD_REQUEST) - project = Project.objects.get(pk=project_id) - if not project.training_project: - Response({'status': 'done'}) - - cache_key = f'predict_status_{project_id}' - save_prediction_server_status_to_cache_job.delay(cache_key, cvat_project_id=project_id) - resp = { - 'status': 'queued', - } - - return Response(resp) diff --git a/cvat/urls.py b/cvat/urls.py index 9c9e988943a4..66b62eb15673 100644 --- a/cvat/urls.py +++ b/cvat/urls.py @@ -42,6 +42,3 @@ if apps.is_installed('silk'): urlpatterns.append(path('profiler/', include('silk.urls'))) - -if apps.is_installed('cvat.apps.training'): - urlpatterns.append(path('api/predict/', include('cvat.apps.training.urls'))) diff --git a/tests/rest_api/assets/cvat_db/cvat_db.sql b/tests/rest_api/assets/cvat_db/cvat_db.sql index 880c3ccd35b4..71cf2859d3ce 100644 --- a/tests/rest_api/assets/cvat_db/cvat_db.sql +++ b/tests/rest_api/assets/cvat_db/cvat_db.sql @@ -28,8 +28,6 @@ ALTER TABLE ONLY public.organizations_invitation DROP CONSTRAINT organizations_i ALTER TABLE ONLY public.organizations_invitation DROP CONSTRAINT organizations_invita_membership_id_d0265539_fk_organizat; ALTER TABLE ONLY public.dataset_repo_gitdata DROP CONSTRAINT git_gitdata_task_id_a6f2ea20_fk_engine_task_id; ALTER TABLE ONLY public.engine_video DROP CONSTRAINT engine_video_data_id_b37015e9_fk_engine_data_id; -ALTER TABLE ONLY public.engine_trainingprojectimage DROP CONSTRAINT engine_trainingprojectimage_task_id_68b8b707_fk_engine_task_id; -ALTER TABLE ONLY public.engine_trainingprojectlabel DROP CONSTRAINT engine_trainingproje_cvat_label_id_ec627ead_fk_engine_la; ALTER TABLE ONLY public.engine_trackedshapeattributeval DROP CONSTRAINT engine_trackedshapea_spec_id_a944a532_fk_engine_at; ALTER TABLE ONLY public.engine_trackedshapeattributeval DROP CONSTRAINT engine_trackedshapea_shape_id_361f0e2f_fk_engine_tr; ALTER TABLE ONLY public.engine_trackedshape DROP CONSTRAINT engine_trackedshape_track_id_a6dc58bd_fk_engine_labeledtrack_id; @@ -43,7 +41,6 @@ ALTER TABLE ONLY public.engine_segment DROP CONSTRAINT engine_segment_task_id_37 ALTER TABLE ONLY public.engine_remotefile DROP CONSTRAINT engine_remotefile_data_id_ff16acda_fk_engine_data_id; ALTER TABLE ONLY public.engine_relatedfile DROP CONSTRAINT engine_relatedfile_primary_image_id_928aa7d5_fk_engine_image_id; ALTER TABLE ONLY public.engine_relatedfile DROP CONSTRAINT engine_relatedfile_data_id_aa10f063_fk_engine_data_id; -ALTER TABLE ONLY public.engine_project DROP CONSTRAINT engine_project_training_project_id_89feecf6_fk_engine_tr; ALTER TABLE ONLY public.engine_project DROP CONSTRAINT engine_project_owner_id_de2a8424_fk_auth_user_id; ALTER TABLE ONLY public.engine_project DROP CONSTRAINT engine_project_organization_id_21c08e6b_fk_organizat; ALTER TABLE ONLY public.engine_project DROP CONSTRAINT engine_project_assignee_id_77655de8_fk_auth_user_id; @@ -101,8 +98,6 @@ DROP INDEX public.organizations_membership_user_id_a8e72055; DROP INDEX public.organizations_membership_organization_id_6889aa64; DROP INDEX public.organizations_invitation_owner_id_d8ffe9d9; DROP INDEX public.organizations_invitation_key_514623ce_like; -DROP INDEX public.engine_trainingprojectlabel_cvat_label_id_ec627ead; -DROP INDEX public.engine_trainingprojectimage_task_id_68b8b707; DROP INDEX public.engine_trackedshapeattributeval_spec_id_a944a532; DROP INDEX public.engine_trackedshapeattributeval_shape_id_361f0e2f; DROP INDEX public.engine_trackedshape_track_id_a6dc58bd; @@ -116,7 +111,6 @@ DROP INDEX public.engine_segment_task_id_37d935cf; DROP INDEX public.engine_remotefile_data_id_ff16acda; DROP INDEX public.engine_relatedfile_primary_image_id_928aa7d5; DROP INDEX public.engine_relatedfile_data_id_aa10f063; -DROP INDEX public.engine_project_training_project_id_89feecf6; DROP INDEX public.engine_project_owner_id_de2a8424; DROP INDEX public.engine_project_organization_id_21c08e6b; DROP INDEX public.engine_project_assignee_id_77655de8; @@ -185,9 +179,6 @@ ALTER TABLE ONLY public.organizations_invitation DROP CONSTRAINT organizations_i ALTER TABLE ONLY public.dataset_repo_gitdata DROP CONSTRAINT git_gitdata_pkey; ALTER TABLE ONLY public.engine_video DROP CONSTRAINT engine_video_pkey; ALTER TABLE ONLY public.engine_video DROP CONSTRAINT engine_video_data_id_key; -ALTER TABLE ONLY public.engine_trainingprojectlabel DROP CONSTRAINT engine_trainingprojectlabel_pkey; -ALTER TABLE ONLY public.engine_trainingprojectimage DROP CONSTRAINT engine_trainingprojectimage_pkey; -ALTER TABLE ONLY public.engine_trainingproject DROP CONSTRAINT engine_trainingproject_pkey; ALTER TABLE ONLY public.engine_trackedshapeattributeval DROP CONSTRAINT engine_trackedshapeattributeval_pkey; ALTER TABLE ONLY public.engine_trackedshape DROP CONSTRAINT engine_trackedshape_pkey; ALTER TABLE ONLY public.engine_task DROP CONSTRAINT engine_task_pkey; @@ -252,9 +243,6 @@ ALTER TABLE public.socialaccount_socialaccount ALTER COLUMN id DROP DEFAULT; ALTER TABLE public.organizations_organization ALTER COLUMN id DROP DEFAULT; ALTER TABLE public.organizations_membership ALTER COLUMN id DROP DEFAULT; ALTER TABLE public.engine_video ALTER COLUMN id DROP DEFAULT; -ALTER TABLE public.engine_trainingprojectlabel ALTER COLUMN id DROP DEFAULT; -ALTER TABLE public.engine_trainingprojectimage ALTER COLUMN id DROP DEFAULT; -ALTER TABLE public.engine_trainingproject ALTER COLUMN id DROP DEFAULT; ALTER TABLE public.engine_trackedshapeattributeval ALTER COLUMN id DROP DEFAULT; ALTER TABLE public.engine_trackedshape ALTER COLUMN id DROP DEFAULT; ALTER TABLE public.engine_task ALTER COLUMN id DROP DEFAULT; @@ -308,12 +296,6 @@ DROP TABLE public.organizations_membership; DROP TABLE public.organizations_invitation; DROP SEQUENCE public.engine_video_id_seq; DROP TABLE public.engine_video; -DROP SEQUENCE public.engine_trainingprojectlabel_id_seq; -DROP TABLE public.engine_trainingprojectlabel; -DROP SEQUENCE public.engine_trainingprojectimage_id_seq; -DROP TABLE public.engine_trainingprojectimage; -DROP SEQUENCE public.engine_trainingproject_id_seq; -DROP TABLE public.engine_trainingproject; DROP SEQUENCE public.engine_trackedshapeattributeval_id_seq; DROP TABLE public.engine_trackedshapeattributeval; DROP SEQUENCE public.engine_trackedshape_id_seq; @@ -1623,7 +1605,6 @@ CREATE TABLE public.engine_project ( status character varying(32) NOT NULL, assignee_id integer, owner_id integer, - training_project_id integer, organization_id integer ); @@ -1920,117 +1901,6 @@ ALTER TABLE public.engine_trackedshapeattributeval_id_seq OWNER TO root; ALTER SEQUENCE public.engine_trackedshapeattributeval_id_seq OWNED BY public.engine_trackedshapeattributeval.id; --- --- Name: engine_trainingproject; Type: TABLE; Schema: public; Owner: root --- - -CREATE TABLE public.engine_trainingproject ( - id integer NOT NULL, - host character varying(256) NOT NULL, - username character varying(256) NOT NULL, - password character varying(256) NOT NULL, - training_id character varying(64) NOT NULL, - enabled boolean, - project_class character varying(2) -); - - -ALTER TABLE public.engine_trainingproject OWNER TO root; - --- --- Name: engine_trainingproject_id_seq; Type: SEQUENCE; Schema: public; Owner: root --- - -CREATE SEQUENCE public.engine_trainingproject_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.engine_trainingproject_id_seq OWNER TO root; - --- --- Name: engine_trainingproject_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root --- - -ALTER SEQUENCE public.engine_trainingproject_id_seq OWNED BY public.engine_trainingproject.id; - - --- --- Name: engine_trainingprojectimage; Type: TABLE; Schema: public; Owner: root --- - -CREATE TABLE public.engine_trainingprojectimage ( - id integer NOT NULL, - idx integer NOT NULL, - training_image_id character varying(64) NOT NULL, - task_id integer NOT NULL, - CONSTRAINT engine_trainingprojectimage_idx_check CHECK ((idx >= 0)) -); - - -ALTER TABLE public.engine_trainingprojectimage OWNER TO root; - --- --- Name: engine_trainingprojectimage_id_seq; Type: SEQUENCE; Schema: public; Owner: root --- - -CREATE SEQUENCE public.engine_trainingprojectimage_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.engine_trainingprojectimage_id_seq OWNER TO root; - --- --- Name: engine_trainingprojectimage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root --- - -ALTER SEQUENCE public.engine_trainingprojectimage_id_seq OWNED BY public.engine_trainingprojectimage.id; - - --- --- Name: engine_trainingprojectlabel; Type: TABLE; Schema: public; Owner: root --- - -CREATE TABLE public.engine_trainingprojectlabel ( - id integer NOT NULL, - training_label_id character varying(64) NOT NULL, - cvat_label_id integer NOT NULL -); - - -ALTER TABLE public.engine_trainingprojectlabel OWNER TO root; - --- --- Name: engine_trainingprojectlabel_id_seq; Type: SEQUENCE; Schema: public; Owner: root --- - -CREATE SEQUENCE public.engine_trainingprojectlabel_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.engine_trainingprojectlabel_id_seq OWNER TO root; - --- --- Name: engine_trainingprojectlabel_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: root --- - -ALTER SEQUENCE public.engine_trainingprojectlabel_id_seq OWNED BY public.engine_trainingprojectlabel.id; - - -- -- Name: engine_video; Type: TABLE; Schema: public; Owner: root -- @@ -2578,27 +2448,6 @@ ALTER TABLE ONLY public.engine_trackedshape ALTER COLUMN id SET DEFAULT nextval( ALTER TABLE ONLY public.engine_trackedshapeattributeval ALTER COLUMN id SET DEFAULT nextval('public.engine_trackedshapeattributeval_id_seq'::regclass); --- --- Name: engine_trainingproject id; Type: DEFAULT; Schema: public; Owner: root --- - -ALTER TABLE ONLY public.engine_trainingproject ALTER COLUMN id SET DEFAULT nextval('public.engine_trainingproject_id_seq'::regclass); - - --- --- Name: engine_trainingprojectimage id; Type: DEFAULT; Schema: public; Owner: root --- - -ALTER TABLE ONLY public.engine_trainingprojectimage ALTER COLUMN id SET DEFAULT nextval('public.engine_trainingprojectimage_id_seq'::regclass); - - --- --- Name: engine_trainingprojectlabel id; Type: DEFAULT; Schema: public; Owner: root --- - -ALTER TABLE ONLY public.engine_trainingprojectlabel ALTER COLUMN id SET DEFAULT nextval('public.engine_trainingprojectlabel_id_seq'::regclass); - - -- -- Name: engine_video id; Type: DEFAULT; Schema: public; Owner: root -- @@ -2801,8 +2650,8 @@ COPY public.auth_user (id, password, last_login, is_superuser, username, first_n 18 pbkdf2_sha256$260000$uOqP32bk2zHuvO0sdGBGmu$hMbzA1yBWcY5rIU670sZ3SHXRLUa7bCkbrMnrEDGSRM= \N t admin2 Admin Second admin2@cvat.org t t 2021-12-14 18:38:46+00 6 pbkdf2_sha256$260000$15iUjDNh5gPg5683u1HhOG$fF8hW6AR90o9SCsO/MomzdQFkgQsMUW3YQUlwwiC1vA= 2021-12-14 19:11:21.04874+00 f worker1 Worker First worker1@cvat.org f t 2021-12-14 18:30:00+00 2 pbkdf2_sha256$260000$Pf2xYWXBedoAJ504jyDD8e$8sJ244Ai0xhZrUTelapPNHlEg7CV0cCUaxbcxZtfaug= 2021-12-22 07:55:35.269206+00 f user1 User First user1@cvat.org f t 2021-12-14 18:21:09+00 -1 pbkdf2_sha256$260000$DevmxlmLwciP1P6sZs2Qag$U9DFtjTWx96Sk95qY6UXVcvpdQEP2LcoFBftk5D2RKY= 2021-12-22 08:11:58.502575+00 t admin1 Admin First admin1@cvat.org t t 2021-12-14 18:04:57+00 10 pbkdf2_sha256$260000$X4F89IRqnBtojZuHidrwQG$j1+EpXfyvMesHdod4N+dNUfF4WKS2NWFfeGDec/43as= 2022-01-19 13:52:59.477881+00 f business1 Business First business1@cvat.org f t 2021-12-14 18:33:06+00 +1 pbkdf2_sha256$260000$DevmxlmLwciP1P6sZs2Qag$U9DFtjTWx96Sk95qY6UXVcvpdQEP2LcoFBftk5D2RKY= 2022-02-11 14:54:28.083729+00 t admin1 Admin First admin1@cvat.org t t 2021-12-14 18:04:57+00 \. @@ -3052,6 +2901,8 @@ COPY public.django_migrations (id, app, name, applied) FROM stdin; 86 dataset_repo 0001_initial 2021-12-14 17:51:27.585687+00 87 dataset_repo 0003_gitdata_lfs 2021-12-14 17:51:27.587237+00 88 dataset_repo 0002_auto_20190123_1305 2021-12-14 17:51:27.588845+00 +89 engine 0049_auto_20220202_0710 2022-02-11 14:54:41.053611+00 +90 engine 0050_auto_20220211_1425 2022-02-11 14:54:41.126041+00 \. @@ -3065,6 +2916,7 @@ ic4rcr36vkoymwaw6p322bjqlryvq2jd .eJxVjMsOwiAQRf-FtSEDFRhcuu83kBkeUjU0Ke3K-O_apA mnb97kue40xo05g2rwwkw6d34sxrnesw .eJxVjDsOwjAQBe_iGllO8E-U9JzB2l3v4gBypDipEHfHkVJAOzPvvVWCbS1pa7ykKauLGtTplyHQk-su8gPqfdY013WZUO-JPmzTtznz63q0fwcFWunrgELAEtGgEzcCGTp7I4ZCdA5iN9KRFaA8YARvDXoL7GNgO5Jn9fkCIRs5Sw:1mxQKq:6A9lz-3mKMJukzqDk-DXfGIbDNeLeGul_TgZ7A6Xlf8 2021-12-29 09:12:28.010763+00 po0rbd1yhywmc0i2jfam69r419a66aj8 .eJxVjMsOwiAQRf-FtSE8pB1cuvcbCMMMUjWQlHZl_HdD0oVu7znnvkWI-1bC3nkNC4mL0OL0u2FMT64D0CPWe5Op1W1dUA5FHrTLWyN-XQ_376DEXkY9QeKzIpWVn9gYhEhkI3lyYFg7jTMDg7WkAdF5mCFh9mRZZUhOi88X-eU4dg:1mzwj8:CWx3-u6eXmWLpwiFMK5_yWnoPY3yUSf1QCZY-UdJcF8 2022-01-05 08:11:58.507079+00 v28l0efbrv9x06z97ilwcf7lwtuf4ctc .eJxVjDsOwjAQRO_iGlm22fhDSc8ZrLV3gwPIluKkQtydREoBzRTz3sxbRFyXEtfOc5xIXIRW4vRbJsxPrjuhB9Z7k7nVZZ6S3BV50C5vjfh1Pdy_g4K9bGuLXqMDQqdDTtYN6AHIIoGGMIJlQwxB-VFn3gLPzjil3ABkAIBZfL7_vTer:1nABOV:0UAK9VV6D18QF1-189XQ2T9LrQUSdioGNoHdRUzzt7o 2022-02-02 13:52:59.489923+00 +wf6d6vzf4u74l08o0qgbqehei21hibea .eJxVjDEOwjAMRe-SGUUkpHZgZO8ZIttxSAG1UtNOiLtDpQ6w_vfef5lE61LT2nROQzYX48zhd2OSh44byHcab5OVaVzmge2m2J02209Zn9fd_Tuo1Oq3DrGwD040Ro_-nJmJgkgsqAAIioCi0KGKMhU4Mgip6wjRF6JyMu8PBAI5Mw:1nIXJc:oovNJRods5cbviWOWush4H3jDdP8XklEignva_EnQ8Q 2022-02-25 14:54:28.092369+00 \. @@ -4036,9 +3888,9 @@ COPY public.engine_profile (id, rating, user_id) FROM stdin; -- Data for Name: engine_project; Type: TABLE DATA; Schema: public; Owner: root -- -COPY public.engine_project (id, name, bug_tracker, created_date, updated_date, status, assignee_id, owner_id, training_project_id, organization_id) FROM stdin; -1 project1 2021-12-14 19:46:37.969497+00 2021-12-14 19:48:33.103265+00 annotation \N 10 \N \N -2 project2 2021-12-14 19:52:37.278149+00 2021-12-14 19:55:57.483506+00 annotation 3 10 \N 2 +COPY public.engine_project (id, name, bug_tracker, created_date, updated_date, status, assignee_id, owner_id, organization_id) FROM stdin; +1 project1 2021-12-14 19:46:37.969497+00 2021-12-14 19:48:33.103265+00 annotation \N 10 \N +2 project2 2021-12-14 19:52:37.278149+00 2021-12-14 19:55:57.483506+00 annotation 3 10 2 \. @@ -4108,30 +3960,6 @@ COPY public.engine_trackedshapeattributeval (id, value, shape_id, spec_id) FROM \. --- --- Data for Name: engine_trainingproject; Type: TABLE DATA; Schema: public; Owner: root --- - -COPY public.engine_trainingproject (id, host, username, password, training_id, enabled, project_class) FROM stdin; -\. - - --- --- Data for Name: engine_trainingprojectimage; Type: TABLE DATA; Schema: public; Owner: root --- - -COPY public.engine_trainingprojectimage (id, idx, training_image_id, task_id) FROM stdin; -\. - - --- --- Data for Name: engine_trainingprojectlabel; Type: TABLE DATA; Schema: public; Owner: root --- - -COPY public.engine_trainingprojectlabel (id, training_label_id, cvat_label_id) FROM stdin; -\. - - -- -- Data for Name: engine_video; Type: TABLE DATA; Schema: public; Owner: root -- @@ -4257,7 +4085,7 @@ SELECT pg_catalog.setval('public.auth_permission_id_seq', 88, true); -- Name: auth_user_groups_id_seq; Type: SEQUENCE SET; Schema: public; Owner: root -- -SELECT pg_catalog.setval('public.auth_user_groups_id_seq', 43, true); +SELECT pg_catalog.setval('public.auth_user_groups_id_seq', 44, true); -- @@ -4292,7 +4120,7 @@ SELECT pg_catalog.setval('public.django_content_type_id_seq', 48, true); -- Name: django_migrations_id_seq; Type: SEQUENCE SET; Schema: public; Owner: root -- -SELECT pg_catalog.setval('public.django_migrations_id_seq', 88, true); +SELECT pg_catalog.setval('public.django_migrations_id_seq', 90, true); -- @@ -4484,27 +4312,6 @@ SELECT pg_catalog.setval('public.engine_trackedshape_id_seq', 1, false); SELECT pg_catalog.setval('public.engine_trackedshapeattributeval_id_seq', 1, false); --- --- Name: engine_trainingproject_id_seq; Type: SEQUENCE SET; Schema: public; Owner: root --- - -SELECT pg_catalog.setval('public.engine_trainingproject_id_seq', 1, false); - - --- --- Name: engine_trainingprojectimage_id_seq; Type: SEQUENCE SET; Schema: public; Owner: root --- - -SELECT pg_catalog.setval('public.engine_trainingprojectimage_id_seq', 1, false); - - --- --- Name: engine_trainingprojectlabel_id_seq; Type: SEQUENCE SET; Schema: public; Owner: root --- - -SELECT pg_catalog.setval('public.engine_trainingprojectlabel_id_seq', 1, false); - - -- -- Name: engine_video_id_seq; Type: SEQUENCE SET; Schema: public; Owner: root -- @@ -5010,30 +4817,6 @@ ALTER TABLE ONLY public.engine_trackedshapeattributeval ADD CONSTRAINT engine_trackedshapeattributeval_pkey PRIMARY KEY (id); --- --- Name: engine_trainingproject engine_trainingproject_pkey; Type: CONSTRAINT; Schema: public; Owner: root --- - -ALTER TABLE ONLY public.engine_trainingproject - ADD CONSTRAINT engine_trainingproject_pkey PRIMARY KEY (id); - - --- --- Name: engine_trainingprojectimage engine_trainingprojectimage_pkey; Type: CONSTRAINT; Schema: public; Owner: root --- - -ALTER TABLE ONLY public.engine_trainingprojectimage - ADD CONSTRAINT engine_trainingprojectimage_pkey PRIMARY KEY (id); - - --- --- Name: engine_trainingprojectlabel engine_trainingprojectlabel_pkey; Type: CONSTRAINT; Schema: public; Owner: root --- - -ALTER TABLE ONLY public.engine_trainingprojectlabel - ADD CONSTRAINT engine_trainingprojectlabel_pkey PRIMARY KEY (id); - - -- -- Name: engine_video engine_video_data_id_key; Type: CONSTRAINT; Schema: public; Owner: root -- @@ -5526,13 +5309,6 @@ CREATE INDEX engine_project_organization_id_21c08e6b ON public.engine_project US CREATE INDEX engine_project_owner_id_de2a8424 ON public.engine_project USING btree (owner_id); --- --- Name: engine_project_training_project_id_89feecf6; Type: INDEX; Schema: public; Owner: root --- - -CREATE INDEX engine_project_training_project_id_89feecf6 ON public.engine_project USING btree (training_project_id); - - -- -- Name: engine_relatedfile_data_id_aa10f063; Type: INDEX; Schema: public; Owner: root -- @@ -5624,20 +5400,6 @@ CREATE INDEX engine_trackedshapeattributeval_shape_id_361f0e2f ON public.engine_ CREATE INDEX engine_trackedshapeattributeval_spec_id_a944a532 ON public.engine_trackedshapeattributeval USING btree (spec_id); --- --- Name: engine_trainingprojectimage_task_id_68b8b707; Type: INDEX; Schema: public; Owner: root --- - -CREATE INDEX engine_trainingprojectimage_task_id_68b8b707 ON public.engine_trainingprojectimage USING btree (task_id); - - --- --- Name: engine_trainingprojectlabel_cvat_label_id_ec627ead; Type: INDEX; Schema: public; Owner: root --- - -CREATE INDEX engine_trainingprojectlabel_cvat_label_id_ec627ead ON public.engine_trainingprojectlabel USING btree (cvat_label_id); - - -- -- Name: organizations_invitation_key_514623ce_like; Type: INDEX; Schema: public; Owner: root -- @@ -6083,14 +5845,6 @@ ALTER TABLE ONLY public.engine_project ADD CONSTRAINT engine_project_owner_id_de2a8424_fk_auth_user_id FOREIGN KEY (owner_id) REFERENCES public.auth_user(id) DEFERRABLE INITIALLY DEFERRED; --- --- Name: engine_project engine_project_training_project_id_89feecf6_fk_engine_tr; Type: FK CONSTRAINT; Schema: public; Owner: root --- - -ALTER TABLE ONLY public.engine_project - ADD CONSTRAINT engine_project_training_project_id_89feecf6_fk_engine_tr FOREIGN KEY (training_project_id) REFERENCES public.engine_trainingproject(id) DEFERRABLE INITIALLY DEFERRED; - - -- -- Name: engine_relatedfile engine_relatedfile_data_id_aa10f063_fk_engine_data_id; Type: FK CONSTRAINT; Schema: public; Owner: root -- @@ -6195,22 +5949,6 @@ ALTER TABLE ONLY public.engine_trackedshapeattributeval ADD CONSTRAINT engine_trackedshapea_spec_id_a944a532_fk_engine_at FOREIGN KEY (spec_id) REFERENCES public.engine_attributespec(id) DEFERRABLE INITIALLY DEFERRED; --- --- Name: engine_trainingprojectlabel engine_trainingproje_cvat_label_id_ec627ead_fk_engine_la; Type: FK CONSTRAINT; Schema: public; Owner: root --- - -ALTER TABLE ONLY public.engine_trainingprojectlabel - ADD CONSTRAINT engine_trainingproje_cvat_label_id_ec627ead_fk_engine_la FOREIGN KEY (cvat_label_id) REFERENCES public.engine_label(id) DEFERRABLE INITIALLY DEFERRED; - - --- --- Name: engine_trainingprojectimage engine_trainingprojectimage_task_id_68b8b707_fk_engine_task_id; Type: FK CONSTRAINT; Schema: public; Owner: root --- - -ALTER TABLE ONLY public.engine_trainingprojectimage - ADD CONSTRAINT engine_trainingprojectimage_task_id_68b8b707_fk_engine_task_id FOREIGN KEY (task_id) REFERENCES public.engine_task(id) DEFERRABLE INITIALLY DEFERRED; - - -- -- Name: engine_video engine_video_data_id_b37015e9_fk_engine_data_id; Type: FK CONSTRAINT; Schema: public; Owner: root -- diff --git a/tests/rest_api/assets/projects.json b/tests/rest_api/assets/projects.json index f294827d97a0..a57d12e57381 100644 --- a/tests/rest_api/assets/projects.json +++ b/tests/rest_api/assets/projects.json @@ -45,7 +45,6 @@ "tasks": [ 4 ], - "training_project": null, "updated_date": "2021-12-14T19:55:57.483506Z", "url": "http://localhost:8080/api/projects/2" }, @@ -98,7 +97,6 @@ "tasks": [ 3 ], - "training_project": null, "updated_date": "2021-12-14T19:48:33.103265Z", "url": "http://localhost:8080/api/projects/1" }