Skip to content

Conversation

@gdj0nes
Copy link

@gdj0nes gdj0nes commented Nov 3, 2021

Batch mode allows you to specify specific data rows rather than entire datasets for labeling

https://docs.labelbox.com/docs/batch-queue

  • First version of the batch mode in the SDK

@gdj0nes gdj0nes requested a review from msokoloff1 November 3, 2021 01:13
Comment on lines 485 to 499
def change_queue_mode(self, mode: str):
"""Change the queue between Batch and Datasets mode
Args:
mode: `BATCH` or `DATASET`
"""
if mode == "BATCH":
self._update_queue_mode("ENABLED")

elif mode == "DATASET":
self._update_queue_mode("DISABLED")
else:
raise ValueError(
"Must provide either `BATCH` or `DATASET` as a mode")

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msokoloff1 how hard would it be to get this into the update call

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i added it but it might be a bit of a hack

@gdj0nes gdj0nes changed the title Batch Mode [DIAG-944] Batch Mode Nov 3, 2021
Comment on lines 54 to 62
@classmethod
def from_2D_array(cls, arr: TypedArray[Literal['uint8']], **kwargs):

if len(arr.shape) != 2:
raise ValueError(
f"Found array with shape {arr.shape}. Expected two dimensions ([W,H])"
)
arr = np.stack((arr,) * 3, axis=-1)
return cls(arr=arr, **kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is something old you might have had locally.

Comment on lines 534 to 537
if self.tag_set_status == "ENABLED":
return True
else:
return False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return self.tag_set_status == "ENABLED"

'projectId': self.uid,
'status': status
})
self.tag_set_status = status
Copy link
Contributor

@msokoloff1 msokoloff1 Nov 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tag_set_status is not going to be defined until this point. On Project init we should fetch the existing status since other parts of the code rely on this being set.

Comment on lines +520 to +523
self.client.execute(query_str, {
'projectId': self.uid,
'status': status
})
Copy link
Contributor

@msokoloff1 msokoloff1 Nov 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not run this if the current queue mode == mode param the user passed in

benchmarks = Relationship.ToMany("Benchmark", False)
ontology = Relationship.ToOne("Ontology", True)

def update(self, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any danger to toggling the mode? What happens to existing annotations or data in the queue?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be handled by product in the future

@GrantEating
Copy link
Contributor

  • First version of the batch mode in the SDK

Can you provide a more lengthy description? I dont know what batch mode is. I would love to understand the ideas behind the PR before reviewing

@gdj0nes gdj0nes requested a review from msokoloff1 November 8, 2021 18:43
@msokoloff1 msokoloff1 self-requested a review November 8, 2021 18:55
Copy link
Contributor

@msokoloff1 msokoloff1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a couple of small things

Comment on lines 18 to 19
# raster = rectangle.draw(height=32, width=32)
# assert (cv2.imread("tests/data/assets/rectangle.png") == raster).all()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsure but I'll uncommit to see if it passes

@msokoloff1 msokoloff1 self-requested a review November 8, 2021 19:00
@gdj0nes gdj0nes requested a review from msokoloff1 November 9, 2021 00:58
@gdj0nes gdj0nes merged commit 47bab9d into develop Nov 9, 2021
@msokoloff1 msokoloff1 deleted the gj/batch-mode branch November 9, 2021 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants