fiftyone.core.session.events#

Session events.

Copyright 2017-2025, Voxel51, Inc.

Classes:

Event()

Base server event

LabelData(label_id, field, sample_id[, ...])

Screenshot(bytes, max_width)

CaptureNotebookCell(subscription, src, width)

Capture notebook cell screenshot event

CloseSession()

Close session event

DeactivateNotebookCell()

Deactivate notebook cell event

Ping()

Ping (builtin) event

ReactivateNotebookCell(subscription)

Reactivate notebook cell event

Refresh(state)

Refresh event

SelectLabels(labels)

Select labels event

SelectSamples(sample_ids)

Select samples event

ValueColor(color, value)

MaskColor(color, intTarget)

CustomizeColor(path[, fieldColor, ...])

ColorscaleList(value, color)

Colorscale(path[, name, list])

DefaultColorscale([name, list])

LabelTagsColors([fieldColor, valueColors])

ColorScheme([color_pool, color_by, ...])

SetColorScheme(color_scheme)

Set color scheme event

SetDatasetColorScheme()

Set dataset color scheme event

SetSample([group_id, sample_id])

Set sample event

SetSpaces(spaces)

Set spaces event

SetGroupSlice(slice)

Set group slice eventt

SetFieldVisibilityStage([stage])

StateUpdate(state)

State update event

AppInitializer([dataset, group_id, ...])

ListenPayload(initializer, events, subscription)

An initialization payload for an event listener request

Functions:

add_screenshot(event)

dict_factory(data)

get_screenshot(subscription[, pop])

class fiftyone.core.session.events.Event#

Bases: object

Base server event

Methods:

get_event_name()

from_data(event_name, data)

from_data_async(event_name, data)

serialize()

classmethod get_event_name() str#
static from_data(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
async static from_data_async(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
serialize()#
class fiftyone.core.session.events.LabelData(label_id: str, field: str, sample_id: str, frame_number: int | None = None, instance_id: str | None = None)#

Bases: object

Attributes:

label_id: str#
field: str#
sample_id: str#
frame_number: int | None = None#
instance_id: str | None = None#
class fiftyone.core.session.events.Screenshot(bytes: bytes, max_width: int)#

Bases: object

Attributes:

bytes: bytes#
max_width: int#
class fiftyone.core.session.events.CaptureNotebookCell(subscription: str, src: str, width: int)#

Bases: Event

Capture notebook cell screenshot event

Attributes:

Methods:

from_data(event_name, data)

from_data_async(event_name, data)

get_event_name()

serialize()

subscription: str#
src: str#
width: int#
static from_data(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
async static from_data_async(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
classmethod get_event_name() str#
serialize()#
class fiftyone.core.session.events.CloseSession#

Bases: Event

Close session event

Methods:

from_data(event_name, data)

from_data_async(event_name, data)

get_event_name()

serialize()

static from_data(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
async static from_data_async(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
classmethod get_event_name() str#
serialize()#
class fiftyone.core.session.events.DeactivateNotebookCell#

Bases: Event

Deactivate notebook cell event

Methods:

from_data(event_name, data)

from_data_async(event_name, data)

get_event_name()

serialize()

static from_data(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
async static from_data_async(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
classmethod get_event_name() str#
serialize()#
class fiftyone.core.session.events.Ping#

Bases: Event

Ping (builtin) event

Methods:

from_data(event_name, data)

from_data_async(event_name, data)

get_event_name()

serialize()

static from_data(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
async static from_data_async(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
classmethod get_event_name() str#
serialize()#
class fiftyone.core.session.events.ReactivateNotebookCell(subscription: str)#

Bases: Event

Reactivate notebook cell event

Attributes:

Methods:

from_data(event_name, data)

from_data_async(event_name, data)

get_event_name()

serialize()

subscription: str#
static from_data(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
async static from_data_async(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
classmethod get_event_name() str#
serialize()#
class fiftyone.core.session.events.Refresh(state: StateDescription)#

Bases: Event

Refresh event

Attributes:

Methods:

from_data(event_name, data)

from_data_async(event_name, data)

get_event_name()

serialize()

state: StateDescription#
static from_data(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
async static from_data_async(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
classmethod get_event_name() str#
serialize()#
class fiftyone.core.session.events.SelectLabels(labels: List[LabelData])#

Bases: Event

Select labels event

Attributes:

Methods:

from_data(event_name, data)

from_data_async(event_name, data)

get_event_name()

serialize()

labels: List[LabelData]#
static from_data(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
async static from_data_async(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
classmethod get_event_name() str#
serialize()#
class fiftyone.core.session.events.SelectSamples(sample_ids: List[str])#

Bases: Event

Select samples event

Attributes:

Methods:

from_data(event_name, data)

from_data_async(event_name, data)

get_event_name()

serialize()

sample_ids: List[str]#
static from_data(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
async static from_data_async(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
classmethod get_event_name() str#
serialize()#
class fiftyone.core.session.events.ValueColor(color: str, value: str)#

Bases: object

Attributes:

color: str#
value: str#
class fiftyone.core.session.events.MaskColor(color: str, intTarget: int | None)#

Bases: object

Attributes:

color: str#
intTarget: int | None#
class fiftyone.core.session.events.CustomizeColor(path: str, fieldColor: str | None = None, colorByAttribute: str | None = None, valueColors: List[fiftyone.core.session.events.ValueColor] | None = None, maskTargetsColors: List[fiftyone.core.session.events.MaskColor] | None = None)#

Bases: object

Attributes:

path: str#
fieldColor: str | None = None#
colorByAttribute: str | None = None#
valueColors: List[ValueColor] | None = None#
maskTargetsColors: List[MaskColor] | None = None#
class fiftyone.core.session.events.ColorscaleList(value: float, color: str)#

Bases: object

Attributes:

value: float#
color: str#
class fiftyone.core.session.events.Colorscale(path: str, name: str | None = None, list: List[fiftyone.core.session.events.ColorscaleList] | None = None)#

Bases: object

Attributes:

Methods:

path: str#
name: str | None = None#
list: List[ColorscaleList] | None = None#
serialize()#
class fiftyone.core.session.events.DefaultColorscale(name: str | None = None, list: List[fiftyone.core.session.events.ColorscaleList] | None = None)#

Bases: object

Attributes:

Methods:

name: str | None = None#
list: List[ColorscaleList] | None = None#
serialize()#
class fiftyone.core.session.events.LabelTagsColors(fieldColor: str | None = None, valueColors: List[fiftyone.core.session.events.ValueColor] | None = None)#

Bases: object

Attributes:

fieldColor: str | None = None#
valueColors: List[ValueColor] | None = None#
class fiftyone.core.session.events.ColorScheme(color_pool: List[str] | None = None, color_by: str | None = None, multicolor_keypoints: bool | None = None, opacity: float | None = None, show_skeletons: bool | None = None, fields: List[fiftyone.core.session.events.CustomizeColor] | None = None, default_mask_targets_colors: List[fiftyone.core.session.events.MaskColor] | None = None, colorscales: List[fiftyone.core.session.events.Colorscale] | None = None, default_colorscale: fiftyone.core.session.events.DefaultColorscale | None = None, label_tags: fiftyone.core.session.events.LabelTagsColors | None = None)#

Bases: object

Attributes:

Methods:

color_pool: List[str] | None = None#
color_by: str | None = None#
multicolor_keypoints: bool | None = None#
opacity: float | None = None#
show_skeletons: bool | None = None#
fields: List[CustomizeColor] | None = None#
default_mask_targets_colors: List[MaskColor] | None = None#
colorscales: List[Colorscale] | None = None#
default_colorscale: DefaultColorscale | None = None#
label_tags: LabelTagsColors | None = None#
serialize()#
class fiftyone.core.session.events.SetColorScheme(color_scheme: ColorScheme)#

Bases: Event

Set color scheme event

Attributes:

Methods:

from_odm(color_scheme)

to_odm()

from_data(event_name, data)

from_data_async(event_name, data)

get_event_name()

serialize()

color_scheme: ColorScheme#
classmethod from_odm(color_scheme: ColorScheme)#
to_odm()#
static from_data(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
async static from_data_async(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
classmethod get_event_name() str#
serialize()#
class fiftyone.core.session.events.SetDatasetColorScheme#

Bases: Event

Set dataset color scheme event

Methods:

from_data(event_name, data)

from_data_async(event_name, data)

get_event_name()

serialize()

static from_data(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
async static from_data_async(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
classmethod get_event_name() str#
serialize()#
class fiftyone.core.session.events.SetSample(group_id: str | None = None, sample_id: str | None = None)#

Bases: Event

Set sample event

Attributes:

Methods:

from_data(event_name, data)

from_data_async(event_name, data)

get_event_name()

serialize()

group_id: str | None = None#
sample_id: str | None = None#
static from_data(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
async static from_data_async(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
classmethod get_event_name() str#
serialize()#
class fiftyone.core.session.events.SetSpaces(spaces: Dict)#

Bases: Event

Set spaces event

Attributes:

Methods:

from_data(event_name, data)

from_data_async(event_name, data)

get_event_name()

serialize()

spaces: Dict#
static from_data(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
async static from_data_async(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
classmethod get_event_name() str#
serialize()#
class fiftyone.core.session.events.SetGroupSlice(slice: str)#

Bases: Event

Set group slice eventt

Attributes:

Methods:

from_data(event_name, data)

from_data_async(event_name, data)

get_event_name()

serialize()

slice: str#
static from_data(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
async static from_data_async(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
classmethod get_event_name() str#
serialize()#
class fiftyone.core.session.events.SetFieldVisibilityStage(stage: Dict | None = None)#

Bases: Event

Attributes:

Methods:

from_data(event_name, data)

from_data_async(event_name, data)

get_event_name()

serialize()

stage: Dict | None = None#
static from_data(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
async static from_data_async(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
classmethod get_event_name() str#
serialize()#
class fiftyone.core.session.events.StateUpdate(state: StateDescription)#

Bases: Event

State update event

Attributes:

Methods:

from_data(event_name, data)

from_data_async(event_name, data)

get_event_name()

serialize()

state: StateDescription#
static from_data(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
async static from_data_async(event_name: str, data: str | dict) CaptureNotebookCell | CloseSession | DeactivateNotebookCell | ReactivateNotebookCell | SelectSamples | SelectLabels | SetColorScheme | SetGroupSlice | SetSample | SetSpaces | StateUpdate | SetFieldVisibilityStage#
classmethod get_event_name() str#
serialize()#
class fiftyone.core.session.events.AppInitializer(dataset: str | None = None, group_id: str | None = None, group_slice: str | None = None, sample_id: str | None = None, view: str | None = None, workspace: str | None = None)#

Bases: object

Attributes:

dataset: str | None = None#
group_id: str | None = None#
group_slice: str | None = None#
sample_id: str | None = None#
view: str | None = None#
workspace: str | None = None#
class fiftyone.core.session.events.ListenPayload(initializer: AppInitializer | None | StateDescription, events: List[str], subscription: str, polling: bool | None = False)#

Bases: object

An initialization payload for an event listener request

Attributes:

Methods:

initializer: AppInitializer | None | StateDescription#
events: List[str]#
subscription: str#
polling: bool | None = False#
async classmethod from_dict(d: dict) ListenPayload#
fiftyone.core.session.events.add_screenshot(event: CaptureNotebookCell) None#
fiftyone.core.session.events.dict_factory(data: List[Tuple[str, Any]]) Dict[str, Any]#
fiftyone.core.session.events.get_screenshot(subscription: str, pop=False) Screenshot#