Skip to content

Commit

Permalink
Merge pull request #39 from ternaus/fixes
Browse files Browse the repository at this point in the history
Fixes
  • Loading branch information
ternaus committed Jan 24, 2022
2 parents 0bfa402 + 5f04193 commit b72317d
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 45 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Expand Up @@ -10,11 +10,11 @@ repos:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/psf/black
rev: 21.6b0
rev: 21.12b0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
rev: 4.0.1
hooks:
- id: flake8
language_version: python3
Expand Down
43 changes: 7 additions & 36 deletions requirements_dev.txt
@@ -1,42 +1,13 @@
black==21.6b0
flake8==3.9.2
flake8-bandit==2.1.2
flake8-breakpoint==1.1.0
flake8-bugbear==21.3.1
flake8-builtins==1.5.3
flake8-colors==0.1.9
flake8-comprehensions==3.3.1
flake8-debugger==4.0.0
flake8-docstrings==1.5.0
flake8-eradicate==1.0.0
flake8-executable==2.1.1
flake8-fixme==1.1.1
flake8-graphql==0.2.5
flake8-implicit-str-concat==0.2.0
flake8-logging-format==0.6.0
flake8-mock==0.3
flake8-pathlib==0.1.3
flake8-plugin-utils==1.3.1
flake8-polyfill==1.0.2
flake8-print==4.0.0
flake8-printf-formatting==1.1.2
flake8-pytest==1.3
flake8-pytest-style==1.3.0
flake8-raise==0.0.5
flake8-requests==0.4.0
flake8-requirements==1.3.3
flake8-string-format==0.3.0
flake8-tidy-imports==4.2.1
flake8-todo==0.7
flake8-tuple==0.4.1
black==21.12b0
flake8==4.0.1
iglovikov-helper-functions==0.0.53
isort==5.8.0
mypy==0.910
isort==5.10.1
mypy==0.931
onnx==1.9.0
pep8-naming==0.11.1
pip==21.1.3
pre-commit==2.13.0
pylint==2.8.2
pip==21.3.1
pre_commit==2.17.0
pylint==2.12.2
pytest==6.2.4
pytest-asyncio==0.15.1
pytest-clarity==0.3.0a0
Expand Down
2 changes: 1 addition & 1 deletion retinaface/__init__.py
@@ -1 +1 @@
__version__ = "0.0.7"
__version__ = "0.0.8"
2 changes: 1 addition & 1 deletion retinaface/box_utils.py
Expand Up @@ -196,7 +196,7 @@ def encode_landm(
priors = torch.cat([priors_cx, priors_cy, priors_w, priors_h], dim=2)
g_cxcy = matched[:, :, :2] - priors[:, :, :2]
# encode variance
g_cxcy = g_cxcy // variances[0] * priors[:, :, 2:]
g_cxcy /= variances[0] * priors[:, :, 2:]
# return target for smooth_l1_loss
return g_cxcy.reshape(g_cxcy.size(0), -1)

Expand Down
6 changes: 3 additions & 3 deletions retinaface/inference.py
Expand Up @@ -90,9 +90,9 @@ def unnormalize(image: Union[np.ndarray, torch.Tensor]) -> Union[np.ndarray, tor
std = [0.229, 0.224, 0.225]

for c in range(image.shape[-1]):
image[:, :, c] *= std[c]
image[:, :, c] += mean[c]
image[:, :, c] *= 255
image[:, :, c] *= std[c] # type: ignore
image[:, :, c] += mean[c] # type: ignore
image[:, :, c] *= 255 # type: ignore

return image

Expand Down
2 changes: 1 addition & 1 deletion retinaface/predict_single.py
Expand Up @@ -94,7 +94,7 @@ def predict_jsons(
landmarks_np = landmarks.cpu().numpy()
resize_coeff = original_height / transformed_height

boxes *= resize_coeff
boxes_np *= resize_coeff
landmarks_np = landmarks_np.reshape(-1, 10) * resize_coeff

for box_id, bbox in enumerate(boxes_np):
Expand Down
2 changes: 1 addition & 1 deletion retinaface/train.py
Expand Up @@ -49,7 +49,7 @@ def __init__(self, config: Adict[str, Any]) -> None:

self.loss = object_from_dict(self.config.loss, priors=self.prior_box)

def setup(self, state=0) -> None: # type: ignore
def setup(self, stage=0) -> None: # type: ignore
self.preproc = Preproc(img_dim=self.config.image_size[0])

def forward(self, batch: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]: # type: ignore
Expand Down

0 comments on commit b72317d

Please sign in to comment.