Skip to content

Commit

Permalink
add overlap & segment_size flag for python cli task create (#1950)
Browse files Browse the repository at this point in the history
Thanks you so much
  • Loading branch information
foreverYoungGitHub authored Jul 29, 2020
1 parent 6eb777a commit 3f6d2e9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Source type support for tags, shapes and tracks (<https://github.com/opencv/cvat/pull/1192>)
- Source type support for CVAT Dumper/Loader (<https://github.com/opencv/cvat/pull/1192>)
- Intelligent polygon editing (<https://github.com/opencv/cvat/pull/1921>)
- Support creating multiple jobs for each task through python cli (https://github.com/opencv/cvat/pull/1950)
- python cli over https (<https://github.com/opencv/cvat/pull/1942>)

### Changed
Expand Down
4 changes: 3 additions & 1 deletion utils/cli/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,16 @@ def tasks_list(self, use_json_output, **kwargs):
response = self.session.get(url)
response.raise_for_status()

def tasks_create(self, name, labels, bug, resource_type, resources,
def tasks_create(self, name, labels, overlap, segment_size, bug, resource_type, resources,
annotation_path='', annotation_format='CVAT XML 1.1',
completion_verification_period=20, **kwargs):
""" Create a new task with the given name and labels JSON and
add the files to it. """
url = self.api.tasks
data = {'name': name,
'labels': labels,
'overlap': overlap,
'segment_size': segment_size,
'bug_tracker': bug,
}
response = self.session.post(url, json=data)
Expand Down
12 changes: 12 additions & 0 deletions utils/cli/core/definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,18 @@ def argparse(s):
type=parse_label_arg,
help='string or file containing JSON labels specification'
)
task_create_parser.add_argument(
'--overlap',
default=0,
type=int,
help='the number of intersected frames between different segments'
)
task_create_parser.add_argument(
'--segment_size',
default=0,
type=int,
help='the number of frames in a segment'
)
task_create_parser.add_argument(
'--bug',
default='',
Expand Down
2 changes: 1 addition & 1 deletion utils/cli/tests/_test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def setUp(self, mock_stdout):
self.taskname = 'test_task'
self.cli.tasks_create(self.taskname,
[{'name' : 'car'}, {'name': 'person'}],
'',
0, 0, '',
ResourceType.LOCAL,
[self.img_file])
# redirect logging to mocked stdout to test program output
Expand Down

0 comments on commit 3f6d2e9

Please sign in to comment.