Data#
acoupi.data
#
Data objects for acoupi System.
Classes:
| Name | Description |
|---|---|
BoundingBox |
BoundingBox to locate a sound event in time and frequency. |
Deployment |
A Deployment captures information about the device deployment. |
Detection |
A Detection is a single prediction from a model. |
Message |
The message to be sent to the remote server. |
ModelOutput |
The output of a model. |
PredictedTag |
A PredictedTag is a label predicted by a model. |
Recording |
A Recording is a single audio file recorded from the microphone. |
Response |
The response from sending a message. |
ResponseStatus |
The status of a message. |
TimeInterval |
An interval of time between two times of day. |
Classes#
BoundingBox
#
Bases: BaseModel
BoundingBox to locate a sound event in time and frequency.
All time values are in seconds and all frequency values are in Hz.
Methods:
| Name | Description |
|---|---|
from_coordinates |
Create a BoundingBox from coordinates. |
validate_coordinates |
Validate that the coordinates are within range. |
Attributes:
| Name | Type | Description |
|---|---|---|
coordinates |
Tuple[float, float, float, float]
|
|
type |
str
|
|
Attributes#
coordinates
instance-attribute
#
type = 'BoundingBox'
class-attribute
instance-attribute
#
Functions#
from_coordinates(start_time, low_freq, end_time, high_freq)
classmethod
#
Create a BoundingBox from coordinates.
validate_coordinates(value)
#
Validate that the coordinates are within range.
Deployment
#
Bases: BaseModel
A Deployment captures information about the device deployment.
This includes the latitude, longitude, and deployment start.
Methods:
| Name | Description |
|---|---|
validate_latitude |
Validate that the latitude are within range. |
validate_longitude |
Validate that the longitude are within range. |
Attributes:
| Name | Type | Description |
|---|---|---|
ended_on |
Optional[datetime]
|
The datetime when the deployment ended. |
id |
UUID
|
The unique ID of the deployment. |
latitude |
Optional[float]
|
The latitude of the site where the device is deployed. |
longitude |
Optional[float]
|
The longitude of the site where the device is deployed. |
name |
str
|
User provided name of the deployment. |
started_on |
datetime
|
The datetime when the device was deployed. |
Attributes#
ended_on = None
class-attribute
instance-attribute
#
The datetime when the deployment ended.
id = Field(default_factory=uuid4)
class-attribute
instance-attribute
#
The unique ID of the deployment.
latitude = None
class-attribute
instance-attribute
#
The latitude of the site where the device is deployed.
longitude = None
class-attribute
instance-attribute
#
The longitude of the site where the device is deployed.
name
instance-attribute
#
User provided name of the deployment.
started_on = Field(default_factory=(datetime.datetime.now))
class-attribute
instance-attribute
#
The datetime when the device was deployed.
Functions#
validate_latitude(value)
#
Validate that the latitude are within range.
validate_longitude(value)
#
Validate that the longitude are within range.
Detection
#
Bases: BaseModel
A Detection is a single prediction from a model.
Methods:
| Name | Description |
|---|---|
sort_tags |
Sort tags. |
validate_score |
Validate that the score is between 0 and 1. |
Attributes:
| Name | Type | Description |
|---|---|---|
detection_score |
float
|
The score of the detection. |
id |
UUID
|
The unique ID of the detection |
location |
Optional[BoundingBox]
|
The location of the detection in the recording. |
tags |
List[PredictedTag]
|
The tags predicted by the model for the detection. |
Attributes#
detection_score = 1
class-attribute
instance-attribute
#
The score of the detection.
id = Field(default_factory=uuid4)
class-attribute
instance-attribute
#
The unique ID of the detection
location = None
class-attribute
instance-attribute
#
The location of the detection in the recording.
tags = Field(default_factory=list)
class-attribute
instance-attribute
#
The tags predicted by the model for the detection.
Functions#
sort_tags(value)
#
Sort tags.
validate_score(value)
#
Validate that the score is between 0 and 1.
Message
#
Bases: BaseModel
The message to be sent to the remote server.
Attributes:
| Name | Type | Description |
|---|---|---|
content |
str
|
The message to be sent. Usually a JSON string. |
created_on |
datetime
|
The datetime when the message was created. |
id |
UUID
|
The unique ID of the message. |
Attributes#
content
instance-attribute
#
The message to be sent. Usually a JSON string.
created_on = Field(default_factory=(datetime.datetime.now))
class-attribute
instance-attribute
#
The datetime when the message was created.
id = Field(default_factory=uuid4)
class-attribute
instance-attribute
#
The unique ID of the message.
ModelOutput
#
Bases: BaseModel
The output of a model.
Methods:
| Name | Description |
|---|---|
sort_detections |
Sort detections by ID. |
sort_tags |
Sort tags. |
Attributes:
| Name | Type | Description |
|---|---|---|
created_on |
datetime
|
The datetime when the model output was created. |
detections |
List[Detection]
|
List of predicted sound events in the recording. |
id |
UUID
|
The unique ID of the model output. |
name_model |
str
|
The name of the model that produced the output. |
recording |
Recording
|
The recording that was used as input to the model. |
tags |
List[PredictedTag]
|
The tags predicted by the model at the recording level. |
Attributes#
created_on = Field(default_factory=(datetime.datetime.now))
class-attribute
instance-attribute
#
The datetime when the model output was created.
detections = Field(default_factory=list)
class-attribute
instance-attribute
#
List of predicted sound events in the recording.
id = Field(default_factory=uuid4)
class-attribute
instance-attribute
#
The unique ID of the model output.
name_model
instance-attribute
#
The name of the model that produced the output.
recording
instance-attribute
#
The recording that was used as input to the model.
tags = Field(default_factory=list)
class-attribute
instance-attribute
#
The tags predicted by the model at the recording level.
Functions#
sort_detections(value)
#
Sort detections by ID.
sort_tags(value)
#
Sort tags.
PredictedTag
#
Bases: BaseModel
A PredictedTag is a label predicted by a model.
It consists of a key, a value and a score.
Methods:
| Name | Description |
|---|---|
validate_score |
Validate that the score is between 0 and 1. |
Attributes:
| Name | Type | Description |
|---|---|---|
confidence_score |
float
|
The confidence score of the predicted tag. |
tag |
Tag
|
The tag predicted by the model. |
Recording
#
Bases: BaseModel
A Recording is a single audio file recorded from the microphone.
Methods:
| Name | Description |
|---|---|
validate_audio_channels |
Validate that the number of audio_channels is greater than 1. |
validate_duration |
Validate that the duration is greater than 0. |
validate_samplerate |
Validate that the samplerate is greater than 0. |
Attributes:
| Name | Type | Description |
|---|---|---|
audio_channels |
Optional[int]
|
The number of audio_channels in the recording. |
chunksize |
Optional[int]
|
The chunksize of the audio file in bytes. Defaults to 4096. |
created_on |
datetime
|
The datetime when the recording was made |
deployment |
Deployment
|
The deployment that the recording belongs to |
duration |
float
|
The duration of the recording in seconds |
id |
UUID
|
The unique ID of the recording |
path |
Optional[Path]
|
The path to the audio file in the local filesystem |
samplerate |
int
|
The samplerate of the recording in Hz |
Attributes#
audio_channels = Field(default=1, repr=False)
class-attribute
instance-attribute
#
The number of audio_channels in the recording.
chunksize = Field(default=4096, repr=False)
class-attribute
instance-attribute
#
The chunksize of the audio file in bytes. Defaults to 4096.
created_on = Field(default_factory=(datetime.datetime.now), repr=False)
class-attribute
instance-attribute
#
The datetime when the recording was made
deployment = Field(repr=False)
class-attribute
instance-attribute
#
The deployment that the recording belongs to
duration = Field(repr=False)
class-attribute
instance-attribute
#
The duration of the recording in seconds
id = Field(default_factory=uuid4, repr=True)
class-attribute
instance-attribute
#
The unique ID of the recording
path = Field(None, repr=True)
class-attribute
instance-attribute
#
The path to the audio file in the local filesystem
samplerate = Field(repr=False)
class-attribute
instance-attribute
#
The samplerate of the recording in Hz
Functions#
validate_audio_channels(value)
#
Validate that the number of audio_channels is greater than 1.
validate_duration(value)
#
Validate that the duration is greater than 0.
validate_samplerate(value)
#
Validate that the samplerate is greater than 0.
Response
#
Bases: BaseModel
The response from sending a message.
Attributes:
| Name | Type | Description |
|---|---|---|
content |
Optional[str]
|
The content of the response. |
message |
Message
|
The message that was sent. |
received_on |
datetime
|
The datetime the message was received. |
status |
ResponseStatus
|
The status of the message. |
Attributes#
content = None
class-attribute
instance-attribute
#
The content of the response.
message
instance-attribute
#
The message that was sent.
received_on = Field(default_factory=(datetime.datetime.now))
class-attribute
instance-attribute
#
The datetime the message was received.
status
instance-attribute
#
The status of the message.
ResponseStatus
#
Bases: IntEnum
The status of a message.
Attributes:
| Name | Type | Description |
|---|---|---|
ERROR |
The message was sent, but there was an error. |
|
FAILED |
The message failed to send. |
|
SUCCESS |
The message was received successfully. |
|
TIMEOUT |
The message timed out. |
Attributes#
ERROR = 2
class-attribute
instance-attribute
#
The message was sent, but there was an error.
FAILED = 1
class-attribute
instance-attribute
#
The message failed to send.
SUCCESS = 0
class-attribute
instance-attribute
#
The message was received successfully.
TIMEOUT = 3
class-attribute
instance-attribute
#
The message timed out.
Tag
#
Bases: BaseModel
A Tag is a label for a recording.
Methods:
| Name | Description |
|---|---|
validate_key |
Validate that the key is not empty. |
validate_value |
Validate that the value is not empty. |
Attributes:
| Name | Type | Description |
|---|---|---|
key |
str
|
The key of the tag. |
value |
str
|
The value of the tag. |