epic_kitchens.hoa.types
¶
The core set of types that represent hand-object detections
Module Contents¶
Classes¶
Generic enumeration. |
|
An enum describing the different states a hand can be in: |
|
A floating-point 2D vector representation |
|
Dataclass representing a hand detection, consisting of a bounding box, |
|
Dataclass representing an object detection, consisting of a bounding box and a |
|
Dataclass representing hand-object detections for a frame of a video |
-
class
epic_kitchens.hoa.types.
HandSide
¶ Bases:
enum.Enum
Generic enumeration.
Derive from this class to define new enumerations.
-
LEFT
= 0¶
-
RIGHT
= 1¶
-
__repr__
(self)¶ Return repr(self).
-
__str__
(self)¶ Return str(self).
-
__dir__
(self)¶ Default dir() implementation.
-
__format__
(self, format_spec)¶ Default object formatter.
-
__hash__
(self)¶ Return hash(self).
-
__reduce_ex__
(self, proto)¶ Helper for pickle.
-
name
(self)¶ The name of the Enum member.
-
value
(self)¶ The value of the Enum member.
-
-
class
epic_kitchens.hoa.types.
HandState
¶ Bases:
enum.Enum
An enum describing the different states a hand can be in: - No contact: The hand isn’t touching anything - Self contact: The hand is touching itself - Another person: The hand is touching another person - Portable object: The hand is in contact with a portable object - Stationary object: The hand is in contact with an immovable/stationary object
-
NO_CONTACT
= 0¶
-
SELF_CONTACT
= 1¶
-
ANOTHER_PERSON
= 2¶
-
PORTABLE_OBJECT
= 3¶
-
STATIONARY_OBJECT
= 4¶
-
__repr__
(self)¶ Return repr(self).
-
__str__
(self)¶ Return str(self).
-
__dir__
(self)¶ Default dir() implementation.
-
__format__
(self, format_spec)¶ Default object formatter.
-
__hash__
(self)¶ Return hash(self).
-
__reduce_ex__
(self, proto)¶ Helper for pickle.
-
name
(self)¶ The name of the Enum member.
-
value
(self)¶ The value of the Enum member.
-
-
class
epic_kitchens.hoa.types.
FloatVector
¶ A floating-point 2D vector representation
-
x
:np.float32¶
-
y
:np.float32¶
-
to_protobuf
(self) → epic_kitchens.hoa.types_pb2.FloatVector¶
-
static
from_protobuf
(vector: epic_kitchens.hoa.types_pb2.FloatVector) → epic_kitchens.hoa.types.FloatVector¶
-
__add__
(self, other: epic_kitchens.hoa.types.FloatVector) → epic_kitchens.hoa.types.FloatVector¶
-
__mul__
(self, scaler: float) → epic_kitchens.hoa.types.FloatVector¶
-
-
class
epic_kitchens.hoa.types.
BBox
¶ -
left
:float¶
-
top
:float¶
-
right
:float¶
-
bottom
:float¶
-
to_protobuf
(self) → epic_kitchens.hoa.types_pb2.BBox¶
-
static
from_protobuf
(bbox: epic_kitchens.hoa.types_pb2.BBox) → epic_kitchens.hoa.types.BBox¶
-
-
class
epic_kitchens.hoa.types.
HandDetection
¶ Dataclass representing a hand detection, consisting of a bounding box, a score (representing the model’s confidence this is a hand), the predicted state of the hand, whether this is a left/right hand, and a predicted offset to the interacted object if the hand is interacting.
-
bbox
:BBox¶
-
score
:np.float32¶
-
state
:HandState¶
-
side
:HandSide¶
-
object_offset
:FloatVector¶
-
to_protobuf
(self) → epic_kitchens.hoa.types_pb2.HandDetection¶
-
static
from_protobuf
(detection: epic_kitchens.hoa.types_pb2.HandDetection) → epic_kitchens.hoa.types.HandDetection¶
-
-
class
epic_kitchens.hoa.types.
ObjectDetection
¶ Dataclass representing an object detection, consisting of a bounding box and a score (the model’s confidence this is an object)
-
bbox
:BBox¶
-
score
:np.float32¶
-
to_protobuf
(self) → epic_kitchens.hoa.types_pb2.ObjectDetection¶
-
static
from_protobuf
(detection: epic_kitchens.hoa.types_pb2.ObjectDetection) → epic_kitchens.hoa.types.ObjectDetection¶
-
-
class
epic_kitchens.hoa.types.
FrameDetections
¶ Dataclass representing hand-object detections for a frame of a video
-
video_id
:str¶
-
frame_number
:int¶
-
objects
:List[ObjectDetection]¶
-
hands
:List[HandDetection]¶
-
to_protobuf
(self) → epic_kitchens.hoa.types_pb2.Detections¶
-
static
from_protobuf
(detections: epic_kitchens.hoa.types_pb2.Detections) → epic_kitchens.hoa.types.FrameDetections¶
-
static
from_protobuf_str
(pb_str: bytes) → epic_kitchens.hoa.types.FrameDetections¶
-
get_hand_object_interactions
(self, object_threshold: float = 0, hand_threshold: float = 0) → Dict[int, int]¶ Match the hands to objects based on the hand offset vector that the model uses to predict the location of the interacted object.
- Parameters
object_threshold – Object score threshold above which to consider objects for matching
hand_threshold – Hand score threshold above which to consider hands for matching.
- Returns
A dictionary mapping hand detections to objects by indices
-