util package

add_labels_to_dataframe

edgeimpulse.experimental.util.add_labels_to_dataframe(
		df,
		labels,
		label_col_name='label'
)

Adds labels to a DataFrame based on provided label information.

Parameters

  • df

  • labels

  • label_col_name='label'

convert_json_cbor_to_dataframe

edgeimpulse.experimental.util.convert_json_cbor_to_dataframe(
		data,
		ts_col_name=None
)

Converts JSON CBOR data to a pandas DataFrame.

Parameters

  • data

  • ts_col_name=None

convert_sample_to_dataframe

edgeimpulse.experimental.util.convert_sample_to_dataframe(
		sample,
		label_col_name: Optional[str= 'label',
		ts_col_name: Optional[str= None
)

Converts a sample to a DataFrame and adds labels if provided.

Parameters

  • sample

  • label_col_name: Optional[str] = 'label'

  • ts_col_name: Optional[str] = None

fetch_samples

edgeimpulse.experimental.util.fetch_samples(
		filename: Optional[str= None,
		category: Optional[str= None,
		labels: Optional[str= None,
		max_workers=None
)

Fetch samples based on the provided parameters and stream them by their IDs.

Parameters

  • filename: Optional[str] = None

  • category: Optional[str] = None

  • labels: Optional[str] = None

  • max_workers=None

generate_labels_from_dataframe

edgeimpulse.experimental.util.generate_labels_from_dataframe(
		df,
		label_col='label',
		file_name=None
)

Generates structured labels from a DataFrame based on transitions in the specified label column.

This function iterates over the rows of a pandas DataFrame and detects changes in the values of a specified label column. It groups consecutive rows with the same label value, and for each group, it returns a dictionary containing the start index, end index, and the label. Optionally, the result can be returned in a dictionary format, compatible with file saving, including the file name.

Parameters

  • df

  • label_col='label'

  • file_name=None

Last updated