Module ivit_i.core
Classes
class Detection (xmin: int, ymin: int, xmax: int, ymax: int, score: float, id: int, label: str)
-
The output object of iDetection
Args
xmin
:int
- the minimum of x coordinate
ymin
:int
- the minimum of y coordinate
xmax
:int
- the maximum of x coordinate
ymax
:int
- the maximum of y coordinate
score
:float
- the confidence of the detection object
id
:int
- the index of the detectino object
label
:str
- the label of the detectino object
Methods
def get_coords(self) ‑> Tuple[int, int, int, int]
-
Get coordinations
Returns
Tuple[int, int, int, int]
- the tuple include (xmin, ymin, xmax, ymax)
class iClassification (model_path: str, label_path: str, device: Literal['DPU'] = 'DPU', topk: int = 3, confidence_threshold: Union[int, float] = 0.1, **kwargs)
-
Helper class that provides a standard way to create an ABC using inheritance.
iVIT Classification
Args
model_path
:str
- path to model file ( .xmodel ).
label_path
:str
- path to label file ( .txt ).
- device (Literal["DPU"], optional): description. Defaults to "DPU".
topk
:int
, optional- return top
results. Defaults to 3. confidence_threshold
:Union[float, int]
, optional- set the threshold of confidence. Defaults to 0.1.
Ancestors
- ivit_i.core.models.model.iModel
- abc.ABC
Methods
def postprocess(self, outputs: list) ‑> List[Tuple[int, str, float]]
-
Postprocess
Args
outputs
:list
- the outputs of the model inference
Returns
List[Tuple[int, str, float]]
- the results which already tidy up
def preprocess(self, frame: numpy.ndarray) ‑> numpy.ndarray
-
Preprocess
Args
frame
:np.ndarray
- read frame from opencv
Returns
np.ndarray
- the frame already do preprocess
class iDetection (model_path: str, label_path: str, device: Literal['DPU'] = 'DPU', confidence_threshold: Union[int, float] = 0.9, anchors: Union[tuple, list, ForwardRef(None)] = None, iou_threshold: float = 0.3, **kwargs)
-
Helper class that provides a standard way to create an ABC using inheritance.
iDetection object, the r1.1 versio is only support yolov3 and yolov3-tiny
Args
model_path
:str
- path to model file ( .xmodel ).
label_path
:str
- path to label file ( .txt ).
- device (Literal["DPU"], optional): description. Defaults to "DPU".
confidence_threshold
:Union[float, int]
, optional- description. Defaults to 0.9.
anchors
:Union[tuple, list, None]
, optional- the anchor for YOLO. Defaults to None.
iou_threshold
:float
, optional- threshold for IOU. Defaults to 0.3.
Ancestors
- ivit_i.core.models.model.iModel
- abc.ABC
Static methods
def available_wrappers()
Methods
def postprocess(self, results: list) ‑> list
-
summary
Args
results
:list
- description
Returns
list
- description
def preprocess(self, frame: numpy.ndarray) ‑> numpy.ndarray
-
Preprocess
Args
frame
:np.ndarray
- read frame from opencv
Returns
np.ndarray
- the frame already do preprocess
class iModel (model_path: str, label_path: str, device: str = 'DPU', **kwargs)
-
Helper class that provides a standard way to create an ABC using inheritance.
Initialize iModel Object
Args
model_path
:str
- path to model file ( .xmodel ).
label_path
:str
- path to label file ( .txt ).
device
:str
, optional- set device uuid, current support is [ "DPU" ]. Defaults to "DPU".
kwargs
:optional
- custom options for each different model
Ancestors
- abc.ABC
Subclasses
- ivit_i.core.models.classification.iClassification
- ivit_i.core.models.detection.iDetection
Methods
def get_layer_param(*args)
def inference(self, frame: numpy.ndarray) ‑> list
-
Do Inference
Args
frame
:np.ndarray
- read frame from opencv
Returns
list
- inference results
def postprocess(self, outputs: list) ‑> list
-
Postprocess
Args
outputs
:list
- description
Raises
NotImplementedError
- description
Returns
list
- a list include each result
def preprocess(self, frame: numpy.ndarray) ‑> numpy.ndarray
-
Preprocess
Args
frame
:np.ndarray
- read frame from opencv
Raises
NotImplementedError
- description
Returns
np.ndarray
- frame with correct resolution and format
def release(self)