-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Az/import export tasks #3056
Az/import export tasks #3056
Conversation
@azhavoro , can we avoid limits 500 images, if we import a task? Does it handle properly? |
@azhavoro , when are we going to support the same functionality for projects? |
cvat-ui/src/actions/tasks-actions.ts
Outdated
dispatch(exportTaskFailed(taskInstance.id, error)); | ||
} | ||
|
||
dispatch(exportTaskSuccess(taskInstance.id)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably you can put the line under try. It looks more naturally.
utils/cli/core/definition.py
Outdated
help='output file' | ||
) | ||
export_task_parser.add_argument( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need the argument. Let's have something by default.
utils/cli/core/definition.py
Outdated
) | ||
import_task_parser.add_argument( | ||
'--import_verification_period', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need the argument. Let's have something by default.
utils/cli/core/core.py
Outdated
""" Export and download a whole task """ | ||
url = self.api.tasks_id(task_id) | ||
export_url = url + '?action=export' | ||
response = self.session.get(export_url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like exactly the lines are in the beginning of while loop. Move sleep at the end of while and you can remove these 2 lines.
cvat/apps/engine/task.py
Outdated
from .log import slogger | ||
from cvat.apps.engine import models | ||
from cvat.apps.engine.log import slogger | ||
from cvat.apps.engine.media_extractors import (MEDIA_TYPES, Mpeg4ChunkWriter, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this changes? The indent should be 4 spaces.
@@ -284,6 +284,7 @@ Go to the [Django administration panel](http://localhost:8080/admin). There you | |||
1. Assigned to — is used to assign a task to a person. Start typing an assignee’s name and/or | |||
choose the right person out of the dropdown list. | |||
- `Jobs` — is a list of all jobs for a particular task. Here you can find the next data: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want to revert the file. Otherwise it will affect documentation PR.
@@ -536,14 +536,13 @@ archive.zip/ | |||
- `score` (number) - the annotation `score` field | |||
- arbitrary attributes - will be stored in the `attributes` annotation section | |||
|
|||
|
|||
*Note*: there is also a [support for COCO keypoints over Datumaro](https://github.com/openvinotoolkit/cvat/issues/2910#issuecomment-726077582) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Probably it is a good idea to revert all files which you don't want to change.
cvat-core/src/server-proxy.js
Outdated
async function importTask(file) { | ||
const { backendAPI } = config; | ||
|
||
let annotationData = new FormData(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason behind annotationData
name? Should it be payload or something like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe need to update utils/cli/README.md
utils/cli/core/core.py
Outdated
url = self.api.tasks + '?action=import' | ||
response = self.session.post( | ||
url, | ||
files={'task_file': open(filename, 'rb')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a handler if such file not exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
little bit improved, in this case error message will be like this, I think it's enough for user
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/343.zip'
@azhavoro , I have found an issue. Multiple times to import the same video task and got the following error a couple of times:
|
@azhavoro , also the list of tasks isn't updated. Need to refresh the whole site or go to |
@azhavoro , I see great process with the layout of the exported archive. Could we do one more step forward?
Can it be implemented from your point of view? Will we loose any information? |
Another exception when try to export a task:
|
@azhavoro , also I see "index.json" file which should be created on the fly. |
Now we have tasks.json {
"name": "tracking video",
"bug_tracker": "",
"status": "annotation",
"labels": [
{
"id": 12,
"name": "person",
"color": "#c06060",
"attributes": []
}
],
"subset": "",
"version": "1.0",
"data": {
"chunk_size": 72,
"image_quality": 70,
"start_frame": 0,
"stop_frame": 794,
"storage_method": "file_system",
"storage": "local",
"chunk_type": "imageset"
},
"jobs": [
{
"start_frame": 0,
"stop_frame": 794,
"id": 6,
"status": "annotation"
}
]
} Can we have something like json below?
|
For annotations.json before: {
"16": {
"version": 3,
"tags": [],
"shapes": [
{
"type": "rectangle",
"occluded": false,
"z_order": 0,
"points": [
971.5869140625,
462.3623046875,
1020.4619140625,
582.5683822631836
],
"frame": 0,
"label_id": 22,
"group": 0,
"source": "manual",
"attributes": []
},
{
"type": "rectangle",
"occluded": false,
"z_order": 0,
"points": [
1190.86328125,
590.4931640625,
1256.9105758666992,
715.9830322265625
],
"frame": 0,
"label_id": 22,
"group": 0,
"source": "manual",
"attributes": []
},
{
"type": "rectangle",
"occluded": false,
"z_order": 0,
"points": [
527.7490234375,
516.5205078125,
717.9652404785156,
721.2671356201172
],
"frame": 0,
"label_id": 22,
"group": 0,
"source": "manual",
"attributes": []
}
],
"tracks": []
}
} And after my suggestions: [
{
"version": 3,
"tags": [],
"shapes": [
{
"type": "rectangle",
"occluded": false,
"z_order": 0,
"points": [
971.5869140625,
462.3623046875,
1020.4619140625,
582.5683822631836
],
"frame": 0,
"label": "person",
"group": 0,
"source": "manual",
"attributes": []
},
{
"type": "rectangle",
"occluded": false,
"z_order": 0,
"points": [
1190.86328125,
590.4931640625,
1256.9105758666992,
715.9830322265625
],
"frame": 0,
"label": "person",
"group": 0,
"source": "manual",
"attributes": []
},
{
"type": "rectangle",
"occluded": false,
"z_order": 0,
"points": [
527.7490234375,
516.5205078125,
717.9652404785156,
721.2671356201172
],
"frame": 0,
"label": "person",
"group": 0,
"source": "manual",
"attributes": []
}
],
"tracks": []
}
] |
FYI: Extra |
In tasks.json we have "storage" and "storage_method". Do we really need both? |
If we export a task from a project, we can't import it back to the project. Is it known issue? We just do not have "Import task" button on the project page. The only way is to import and then move the task to the project (using this way in current implementation we lose all the annotated attributes).
Extra offset of "Create new task" button: |
I exported a task with a finished job. Imported it and job in annotation status. I suppose the same works for jobs in reviews. Also video task has overlap (5 default). Export, import it and now it has overlap 0. |
One more possible problem: Looks like issues aren't dumped together with annotations. |
|
|
cache_dir = get_export_cache_dir(db_task) | ||
output_path = osp.join(cache_dir, output_path) | ||
|
||
task_time = timezone.localtime(db_task.updated_date).timestamp() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to adjust time for clearning_job somewhere here? I believe we have multiple races here. Several users can try to backup the same task in parallel. Clearning job can remove our file after all our successful checks.
Races are fine if they don't lead to unexpected results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's merge the branch as is and try to fix remaining issues in the next PR.
self._db_task = models.Task.objects.prefetch_related('data__images').select_related('data__video').get(pk=pk) | ||
self._db_data = self._db_task.data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@azhavoro
Probably there is the same problem like in the recent fix.
select_related(data__..) breaks prefetch_related(data__...)
Motivation and context
How has this been tested?
Checklist
develop
branchcvat-core, cvat-data and cvat-ui)
License
Feel free to contact the maintainers if that's a concern.