DataModels package
Submodules
DataModels.BaseModel module
- class DataModels.BaseModel.BaseModel(*, id: str | None = None, dateObserved: datetime = None, type: str = 'BaseModel')[source]
Bases:
BaseModelBase class for the toolbox data models.
- Attributes to override:
__rel_attrs__ (set): Set of attributes names that are relationships.
__context__ (set): Set of context URIs.
type (Field): Data model type name.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- class Config[source]
Bases:
objectPydantic configuration
- allow_population_by_field_name = True
- arbitrary_types_allowed = True
- property context: Set[str]
Return a set with the context URLs of the entity.
- dateObserved: datetime
Entity creation time
- id: str | None
Unique identifier of the entity
- property rel_attrs: Set[str]
Return a set with the names of the attributes that are relationships.
- type: str
Name of the entity type
DataModels.DataModelsCatalog module
- DataModels.DataModelsCatalog.data_models_catalog: Dict[str, Type[BaseModel]] = {'Face': <class 'DataModels.Face.Face'>, 'Image': <class 'DataModels.Image.Image'>, 'InstanceSegmentation': <class 'DataModels.InstanceSegmentation.InstanceSegmentation'>, 'PersonKeyPoints': <class 'DataModels.PersonKeyPoints.PersonKeyPoints'>}
Dict storing the class responsible of each data model. The key is a string of the data model type.
DataModels.Face module
- class DataModels.Face.Face(*, id: str | None = None, dateObserved: datetime = None, type: str = 'Face', image: str | None = None, boundingBox: BoundingBox | None = None, detectionConfidence: float | None = None, age: float | None = None, gender: Gender | None = None, genderConfidence: float | None = None, emotion: Emotion | None = None, emotionConfidence: float | None = None, features: list | None = None, featuresAlgorithm: str | None = None, recognitionDomain: str | None = None, recognized: bool | None = False, recognizedDistance: float | None = None, recognizedPerson: str | None = None)[source]
Bases:
BaseModelThis data model stores information about a face, such as its estimated age, gender or identity. It is intended to be used with computer vision algorithms to infer common properties from a facial image.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- class Config[source]
Bases:
objectPydantic configuration
- schema_extra = {'description': 'This entity stores information about a face, such as its estimated age, gender or identity. It is intended to be used with computer vision algorithms to infer common properties from a facial image'}
- age: float | None
The estimated age of the face
- bounding_box: BoundingBox | None
Bounding box of the detected face
- detection_confidence: float | None
Confidence of the face detection
- emotion: Emotion | None
The inferred emotion of the face
- emotion_confidence: float | None
Confidence of the emotion classification
- features: list | None
Facial features extracted with a computer vision algorithm used for face recognition tasks
- features_algorithm: str | None
Name of the algorithm used to generate the features
- gender: Gender | None
The inferred gender of the face
- gender_confidence: float | None
Confidence of the gender classification
- image: str | None
Id of the source image
- recognition_domain: str | None
The face recognition domain. I.e. name of the group of people to recognize
- recognized: bool | None
Flags whether a face recognition task has been performed
- recognized_distance: float | None
Distance between the extracted features and the most similar face on the dataset. Less distance means more similarity
- recognized_person: str | None
Name or id of the recognized person
- type: str
The data model type (“Face”). Should not be changed.
DataModels.Image module
- class DataModels.Image.Image(*, id: str | None = None, dateObserved: datetime = None, type: str = 'Image', width: int, height: int, path: str = '', url: str = '', source: str = '', purpose: str = '')[source]
Bases:
BaseModelThis data model stores information about an image file that is uploaded to a server from a camera or any other source, and that is available to other services.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- class Config[source]
Bases:
objectPydantic configuration
- schema_extra = {'description': 'This entity stores information about an image file that is uploaded to a server from a camera or any other source, and that is available to other services'}
- height: int
Height of the image in pixels
- path: str
Local file path to the image within the storage host
- purpose: str
The purpose of the image, if any
- source: str
The ID of the entity that created the image or a text describing the source of the image
- type: str
The data model type (“Image”). Should not be changed.
- url: str
URL to the image
- width: int
Width of the image in pixels
DataModels.InstanceSegmentation module
- class DataModels.InstanceSegmentation.InstanceSegmentation(*, id: str | None = None, dateObserved: datetime = None, type: str = 'InstanceSegmentation', image: str | None = None, mask: SegmentationMask | None = None, boundingBox: BoundingBox | None = None, label: str | None = None, labelId: int | None = None, confidence: float | None = None)[source]
Bases:
BaseModelThis data model stores information about segmented objects on an image. It is intended to be used with instance segmentation algorithms to detect objects and infer a segmentation mask.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- class Config[source]
Bases:
objectPydantic configuration
- schema_extra = {'description': 'This entity stores information about segmented objects on an image. It is intended to be used with instance segmentation algorithms to detect objects and infer a segmentation mask'}
- bounding_box: BoundingBox | None
Bounding box of the detected instance
- confidence: float | None
Confidence of the detection
- image: str | None
Id of the source image
- label: str | None
Name of the predicted class
- label_id: int | None
Id of the label
- mask: SegmentationMask | None
Segmentation mask of the detected instance
- type: str
The data model type (“InstanceSegmentation”). Should not be changed.
DataModels.Notification module
- class DataModels.Notification.Notification(*, id: str, type: str, subscriptionId: str, notifiedAt: datetime, data: List[dict])[source]
Bases:
BaseModelData model for the context broker subscription notifications.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- data: List[dict]
- id: str
- notifiedAt: datetime
- subscriptionId: str
- type: str
DataModels.PersonKeyPoints module
- class DataModels.PersonKeyPoints.PersonKeyPoints(*, id: str | None = None, dateObserved: datetime = None, type: str = 'PersonKeyPoints', image: str | None = None, boundingBox: BoundingBox | None = None, confidence: float | None = None, keypoints: COCOKeypoints | None = None)[source]
Bases:
BaseModelThis data model stores information about a set of body-keypoints of an image of a person. It is intended to be used with computer vision algorithms to infer the position of different parts of the body from an image.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- class Config[source]
Bases:
objectPydantic configuration
- schema_extra = {'description': 'This entity stores information about a set of body-keypoints of an image of a person. It is intended to be used with computer vision algorithms to infer the position of different parts of the body from an image'}
- bounding_box: BoundingBox | None
Bounding box of the detected person
- confidence: float | None
Confidence of the detection
- image: str | None
Id of the source image
- keypoints: COCOKeypoints | None
Keypoints of the detected person
- type: str
The data model type (“PersonKeyPoints”). Should not be changed.