Skip to content

Commit

Permalink
provide custom task name when uploading to cvat
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustem Galiullin committed Nov 28, 2022
1 parent f8ef906 commit 02e9ba1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 8 additions & 2 deletions fiftyone/utils/cvat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3060,6 +3060,7 @@ class CVATBackendConfig(foua.AnnotationBackendConfig):
default, no project is used
project_id (None): an optional ID of an existing CVAT project to which
to upload the annotation tasks. By default, no project is used
task_name (None): an optional task name to use for the created CVAT task
occluded_attr (None): an optional attribute name containing existing
occluded values and/or in which to store downloaded occluded values
for all objects in the annotation run
Expand Down Expand Up @@ -3091,6 +3092,7 @@ def __init__(
job_reviewers=None,
project_name=None,
project_id=None,
task_name=None,
occluded_attr=None,
group_id_attr=None,
issue_tracker=None,
Expand All @@ -3109,6 +3111,7 @@ def __init__(
self.job_reviewers = job_reviewers
self.project_name = project_name
self.project_id = project_id
self.task_name = task_name
self.occluded_attr = occluded_attr
self.group_id_attr = group_id_attr
self.issue_tracker = issue_tracker
Expand Down Expand Up @@ -4290,8 +4293,11 @@ def upload_samples(self, samples, backend):
project_id = self.create_project(project_name, cvat_schema)
project_ids.append(project_id)

_dataset_name = samples_batch._dataset.name.replace(" ", "_")
task_name = "FiftyOne_%s" % _dataset_name
if config.task_name is None:
_dataset_name = samples_batch._dataset.name.replace(" ", "_")
task_name = "FiftyOne_%s" % _dataset_name
else:
task_name = config.task_name

(
task_id,
Expand Down
3 changes: 3 additions & 0 deletions tests/intensive/cvat_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ def test_task_creation_arguments(self):

anno_key = "anno_key"
bug_tracker = "test_tracker"
task_name = "test_task"
results = dataset.annotate(
anno_key,
backend="cvat",
Expand All @@ -427,6 +428,7 @@ def test_task_creation_arguments(self):
job_assignees=users,
job_reviewers=users,
issue_tracker=bug_tracker,
task_name=task_name,
)
task_ids = results.task_ids
with results:
Expand All @@ -436,6 +438,7 @@ def test_task_creation_arguments(self):
task_json = api.get(api.task_url(task_id)).json()
self.assertEqual(task_json["bug_tracker"], bug_tracker)
self.assertEqual(task_json["segment_size"], 1)
self.assertEqual(task_json["name"], task_name)
if user is not None:
self.assertEqual(task_json["assignee"]["username"], user)
for job in api.get(api.jobs_url(task_id)).json():
Expand Down

0 comments on commit 02e9ba1

Please sign in to comment.