Skip to content

Commit

Permalink
add codespell and fix typos discovered by codespell
Browse files Browse the repository at this point in the history
  • Loading branch information
xinntao committed Sep 27, 2021
1 parent 206e0cc commit 0949144
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 yapf isort
pip install codespell flake8 isort yapf
- name: Lint
run: |
codespell
flake8 .
isort --check-only --diff facexlib/ inference/ scripts/ setup.py
yapf -r -d facexlib/ inference/ scripts/ setup.py
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ repos:
hooks:
- id: yapf

# codespell
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell

# pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
Expand Down
4 changes: 2 additions & 2 deletions facexlib/detection/retinaface.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def __init__(self, network_name='resnet50', half=False, phase='test'):
self.target_size, self.max_size = 1600, 2150
self.resize, self.scale, self.scale1 = 1., None, None
self.mean_tensor = torch.tensor([[[[104.]], [[117.]], [[123.]]]]).to(device)
self.refrence = get_reference_facial_points(default_square=True)
self.reference = get_reference_facial_points(default_square=True)
# Build network.
backbone = None
if cfg['name'] == 'mobilenet0.25':
Expand Down Expand Up @@ -245,7 +245,7 @@ def __align_multi(self, image, boxes, landmarks, limit=None):
for landmark in landmarks:
facial5points = [[landmark[2 * j], landmark[2 * j + 1]] for j in range(5)]

warped_face = warp_and_crop_face(np.array(image), facial5points, self.refrence, crop_size=(112, 112))
warped_face = warp_and_crop_face(np.array(image), facial5points, self.reference, crop_size=(112, 112))
faces.append(warped_face)

return np.concatenate((boxes, landmarks), axis=1), faces
Expand Down
6 changes: 3 additions & 3 deletions facexlib/detection/retinaface_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,16 @@ def match(threshold, truths, priors, variances, labels, landms, loc_t, conf_t, l
overlap, encode the bounding boxes, then return the matched indices
corresponding to both confidence and location preds.
Args:
threshold: (float) The overlap threshold used when mathing boxes.
threshold: (float) The overlap threshold used when matching boxes.
truths: (tensor) Ground truth boxes, Shape: [num_obj, 4].
priors: (tensor) Prior boxes from priorbox layers, Shape: [n_priors,4].
variances: (tensor) Variances corresponding to each prior coord,
Shape: [num_priors, 4].
labels: (tensor) All the class labels for the image, Shape: [num_obj].
landms: (tensor) Ground truth landms, Shape [num_obj, 10].
loc_t: (tensor) Tensor to be filled w/ endcoded location targets.
loc_t: (tensor) Tensor to be filled w/ encoded location targets.
conf_t: (tensor) Tensor to be filled w/ matched indices for conf preds.
landm_t: (tensor) Tensor to be filled w/ endcoded landm targets.
landm_t: (tensor) Tensor to be filled w/ encoded landm targets.
idx: (int) current batch index
Return:
The matched indices corresponding to 1)location 2)confidence
Expand Down
2 changes: 1 addition & 1 deletion facexlib/tracking/kalman_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self, bbox):
# define constant velocity model
# TODO: x: what is the meanning of x[4:7], v?
self.kf = KalmanFilter(dim_x=7, dim_z=4)
# F (dim_x, dim_x): state transistion matrix
# F (dim_x, dim_x): state transition matrix
self.kf.F = np.array([[1, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0,
1], [0, 0, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1]])
Expand Down
2 changes: 1 addition & 1 deletion facexlib/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def scandir(dir_path, suffix=None, recursive=False, full_path=False):
full_path (bool, optional): If set to True, include the dir_path.
Default: False.
Returns:
A generator for all the interested files with relative pathes.
A generator for all the interested files with relative paths.
"""

if (suffix is not None) and not isinstance(suffix, (str, tuple)):
Expand Down
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ known_first_party = facexlib
known_third_party = PIL,cv2,filterpy,numba,numpy,scipy,torch,torchvision,tqdm
no_lines_before = STDLIB,LOCALFOLDER
default_section = THIRDPARTY

[codespell]
skip = .git,./docs/build
count =
quiet-level = 3

0 comments on commit 0949144

Please sign in to comment.