Detection
Face detector
- class expert.data.detection.face_detector.FaceDetector(model_selection: Optional[int] = 0, min_detection_confidence: Optional[float] = 0.75, max_num_faces: Optional[int] = 10, device: Optional[torch.device] = None)[source]
Bases:
objectFace detection and embedding implementation.
FaceDetector processes an BGR image and returns a list of the detected face embeddings and bounding boxes.
Example
>>> face_detector = FaceDetector(model_selection=0, min_detection_confidence=0.9)
- property device: torch.device
Check the device type.
- Returns
Device type on local machine.
- Return type
torch.device
Inception resnet
- class expert.data.detection.inception_resnet_v1.BasicConv2d(in_planes: int, out_planes: int, kernel_size: int, stride: int, padding: int = 0)[source]
Bases:
torch.nn.modules.module.Module- forward(x: torch.Tensor) torch.Tensor[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class expert.data.detection.inception_resnet_v1.Block35(scale: float = 1.0)[source]
Bases:
torch.nn.modules.module.Module- forward(x: torch.Tensor) torch.Tensor[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class expert.data.detection.inception_resnet_v1.Block17(scale: float = 1.0)[source]
Bases:
torch.nn.modules.module.Module- forward(x: torch.Tensor) torch.Tensor[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class expert.data.detection.inception_resnet_v1.Block8(scale: float = 1.0, noReLU: bool = False)[source]
Bases:
torch.nn.modules.module.Module- forward(x: torch.Tensor) torch.Tensor[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class expert.data.detection.inception_resnet_v1.Mixed_6a[source]
Bases:
torch.nn.modules.module.Module- forward(x: torch.Tensor) torch.Tensor[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class expert.data.detection.inception_resnet_v1.Mixed_7a[source]
Bases:
torch.nn.modules.module.Module- forward(x: torch.Tensor) torch.Tensor[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class expert.data.detection.inception_resnet_v1.InceptionResnetV1(pretrained: Optional[str] = 'vggface2', classify: Optional[bool] = False, num_classes: Optional[int] = None, dropout_prob: Optional[float] = 0.6, device: Optional[torch.device] = None)[source]
Bases:
torch.nn.modules.module.ModuleInception Resnet V1 model with optional loading of pretrained weights.
Model parameters can be loaded based on pretraining on the VGGFace2 or CASIA-Webface datasets. Pretrained state_dicts are automatically downloaded on model instantiation if requested and cached in the torch cache. Subsequent instantiations use the cache rather than redownloading.
- Raises
Exception – If “pretrained” is not specified and “classify” is True, “num_classes” must be specified.
Example
>>> import torch >>> device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') >>> resnet = InceptionResnetV1(pretrained='vggface2', device=device).eval()
- property device: torch.device
Check the device type.
- Returns
Device type on local machine.
- Return type
torch.device