sample_type module

DataAcquisition

class edgeimpulse.data.sample_type.DataAcquisition(
		protected: edgeimpulse.data.sample_type.Protected,
		payload: edgeimpulse.data.sample_type.Payload,
		signature: Optional[str= None
)

Wrapper class for the Edge Impulse data acquisition format.

See here for more information: https://docs.edgeimpulse.com/reference/data-acquisition-format.

Parameters

  • protected: edgeimpulse.data.sample_type.Protected

  • payload: edgeimpulse.data.sample_type.Payload

  • signature: Optional[str] = None

Class variables

  • payload: edgeimpulse.data.sample_type.Payload

  • protected: edgeimpulse.data.sample_type.Protected

  • signature: Optional[str]

Payload

class edgeimpulse.data.sample_type.Payload(
		device_type: str,
		sensors: List[edgeimpulse.data.sample_type.Sensor],
		values: List[List[float]],
		interval_ms: Optional[int= 0,
		device_name: Optional[str= None
)

Wrapper class for the sensor data.

Information about the data acquisition format can be found here: https://docs.edgeimpulse.com/reference/data-acquisition-format.

Parameters

  • device_type: str

  • sensors: List[edgeimpulse.data.sample_type.Sensor]

  • values: List[List[float]]

  • interval_ms: Optional[int] = 0

  • device_name: Optional[str] = None

Class variables

  • device_name: Optional[str]

  • device_type: str

  • interval_ms: Optional[int]

  • sensors: List[edgeimpulse.data.sample_type.Sensor]

  • values: List[List[float]]

Protected

class edgeimpulse.data.sample_type.Protected(
		ver: str = 'v1',
		alg: Literal['HS256''none'= 'none',
		iat: Optional[int= None
)

Wrapper class for information about the signature format.

More information can be found here: https://docs.edgeimpulse.com/reference/data-acquisition-format.

Parameters

  • ver: str = 'v1'

  • alg: Literal['HS256', 'none'] = 'none'

  • iat: Optional[int] = None

Class variables

  • alg: Literal['HS256', 'none']

  • iat: Optional[int]

  • ver: str

Sample

class edgeimpulse.data.sample_type.Sample(
		data: Union[io.BufferedIOBase, _io.StringIO, str],
		filename: Optional[str= None,
		category: Optional[Literal['training''testing''anomaly''split']] = 'split',
		label: Optional[str= None,
		bounding_boxes: Optional[List[dict]] = None,
		metadata: Optional[dict= None,
		sample_id: Optional[int= None,
		structured_labels: Optional[List[dict]] = None
)

Wrapper class for sample data, labels, and associated metadata.

Sample data should be contained in a file or file-like object, for example, as the return from open(..., "rb"). The upload_samples() function expects Sample objects as input.

Parameters

  • data: Union[io.BufferedIOBase, _io.StringIO, str]

  • filename: Optional[str] = None

  • category: Optional[Literal['training', 'testing', 'anomaly', 'split']] = 'split'

  • label: Optional[str] = None

  • bounding_boxes: Optional[List[dict]] = None

  • metadata: Optional[dict] = None

  • sample_id: Optional[int] = None

  • structured_labels: Optional[List[dict]] = None

Class variables

  • bounding_boxes: Optional[List[dict]]

  • category: Optional[Literal['training', 'testing', 'anomaly', 'split']]

  • data: Union[io.BufferedIOBase, _io.StringIO, str]

  • filename: Optional[str]

  • label: Optional[str]

  • metadata: Optional[dict]

  • sample_id: Optional[int]

  • structured_labels: Optional[List[dict]]

SampleInfo

class edgeimpulse.data.sample_type.SampleInfo(
		sample_id: Optional[int= None,
		filename: Optional[str= None,
		category: Optional[str= None,
		label: Optional[str= None
)

Wrapper for the response from the Edge Impulse ingestion service when retrieving sample information.

Parameters

  • sample_id: Optional[int] = None

  • filename: Optional[str] = None

  • category: Optional[str] = None

  • label: Optional[str] = None

Class variables

  • category: Optional[str]

  • filename: Optional[str]

  • label: Optional[str]

  • sample_id: Optional[int]

SampleIngestionResponse

class edgeimpulse.data.sample_type.SampleIngestionResponse(
		sample: edgeimpulse.data.sample_type.Sample,
		response: dict
)

Wrapper for the response from the Edge Impulse ingestion service when uploading a sample along with the sample that was uploaded.

Parameters

  • sample: edgeimpulse.data.sample_type.Sample

  • response: dict

Sensor

class edgeimpulse.data.sample_type.Sensor(
		name: str,
		units: Literal['m', 'kg', 'g', 's', 'A', 'K', 'cd', 'mol', 'Hz', 'rad', 'sr', 'N', 'Pa', 'J', 'W', 'C', 'V', 'F', 'Ohm', 'S', 'Wb', 'T', 'H', 'Cel', 'lm', 'lx', 'Bq', 'Gy', 'Sv', 'kat', 'm2', 'm3', 'l', 'm/s', 'm/s2', 'm3/s', 'l/s', 'W/m2', 'cd/m2', 'bit', 'bit/s', 'lat', 'lon', 'pH', 'dB', 'dBW', 'Bspl', 'count', '/', '%', '%RH', '%EL', 'EL', '1/s', '1/min', 'beat/min', 'beats', 'S/m', 'B', 'VA', 'VAs', 'var', 'vars', 'J/m', 'kg/m3', 'deg', 'NTU', 'rgba'] = 'm/s'
)

Represents a sensor in the Edge Impulse data acquisition format.

Note: The units must comply with the SenML units list: https://www.iana.org/assignments/senml/senml.xhtml

Parameters

  • name: str

  • units: Literal['m', 'kg', 'g', 's', 'A', 'K', 'cd', 'mol', 'Hz', 'rad', 'sr', 'N', 'Pa', 'J', 'W', 'C', 'V', 'F', 'Ohm', 'S', 'Wb', 'T', 'H', 'Cel', 'lm', 'lx', 'Bq', 'Gy', 'Sv', 'kat', 'm2', 'm3', 'l', 'm/s', 'm/s2', 'm3/s', 'l/s', 'W/m2', 'cd/m2', 'bit', 'bit/s', 'lat', 'lon', 'pH', 'dB', 'dBW', 'Bspl', 'count', '/', '%', '%RH', '%EL', 'EL', '1/s', '1/min', 'beat/min', 'beats', 'S/m', 'B', 'VA', 'VAs', 'var', 'vars', 'J/m', 'kg/m3', 'deg', 'NTU', 'rgba'] = 'm/s'

Class variables

  • name: str

  • units: Literal['m', 'kg', 'g', 's', 'A', 'K', 'cd', 'mol', 'Hz', 'rad', 'sr', 'N', 'Pa', 'J', 'W', 'C', 'V', 'F', 'Ohm', 'S', 'Wb', 'T', 'H', 'Cel', 'lm', 'lx', 'Bq', 'Gy', 'Sv', 'kat', 'm2', 'm3', 'l', 'm/s', 'm/s2', 'm3/s', 'l/s', 'W/m2', 'cd/m2', 'bit', 'bit/s', 'lat', 'lon', 'pH', 'dB', 'dBW', 'Bspl', 'count', '/', '%', '%RH', '%EL', 'EL', '1/s', '1/min', 'beat/min', 'beats', 'S/m', 'B', 'VA', 'VAs', 'var', 'vars', 'J/m', 'kg/m3', 'deg', 'NTU', 'rgba']

UploadSamplesResponse

class edgeimpulse.data.sample_type.UploadSamplesResponse(
		successes: List[edgeimpulse.data.sample_type.SampleIngestionResponse],
		fails: List[edgeimpulse.data.sample_type.SampleIngestionResponse]
)

Response from the Edge Impulse server when uploading multiple samples.

Parameters

  • successes: List[edgeimpulse.data.sample_type.SampleIngestionResponse]

  • fails: List[edgeimpulse.data.sample_type.SampleIngestionResponse]

Methods

extend

edgeimpulse.data.sample_type.extend(
		self,
		successes: List[edgeimpulse.data.sample_type.SampleIngestionResponse],
		fails: List[edgeimpulse.data.sample_type.SampleIngestionResponse]
)

Add new responses to the existing responses.

Parameters

  • self

  • successes: List[edgeimpulse.data.sample_type.SampleIngestionResponse]

  • fails: List[edgeimpulse.data.sample_type.SampleIngestionResponse]

Last updated