Properties
-
dataset_version_id
UUID of the DatasetVersion of this campaign -
name
Name of the campaign
Methods
add_tags
add_tags(
tags: Union[Tag, list[Tag]]
)
Description
Add some tags to an object.
It can be used on Data/MultiData/Asset/MultiAsset/DatasetVersion/Dataset/Model/ModelVersion.
You can give a Tag or a list of Tag.
Examples
tag_bicycle = client.create_tag("bicycle", Target.DATA)
tag_car = client.create_tag("car", Target.DATA)
tag_truck = client.create_tag("truck", Target.DATA)
data.add_tags(tag_bicycle)
data.add_tags([tag_car, tag_truck])
update
update(
name: Optional[str] = None, description: Optional[str] = None,
instructions_object_name: Optional[str] = None,
instructions_text: Optional[str] = None, end_date: Optional[date] = None,
auto_add_new_assets: Optional[bool] = None,
auto_close_on_completion: Optional[bool] = None
)
Description
Update this campaign parameters
Examples
foo_campaign.update(name="another-name")
Arguments
-
name (str, optional) : name of the campaign. Defaults to None.
-
description (str, optional) : Description of the campaign. Defaults to None.
-
instructions_object_name (str, optional) : Instructions file object name stored on S3. Defaults to None.
-
instructions_text (str, optional) : Instructions text. Defaults to None.
-
end_date (date, optional) : End date of the campaign. Defaults to None.
auto_add_new_assets (bool, optional):
If true, new assets of this dataset will be added as a task in the campaign. Defaults to None.
auto_close_on_completion (bool, optional):
If true, campaign will be close when all tasks will be done. Defaults to None.
upload_instructions_file
upload_instructions_file(
path: str
)
Description
Upload instructions for this campaign
Examples
foo_campaign.upload_instructions_file("/path/to/file.pdf")
Arguments
- path (str) : Path of instructions file
delete
delete()
Description
Delete a campaign.
⚠️ DANGER ZONE: Be very careful here!
It will remove this campaign from our database, all tasks and assignments will be removed.
This will not delete annotations and assets.
Examples
foo_campaign.delete()
add_step
add_step(
name: str, type: Union[CampaignStepType, str], description: Optional[str] = None,
assignees: Optional[list[tuple[Union[Worker, UUID], Union[float, int]]]] = None,
order: Optional[int] = None
)
Description
Add a step on this campaign.
Examples
workers = foo_dataset.list_workers()
# In first step, 2 over 3 annotation task will be assigned to worker 1, third one is going to worker 0
foo_campaign.add_step(
name="annotation-step",
type="ANNOTATION",
description="annotation step",
assignees=[(workers[0], 1.0), (workers[1], 2.0)]
)
# In second step, all review task will be assigned to worker 2
foo_campaign.add_step(
name="review-step",
type="REVIEW",
description="review step",
assignees=[(workers[2], 1)]
)
Arguments
-
name (str) : name of the step
-
type (str or CampaignStepType) : Type of the step: can be ANNOTATION or REVIEW
-
description (str, optional) : Description of the step. Defaults to None.
-
assignees (list of tuple of (worker or UUID), float, optional) : Can be used to assign workers to this step.
Defaults to None. -
order (int, optional) : Index where to insert the step in the workflow, the step will be appended at the end
if nothing is specified. Defaults to None.
Returns
dict, data of this step
list_steps
list_steps()
Description
List all the steps of this campaign.
Returns
a list of steps of this campaign as python dict
launch
launch(
existing_annotations_step_id: Union[str, UUID, None] = None
)
Description
Launch this campaign, creating assignments on steps you have created before.
Examples
workers = foo_dataset.list_workers()
foo_campaign = foo_dataset_version.create_campaign("foo-campaign")
foo_campaign.add_step(
name="annotation-step",
type="ANNOTATION",
assignees=[(workers[0], 1.0), (workers[1], 2.0)]
)
review_step = foo_campaign.add_step(
name="review-step",
type="REVIEW",
assignees=[(workers[2], 1)]
)
foo_campaign.launch(existing_annotations_step_id=review_step["id"])
Arguments
existing_annotations_step_id (UUID or str, optional):
If given, will create assignments for existing annotations on given step_id.
You also can give "DONE" in this field, it will create assignments in DONE last step. Defaults to None.
Returns
a Job, that you can wait for.