@@ -45,14 +45,14 @@ def forward(self, x):
4545class BlazeFace (nn .Module ):
4646 """The BlazeFace face detection model from MediaPipe.
4747
48- The version from MediaPipe is simpler than the one in the paper;
48+ The version from MediaPipe is simpler than the one in the paper;
4949 it does not use the "double" BlazeBlocks.
5050
5151 Because we won't be training this model, it doesn't need to have
52- batchnorm layers. These have already been "folded" into the conv
52+ batchnorm layers. These have already been "folded" into the conv
5353 weights by TFLite.
5454
55- The conversion to PyTorch is fairly straightforward, but there are
55+ The conversion to PyTorch is fairly straightforward, but there are
5656 some small differences between TFLite and PyTorch in how they handle
5757 padding on conv layers with stride 2.
5858
@@ -179,7 +179,7 @@ def predict_on_image(self, img):
179179
180180 Arguments:
181181 img: a NumPy array of shape (H, W, 3) or a PyTorch tensor of
182- shape (3, H, W). The image's height and width should be
182+ shape (3, H, W). The image's height and width should be
183183 128 pixels.
184184
185185 Returns:
@@ -198,7 +198,7 @@ def predict_on_batch(self, x):
198198 shape (b, 3, H, W). The height and width should be 128 pixels.
199199
200200 Returns:
201- A list containing a tensor of face detections for each image in
201+ A list containing a tensor of face detections for each image in
202202 the batch. If no faces are found for an image, returns a tensor
203203 of shape (0, 17).
204204
@@ -237,7 +237,7 @@ def predict_on_batch(self, x):
237237
238238 def _tensors_to_detections (self , raw_box_tensor , raw_score_tensor , anchors ):
239239 """The output of the neural network is a tensor of shape (b, 896, 16)
240- containing the bounding box regressor predictions, as well as a tensor
240+ containing the bounding box regressor predictions, as well as a tensor
241241 of shape (b, 896, 1) with the classification confidences.
242242
243243 This function converts these two "raw" tensors into proper detections.
@@ -404,10 +404,10 @@ def jaccard(box_a, box_b):
404404 jaccard overlap: (tensor) Shape: [box_a.size(0), box_b.size(0)]
405405 """
406406 inter = intersect (box_a , box_b )
407- area_a = ((box_a [:, 2 ] - box_a [:, 0 ]) *
408- (box_a [:, 3 ] - box_a [:, 1 ])).unsqueeze (1 ).expand_as (inter ) # [A,B]
409- area_b = ((box_b [:, 2 ] - box_b [:, 0 ]) *
410- (box_b [:, 3 ] - box_b [:, 1 ])).unsqueeze (0 ).expand_as (inter ) # [A,B]
407+ area_a = ((box_a [:, 2 ] - box_a [:, 0 ])
408+ * (box_a [:, 3 ] - box_a [:, 1 ])).unsqueeze (1 ).expand_as (inter ) # [A,B]
409+ area_b = ((box_b [:, 2 ] - box_b [:, 0 ])
410+ * (box_b [:, 3 ] - box_b [:, 1 ])).unsqueeze (0 ).expand_as (inter ) # [A,B]
411411 union = area_a + area_b - inter
412412 return inter / union # [A,B]
413413
0 commit comments